]> xenbits.xensource.com Git - libvirt.git/commitdiff
maint: shorten 'TypeType' function names
authorEric Blake <eblake@redhat.com>
Wed, 14 May 2014 19:48:15 +0000 (13:48 -0600)
committerEric Blake <eblake@redhat.com>
Fri, 16 May 2014 06:22:18 +0000 (00:22 -0600)
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@redhat.com>
12 files changed:
src/conf/domain_conf.c
src/conf/domain_conf.h
src/conf/secret_conf.c
src/conf/secret_conf.h
src/conf/storage_conf.c
src/conf/storage_conf.h
src/libvirt_private.syms
src/lxc/lxc_controller.c
src/storage/storage_backend_disk.c
src/util/virstorageencryption.c
src/util/virstorageencryption.h
tools/virsh-secret.c

index 6c3bdadcd728daf1ed3850d3dc44e6236c6c54d0..e65b62b45674f7405be9355e82bf53eb7ceb2a07 100644 (file)
@@ -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) {
index 9c80096ab77678193846ca38f7015da074db6aaf..bde303c7aa73a716e504a6e0751fd96d3c268f63 100644 (file)
@@ -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)
index 58e12c01b47811a0d59a3ba0b291f77a27d6653d..d85bb4e2c97fdeca028323bcf235eb5ef57b9cdc 100644 (file)
@@ -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"),
index 54d7e7679615ebfc9f43335e5f34c5b5dd527e53..9c13f05dbdd9c97cdd7c635b34123413633c740a 100644 (file)
@@ -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;
index 9769b19149ae3f922db33d9c9fb67d512da8f22c..8b6fd790866730c3571acef9392429c5bdf41b9d 100644 (file)
@@ -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 :
index b10d4f26b096c859bb3500ba08d98209999a327b..04d99eb2564d9eb49992b5319641490b62577a13 100644 (file)
@@ -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 | \
index 0a5fb14286efac6b1e5dfb034f5eed0b13644fc2..c3332c9b2cfebd1260d435487bc5cc2792cbb076 100644 (file)
@@ -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;
index c05dfec6428cad927cd5751004a4f3afc67899de..5521c6ec9c78392fc997e0c30f5d0aad1113103a 100644 (file)
@@ -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;
         }
     }
index b8e69bb6e6d1c583b58925218f6786d4ac6f6a99..8e129741de2c15b0a0819cb522f8a55744d18655 100644 (file)
@@ -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"));
index 90892784cc545aa24025a855eb9cd28dab0e6baa..13064900c77a4065fde01df631f298cd58c22f68 100644 (file)
@@ -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"));
index f146249e66e860851f54491ad01a3f9a479c3bec..0a9bf44c0186ca95990551c07a720692bba5cfd4 100644 (file)
@@ -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;
index bbe83cf6901880d60694f43db7116fef5e6e2b25..add2c09eb2a87d6ffdb299cf6809c1ec9cf1f3b3 100644 (file)
@@ -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) {