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

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



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 */

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