1
0
mirror of https://gitlab.com/libvirt/libvirt.git synced 2024-12-22 17:34:18 +03:00

conf: secret: Provide only virSecretDefParse

Replace the virSecretDefParseFile/String shims by calls to
virSecretDefParse.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
This commit is contained in:
Peter Krempa 2022-09-22 17:42:00 +02:00
parent fcd8750306
commit 7c32578531
6 changed files with 10 additions and 20 deletions

View File

@ -174,7 +174,7 @@ virSecretParseXML(xmlXPathContext *ctxt)
}
static virSecretDef *
virSecretDef *
virSecretDefParse(const char *xmlStr,
const char *filename,
unsigned int flags)
@ -190,18 +190,6 @@ virSecretDefParse(const char *xmlStr,
return virSecretParseXML(ctxt);
}
virSecretDef *
virSecretDefParseString(const char *xmlStr,
unsigned int flags)
{
return virSecretDefParse(xmlStr, NULL, flags);
}
virSecretDef *
virSecretDefParseFile(const char *filename)
{
return virSecretDefParse(NULL, filename, 0);
}
static int
virSecretDefFormatUsage(virBuffer *buf,

View File

@ -35,8 +35,11 @@ struct _virSecretDef {
void virSecretDefFree(virSecretDef *def);
G_DEFINE_AUTOPTR_CLEANUP_FUNC(virSecretDef, virSecretDefFree);
virSecretDef *virSecretDefParseString(const char *xml, unsigned int flags);
virSecretDef *virSecretDefParseFile(const char *filename);
virSecretDef *
virSecretDefParse(const char *xmlStr,
const char *filename,
unsigned int flags);
char *virSecretDefFormat(const virSecretDef *def);
#define VIR_CONNECT_LIST_SECRETS_FILTERS_EPHEMERAL \

View File

@ -870,7 +870,7 @@ virSecretLoad(virSecretObjList *secrets,
virSecretDef *def = NULL;
virSecretObj *obj = NULL;
if (!(def = virSecretDefParseFile(path)))
if (!(def = virSecretDefParse(NULL, path, 0)))
goto cleanup;
if (virSecretLoadValidateUUID(def, file) < 0)

View File

@ -1010,8 +1010,7 @@ virObjectEventStateQueue;
# conf/secret_conf.h
virSecretDefFormat;
virSecretDefFree;
virSecretDefParseFile;
virSecretDefParseString;
virSecretDefParse;
virSecretUsageTypeFromString;
virSecretUsageTypeToString;

View File

@ -207,7 +207,7 @@ secretDefineXML(virConnectPtr conn,
virCheckFlags(VIR_SECRET_DEFINE_VALIDATE, NULL);
if (!(def = virSecretDefParseString(xml, flags)))
if (!(def = virSecretDefParse(xml, NULL, flags)))
return NULL;
if (virSecretDefineXMLEnsureACL(conn, def) < 0)

View File

@ -13,7 +13,7 @@ testCompareXMLToXMLFiles(const char *inxml, const char *outxml)
g_autofree char *actual = NULL;
g_autoptr(virSecretDef) secret = NULL;
if (!(secret = virSecretDefParseFile(inxml)))
if (!(secret = virSecretDefParse(NULL, inxml, 0)))
return -1;
if (!(actual = virSecretDefFormat(secret)))