conf: storage: Provide only virStoragePoolDefParse

Replace the virStoragePoolDefParseString/File thin wrappers by
virStoragePoolDefParse.

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:08:16 +02:00
parent b3e33a0ef7
commit 97df89d7f5
11 changed files with 16 additions and 34 deletions

View File

@ -29914,7 +29914,7 @@ virDomainStorageSourceTranslateSourcePool(virStorageSource *src,
if (!(poolxml = virStoragePoolGetXMLDesc(pool, 0))) if (!(poolxml = virStoragePoolGetXMLDesc(pool, 0)))
return -1; return -1;
if (!(pooldef = virStoragePoolDefParseString(poolxml, 0))) if (!(pooldef = virStoragePoolDefParse(poolxml, NULL, 0)))
return -1; return -1;
src->srcpool->pooltype = pooldef->type; src->srcpool->pooltype = pooldef->type;

View File

@ -972,7 +972,7 @@ virStoragePoolDefParseXML(xmlXPathContextPtr ctxt)
} }
static virStoragePoolDef * virStoragePoolDef *
virStoragePoolDefParse(const char *xmlStr, virStoragePoolDefParse(const char *xmlStr,
const char *filename, const char *filename,
unsigned int flags) unsigned int flags)
@ -990,21 +990,6 @@ virStoragePoolDefParse(const char *xmlStr,
} }
virStoragePoolDef *
virStoragePoolDefParseString(const char *xmlStr,
unsigned int flags)
{
return virStoragePoolDefParse(xmlStr, NULL, flags);
}
virStoragePoolDef *
virStoragePoolDefParseFile(const char *filename)
{
return virStoragePoolDefParse(NULL, filename, 0);
}
static int static int
virStoragePoolSourceFormat(virBuffer *buf, virStoragePoolSourceFormat(virBuffer *buf,
virStoragePoolOptions *options, virStoragePoolOptions *options,

View File

@ -272,12 +272,10 @@ virStoragePoolDef *
virStoragePoolDefParseXML(xmlXPathContextPtr ctxt); virStoragePoolDefParseXML(xmlXPathContextPtr ctxt);
virStoragePoolDef * virStoragePoolDef *
virStoragePoolDefParseString(const char *xml, virStoragePoolDefParse(const char *xmlStr,
const char *filename,
unsigned int flags); unsigned int flags);
virStoragePoolDef *
virStoragePoolDefParseFile(const char *filename);
char * char *
virStoragePoolDefFormat(virStoragePoolDef *def); virStoragePoolDefFormat(virStoragePoolDef *def);

View File

@ -1579,7 +1579,7 @@ virStoragePoolObjLoad(virStoragePoolObjList *pools,
VIR_DEBUG("loading storage pool config XML '%s'", path); VIR_DEBUG("loading storage pool config XML '%s'", path);
if (!(def = virStoragePoolDefParseFile(path))) if (!(def = virStoragePoolDefParse(NULL, path, 0)))
return NULL; return NULL;
if (!virStringMatchesNameSuffix(file, def->name, ".xml")) { if (!virStringMatchesNameSuffix(file, def->name, ".xml")) {

View File

@ -1053,9 +1053,8 @@ virStoragePoolCapsNew;
virStoragePartedFsTypeToString; virStoragePartedFsTypeToString;
virStoragePoolDefFormat; virStoragePoolDefFormat;
virStoragePoolDefFree; virStoragePoolDefFree;
virStoragePoolDefParseFile; virStoragePoolDefParse;
virStoragePoolDefParseSourceString; virStoragePoolDefParseSourceString;
virStoragePoolDefParseString;
virStoragePoolFormatDiskTypeFromString; virStoragePoolFormatDiskTypeFromString;
virStoragePoolFormatDiskTypeToString; virStoragePoolFormatDiskTypeToString;
virStoragePoolFormatFileSystemNetTypeToString; virStoragePoolFormatFileSystemNetTypeToString;

View File

@ -721,7 +721,7 @@ storagePoolCreateXML(virConnectPtr conn,
VIR_EXCLUSIVE_FLAGS_RET(VIR_STORAGE_POOL_BUILD_OVERWRITE, VIR_EXCLUSIVE_FLAGS_RET(VIR_STORAGE_POOL_BUILD_OVERWRITE,
VIR_STORAGE_POOL_BUILD_NO_OVERWRITE, NULL); VIR_STORAGE_POOL_BUILD_NO_OVERWRITE, NULL);
if (!(newDef = virStoragePoolDefParseString(xml, 0))) if (!(newDef = virStoragePoolDefParse(xml, NULL, 0)))
goto cleanup; goto cleanup;
if (virStoragePoolCreateXMLEnsureACL(conn, newDef) < 0) if (virStoragePoolCreateXMLEnsureACL(conn, newDef) < 0)
@ -801,7 +801,7 @@ storagePoolDefineXML(virConnectPtr conn,
virCheckFlags(VIR_STORAGE_POOL_DEFINE_VALIDATE, NULL); virCheckFlags(VIR_STORAGE_POOL_DEFINE_VALIDATE, NULL);
if (!(newDef = virStoragePoolDefParseString(xml, flags))) if (!(newDef = virStoragePoolDefParse(xml, NULL, flags)))
goto cleanup; goto cleanup;
if (virXMLCheckIllegalChars("name", newDef->name, "\n") < 0) if (virXMLCheckIllegalChars("name", newDef->name, "\n") < 0)

View File

@ -6631,7 +6631,7 @@ testStoragePoolCreateXML(virConnectPtr conn,
virCheckFlags(0, NULL); virCheckFlags(0, NULL);
virObjectLock(privconn); virObjectLock(privconn);
if (!(newDef = virStoragePoolDefParseString(xml, 0))) if (!(newDef = virStoragePoolDefParse(xml, NULL, 0)))
goto cleanup; goto cleanup;
if (!(obj = virStoragePoolObjListAdd(privconn->pools, &newDef, if (!(obj = virStoragePoolObjListAdd(privconn->pools, &newDef,
@ -6693,7 +6693,7 @@ testStoragePoolDefineXML(virConnectPtr conn,
virCheckFlags(VIR_STORAGE_POOL_DEFINE_VALIDATE, NULL); virCheckFlags(VIR_STORAGE_POOL_DEFINE_VALIDATE, NULL);
virObjectLock(privconn); virObjectLock(privconn);
if (!(newDef = virStoragePoolDefParseString(xml, flags))) if (!(newDef = virStoragePoolDefParse(xml, NULL, flags)))
goto cleanup; goto cleanup;
newDef->capacity = defaultPoolCap; newDef->capacity = defaultPoolCap;

View File

@ -27,7 +27,7 @@ testCompareXMLToArgvFiles(bool shouldFail,
g_autofree char *src = NULL; g_autofree char *src = NULL;
g_autoptr(virCommand) cmd = NULL; g_autoptr(virCommand) cmd = NULL;
if (!(def = virStoragePoolDefParseFile(poolxml))) if (!(def = virStoragePoolDefParse(NULL, poolxml, 0)))
goto cleanup; goto cleanup;
defTypeStr = virStoragePoolTypeToString(def->type); defTypeStr = virStoragePoolTypeToString(def->type);

View File

@ -19,7 +19,7 @@ testCompareXMLToXMLFiles(const char *inxml, const char *outxml)
g_autofree char *actual = NULL; g_autofree char *actual = NULL;
g_autoptr(virStoragePoolDef) dev = NULL; g_autoptr(virStoragePoolDef) dev = NULL;
if (!(dev = virStoragePoolDefParseFile(inxml))) if (!(dev = virStoragePoolDefParse(NULL, inxml, 0)))
return -1; return -1;
if (!(actual = virStoragePoolDefFormat(dev))) if (!(actual = virStoragePoolDefFormat(dev)))

View File

@ -48,7 +48,7 @@ testCompareXMLToArgvFiles(bool shouldFail,
g_autoptr(virStorageVolDef) inputvol = NULL; g_autoptr(virStorageVolDef) inputvol = NULL;
g_autoptr(virStoragePoolDef) inputpool = NULL; g_autoptr(virStoragePoolDef) inputpool = NULL;
if (!(def = virStoragePoolDefParseFile(poolxml))) if (!(def = virStoragePoolDefParse(NULL, poolxml, 0)))
goto cleanup; goto cleanup;
if (!(obj = virStoragePoolObjNew())) { if (!(obj = virStoragePoolObjNew())) {
@ -58,7 +58,7 @@ testCompareXMLToArgvFiles(bool shouldFail,
virStoragePoolObjSetDef(obj, def); virStoragePoolObjSetDef(obj, def);
if (inputpoolxml) { if (inputpoolxml) {
if (!(inputpool = virStoragePoolDefParseFile(inputpoolxml))) if (!(inputpool = virStoragePoolDefParse(NULL, inputpoolxml, 0)))
goto cleanup; goto cleanup;
} }

View File

@ -19,7 +19,7 @@ testCompareXMLToXMLFiles(const char *poolxml, const char *inxml,
g_autoptr(virStoragePoolDef) pool = NULL; g_autoptr(virStoragePoolDef) pool = NULL;
g_autoptr(virStorageVolDef) dev = NULL; g_autoptr(virStorageVolDef) dev = NULL;
if (!(pool = virStoragePoolDefParseFile(poolxml))) if (!(pool = virStoragePoolDefParse(NULL, poolxml, 0)))
return -1; return -1;
if (!(dev = virStorageVolDefParseFile(pool, inxml, flags))) if (!(dev = virStorageVolDefParseFile(pool, inxml, flags)))