[PATCH 3/4] maint: shorten 'TypeType' function names

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



The VIR_ENUM_DECL/VIR_ENUM_IMPL helper macros already append 'Type'
to the enum name being converted; it looks silly to have functions
with 'TypeType' in their name.  Even though some of our enums have
to have a 'Type' suffix, the corresponding string conversion
functions do not.

* src/conf/secret_conf.h (VIR_ENUM_DECL): Rename virSecretUsageType.
* src/conf/storage_conf.h (VIR_ENUM_DECL): Rename
virStoragePoolAuthType, virStoragePoolSourceAdapterType,
virStoragePartedFsType.
* src/conf/domain_conf.c (virDomainDiskDefParseXML)
(virDomainFSDefParseXML, virDomainFSDefFormat): Update callers.
* src/conf/secret_conf.c (virSecretDefParseUsage)
(virSecretDefFormatUsage): Likewise.
* src/conf/storage_conf.c (virStoragePoolDefParseAuth)
(virStoragePoolDefParseSource, virStoragePoolSourceFormat):
Likewise.
* src/lxc/lxc_controller.c (virLXCControllerSetupLoopDevices):
Likewise.
* src/storage/storage_backend_disk.c
(virStorageBackendDiskPartFormat): Likewise.
* src/util/virstorageencryption.c (virStorageEncryptionSecretParse)
(virStorageEncryptionSecretFormat): Likewise.
* tools/virsh-secret.c (cmdSecretList): Likewise.
* src/libvirt_private.syms (secret_conf.h, storage_conf.h): Export
corrected names.

Signed-off-by: Eric Blake <eblake@xxxxxxxxxx>
---
 src/conf/domain_conf.c             | 10 +++++-----
 src/conf/domain_conf.h             |  2 +-
 src/conf/secret_conf.c             |  8 ++++----
 src/conf/secret_conf.h             |  4 ++--
 src/conf/storage_conf.c            | 14 +++++++-------
 src/conf/storage_conf.h            |  6 +++---
 src/libvirt_private.syms           | 10 +++++-----
 src/lxc/lxc_controller.c           |  2 +-
 src/storage/storage_backend_disk.c |  2 +-
 src/util/virstorageencryption.c    |  6 +++---
 src/util/virstorageencryption.h    |  2 +-
 tools/virsh-secret.c               |  4 ++--
 12 files changed, 35 insertions(+), 35 deletions(-)

diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c
index 6c3bdad..e65b62b 100644
--- a/src/conf/domain_conf.c
+++ b/src/conf/domain_conf.c
@@ -329,7 +329,7 @@ VIR_ENUM_IMPL(virDomainFS, VIR_DOMAIN_FS_TYPE_LAST,
               "ram",
               "bind")

-VIR_ENUM_IMPL(virDomainFSDriverType, VIR_DOMAIN_FS_DRIVER_TYPE_LAST,
+VIR_ENUM_IMPL(virDomainFSDriver, VIR_DOMAIN_FS_DRIVER_TYPE_LAST,
               "default",
               "path",
               "handle",
@@ -5375,7 +5375,7 @@ virDomainDiskDefParseXML(virDomainXMLOptionPtr xmlopt,
                             goto error;
                         }
                         auth_secret_usage =
-                            virSecretUsageTypeTypeFromString(usageType);
+                            virSecretUsageTypeFromString(usageType);
                         if (auth_secret_usage < 0) {
                             virReportError(VIR_ERR_CONFIG_UNSUPPORTED,
                                            _("invalid secret type %s"),
@@ -5537,7 +5537,7 @@ virDomainDiskDefParseXML(virDomainXMLOptionPtr xmlopt,
     if (auth_secret_usage != -1 && auth_secret_usage != expected_secret_usage) {
         virReportError(VIR_ERR_INTERNAL_ERROR,
                        _("invalid secret type '%s'"),
-                       virSecretUsageTypeTypeToString(auth_secret_usage));
+                       virSecretUsageTypeToString(auth_secret_usage));
         goto error;
     }

@@ -6313,7 +6313,7 @@ virDomainFSDefParseXML(xmlNodePtr node,
     }

     if (fsdriver) {
-        if ((def->fsdriver = virDomainFSDriverTypeTypeFromString(fsdriver)) <= 0) {
+        if ((def->fsdriver = virDomainFSDriverTypeFromString(fsdriver)) <= 0) {
             virReportError(VIR_ERR_CONFIG_UNSUPPORTED,
                            _("unknown fs driver type '%s'"), fsdriver);
             goto error;
@@ -15327,7 +15327,7 @@ virDomainFSDefFormat(virBufferPtr buf,
 {
     const char *type = virDomainFSTypeToString(def->type);
     const char *accessmode = virDomainFSAccessModeTypeToString(def->accessmode);
-    const char *fsdriver = virDomainFSDriverTypeTypeToString(def->fsdriver);
+    const char *fsdriver = virDomainFSDriverTypeToString(def->fsdriver);
     const char *wrpolicy = virDomainFSWrpolicyTypeToString(def->wrpolicy);

     if (!type) {
diff --git a/src/conf/domain_conf.h b/src/conf/domain_conf.h
index 9c80096..bde303c 100644
--- a/src/conf/domain_conf.h
+++ b/src/conf/domain_conf.h
@@ -2554,7 +2554,7 @@ VIR_ENUM_DECL(virDomainControllerModelPCI)
 VIR_ENUM_DECL(virDomainControllerModelSCSI)
 VIR_ENUM_DECL(virDomainControllerModelUSB)
 VIR_ENUM_DECL(virDomainFS)
-VIR_ENUM_DECL(virDomainFSDriverType)
+VIR_ENUM_DECL(virDomainFSDriver)
 VIR_ENUM_DECL(virDomainFSAccessMode)
 VIR_ENUM_DECL(virDomainFSWrpolicy)
 VIR_ENUM_DECL(virDomainNet)
diff --git a/src/conf/secret_conf.c b/src/conf/secret_conf.c
index 58e12c0..d85bb4e 100644
--- a/src/conf/secret_conf.c
+++ b/src/conf/secret_conf.c
@@ -1,7 +1,7 @@
 /*
  * secret_conf.c: internal <secret> XML handling
  *
- * Copyright (C) 2009, 2011, 2013, 2014 Red Hat, Inc.
+ * Copyright (C) 2009-2014 Red Hat, Inc.
  *
  * This library is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public
@@ -36,7 +36,7 @@

 VIR_LOG_INIT("conf.secret_conf");

-VIR_ENUM_IMPL(virSecretUsageType, VIR_SECRET_USAGE_TYPE_LAST,
+VIR_ENUM_IMPL(virSecretUsage, VIR_SECRET_USAGE_TYPE_LAST,
               "none", "volume", "ceph", "iscsi")

 void
@@ -82,7 +82,7 @@ virSecretDefParseUsage(xmlXPathContextPtr ctxt,
                        _("unknown secret usage type"));
         return -1;
     }
-    type = virSecretUsageTypeTypeFromString(type_str);
+    type = virSecretUsageTypeFromString(type_str);
     if (type < 0) {
         virReportError(VIR_ERR_CONFIG_UNSUPPORTED,
                        _("unknown secret usage type %s"), type_str);
@@ -249,7 +249,7 @@ virSecretDefFormatUsage(virBufferPtr buf,
 {
     const char *type;

-    type = virSecretUsageTypeTypeToString(def->usage_type);
+    type = virSecretUsageTypeToString(def->usage_type);
     if (type == NULL) {
         virReportError(VIR_ERR_INTERNAL_ERROR,
                        _("unexpected secret usage type %d"),
diff --git a/src/conf/secret_conf.h b/src/conf/secret_conf.h
index 54d7e76..9c13f05 100644
--- a/src/conf/secret_conf.h
+++ b/src/conf/secret_conf.h
@@ -1,7 +1,7 @@
 /*
  * secret_conf.h: internal <secret> XML handling API
  *
- * Copyright (C) 2009-2010, 2013 Red Hat, Inc.
+ * Copyright (C) 2009-2010, 2013-2014 Red Hat, Inc.
  *
  * This library is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public
@@ -26,7 +26,7 @@
 # include "internal.h"
 # include "virutil.h"

-VIR_ENUM_DECL(virSecretUsageType)
+VIR_ENUM_DECL(virSecretUsage)

 typedef struct _virSecretDef virSecretDef;
 typedef virSecretDef *virSecretDefPtr;
diff --git a/src/conf/storage_conf.c b/src/conf/storage_conf.c
index 9769b19..8b6fd79 100644
--- a/src/conf/storage_conf.c
+++ b/src/conf/storage_conf.c
@@ -87,18 +87,18 @@ VIR_ENUM_IMPL(virStorageVolFormatDisk,
               "linux-lvm", "linux-raid",
               "extended")

-VIR_ENUM_IMPL(virStoragePartedFsType,
+VIR_ENUM_IMPL(virStoragePartedFs,
               VIR_STORAGE_PARTED_FS_TYPE_LAST,
               "ext2", "ext2", "fat16",
               "fat32", "linux-swap",
               "ext2", "ext2",
               "extended")

-VIR_ENUM_IMPL(virStoragePoolSourceAdapterType,
+VIR_ENUM_IMPL(virStoragePoolSourceAdapter,
               VIR_STORAGE_POOL_SOURCE_ADAPTER_TYPE_LAST,
               "default", "scsi_host", "fc_host")

-VIR_ENUM_IMPL(virStoragePoolAuthType,
+VIR_ENUM_IMPL(virStoragePoolAuth,
               VIR_STORAGE_POOL_AUTH_LAST,
               "none", "chap", "ceph")

@@ -514,7 +514,7 @@ virStoragePoolDefParseAuth(xmlXPathContextPtr ctxt,
     }

     if ((source->authType =
-         virStoragePoolAuthTypeTypeFromString(authType)) < 0) {
+         virStoragePoolAuthTypeFromString(authType)) < 0) {
         virReportError(VIR_ERR_CONFIG_UNSUPPORTED,
                        _("unknown auth type '%s'"),
                        authType);
@@ -657,7 +657,7 @@ virStoragePoolDefParseSource(xmlXPathContextPtr ctxt,

     if ((adapter_type = virXPathString("string(./adapter/@type)", ctxt))) {
         if ((source->adapter.type =
-             virStoragePoolSourceAdapterTypeTypeFromString(adapter_type)) <= 0) {
+             virStoragePoolSourceAdapterTypeFromString(adapter_type)) <= 0) {
             virReportError(VIR_ERR_CONFIG_UNSUPPORTED,
                            _("Unknown pool adapter type '%s'"),
                            adapter_type);
@@ -1100,7 +1100,7 @@ virStoragePoolSourceFormat(virBufferPtr buf,
         if (src->adapter.type == VIR_STORAGE_POOL_SOURCE_ADAPTER_TYPE_FC_HOST ||
             src->adapter.type == VIR_STORAGE_POOL_SOURCE_ADAPTER_TYPE_SCSI_HOST)
             virBufferAsprintf(buf, "<adapter type='%s'",
-                              virStoragePoolSourceAdapterTypeTypeToString(src->adapter.type));
+                              virStoragePoolSourceAdapterTypeToString(src->adapter.type));

         if (src->adapter.type == VIR_STORAGE_POOL_SOURCE_ADAPTER_TYPE_FC_HOST) {
             virBufferEscapeString(buf, " parent='%s'",
@@ -1141,7 +1141,7 @@ virStoragePoolSourceFormat(virBufferPtr buf,
     if (src->authType == VIR_STORAGE_POOL_AUTH_CHAP ||
         src->authType == VIR_STORAGE_POOL_AUTH_CEPHX) {
         virBufferAsprintf(buf, "<auth type='%s' ",
-                          virStoragePoolAuthTypeTypeToString(src->authType));
+                          virStoragePoolAuthTypeToString(src->authType));
         virBufferEscapeString(buf, "username='%s'>\n",
                               (src->authType == VIR_STORAGE_POOL_AUTH_CHAP ?
                                src->auth.chap.username :
diff --git a/src/conf/storage_conf.h b/src/conf/storage_conf.h
index b10d4f2..04d99eb 100644
--- a/src/conf/storage_conf.h
+++ b/src/conf/storage_conf.h
@@ -113,7 +113,7 @@ typedef enum {

     VIR_STORAGE_POOL_AUTH_LAST,
 } virStoragePoolAuthType;
-VIR_ENUM_DECL(virStoragePoolAuthType)
+VIR_ENUM_DECL(virStoragePoolAuth)

 typedef struct _virStoragePoolAuthSecret virStoragePoolAuthSecret;
 typedef virStoragePoolAuthSecret *virStoragePoolAuthSecretPtr;
@@ -204,7 +204,7 @@ typedef enum {

     VIR_STORAGE_POOL_SOURCE_ADAPTER_TYPE_LAST,
 } virStoragePoolSourceAdapterType;
-VIR_ENUM_DECL(virStoragePoolSourceAdapterType)
+VIR_ENUM_DECL(virStoragePoolSourceAdapter)

 typedef struct _virStoragePoolSourceAdapter virStoragePoolSourceAdapter;
 struct _virStoragePoolSourceAdapter {
@@ -513,7 +513,7 @@ typedef enum {
     VIR_STORAGE_PARTED_FS_TYPE_EXTENDED,
     VIR_STORAGE_PARTED_FS_TYPE_LAST,
 } virStoragePartedFsType;
-VIR_ENUM_DECL(virStoragePartedFsType)
+VIR_ENUM_DECL(virStoragePartedFs)

 # define VIR_CONNECT_LIST_STORAGE_POOLS_FILTERS_ACTIVE   \
                 (VIR_CONNECT_LIST_STORAGE_POOLS_ACTIVE | \
diff --git a/src/libvirt_private.syms b/src/libvirt_private.syms
index 0a5fb14..c3332c9 100644
--- a/src/libvirt_private.syms
+++ b/src/libvirt_private.syms
@@ -671,8 +671,8 @@ virSecretDefFormat;
 virSecretDefFree;
 virSecretDefParseFile;
 virSecretDefParseString;
-virSecretUsageTypeTypeFromString;
-virSecretUsageTypeTypeToString;
+virSecretUsageTypeFromString;
+virSecretUsageTypeToString;


 # conf/snapshot_conf.h
@@ -701,7 +701,7 @@ virDomainSnapshotUpdateRelations;


 # conf/storage_conf.h
-virStoragePartedFsTypeTypeToString;
+virStoragePartedFsTypeToString;
 virStoragePoolDefFormat;
 virStoragePoolDefFree;
 virStoragePoolDefParseFile;
@@ -724,8 +724,8 @@ virStoragePoolObjLock;
 virStoragePoolObjRemove;
 virStoragePoolObjSaveDef;
 virStoragePoolObjUnlock;
-virStoragePoolSourceAdapterTypeTypeFromString;
-virStoragePoolSourceAdapterTypeTypeToString;
+virStoragePoolSourceAdapterTypeFromString;
+virStoragePoolSourceAdapterTypeToString;
 virStoragePoolSourceClear;
 virStoragePoolSourceDeviceClear;
 virStoragePoolSourceFindDuplicate;
diff --git a/src/lxc/lxc_controller.c b/src/lxc/lxc_controller.c
index c05dfec..5521c6e 100644
--- a/src/lxc/lxc_controller.c
+++ b/src/lxc/lxc_controller.c
@@ -523,7 +523,7 @@ static int virLXCControllerSetupLoopDevices(virLXCControllerPtr ctrl)
         } else {
             virReportError(VIR_ERR_CONFIG_UNSUPPORTED,
                            _("fs driver %s is not supported"),
-                           virDomainFSDriverTypeTypeToString(fs->fsdriver));
+                           virDomainFSDriverTypeToString(fs->fsdriver));
             goto cleanup;
         }
     }
diff --git a/src/storage/storage_backend_disk.c b/src/storage/storage_backend_disk.c
index b8e69bb..8e12974 100644
--- a/src/storage/storage_backend_disk.c
+++ b/src/storage/storage_backend_disk.c
@@ -484,7 +484,7 @@ virStorageBackendDiskPartFormat(virStoragePoolObjPtr pool,
     size_t i;
     if (pool->def->source.format == VIR_STORAGE_POOL_DISK_DOS) {
         const char *partedFormat;
-        partedFormat = virStoragePartedFsTypeTypeToString(vol->target.format);
+        partedFormat = virStoragePartedFsTypeToString(vol->target.format);
         if (partedFormat == NULL) {
             virReportError(VIR_ERR_INTERNAL_ERROR,
                            "%s", _("Invalid partition type"));
diff --git a/src/util/virstorageencryption.c b/src/util/virstorageencryption.c
index 9089278..1306490 100644
--- a/src/util/virstorageencryption.c
+++ b/src/util/virstorageencryption.c
@@ -37,7 +37,7 @@

 #define VIR_FROM_THIS VIR_FROM_STORAGE

-VIR_ENUM_IMPL(virStorageEncryptionSecretType,
+VIR_ENUM_IMPL(virStorageEncryptionSecret,
               VIR_STORAGE_ENCRYPTION_SECRET_TYPE_LAST, "passphrase")

 VIR_ENUM_IMPL(virStorageEncryptionFormat,
@@ -88,7 +88,7 @@ virStorageEncryptionSecretParse(xmlXPathContextPtr ctxt,
                        _("unknown volume encryption secret type"));
         goto cleanup;
     }
-    type = virStorageEncryptionSecretTypeTypeFromString(type_str);
+    type = virStorageEncryptionSecretTypeFromString(type_str);
     if (type < 0) {
         virReportError(VIR_ERR_CONFIG_UNSUPPORTED,
                        _("unknown volume encryption secret type %s"),
@@ -209,7 +209,7 @@ virStorageEncryptionSecretFormat(virBufferPtr buf,
     const char *type;
     char uuidstr[VIR_UUID_STRING_BUFLEN];

-    type = virStorageEncryptionSecretTypeTypeToString(secret->type);
+    type = virStorageEncryptionSecretTypeToString(secret->type);
     if (!type) {
         virReportError(VIR_ERR_INTERNAL_ERROR, "%s",
                        _("unexpected volume encryption secret type"));
diff --git a/src/util/virstorageencryption.h b/src/util/virstorageencryption.h
index f146249..0a9bf44 100644
--- a/src/util/virstorageencryption.h
+++ b/src/util/virstorageencryption.h
@@ -34,7 +34,7 @@ typedef enum {

     VIR_STORAGE_ENCRYPTION_SECRET_TYPE_LAST
 } virStorageEncryptionSecretType;
-VIR_ENUM_DECL(virStorageEncryptionSecretType)
+VIR_ENUM_DECL(virStorageEncryptionSecret)

 typedef struct _virStorageEncryptionSecret virStorageEncryptionSecret;
 typedef virStorageEncryptionSecret *virStorageEncryptionSecretPtr;
diff --git a/tools/virsh-secret.c b/tools/virsh-secret.c
index bbe83cf..add2c09 100644
--- a/tools/virsh-secret.c
+++ b/tools/virsh-secret.c
@@ -1,7 +1,7 @@
 /*
  * virsh-secret.c: Commands to manage secret
  *
- * Copyright (C) 2005, 2007-2013 Red Hat, Inc.
+ * Copyright (C) 2005, 2007-2014 Red Hat, Inc.
  *
  * This library is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public
@@ -539,7 +539,7 @@ cmdSecretList(vshControl *ctl, const vshCmd *cmd ATTRIBUTE_UNUSED)
     for (i = 0; i < list->nsecrets; i++) {
         virSecretPtr sec = list->secrets[i];
         int usageType = virSecretGetUsageType(sec);
-        const char *usageStr = virSecretUsageTypeTypeToString(usageType);
+        const char *usageStr = virSecretUsageTypeToString(usageType);
         char uuid[VIR_UUID_STRING_BUFLEN];

         if (virSecretGetUUIDString(sec, uuid) < 0) {
-- 
1.9.0

--
libvir-list mailing list
libvir-list@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/libvir-list




[Index of Archives]     [Virt Tools]     [Libvirt Users]     [Lib OS Info]     [Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [KDE Users]     [Fedora Tools]