History log of /haiku/src/add-ons/kernel/partitioning_systems/intel/PartitionMapParser.cpp
Revision Date Author Comments
# 425ac1b6 20-Jun-2023 Alexander von Gluck IV <kallisti5@unixzen.com>

refactor: Swap %Ld for %lld in all format usages

* %Ld is an undocumented alias for %lld in glibc.
* muslc doesn't implement it for this reason.
* While we will likely never drop %Ld support,
lets clean house and set a better example.

Change-Id: Id46dad3104abae483e80cc5c05d1464d3ecd8030
Reviewed-on: https://review.haiku-os.org/c/haiku/+/6636
Reviewed-by: Adrien Destugues <pulkomandy@pulkomandy.tk>
Reviewed-by: Alex von Gluck IV <kallisti5@unixzen.com>
Tested-by: Commit checker robot <no-reply+buildbot@haiku-os.org>


# f3ed89bb 01-Sep-2014 Alexander von Gluck IV <kallisti5@unixzen.com>

partition/intel: Fix GPT error language.

* Yeah, intel shouldn't support GPT :-)


# 36b21083 01-May-2012 Tyler Dixon <t.dixon@mail.utoronto.ca>

Modify intel partition mapper to fail if it detects a GPT disk

Slightly amended patch from Tyler Dixon. This fixes #8434.
Tested on my new GPT-disk with:
jam run ":<build>makebootable" --dry-run /dev/sda4

Signed-off-by: Fredrik Holmqvist <fredrik.holmqvist@gmail.com>


# e4c0070f 28-Feb-2010 Michael Lotz <mmlr@mlotz.ch>

Added a bit of logic to possibly fall back to a fixed 512 block MBR in case
certain conditions indicate that we might deal with a fixed 512 bytes MBR on
a non 512 byte block size medium. One condition is that at least one partition
had to be shrunk to fit the available size (which usually happens with larger
block sizes). We retry with a fixed 512 block size once and compare the result
if it didn't improve the situation it is reverted again. This is mostly a
preparation for the upcoming "anyboot" hybrid MBR/ISO images.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@35664 a95241bf-73f2-0310-859d-f6bbb57e9c96


# c37e40a0 30-Nov-2009 Axel Dörfler <axeld@pinc-software.de>

* Didn't notice that AdjustSize() was called from somewhere else, too. This
fixes the haiku_loader build.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@34386 a95241bf-73f2-0310-859d-f6bbb57e9c96


# a0973602 30-Nov-2009 Axel Dörfler <axeld@pinc-software.de>

* Apparently, a drive's size is not always reported the same; at least I have
a drive (which had its MBR created on Linux) report a smaller size than the
size of its first partition.
* Since other operating systems seem to ignore this, we now relax our validity
checks and always adjust the size of a child partition to fit into its parent.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@34381 a95241bf-73f2-0310-859d-f6bbb57e9c96


# 1987b05a 10-Aug-2009 Bryce Groff <bgroff@hawaii.edu>

* Added open_partition to disk_device_manager
* Rewrote PartitionMapWriter
* Updated style to match current style guide for the intel partitioning system.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@32235 a95241bf-73f2-0310-859d-f6bbb57e9c96


# 199f3324 13-Apr-2009 Axel Dörfler <axeld@pinc-software.de>

* Removed SECTOR_SIZE in the read-only part of the intel partition scanner;
however, it's still used in the write part.
* Made the read-only code block size agnostic. Only tested with an Apple
iPod so far, and it recognizes its partition fine now. Next test on real
hardware.
* Cleanup.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@30155 a95241bf-73f2-0310-859d-f6bbb57e9c96


# b41bbb4a 14-Apr-2009 Axel Dörfler <axeld@pinc-software.de>

* Renamed partition_table_sector to partition_table, and PTS* to
PartitionTable*; the sector is not really a sector, but only the first
512 bytes of it.
* Cleanup.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@30154 a95241bf-73f2-0310-859d-f6bbb57e9c96


# e9a10566 18-Sep-2008 Stephan Aßmus <superstippi@gmx.de>

Update some comments after understanding things better. Some things which got
me confused were perfectly correct.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@27626 a95241bf-73f2-0310-859d-f6bbb57e9c96


# daa191ec 18-Sep-2008 Stephan Aßmus <superstippi@gmx.de>

Simplified a bit the extended partition parsing loop, no functional changes
intended. I am wondering though about the offset that is passed to the
logical partitions. If I am not confused, later partitions still use the
primary partition's offset as base offset, so I am wondering if more than
two non-extended logical partitions would work.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@27614 a95241bf-73f2-0310-859d-f6bbb57e9c96


# 27ba18f4 20-Aug-2008 Axel Dörfler <axeld@pinc-software.de>

* Turned off debugging output (intel.cpp still puts out some stuff, but only
when compiled for the kernel).
* Minor cleanup.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@27089 a95241bf-73f2-0310-859d-f6bbb57e9c96


# 7554633d 06-Jun-2008 Stephan Aßmus <superstippi@gmx.de>

Improved tracing output.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@25841 a95241bf-73f2-0310-859d-f6bbb57e9c96


# db5c68ca 04-Oct-2007 Ingo Weinhold <ingo_weinhold@gmx.de>

* Added the partition size as parameter to the file and partitioning
system initialize() hooks. It's often the only info about the
partition one needs and thus locking the partition just to get it is
no longer necessary.
* intel partitioning system:
- Removed passing around block sizes. We require 512 byte sectors
anyway. In fact using the parent partition's block size was even
wrong.
- Simplified writing the partition map sector.
- Simplified and corrected the partition map initialization.
- We don't fail identifying a partition anymore, if the partition map
contains no partitions. We would never identify a freshly
initialized partition map before.
- Made pm_identify() more intelligent: It determines the priority to
return depending on whether the partition is the device itself and
whether we have recognized child partitions.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@22447 a95241bf-73f2-0310-859d-f6bbb57e9c96


# 0e9f724c 02-Oct-2006 Axel Dörfler <axeld@pinc-software.de>

* When run as part of the boot loader, it will now adjust the size of partitions
to fit into the session - this should help bug #238 to disappear.
* Minor cleanup.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@18988 a95241bf-73f2-0310-859d-f6bbb57e9c96


# 50b6109c 29-Sep-2006 Marcus Overhagen <marcusoverhagen@gmail.com>

Build fix, at least for building on Linux. The host stdio.h has a different dprintf definition than BeOS.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@18980 a95241bf-73f2-0310-859d-f6bbb57e9c96


# 8d9e5a45 29-Sep-2006 Axel Dörfler <axeld@pinc-software.de>

* Turned on debugging in the Intel partitioning system add-on, and the partition
stuff of the boot loader to help with bug #238.
* Minor cleanup (added license headers, fixed debug output)


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@18977 a95241bf-73f2-0310-859d-f6bbb57e9c96


# deeb2f39 29-Jan-2006 Ingo Weinhold <ingo_weinhold@gmx.de>

A bit of #ifdef'ing to make the stuff edible for userland compilation
with gcc 4.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@16147 a95241bf-73f2-0310-859d-f6bbb57e9c96


# 311049d7 04-Apr-2005 Axel Dörfler <axeld@pinc-software.de>

Added a new PartitionMap::CountNonEmptyPartitions() - now, a partition map
is only accepted when there is at least one valid partition in it.
Before, the module would accept even the BFS boot loader which is now less
likely (IOW you can now boot with Bochs again).
Also, if there was one invalid partition, the partitions that come after
it are no longer ignored.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@12228 a95241bf-73f2-0310-859d-f6bbb57e9c96


# 73d3cc98 31-Mar-2005 Ingo Weinhold <ingo_weinhold@gmx.de>

Be a bit more robust, when encountering partition descriptors that
describe partitions that are out of bounds. We simply ignore those now,
instead of letting the complete scanning fail.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@12206 a95241bf-73f2-0310-859d-f6bbb57e9c96


# f2162522 31-Mar-2005 Ingo Weinhold <ingo_weinhold@gmx.de>

* More debug output.
* We apparently cannot use constants like kPartitionTypeIntelExtended
in static array initializers in the kernel.
* Fixed misunderstanding between Axel (boot loader) and me (Intel
partitioning system module) how to deal with the cookie the
identify() hook returns. We switch to a someone cleaner method by
always invoking free_identify_cookie() for it, even if it were passed
to scan(). Since we want to keep the cookie, we add a reference
counter to it.
This should fix a couple of issues with recognizing the boot partition.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@12185 a95241bf-73f2-0310-859d-f6bbb57e9c96


# 4c710398 29-Mar-2005 Axel Dörfler <axeld@pinc-software.de>

Now also compiles when debug output is turned on.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@12150 a95241bf-73f2-0310-859d-f6bbb57e9c96


# 569750e5 02-Oct-2004 Ingo Weinhold <ingo_weinhold@gmx.de>

Refactored a bit -- pulled the partition map parser out. Userland add-on disabled for the time being, due to build problems.


git-svn-id: file:///srv/svn/repos/haiku/trunk/current@9158 a95241bf-73f2-0310-859d-f6bbb57e9c96


# f3ed89bb649fdc4c474d74b5afadeb9b24ee3583 01-Sep-2014 Alexander von Gluck IV <kallisti5@unixzen.com>

partition/intel: Fix GPT error language.

* Yeah, intel shouldn't support GPT :-)


# 36b210830fa8ea2b4eb6387630b69812d3e18936 01-May-2012 Tyler Dixon <t.dixon@mail.utoronto.ca>

Modify intel partition mapper to fail if it detects a GPT disk

Slightly amended patch from Tyler Dixon. This fixes #8434.
Tested on my new GPT-disk with:
jam run ":<build>makebootable" --dry-run /dev/sda4

Signed-off-by: Fredrik Holmqvist <fredrik.holmqvist@gmail.com>


# e4c0070fe64f204140fdd96ffef71e0ce7d36ba6 28-Feb-2010 Michael Lotz <mmlr@mlotz.ch>

Added a bit of logic to possibly fall back to a fixed 512 block MBR in case
certain conditions indicate that we might deal with a fixed 512 bytes MBR on
a non 512 byte block size medium. One condition is that at least one partition
had to be shrunk to fit the available size (which usually happens with larger
block sizes). We retry with a fixed 512 block size once and compare the result
if it didn't improve the situation it is reverted again. This is mostly a
preparation for the upcoming "anyboot" hybrid MBR/ISO images.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@35664 a95241bf-73f2-0310-859d-f6bbb57e9c96


# c37e40a0780a2f4a4e69d5b91ff144b3fa4047c5 30-Nov-2009 Axel Dörfler <axeld@pinc-software.de>

* Didn't notice that AdjustSize() was called from somewhere else, too. This
fixes the haiku_loader build.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@34386 a95241bf-73f2-0310-859d-f6bbb57e9c96


# a0973602c3d27c22f3d97252e2bb854bb2af606e 30-Nov-2009 Axel Dörfler <axeld@pinc-software.de>

* Apparently, a drive's size is not always reported the same; at least I have
a drive (which had its MBR created on Linux) report a smaller size than the
size of its first partition.
* Since other operating systems seem to ignore this, we now relax our validity
checks and always adjust the size of a child partition to fit into its parent.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@34381 a95241bf-73f2-0310-859d-f6bbb57e9c96


# 1987b05aa02e2c9b2ff9f852cff73a249af7175a 10-Aug-2009 Bryce Groff <bgroff@hawaii.edu>

* Added open_partition to disk_device_manager
* Rewrote PartitionMapWriter
* Updated style to match current style guide for the intel partitioning system.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@32235 a95241bf-73f2-0310-859d-f6bbb57e9c96


# 199f33248dcde6cb2803ee4bd5938817ed30239e 13-Apr-2009 Axel Dörfler <axeld@pinc-software.de>

* Removed SECTOR_SIZE in the read-only part of the intel partition scanner;
however, it's still used in the write part.
* Made the read-only code block size agnostic. Only tested with an Apple
iPod so far, and it recognizes its partition fine now. Next test on real
hardware.
* Cleanup.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@30155 a95241bf-73f2-0310-859d-f6bbb57e9c96


# b41bbb4a46e75fd526ea9e02bab0c5685ddad403 14-Apr-2009 Axel Dörfler <axeld@pinc-software.de>

* Renamed partition_table_sector to partition_table, and PTS* to
PartitionTable*; the sector is not really a sector, but only the first
512 bytes of it.
* Cleanup.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@30154 a95241bf-73f2-0310-859d-f6bbb57e9c96


# e9a105668deada67ce6e58b6ff00a67e8e57de5d 18-Sep-2008 Stephan Aßmus <superstippi@gmx.de>

Update some comments after understanding things better. Some things which got
me confused were perfectly correct.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@27626 a95241bf-73f2-0310-859d-f6bbb57e9c96


# daa191ec7c099dad2fd1f043a048de5393ac0bf4 18-Sep-2008 Stephan Aßmus <superstippi@gmx.de>

Simplified a bit the extended partition parsing loop, no functional changes
intended. I am wondering though about the offset that is passed to the
logical partitions. If I am not confused, later partitions still use the
primary partition's offset as base offset, so I am wondering if more than
two non-extended logical partitions would work.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@27614 a95241bf-73f2-0310-859d-f6bbb57e9c96


# 27ba18f4123ec65b8f091927ca7eb5c62b6b6733 20-Aug-2008 Axel Dörfler <axeld@pinc-software.de>

* Turned off debugging output (intel.cpp still puts out some stuff, but only
when compiled for the kernel).
* Minor cleanup.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@27089 a95241bf-73f2-0310-859d-f6bbb57e9c96


# 7554633d6019a335f0f694a9432e8e922f0ef98e 06-Jun-2008 Stephan Aßmus <superstippi@gmx.de>

Improved tracing output.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@25841 a95241bf-73f2-0310-859d-f6bbb57e9c96


# db5c68ca46ce6f291fa5c047035418f6ccc89817 04-Oct-2007 Ingo Weinhold <ingo_weinhold@gmx.de>

* Added the partition size as parameter to the file and partitioning
system initialize() hooks. It's often the only info about the
partition one needs and thus locking the partition just to get it is
no longer necessary.
* intel partitioning system:
- Removed passing around block sizes. We require 512 byte sectors
anyway. In fact using the parent partition's block size was even
wrong.
- Simplified writing the partition map sector.
- Simplified and corrected the partition map initialization.
- We don't fail identifying a partition anymore, if the partition map
contains no partitions. We would never identify a freshly
initialized partition map before.
- Made pm_identify() more intelligent: It determines the priority to
return depending on whether the partition is the device itself and
whether we have recognized child partitions.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@22447 a95241bf-73f2-0310-859d-f6bbb57e9c96


# 0e9f724cf848a82b76a65ea6c5144d197c554495 02-Oct-2006 Axel Dörfler <axeld@pinc-software.de>

* When run as part of the boot loader, it will now adjust the size of partitions
to fit into the session - this should help bug #238 to disappear.
* Minor cleanup.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@18988 a95241bf-73f2-0310-859d-f6bbb57e9c96


# 50b6109c5f08d14e6515124747d3d479e2563b60 29-Sep-2006 Marcus Overhagen <marcusoverhagen@gmail.com>

Build fix, at least for building on Linux. The host stdio.h has a different dprintf definition than BeOS.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@18980 a95241bf-73f2-0310-859d-f6bbb57e9c96


# 8d9e5a451e2fb58549aba969c921614bb15d2607 29-Sep-2006 Axel Dörfler <axeld@pinc-software.de>

* Turned on debugging in the Intel partitioning system add-on, and the partition
stuff of the boot loader to help with bug #238.
* Minor cleanup (added license headers, fixed debug output)


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@18977 a95241bf-73f2-0310-859d-f6bbb57e9c96


# deeb2f399a15572234d802bb1ea4cfa0de61d2a6 29-Jan-2006 Ingo Weinhold <ingo_weinhold@gmx.de>

A bit of #ifdef'ing to make the stuff edible for userland compilation
with gcc 4.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@16147 a95241bf-73f2-0310-859d-f6bbb57e9c96


# 311049d75104d6ff977feb56c5eb76c0761a8dde 04-Apr-2005 Axel Dörfler <axeld@pinc-software.de>

Added a new PartitionMap::CountNonEmptyPartitions() - now, a partition map
is only accepted when there is at least one valid partition in it.
Before, the module would accept even the BFS boot loader which is now less
likely (IOW you can now boot with Bochs again).
Also, if there was one invalid partition, the partitions that come after
it are no longer ignored.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@12228 a95241bf-73f2-0310-859d-f6bbb57e9c96


# 73d3cc98f6231a1d93f37dac83c32a4303d57767 31-Mar-2005 Ingo Weinhold <ingo_weinhold@gmx.de>

Be a bit more robust, when encountering partition descriptors that
describe partitions that are out of bounds. We simply ignore those now,
instead of letting the complete scanning fail.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@12206 a95241bf-73f2-0310-859d-f6bbb57e9c96


# f2162522b06c959f240c6e2f3a81717a92b95b80 31-Mar-2005 Ingo Weinhold <ingo_weinhold@gmx.de>

* More debug output.
* We apparently cannot use constants like kPartitionTypeIntelExtended
in static array initializers in the kernel.
* Fixed misunderstanding between Axel (boot loader) and me (Intel
partitioning system module) how to deal with the cookie the
identify() hook returns. We switch to a someone cleaner method by
always invoking free_identify_cookie() for it, even if it were passed
to scan(). Since we want to keep the cookie, we add a reference
counter to it.
This should fix a couple of issues with recognizing the boot partition.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@12185 a95241bf-73f2-0310-859d-f6bbb57e9c96


# 4c7103986e75cab7323d3d4eb2aa5c4203627ba6 29-Mar-2005 Axel Dörfler <axeld@pinc-software.de>

Now also compiles when debug output is turned on.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@12150 a95241bf-73f2-0310-859d-f6bbb57e9c96


# 569750e57f75b9e440f4cdbfd780ec49da53aace 02-Oct-2004 Ingo Weinhold <ingo_weinhold@gmx.de>

Refactored a bit -- pulled the partition map parser out. Userland add-on disabled for the time being, due to build problems.


git-svn-id: file:///srv/svn/repos/haiku/trunk/current@9158 a95241bf-73f2-0310-859d-f6bbb57e9c96