]> xenbits.xensource.com Git - people/liuw/libxenctrl-split/libvirt.git/commitdiff
util: storagefile: Add fields from virStorageMetadata to virStorageSource
authorPeter Krempa <pkrempa@redhat.com>
Thu, 17 Apr 2014 14:04:33 +0000 (16:04 +0200)
committerPeter Krempa <pkrempa@redhat.com>
Wed, 23 Apr 2014 21:11:07 +0000 (23:11 +0200)
Add the required fields that are missing from the new structure that
will allow us to switch the storage file metadata code entirely to the
new structure.

Add "relPath" and "relDir" and the raw backing store name. Also allow
creating linked lists of virStorageSourcePtrs to express backing chains.

src/util/virstoragefile.c
src/util/virstoragefile.h

index 4486b758e53d72bf1deaa6061f2a36e0813c7c70..91fdc95e66765453865187bf8ee9357302ba8ac0 100644 (file)
@@ -1718,6 +1718,13 @@ virStorageSourceClear(virStorageSourcePtr def)
 
     virStorageNetHostDefFree(def->nhosts, def->hosts);
     virStorageSourceAuthClear(def);
+
+    VIR_FREE(def->relPath);
+    VIR_FREE(def->relDir);
+    VIR_FREE(def->backingStoreRaw);
+
+    /* recursively free backing chain */
+    virStorageSourceFree(def->backingMeta);
 }
 
 
index 0e5136e8a1c1c584a70dba5eea4b11ff1f983623..11e25eb4967b1eac7a1c0a058c8e0e349dee02b6 100644 (file)
@@ -271,8 +271,22 @@ struct _virStorageSource {
     size_t nseclabels;
     virSecurityDeviceLabelDefPtr *seclabels;
 
+    /* backing chain of the storage source */
+    virStorageSourcePtr backingMeta;
+
     /* metadata for storage driver access to remote and local volumes */
     virStorageDriverDataPtr drv;
+
+    /* metadata about storage image which need separate fields */
+    /* Name of the current file as spelled by the user (top level) or
+     * metadata of the overlay (if this is a backing store).  */
+    char *relPath;
+    /* Directory to start from if backingStoreRaw is a relative file
+     * name.  */
+    char *relDir;
+    /* Name of the child backing store recorded in metadata of the
+     * current file.  */
+    char *backingStoreRaw;
 };