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)))
return -1;
if (!(pooldef = virStoragePoolDefParseString(poolxml, 0)))
if (!(pooldef = virStoragePoolDefParse(poolxml, NULL, 0)))
return -1;
src->srcpool->pooltype = pooldef->type;

View File

@ -972,7 +972,7 @@ virStoragePoolDefParseXML(xmlXPathContextPtr ctxt)
}
static virStoragePoolDef *
virStoragePoolDef *
virStoragePoolDefParse(const char *xmlStr,
const char *filename,
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
virStoragePoolSourceFormat(virBuffer *buf,
virStoragePoolOptions *options,

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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