[libvirt] [PATCH 1/5] Add type of free area

Daniel P. Berrange berrange at redhat.com
Thu Jun 25 09:21:31 UTC 2009


On Wed, Jun 24, 2009 at 11:12:18AM +0200, Henrik Persson wrote:
> This patch adds the type of the free area, since this is important when
> creating logical partitions.

> --- libvirt-0.6.4.org/src/storage_conf.h	2009-06-23 13:11:05.624511000 +0200
> +++ libvirt-0.6.4/src/storage_conf.h	2009-06-23 13:04:06.822880000 +0200
> @@ -153,6 +153,18 @@ struct _virStoragePoolSourceHost {
>  
>  
>  /*
> + * For MSDOS partitions, the free area
> + * is important when creating
> + * logical partitions
> + */
> +enum virStorageFreeType {
> +    VIR_STORAGE_FREE_NONE = 0,
> +    VIR_STORAGE_FREE_NORMAL,
> +    VIR_STORAGE_FREE_LOGICAL,
> +    VIR_STORAGE_FREE_LAST
> +};
> +
> +/*
>   * Available extents on the underlying storage
>   */
>  typedef struct _virStoragePoolSourceDeviceExtent virStoragePoolSourceDeviceExtent;
> @@ -160,6 +172,7 @@ typedef virStoragePoolSourceDeviceExtent
>  struct _virStoragePoolSourceDeviceExtent {
>      unsigned long long start;
>      unsigned long long end;
> +    int type;  /* free space type */
>  };
>  
>  
> --- libvirt-0.6.4.org/src/storage_backend_disk.c	2009-06-23 13:07:38.272045000 +0200
> +++ libvirt-0.6.4/src/storage_backend_disk.c	2009-06-23 13:23:41.612530000 +0200
> @@ -188,6 +188,14 @@ virStorageBackendDiskMakeFreeExtent(virC
>             dev->nfreeExtent, 0,
>             sizeof(dev->freeExtents[0]));
>  
> +    /* set type of free area */
> +    if(STREQ(groups[1], "logical")) {
> +        dev->freeExtents[dev->nfreeExtent].type = VIR_STORAGE_FREE_LOGICAL;
> +    } else {
> +        dev->freeExtents[dev->nfreeExtent].type = VIR_STORAGE_FREE_NORMAL;
> +    }
> +
> +
>      if (virStrToLong_ull(groups[3], NULL, 10,
>                           &dev->freeExtents[dev->nfreeExtent].start) < 0)
>          return -1; /* Don't bother to re-alloc freeExtents - it'll be free'd shortly */

Was a little concerned about adding this to the virStoragePoolDef 
struct, since that's generally all public ABI. Since your patch 
isn't exporting it in the XML format though, I think this is a 
reasonable approach for now. ACK


Daniel
-- 
|: Red Hat, Engineering, London   -o-   http://people.redhat.com/berrange/ :|
|: http://libvirt.org  -o-  http://virt-manager.org  -o-  http://ovirt.org :|
|: http://autobuild.org       -o-         http://search.cpan.org/~danberr/ :|
|: GnuPG: 7D3B9505  -o-  F3C9 553F A1DA 4AC2 5648 23C1 B3DF F742 7D3B 9505 :|




More information about the libvir-list mailing list