Re: [PATCH] Fix parted sector size assumption

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Wed, Aug 31, 2011 at 11:04:04AM +0100, Daniel P. Berrange wrote:
> From: "Daniel P. Berrange" <berrange@xxxxxxxxxx>
> 
> 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
> ---
>  src/storage/parthelper.c |   12 ++++++------
>  1 files changed, 6 insertions(+), 6 deletions(-)
> 
> diff --git a/src/storage/parthelper.c b/src/storage/parthelper.c
> index acc9171..964aa78 100644
> --- a/src/storage/parthelper.c
> +++ b/src/storage/parthelper.c
> @@ -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);
>      }

  ACK,

Daniel

-- 
Daniel Veillard      | libxml Gnome XML XSLT toolkit  http://xmlsoft.org/
daniel@xxxxxxxxxxxx  | Rpmfind RPM search engine http://rpmfind.net/
http://veillard.com/ | virtualization library  http://libvirt.org/

--
libvir-list mailing list
libvir-list@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/libvir-list


[Index of Archives]     [Virt Tools]     [Libvirt Users]     [Lib OS Info]     [Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [KDE Users]     [Fedora Tools]