[libvirt] [PATCH 3/4] conf: use typedefs for enums in "src/conf/storage_conf.h"

Eric Blake eblake at redhat.com
Wed May 14 16:18:29 UTC 2014


On 05/11/2014 09:08 AM, Julio Faracco wrote:
> In "src/conf/" there are many enumeration (enum) declarations. Similar to the recent cleanup to "src/util" directory, it's better to use a typedef for variable types, function types and other usages. Other enumeration and folders will be changed to typedef's in the future. Most of the files changed in this commit are related to storage (storage_conf) enums.

Rewrapped,

> 
> Signed-off-by: Julio Faracco <jcfaracco at gmail.com>
> Signed-off-by: Eric Blake <eblake at redhat.com>
> ---
>  src/conf/storage_conf.h      |   48 +++++++++++++++++++++---------------------
>  src/qemu/qemu_conf.c         |    2 +-
>  src/storage/storage_driver.c |    4 ++--
>  tools/virsh-pool.c           |    2 +-
>  4 files changed, 28 insertions(+), 28 deletions(-)

I also updated the patch to clean up lots of comments.  (Hmm,
util/virstoragefile.h would be another candidate for a cleanup).

ACK and pushed as amended:

diff --git i/src/conf/domain_conf.h w/src/conf/domain_conf.h
index a92f0f3..63c4577 100644
--- i/src/conf/domain_conf.h
+++ w/src/conf/domain_conf.h
@@ -607,7 +607,7 @@ struct _virDomainDiskDef {
     int removable; /* enum virDomainFeatureState */

     char *mirror;
-    int mirrorFormat; /* enum virStorageFileFormat */
+    int mirrorFormat; /* virStorageFileFormat */
     bool mirroring;

     struct {
@@ -776,7 +776,7 @@ struct _virDomainFSDef {
     int fsdriver; /* enum virDomainFSDriverType */
     int accessmode; /* enum virDomainFSAccessMode */
     int wrpolicy; /* enum virDomainFSWrpolicy */
-    int format; /* enum virStorageFileFormat */
+    int format; /* virStorageFileFormat */
     unsigned long long usage; /* in bytes */
     char *src;
     char *dst;
diff --git i/src/conf/storage_conf.h w/src/conf/storage_conf.h
index 8c3bc57..b10d4f2 100644
--- i/src/conf/storage_conf.h
+++ w/src/conf/storage_conf.h
@@ -51,7 +51,7 @@ struct _virStorageVolSource {
     int nextent;
     virStorageVolSourceExtentPtr extents;

-    int partType; /* enum virStorageVolTypeDisk, only used by disk
+    int partType; /* virStorageVolTypeDisk, only used by disk
                    * backend for partition type creation */
 };

@@ -61,7 +61,7 @@ typedef virStorageVolDef *virStorageVolDefPtr;
 struct _virStorageVolDef {
     char *name;
     char *key;
-    int type; /* enum virStorageVolType */
+    int type; /* virStorageVolType */

     unsigned int building;
     unsigned int in_use;
@@ -167,7 +167,7 @@ typedef virStoragePoolSourceDeviceExtent
*virStoragePoolSourceDeviceExtentPtr;
 struct _virStoragePoolSourceDeviceExtent {
     unsigned long long start;
     unsigned long long end;
-    int type; /* enum virStorageFreeType */
+    int type; /* virStorageFreeType */
 };

 typedef struct _virStoragePoolSourceInitiatorAttr
virStoragePoolSourceInitiatorAttr;
@@ -208,7 +208,7 @@ VIR_ENUM_DECL(virStoragePoolSourceAdapterType)

 typedef struct _virStoragePoolSourceAdapter virStoragePoolSourceAdapter;
 struct _virStoragePoolSourceAdapter {
-    int type; /* enum virStoragePoolSourceAdapterType */
+    int type; /* virStoragePoolSourceAdapterType */

     union {
         char *name;
@@ -273,7 +273,7 @@ typedef virStoragePoolDef *virStoragePoolDefPtr;
 struct _virStoragePoolDef {
     char *name;
     unsigned char uuid[VIR_UUID_BUFLEN];
-    int type; /* enum virStoragePoolType */
+    int type; /* virStoragePoolType */

     unsigned long long allocation; /* bytes */
     unsigned long long capacity; /* bytes */
diff --git i/src/util/virstoragefile.h w/src/util/virstoragefile.h
index 6072409..e32389e 100644
--- i/src/util/virstoragefile.h
+++ w/src/util/virstoragefile.h
@@ -150,7 +150,7 @@ typedef virStorageNetHostDef *virStorageNetHostDefPtr;
 struct _virStorageNetHostDef {
     char *name;
     char *port;
-    int transport; /* enum virStorageNetHostTransport */
+    int transport; /* virStorageNetHostTransport */
     char *socket;  /* path to unix socket */
 };

@@ -182,10 +182,10 @@ typedef struct _virStorageSourcePoolDef
virStorageSourcePoolDef;
 struct _virStorageSourcePoolDef {
     char *pool; /* pool name */
     char *volume; /* volume name */
-    int voltype; /* enum virStorageVolType, internal only */
-    int pooltype; /* enum virStoragePoolType, internal only */
-    int actualtype; /* enum virStorageType, internal only */
-    int mode; /* enum virStorageSourcePoolMode */
+    int voltype; /* virStorageVolType, internal only */
+    int pooltype; /* virStoragePoolType, internal only */
+    int actualtype; /* virStorageType, internal only */
+    int mode; /* virStorageSourcePoolMode */
 };
 typedef virStorageSourcePoolDef *virStorageSourcePoolDefPtr;

@@ -208,15 +208,15 @@ typedef virStorageSource *virStorageSourcePtr;
  * backing chains, multiple source disks join to form a single guest
  * view.  */
 struct _virStorageSource {
-    int type; /* enum virStorageType */
+    int type; /* virStorageType */
     char *path;
-    int protocol; /* enum virStorageNetProtocol */
+    int protocol; /* virStorageNetProtocol */
     size_t nhosts;
     virStorageNetHostDefPtr hosts;
     virStorageSourcePoolDefPtr srcpool;
     struct {
         char *username;
-        int secretType; /* enum virStorageSecretType */
+        int secretType; /* virStorageSecretType */
         union {
             unsigned char uuid[VIR_UUID_BUFLEN];
             char *usage;
@@ -225,7 +225,7 @@ struct _virStorageSource {
     virStorageEncryptionPtr encryption;

     char *driverName;
-    int format; /* enum virStorageFileFormat */
+    int format; /* virStorageFileFormat */
     virBitmapPtr features;
     char *compat;



-- 
Eric Blake   eblake redhat com    +1-919-301-3266
Libvirt virtualization library http://libvirt.org

-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 604 bytes
Desc: OpenPGP digital signature
URL: <http://listman.redhat.com/archives/libvir-list/attachments/20140514/c9ec281c/attachment-0001.sig>


More information about the libvir-list mailing list