secret: Change virSecretDef variable names

Change 'ephemeral' to 'isephemeral' and 'private' to 'isprivate' since
both are bools.
This commit is contained in:
John Ferlan 2016-03-08 11:34:56 -05:00
parent 43d3e3c130
commit 662bf30c0f
5 changed files with 22 additions and 22 deletions

View File

@ -183,9 +183,9 @@ secretXMLParseNode(xmlDocPtr xml, xmlNodePtr root)
prop = virXPathString("string(./@ephemeral)", ctxt);
if (prop != NULL) {
if (STREQ(prop, "yes")) {
def->ephemeral = true;
def->isephemeral = true;
} else if (STREQ(prop, "no")) {
def->ephemeral = false;
def->isephemeral = false;
} else {
virReportError(VIR_ERR_XML_ERROR, "%s",
_("invalid value of 'ephemeral'"));
@ -197,9 +197,9 @@ secretXMLParseNode(xmlDocPtr xml, xmlNodePtr root)
prop = virXPathString("string(./@private)", ctxt);
if (prop != NULL) {
if (STREQ(prop, "yes")) {
def->private = true;
def->isprivate = true;
} else if (STREQ(prop, "no")) {
def->private = false;
def->isprivate = false;
} else {
virReportError(VIR_ERR_XML_ERROR, "%s",
_("invalid value of 'private'"));
@ -325,8 +325,8 @@ virSecretDefFormat(const virSecretDef *def)
char uuidstr[VIR_UUID_STRING_BUFLEN];
virBufferAsprintf(&buf, "<secret ephemeral='%s' private='%s'>\n",
def->ephemeral ? "yes" : "no",
def->private ? "yes" : "no");
def->isephemeral ? "yes" : "no",
def->isprivate ? "yes" : "no");
uuid = def->uuid;
virUUIDFormat(uuid, uuidstr);

View File

@ -31,8 +31,8 @@ VIR_ENUM_DECL(virSecretUsage)
typedef struct _virSecretDef virSecretDef;
typedef virSecretDef *virSecretDefPtr;
struct _virSecretDef {
bool ephemeral;
bool private;
bool isephemeral;
bool isprivate;
unsigned char uuid[VIR_UUID_BUFLEN];
char *description; /* May be NULL */
int usage_type;

View File

@ -369,7 +369,7 @@ virSecretObjListAddLocked(virSecretObjListPtr secrets,
goto cleanup;
}
if (secret->def->private && !def->private) {
if (secret->def->isprivate && !def->isprivate) {
virReportError(VIR_ERR_INTERNAL_ERROR, "%s",
_("cannot change private flag on existing secret"));
goto cleanup;
@ -517,17 +517,17 @@ virSecretObjMatchFlags(virSecretObjPtr secret,
/* filter by whether it's ephemeral */
if (MATCH(VIR_CONNECT_LIST_SECRETS_FILTERS_EPHEMERAL) &&
!((MATCH(VIR_CONNECT_LIST_SECRETS_EPHEMERAL) &&
secret->def->ephemeral) ||
secret->def->isephemeral) ||
(MATCH(VIR_CONNECT_LIST_SECRETS_NO_EPHEMERAL) &&
!secret->def->ephemeral)))
!secret->def->isephemeral)))
return false;
/* filter by whether it's private */
if (MATCH(VIR_CONNECT_LIST_SECRETS_FILTERS_PRIVATE) &&
!((MATCH(VIR_CONNECT_LIST_SECRETS_PRIVATE) &&
secret->def->private) ||
secret->def->isprivate) ||
(MATCH(VIR_CONNECT_LIST_SECRETS_NO_PRIVATE) &&
!secret->def->private)))
!secret->def->isprivate)))
return false;
return true;
@ -660,7 +660,7 @@ virSecretObjListGetUUIDs(virSecretObjListPtr secrets,
int
virSecretObjDeleteConfig(virSecretObjPtr secret)
{
if (!secret->def->ephemeral &&
if (!secret->def->isephemeral &&
unlink(secret->configFile) < 0 && errno != ENOENT) {
virReportSystemError(errno, _("cannot unlink '%s'"),
secret->configFile);
@ -804,7 +804,7 @@ virSecretObjSetValue(virSecretObjPtr secret,
secret->value = new_value;
secret->value_size = value_size;
if (!secret->def->ephemeral && virSecretObjSaveData(secret) < 0)
if (!secret->def->isephemeral && virSecretObjSaveData(secret) < 0)
goto error;
/* Saved successfully - drop old value */

View File

@ -231,23 +231,23 @@ secretDefineXML(virConnectPtr conn,
driver->configDir, &backup)))
goto cleanup;
if (!new_attrs->ephemeral) {
if (!new_attrs->isephemeral) {
if (secretEnsureDirectory() < 0)
goto cleanup;
if (backup && backup->ephemeral) {
if (backup && backup->isephemeral) {
if (virSecretObjSaveData(secret) < 0)
goto restore_backup;
}
if (virSecretObjSaveConfig(secret) < 0) {
if (backup && backup->ephemeral) {
if (backup && backup->isephemeral) {
/* Undo the virSecretObjSaveData() above; ignore errors */
virSecretObjDeleteData(secret);
}
goto restore_backup;
}
} else if (backup && !backup->ephemeral) {
} else if (backup && !backup->isephemeral) {
if (virSecretObjDeleteConfig(secret) < 0)
goto restore_backup;
@ -358,7 +358,7 @@ secretGetValue(virSecretPtr obj,
goto cleanup;
if ((internalFlags & VIR_SECRET_GET_VALUE_INTERNAL_CALL) == 0 &&
def->private) {
def->isprivate) {
virReportError(VIR_ERR_INVALID_SECRET, "%s",
_("secret is private"));
goto cleanup;

View File

@ -620,8 +620,8 @@ virStorageGenerateQcowEncryption(virConnectPtr conn,
VIR_ALLOC(def) < 0)
goto cleanup;
def->ephemeral = false;
def->private = false;
def->isephemeral = false;
def->isprivate = false;
if (virStorageGenerateSecretUUID(conn, def->uuid) < 0)
goto cleanup;