In "src/conf/" there are many enumeration (enum) structures like
"src/util" directory, for example. Sometimes, it's better using 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 included Storage and Snapshot (storage_conf.* and
snapshot_conf.*) enum structures.
Signed-off-by: Julio Faracco <jcfaracco(a)gmail.com>
---
src/conf/snapshot_conf.h | 8 +++----
src/conf/storage_conf.h | 48 +++++++++++++++++++++---------------------
src/qemu/qemu_conf.c | 2 +-
src/storage/storage_driver.c | 4 ++--
tools/virsh-pool.c | 2 +-
5 files changed, 32 insertions(+), 32 deletions(-)
diff --git a/src/conf/snapshot_conf.h b/src/conf/snapshot_conf.h
index 5f74b62..e0b2253 100644
--- a/src/conf/snapshot_conf.h
+++ b/src/conf/snapshot_conf.h
@@ -29,20 +29,20 @@
/* Items related to snapshot state */
-enum virDomainSnapshotLocation {
+typedef enum {
VIR_DOMAIN_SNAPSHOT_LOCATION_DEFAULT = 0,
VIR_DOMAIN_SNAPSHOT_LOCATION_NONE,
VIR_DOMAIN_SNAPSHOT_LOCATION_INTERNAL,
VIR_DOMAIN_SNAPSHOT_LOCATION_EXTERNAL,
VIR_DOMAIN_SNAPSHOT_LOCATION_LAST
-};
+} virDomainSnapshotLocation;
-enum virDomainSnapshotState {
+typedef enum {
/* Inherit the VIR_DOMAIN_* states from virDomainState. */
VIR_DOMAIN_DISK_SNAPSHOT = VIR_DOMAIN_LAST,
VIR_DOMAIN_SNAPSHOT_STATE_LAST
-};
+} virDomainSnapshotState;
/* Stores disk-snapshot information */
typedef struct _virDomainSnapshotDiskDef virDomainSnapshotDiskDef;
diff --git a/src/conf/storage_conf.h b/src/conf/storage_conf.h
index 9ad38e1..895155d 100644
--- a/src/conf/storage_conf.h
+++ b/src/conf/storage_conf.h
@@ -79,7 +79,7 @@ struct _virStorageVolDefList {
VIR_ENUM_DECL(virStorageVol)
-enum virStoragePoolType {
+typedef enum {
VIR_STORAGE_POOL_DIR, /* Local directory */
VIR_STORAGE_POOL_FS, /* Local filesystem */
VIR_STORAGE_POOL_NETFS, /* Networked filesystem - eg NFS, GFS, etc */
@@ -93,25 +93,25 @@ enum virStoragePoolType {
VIR_STORAGE_POOL_GLUSTER, /* Gluster device */
VIR_STORAGE_POOL_LAST,
-};
+} virStoragePoolType;
VIR_ENUM_DECL(virStoragePool)
-enum virStoragePoolDeviceType {
+typedef enum {
VIR_STORAGE_DEVICE_TYPE_DISK = 0x00,
VIR_STORAGE_DEVICE_TYPE_ROM = 0x05,
VIR_STORAGE_DEVICE_TYPE_LAST,
-};
+} virStoragePoolDeviceType;
-enum virStoragePoolAuthType {
+typedef enum {
VIR_STORAGE_POOL_AUTH_NONE,
VIR_STORAGE_POOL_AUTH_CHAP,
VIR_STORAGE_POOL_AUTH_CEPHX,
VIR_STORAGE_POOL_AUTH_LAST,
-};
+} virStoragePoolAuthType;
VIR_ENUM_DECL(virStoragePoolAuthType)
typedef struct _virStoragePoolAuthSecret virStoragePoolAuthSecret;
@@ -151,12 +151,12 @@ struct _virStoragePoolSourceHost {
* For MSDOS partitions, the free area is important when
* creating logical partitions
*/
-enum virStorageFreeType {
+typedef enum {
VIR_STORAGE_FREE_NONE = 0,
VIR_STORAGE_FREE_NORMAL,
VIR_STORAGE_FREE_LOGICAL,
VIR_STORAGE_FREE_LAST
-};
+} virStorageFreeType;
/*
* Available extents on the underlying storage
@@ -196,13 +196,13 @@ struct _virStoragePoolSourceDevice {
} geometry;
};
-enum virStoragePoolSourceAdapterType {
+typedef enum {
VIR_STORAGE_POOL_SOURCE_ADAPTER_TYPE_DEFAULT = 0,
VIR_STORAGE_POOL_SOURCE_ADAPTER_TYPE_SCSI_HOST,
VIR_STORAGE_POOL_SOURCE_ADAPTER_TYPE_FC_HOST,
VIR_STORAGE_POOL_SOURCE_ADAPTER_TYPE_LAST,
-};
+} virStoragePoolSourceAdapterType;
VIR_ENUM_DECL(virStoragePoolSourceAdapterType)
typedef struct _virStoragePoolSourceAdapter virStoragePoolSourceAdapter;
@@ -419,7 +419,7 @@ void virStoragePoolObjLock(virStoragePoolObjPtr obj);
void virStoragePoolObjUnlock(virStoragePoolObjPtr obj);
-enum virStoragePoolFormatFileSystem {
+typedef enum {
VIR_STORAGE_POOL_FS_AUTO = 0,
VIR_STORAGE_POOL_FS_EXT2,
VIR_STORAGE_POOL_FS_EXT3,
@@ -434,19 +434,19 @@ enum virStoragePoolFormatFileSystem {
VIR_STORAGE_POOL_FS_XFS,
VIR_STORAGE_POOL_FS_OCFS2,
VIR_STORAGE_POOL_FS_LAST,
-};
+} virStoragePoolFormatFileSystem;
VIR_ENUM_DECL(virStoragePoolFormatFileSystem)
-enum virStoragePoolFormatFileSystemNet {
+typedef enum {
VIR_STORAGE_POOL_NETFS_AUTO = 0,
VIR_STORAGE_POOL_NETFS_NFS,
VIR_STORAGE_POOL_NETFS_GLUSTERFS,
VIR_STORAGE_POOL_NETFS_CIFS,
VIR_STORAGE_POOL_NETFS_LAST,
-};
+} virStoragePoolFormatFileSystemNet;
VIR_ENUM_DECL(virStoragePoolFormatFileSystemNet)
-enum virStoragePoolFormatDisk {
+typedef enum {
VIR_STORAGE_POOL_DISK_UNKNOWN = 0,
VIR_STORAGE_POOL_DISK_DOS = 1,
VIR_STORAGE_POOL_DISK_DVH,
@@ -457,14 +457,14 @@ enum virStoragePoolFormatDisk {
VIR_STORAGE_POOL_DISK_SUN,
VIR_STORAGE_POOL_DISK_LVM2,
VIR_STORAGE_POOL_DISK_LAST,
-};
+} virStoragePoolFormatDisk;
VIR_ENUM_DECL(virStoragePoolFormatDisk)
-enum virStoragePoolFormatLogical {
+typedef enum {
VIR_STORAGE_POOL_LOGICAL_UNKNOWN = 0,
VIR_STORAGE_POOL_LOGICAL_LVM2 = 1,
VIR_STORAGE_POOL_LOGICAL_LAST,
-};
+} virStoragePoolFormatLogical;
VIR_ENUM_DECL(virStoragePoolFormatLogical)
/*
@@ -476,7 +476,7 @@ VIR_ENUM_DECL(virStoragePoolFormatLogical)
*
* So this is a semi-generic set
*/
-enum virStorageVolFormatDisk {
+typedef enum {
VIR_STORAGE_VOL_DISK_NONE = 0,
VIR_STORAGE_VOL_DISK_LINUX,
VIR_STORAGE_VOL_DISK_FAT16,
@@ -486,22 +486,22 @@ enum virStorageVolFormatDisk {
VIR_STORAGE_VOL_DISK_LINUX_RAID,
VIR_STORAGE_VOL_DISK_EXTENDED,
VIR_STORAGE_VOL_DISK_LAST,
-};
+} virStorageVolFormatDisk;
VIR_ENUM_DECL(virStorageVolFormatDisk)
-enum virStorageVolTypeDisk {
+typedef enum {
VIR_STORAGE_VOL_DISK_TYPE_NONE = 0,
VIR_STORAGE_VOL_DISK_TYPE_PRIMARY,
VIR_STORAGE_VOL_DISK_TYPE_LOGICAL,
VIR_STORAGE_VOL_DISK_TYPE_EXTENDED,
VIR_STORAGE_VOL_DISK_TYPE_LAST,
-};
+} virStorageVolTypeDisk;
/*
* Mapping of Parted fs-types MUST be kept in the
* same order as virStorageVolFormatDisk
*/
-enum virStoragePartedFsType {
+typedef enum {
VIR_STORAGE_PARTED_FS_TYPE_NONE = 0,
VIR_STORAGE_PARTED_FS_TYPE_LINUX,
VIR_STORAGE_PARTED_FS_TYPE_FAT16,
@@ -511,7 +511,7 @@ enum virStoragePartedFsType {
VIR_STORAGE_PARTED_FS_TYPE_LINUX_RAID,
VIR_STORAGE_PARTED_FS_TYPE_EXTENDED,
VIR_STORAGE_PARTED_FS_TYPE_LAST,
-};
+} virStoragePartedFsType;
VIR_ENUM_DECL(virStoragePartedFsType)
# define VIR_CONNECT_LIST_STORAGE_POOLS_FILTERS_ACTIVE \
diff --git a/src/qemu/qemu_conf.c b/src/qemu/qemu_conf.c
index 198ee2f..b0dab59 100644
--- a/src/qemu/qemu_conf.c
+++ b/src/qemu/qemu_conf.c
@@ -1312,7 +1312,7 @@ qemuTranslateDiskSourcePool(virConnectPtr conn,
virStorageNetHostDefFree(def->src.nhosts, def->src.hosts);
virStorageSourceAuthClear(&def->src);
- switch ((enum virStoragePoolType) pooldef->type) {
+ switch ((virStoragePoolType) pooldef->type) {
case VIR_STORAGE_POOL_DIR:
case VIR_STORAGE_POOL_FS:
case VIR_STORAGE_POOL_NETFS:
diff --git a/src/storage/storage_driver.c b/src/storage/storage_driver.c
index 2cb8347..01ed1bf 100644
--- a/src/storage/storage_driver.c
+++ b/src/storage/storage_driver.c
@@ -1483,7 +1483,7 @@ storageVolLookupByPath(virConnectPtr conn,
continue;
}
- switch ((enum virStoragePoolType) pool->def->type) {
+ switch ((virStoragePoolType) pool->def->type) {
case VIR_STORAGE_POOL_DIR:
case VIR_STORAGE_POOL_FS:
case VIR_STORAGE_POOL_NETFS:
@@ -2083,7 +2083,7 @@ storageVolUpload(virStorageVolPtr obj,
goto cleanup;
}
- switch ((enum virStoragePoolType) pool->def->type) {
+ switch ((virStoragePoolType) pool->def->type) {
case VIR_STORAGE_POOL_DIR:
case VIR_STORAGE_POOL_FS:
case VIR_STORAGE_POOL_NETFS:
diff --git a/tools/virsh-pool.c b/tools/virsh-pool.c
index 0d35cf5..7c40b5b 100644
--- a/tools/virsh-pool.c
+++ b/tools/virsh-pool.c
@@ -1029,7 +1029,7 @@ cmdPoolList(vshControl *ctl, const vshCmd *cmd ATTRIBUTE_UNUSED)
return false;
}
- switch ((enum virStoragePoolType) poolType) {
+ switch ((virStoragePoolType) poolType) {
case VIR_STORAGE_POOL_DIR:
flags |= VIR_CONNECT_LIST_STORAGE_POOLS_DIR;
break;
--
1.7.10.4