提交 8a20e227 编写于 作者: E Eric Blake

conf: move storage source type to util/

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: NEric Blake <eblake@redhat.com>
上级 c05d9dca
...@@ -1193,7 +1193,7 @@ virDomainDiskSourcePoolDefFree(virStorageSourcePoolDefPtr def) ...@@ -1193,7 +1193,7 @@ virDomainDiskSourcePoolDefFree(virStorageSourcePoolDefPtr def)
static void static void
virDomainDiskSourceDefClear(virDomainDiskSourceDefPtr def) virDomainDiskSourceDefClear(virStorageSourcePtr def)
{ {
size_t i; size_t i;
...@@ -1237,7 +1237,7 @@ virDomainDiskDefFree(virDomainDiskDefPtr def) ...@@ -1237,7 +1237,7 @@ virDomainDiskDefFree(virDomainDiskDefPtr def)
void void
virDomainDiskAuthClear(virDomainDiskSourceDefPtr def) virDomainDiskAuthClear(virStorageSourcePtr def)
{ {
VIR_FREE(def->auth.username); VIR_FREE(def->auth.username);
......
...@@ -595,38 +595,10 @@ struct _virDomainBlockIoTuneInfo { ...@@ -595,38 +595,10 @@ struct _virDomainBlockIoTuneInfo {
}; };
typedef virDomainBlockIoTuneInfo *virDomainBlockIoTuneInfoPtr; 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 */ /* Stores the virtual disk configuration */
struct _virDomainDiskDef { struct _virDomainDiskDef {
virDomainDiskSourceDef src; virStorageSource src;
int device; /* enum virDomainDiskDevice */ int device; /* enum virDomainDiskDevice */
int bus; /* enum virDomainDiskBus */ int bus; /* enum virDomainDiskBus */
...@@ -2153,7 +2125,7 @@ void virDomainGraphicsDefFree(virDomainGraphicsDefPtr def); ...@@ -2153,7 +2125,7 @@ void virDomainGraphicsDefFree(virDomainGraphicsDefPtr def);
void virDomainInputDefFree(virDomainInputDefPtr def); void virDomainInputDefFree(virDomainInputDefPtr def);
void virDomainDiskDefFree(virDomainDiskDefPtr def); void virDomainDiskDefFree(virDomainDiskDefPtr def);
void virDomainLeaseDefFree(virDomainLeaseDefPtr def); void virDomainLeaseDefFree(virDomainLeaseDefPtr def);
void virDomainDiskAuthClear(virDomainDiskSourceDefPtr def); void virDomainDiskAuthClear(virStorageSourcePtr def);
int virDomainDiskGetType(virDomainDiskDefPtr def); int virDomainDiskGetType(virDomainDiskDefPtr def);
void virDomainDiskSetType(virDomainDiskDefPtr def, int type); void virDomainDiskSetType(virDomainDiskDefPtr def, int type);
int virDomainDiskGetActualType(virDomainDiskDefPtr def); int virDomainDiskGetActualType(virDomainDiskDefPtr def);
......
...@@ -25,6 +25,8 @@ ...@@ -25,6 +25,8 @@
# define __VIR_STORAGE_FILE_H__ # define __VIR_STORAGE_FILE_H__
# include "virbitmap.h" # include "virbitmap.h"
# include "virseclabel.h"
# include "virstorageencryption.h"
# include "virutil.h" # include "virutil.h"
/* Minimum header size required to probe all known formats with /* Minimum header size required to probe all known formats with
...@@ -182,6 +184,36 @@ enum virStorageSecretType { ...@@ -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 # ifndef DEV_BSIZE
# define DEV_BSIZE 512 # define DEV_BSIZE 512
# endif # endif
......
...@@ -148,6 +148,7 @@ virt_host_validate_LDADD = \ ...@@ -148,6 +148,7 @@ virt_host_validate_LDADD = \
$(NULL) $(NULL)
virt_host_validate_CFLAGS = \ virt_host_validate_CFLAGS = \
$(LIBXML_CFLAGS) \
$(WARN_CFLAGS) \ $(WARN_CFLAGS) \
$(PIE_CFLAGS) \ $(PIE_CFLAGS) \
$(COVERAGE_CFLAGS) \ $(COVERAGE_CFLAGS) \
...@@ -173,6 +174,7 @@ virt_login_shell_LDADD = \ ...@@ -173,6 +174,7 @@ virt_login_shell_LDADD = \
virt_login_shell_CFLAGS = \ virt_login_shell_CFLAGS = \
-DLIBVIRT_SETUID_RPC_CLIENT \ -DLIBVIRT_SETUID_RPC_CLIENT \
$(LIBXML_CFLAGS) \
$(WARN_CFLAGS) \ $(WARN_CFLAGS) \
$(PIE_CFLAGS) \ $(PIE_CFLAGS) \
$(COVERAGE_CFLAGS) $(COVERAGE_CFLAGS)
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册