mirror of https://gitee.com/openkylin/libvirt.git
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:
parent
6f2581edd7
commit
b6263c1801
|
@ -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);
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue