提交 ab517818 编写于 作者: E Eric Blake

maint: shorten 'TypeType' function names

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: NEric Blake <eblake@redhat.com>
上级 ea18f8b2
......@@ -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) {
......
......@@ -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)
......
/*
* 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"),
......
/*
* 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;
......
......@@ -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 :
......
......@@ -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 | \
......
......@@ -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;
......
......@@ -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;
}
}
......
......@@ -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"));
......
......@@ -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"));
......
......@@ -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;
......
/*
* 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) {
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册