diff options
author | Pierre-Alexandre Meyer <pierre@mouraf.org> | 2009-08-04 17:35:32 -0700 |
---|---|---|
committer | Pierre-Alexandre Meyer <pierre@mouraf.org> | 2009-08-04 17:35:32 -0700 |
commit | a6b80d3e8a356a55b4365c5e402e502843bbff8c (patch) | |
tree | a9e92742895618e608078c21d0309ea417ea1682 /com32/hdt | |
parent | a3a51af1381b1abbbf82484b3258955f7d1e79f8 (diff) | |
download | hdt-a6b80d3e8a356a55b4365c5e402e502843bbff8c.tar.gz hdt-a6b80d3e8a356a55b4365c5e402e502843bbff8c.tar.xz hdt-a6b80d3e8a356a55b4365c5e402e502843bbff8c.zip |
gpllib: refactor partitions detection
Re-implement the logic to parse extended partitions to correctly go through the
linked list of partitions.
Updated the CLI in hdt and tested it both on Qemu (Debian Lenny installation)
and on DELL E6400 (6 partitions). The output seemed sane.
Signed-off-by: Pierre-Alexandre Meyer <pierre@mouraf.org>
Diffstat (limited to 'com32/hdt')
-rw-r--r-- | com32/hdt/hdt-cli-disk.c | 11 |
1 files changed, 5 insertions, 6 deletions
diff --git a/com32/hdt/hdt-cli-disk.c b/com32/hdt/hdt-cli-disk.c index 3209c8b1..8e07ed08 100644 --- a/com32/hdt/hdt-cli-disk.c +++ b/com32/hdt/hdt-cli-disk.c @@ -58,9 +58,8 @@ **/ static void show_partition_information(struct driveinfo *drive_info, struct part_entry *ptab, - struct part_entry *ptab_root, - int offset_root, int data_partitions_seen, - int ebr_seen) + int partition_offset, + int nb_partitions_seen) { char size[8]; char *parttype; @@ -68,10 +67,10 @@ static void show_partition_information(struct driveinfo *drive_info, char *error_buffer; unsigned int start, end; - int i = 1 + ebr_seen * 4 + data_partitions_seen; + int i = nb_partitions_seen; - start = ptab->start_lba + ptab_root->start_lba + offset_root; - end = (ptab->start_lba + ptab_root->start_lba) + ptab->length + offset_root; + start = partition_offset; + end = start + ptab->length; if (ptab->length > 0) sectors_to_size(ptab->length, size); |