[Haiku-commits] r27624 - haiku/trunk/src/add-ons/kernel/partitioning_systems/intel
stippi at BerliOS
stippi at mail.berlios.de
Thu Sep 18 16:56:49 CEST 2008
Author: stippi
Date: 2008-09-18 16:56:49 +0200 (Thu, 18 Sep 2008)
New Revision: 27624
ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=27624&view=rev
Modified:
haiku/trunk/src/add-ons/kernel/partitioning_systems/intel/PartitionMap.cpp
haiku/trunk/src/add-ons/kernel/partitioning_systems/intel/PartitionMap.h
Log:
* Added some hopefully helpful comments.
* Replaced my bogus comment that Ingo pointed out with a description that
mentions LogicalPartitions also being used to describe so called "inner
extended" partitions, which are only needed to point to the next PTS.
Modified: haiku/trunk/src/add-ons/kernel/partitioning_systems/intel/PartitionMap.cpp
===================================================================
--- haiku/trunk/src/add-ons/kernel/partitioning_systems/intel/PartitionMap.cpp 2008-09-18 14:01:29 UTC (rev 27623)
+++ haiku/trunk/src/add-ons/kernel/partitioning_systems/intel/PartitionMap.cpp 2008-09-18 14:56:49 UTC (rev 27624)
@@ -576,14 +576,16 @@
{
Unset();
if (descriptor && primary) {
- // TODO: I am wondering if this is wrong, since it always uses the
- // offset of the primary partition as base offset, even for
- // logical partitions that come much later in the chain. For each,
- // PTS in the chain of logical partitions, there should be one
- // extended and one non-extended in the four possible table entries.
- // So baseOffset would be wrong for all but the first three? The
- // forth logical partition, assuming it's the extended one, would
- // get a wrong baseOffset.
+ // There are two types of LogicalPartitions. There are so called
+ // "inner extended" partitions and the "real" logical partitions
+ // which contain data. The "inner extended" partitions don't contain
+ // data and are only used to point to the next PTS in the linked
+ // list of logical partitions. For "inner extended" partitions,
+ // the baseOffset is in relation to the (first sector of the)
+ // "primary extended" partition, in another words, all inner extended
+ // partitions use the same base offset for reference.
+ // The data containing, real logical partitions use the offset of the
+ // PTS that contains their partition descriptor as their baseOffset.
off_t baseOffset = (descriptor->is_extended() ? primary->Offset()
: ptsOffset);
Partition::SetTo(descriptor, ptsOffset, baseOffset);
Modified: haiku/trunk/src/add-ons/kernel/partitioning_systems/intel/PartitionMap.h
===================================================================
--- haiku/trunk/src/add-ons/kernel/partitioning_systems/intel/PartitionMap.h 2008-09-18 14:01:29 UTC (rev 27623)
+++ haiku/trunk/src/add-ons/kernel/partitioning_systems/intel/PartitionMap.h 2008-09-18 14:56:49 UTC (rev 27624)
@@ -10,6 +10,8 @@
for related classes.
*/
+// NOTE: <http://www.win.tue.nl/~aeb/partitions/partition_tables-2.html>
+
#ifndef _INTEL_PARTITION_MAP_H
#define _INTEL_PARTITION_MAP_H
@@ -55,6 +57,8 @@
void get_partition_type_string(uint8 type, char *buffer);
// chs
+// NOTE: The CHS cannot express locations within larger disks and is therefor
+// mostly obsolete.
struct chs {
uint8 cylinder;
uint16 head_sector; // head[15:10], sector[9:0]
@@ -64,11 +68,11 @@
// partition_descriptor
struct partition_descriptor {
uint8 active;
- chs begin;
- uint8 type;
- chs end;
- uint32 start;
- uint32 size;
+ chs begin; // mostly ignored
+ uint8 type; // empty, filesystem or extended
+ chs end; // mostly ignored
+ uint32 start; // in sectors
+ uint32 size; // in sectors
bool is_empty() const { return is_empty_type(type); }
bool is_extended() const { return is_extended_type(type); }
@@ -92,9 +96,9 @@
/*!
\brief Class for validating partition types.
- To this class we can set partition type and then we can check whether
- this type is valid, empty or if it represents extended partition.
- We can also retrieve the name of that partition type or find next
+ To this class we can set a partition type and then we can check whether
+ this type is valid, empty or if it represents an extended partition.
+ We can also retrieve the name of that partition type or find the next
supported type.
*/
class PartitionType {
@@ -134,15 +138,23 @@
bool IsEmpty() const { return is_empty_type(fType); }
bool IsExtended() const { return is_extended_type(fType); }
+ // NOTE: Both PTSOffset() and Offset() are absolute with regards to the
+ // session (usually the disk). Ie, for all primary partitions, including
+ // the primary extended partition, the PTSOffset() points to the MBR (0).
+ // For logical partitions, the PTSOffset() is located within the primary
+ // extended partition, but again, the returned values are absolute with
+ // regards to the session. All values are expressed in bytes.
off_t PTSOffset() const { return fPTSOffset; }
+ // offset of the sector containing the descriptor for this partition
off_t Offset() const { return fOffset; }
+ // start offset of the partition contents
off_t Size() const { return fSize; }
uint8 Type() const { return fType; }
bool Active() const { return fActive; }
void GetTypeString(char *buffer) const
{ get_partition_type_string(fType, buffer); }
void GetPartitionDescriptor(partition_descriptor *descriptor,
- off_t baseOffset) const;
+ off_t baseOffset) const;
void SetPTSOffset(off_t offset) { fPTSOffset = offset; }
void SetOffset(off_t offset) { fOffset = offset; }
More information about the Haiku-commits
mailing list