]> xenbits.xensource.com Git - libvirt.git/commitdiff
conf: move storage source type to util/
authorEric Blake <eblake@redhat.com>
Fri, 28 Mar 2014 18:38:43 +0000 (12:38 -0600)
committerEric Blake <eblake@redhat.com>
Tue, 1 Apr 2014 16:38:14 +0000 (10:38 -0600)
With this patch, all information related to a host resource in
a storage file backing chain now lives in util/virstoragefile.h.
The next step will be to consolidate various places that have
been tracking backing chain details to all use a common struct.

The changes to tools/Makefile.am were made necessary by the
fact that virstorageencryption includes uses of libxml, and is
now pulled in by inclusion from virstoragefile.h.  No
additional libraries are linked into the final image, and in
comparison, the build of the setuid library in src/Makefile.am
already was using LIBXML_CFLAGS via AM_CFLAGS.

* src/conf/domain_conf.h (virDomainDiskSourceDef): Move...
* src/util/virstoragefile.h (virStorageSource): ...and rename.
* src/conf/domain_conf.c (virDomainDiskSourceDefClear)
(virDomainDiskAuthClear): Adjust clients.
* tools/Makefile.am (virt_login_shell_CFLAGS)
(virt_host_validate_CFLAGS): Add libxml headers.

Signed-off-by: Eric Blake <eblake@redhat.com>
src/conf/domain_conf.c
src/conf/domain_conf.h
src/util/virstoragefile.h
tools/Makefile.am

index a5afacfbb502cb74d43b5dfbfa0731d53b20cfb5..b38021d0f9b25a97599a91dd3d040bcfe6a5c520 100644 (file)
@@ -1193,7 +1193,7 @@ virDomainDiskSourcePoolDefFree(virStorageSourcePoolDefPtr def)
 
 
 static void
-virDomainDiskSourceDefClear(virDomainDiskSourceDefPtr def)
+virDomainDiskSourceDefClear(virStorageSourcePtr def)
 {
     size_t i;
 
@@ -1237,7 +1237,7 @@ virDomainDiskDefFree(virDomainDiskDefPtr def)
 
 
 void
-virDomainDiskAuthClear(virDomainDiskSourceDefPtr def)
+virDomainDiskAuthClear(virStorageSourcePtr def)
 {
     VIR_FREE(def->auth.username);
 
index 52b59a1d0cc70aa075788569a9a45923cc48bd5a..b011847ed4bcaf5603fa13666a439cb127962077 100644 (file)
@@ -595,38 +595,10 @@ struct _virDomainBlockIoTuneInfo {
 };
 typedef virDomainBlockIoTuneInfo *virDomainBlockIoTuneInfoPtr;
 
-typedef struct _virDomainDiskSourceDef virDomainDiskSourceDef;
-typedef virDomainDiskSourceDef *virDomainDiskSourceDefPtr;
-
-/* Stores information related to a host resource.  In the case of
- * backing chains, multiple source disks join to form a single guest
- * view.  TODO Move this to util/ */
-struct _virDomainDiskSourceDef {
-    int type; /* enum virStorageType */
-    char *path;
-    int protocol; /* enum virStorageNetProtocol */
-    size_t nhosts;
-    virStorageNetHostDefPtr hosts;
-    virStorageSourcePoolDefPtr srcpool;
-    struct {
-        char *username;
-        int secretType; /* enum virStorageSecretType */
-        union {
-            unsigned char uuid[VIR_UUID_BUFLEN];
-            char *usage;
-        } secret;
-    } auth;
-    virStorageEncryptionPtr encryption;
-    char *driverName;
-    int format; /* enum virStorageFileFormat */
-
-    size_t nseclabels;
-    virSecurityDeviceLabelDefPtr *seclabels;
-};
 
 /* Stores the virtual disk configuration */
 struct _virDomainDiskDef {
-    virDomainDiskSourceDef src;
+    virStorageSource src;
 
     int device; /* enum virDomainDiskDevice */
     int bus; /* enum virDomainDiskBus */
@@ -2153,7 +2125,7 @@ void virDomainGraphicsDefFree(virDomainGraphicsDefPtr def);
 void virDomainInputDefFree(virDomainInputDefPtr def);
 void virDomainDiskDefFree(virDomainDiskDefPtr def);
 void virDomainLeaseDefFree(virDomainLeaseDefPtr def);
-void virDomainDiskAuthClear(virDomainDiskSourceDefPtr def);
+void virDomainDiskAuthClear(virStorageSourcePtr def);
 int virDomainDiskGetType(virDomainDiskDefPtr def);
 void virDomainDiskSetType(virDomainDiskDefPtr def, int type);
 int virDomainDiskGetActualType(virDomainDiskDefPtr def);
index 68172c80f095281a66161c261406081ca8b12179..a6dcfa46ecc398ec4db8aa967ff655b7400b970a 100644 (file)
@@ -25,6 +25,8 @@
 # define __VIR_STORAGE_FILE_H__
 
 # include "virbitmap.h"
+# include "virseclabel.h"
+# include "virstorageencryption.h"
 # include "virutil.h"
 
 /* Minimum header size required to probe all known formats with
@@ -182,6 +184,36 @@ enum virStorageSecretType {
 };
 
 
+typedef struct _virStorageSource virStorageSource;
+typedef virStorageSource *virStorageSourcePtr;
+
+/* Stores information related to a host resource.  In the case of
+ * backing chains, multiple source disks join to form a single guest
+ * view.  */
+struct _virStorageSource {
+    int type; /* enum virStorageType */
+    char *path;
+    int protocol; /* enum virStorageNetProtocol */
+    size_t nhosts;
+    virStorageNetHostDefPtr hosts;
+    virStorageSourcePoolDefPtr srcpool;
+    struct {
+        char *username;
+        int secretType; /* enum virStorageSecretType */
+        union {
+            unsigned char uuid[VIR_UUID_BUFLEN];
+            char *usage;
+        } secret;
+    } auth;
+    virStorageEncryptionPtr encryption;
+    char *driverName;
+    int format; /* enum virStorageFileFormat */
+
+    size_t nseclabels;
+    virSecurityDeviceLabelDefPtr *seclabels;
+};
+
+
 # ifndef DEV_BSIZE
 #  define DEV_BSIZE 512
 # endif
index 6847f13cb82d88013a7f33902a4d84ccc1217b0f..93d642da67e368b21a465ecc09785dd2f1d2df1a 100644 (file)
@@ -148,6 +148,7 @@ virt_host_validate_LDADD = \
                $(NULL)
 
 virt_host_validate_CFLAGS = \
+               $(LIBXML_CFLAGS)                                \
                $(WARN_CFLAGS)                                  \
                $(PIE_CFLAGS)                                   \
                $(COVERAGE_CFLAGS)                              \
@@ -173,6 +174,7 @@ virt_login_shell_LDADD =                                    \
 
 virt_login_shell_CFLAGS =                                      \
                -DLIBVIRT_SETUID_RPC_CLIENT                     \
+               $(LIBXML_CFLAGS)                                \
                $(WARN_CFLAGS)                                  \
                $(PIE_CFLAGS)                                   \
                $(COVERAGE_CFLAGS)