Re: PATCH: 14/16: disk partition backend

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

 



"Daniel P. Berrange" <berrange@xxxxxxxxxx> wrote:
> +static int virStorageBackendDiskCreateVol(virConnectPtr conn,
> +                                          virStoragePoolObjPtr pool,
> +                                          virStorageVolDefPtr vol)
> +{
> +    int i;
> +    char start[100], end[100];
> +    unsigned long long startOffset, endOffset, smallestSize = 0, smallestExtent = -1;

[Past column 80 -> harder to spot]
unsigned... = -1; ?

How about this instead, since smallestExtent only ever
gets set to values stored in "i" (an int)?

    int smallestExtent = -1;

> +    virStoragePoolSourceDevicePtr dev = &pool->def->source.devices[0];
> +    /* XXX customizable partition types */
> +    const char *cmdargv[] = {
> +        PARTED,
> +        pool->def->source.devices[0].path,
> +        "mkpart",
> +        "--script",
> +        "ext2",
> +        start,
> +        end,
> +        NULL
> +    };
> +
> +    for (i = 0 ; i < dev->nfreeExtent ; i++) {
> +        unsigned long long size =
> +            dev->freeExtents[i].end -
> +            dev->freeExtents[i].start;

Shouldn't size be 1 larger?  i.e.,

        unsigned long long size =
            dev->freeExtents[i].end -
            dev->freeExtents[i].start + 1;

--
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]