Fix parted sector size assumption

Parted does not report disk size in 512 byte units, but
rather the disks' logical sector size, which with modern
drives might be 4k.

* src/storage/parthelper.c: Remove hardcoded 512 byte sector
  size
This commit is contained in:
Daniel P. Berrange 2011-08-23 15:25:28 +01:00
parent 6f2581edd7
commit b6263c1801
1 changed files with 6 additions and 6 deletions

View File

@ -157,17 +157,17 @@ int main(int argc, char **argv)
part->num, '\0',
type, '\0',
content, '\0',
part->geom.start * 512llu, '\0',
(part->geom.end + 1 ) * 512llu, '\0',
part->geom.length * 512llu, '\0');
part->geom.start * dev->sector_size, '\0',
(part->geom.end + 1 ) * dev->sector_size, '\0',
part->geom.length * dev->sector_size, '\0');
} else {
printf("%s%c%s%c%s%c%llu%c%llu%c%llu%c",
"-", '\0',
type, '\0',
content, '\0',
part->geom.start * 512llu, '\0',
(part->geom.end + 1 ) * 512llu, '\0',
part->geom.length * 512llu, '\0');
part->geom.start * dev->sector_size, '\0',
(part->geom.end + 1 ) * dev->sector_size, '\0',
part->geom.length * dev->sector_size, '\0');
}
part = ped_disk_next_partition(disk, part);
}