[movitz-devel] Re: Partition Parsing

Martin Bealby mbealby at gmail.com
Thu Mar 6 20:32:27 UTC 2008


Andreas Davour <ante at Update.UU.SE> writes:

> A question. How is the partition table supposed to look like? I've been trying
> to read a partition table with the new functions and if there is a table at
> all, they all look the same even though the partition sizes and details should
> be different. Am I just showing my ignorance of how partition tables are
> supposed to work?

The ATA code supports four separate drives (master and slave for two
controllers) and 'caches' the partitions in *ata-partitions*.

For example, to read the partition of the first master drive ('-hda'
parameter in qemu) call (ata-read-partition-table (+ata-controller0+ 0))

This will read the partition table and store it in memory.  Partition
tables can contain up to four primary partitions (this code doesn't
currently support extended partitions) and these are stored in a
list. Effectively, *ata-partitions* should be a list of lists of lists
:)

Once the cache is filled, calling ata-get-partition-data with the
controller number (0 or 1), drive number (0 for master, 1 for slave) and
partition number (0 to 3) will return the raw hex partition description.

This is designed to be passed to the other partition functions such as
ata-partition-active-p, ata-partition-type, ata-partition-start-offset
and ata-partition-size to retrieve useful data.

For more information regarding partition tables themselves please see:
http://www.osdev.org/wiki/Partition_Table

Hope this helps,
Martin



More information about the movitz-devel mailing list