conf: nodedev: Provide only virNodeDeviceDefParse

Replace the thin wrappers virNodeDeviceDefParseString/File by directly
calling the main parser.

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-23 11:52:23 +02:00
parent 23f301bd2d
commit 37de09a2f9
8 changed files with 22 additions and 55 deletions

View File

@ -2473,7 +2473,7 @@ virNodeDeviceDefParseXML(xmlXPathContextPtr ctxt,
}
static virNodeDeviceDef *
virNodeDeviceDef *
virNodeDeviceDefParse(const char *str,
const char *filename,
int create,
@ -2513,28 +2513,6 @@ virNodeDeviceDefParse(const char *str,
}
virNodeDeviceDef *
virNodeDeviceDefParseString(const char *str,
int create,
const char *virt_type,
virNodeDeviceDefParserCallbacks *parserCallbacks,
void *opaque)
{
return virNodeDeviceDefParse(str, NULL, create, virt_type, parserCallbacks, opaque);
}
virNodeDeviceDef *
virNodeDeviceDefParseFile(const char *filename,
int create,
const char *virt_type,
virNodeDeviceDefParserCallbacks *parserCallbacks,
void *opaque)
{
return virNodeDeviceDefParse(NULL, filename, create, virt_type, parserCallbacks, opaque);
}
/*
* Return fc_host dev's WWNN and WWPN
*/

View File

@ -377,17 +377,11 @@ typedef struct _virNodeDeviceDefParserCallbacks {
} virNodeDeviceDefParserCallbacks;
virNodeDeviceDef *
virNodeDeviceDefParseString(const char *str,
virNodeDeviceDefParse(const char *str,
const char *filename,
int create,
const char *virt_type,
virNodeDeviceDefParserCallbacks *callbacks,
void *opaque);
virNodeDeviceDef *
virNodeDeviceDefParseFile(const char *filename,
int create,
const char *virt_type,
virNodeDeviceDefParserCallbacks *callbacks,
virNodeDeviceDefParserCallbacks *parserCallbacks,
void *opaque);
virNodeDeviceDef *

View File

@ -395,8 +395,7 @@ virDomainDriverNodeDeviceReset(virNodeDevicePtr dev,
if (!xml)
return -1;
def = virNodeDeviceDefParseString(xml, EXISTING_DEVICE, NULL,
NULL, NULL);
def = virNodeDeviceDefParse(xml, NULL, EXISTING_DEVICE, NULL, NULL, NULL);
if (!def)
return -1;
@ -441,7 +440,7 @@ virDomainDriverNodeDeviceReAttach(virNodeDevicePtr dev,
if (!xml)
return -1;
def = virNodeDeviceDefParseString(xml, EXISTING_DEVICE, NULL, NULL, NULL);
def = virNodeDeviceDefParse(xml, NULL, EXISTING_DEVICE, NULL, NULL, NULL);
if (!def)
return -1;
@ -489,7 +488,7 @@ virDomainDriverNodeDeviceDetachFlags(virNodeDevicePtr dev,
if (!xml)
return -1;
def = virNodeDeviceDefParseString(xml, EXISTING_DEVICE, NULL, NULL, NULL);
def = virNodeDeviceDefParse(xml, NULL, EXISTING_DEVICE, NULL, NULL, NULL);
if (!def)
return -1;

View File

@ -865,8 +865,7 @@ virNodeDevCapTypeToString;
virNodeDeviceCapsListExport;
virNodeDeviceDefFormat;
virNodeDeviceDefFree;
virNodeDeviceDefParseFile;
virNodeDeviceDefParseString;
virNodeDeviceDefParse;
virNodeDeviceDefParseXML;
virNodeDeviceGetAPMatrixDynamicCaps;
virNodeDeviceGetCSSDynamicCaps;

View File

@ -884,7 +884,7 @@ nodeDeviceCreateXML(virConnectPtr conn,
virt_type = virConnectGetType(conn);
if (!(def = virNodeDeviceDefParseString(xmlDesc, CREATE_DEVICE, virt_type,
if (!(def = virNodeDeviceDefParse(xmlDesc, NULL, CREATE_DEVICE, virt_type,
&driver->parserCallbacks, NULL)))
return NULL;
@ -1405,7 +1405,7 @@ nodeDeviceDefineXML(virConnect *conn,
virt_type = virConnectGetType(conn);
if (!(def = virNodeDeviceDefParseString(xmlDesc, CREATE_DEVICE, virt_type,
if (!(def = virNodeDeviceDefParse(xmlDesc, NULL, CREATE_DEVICE, virt_type,
&driver->parserCallbacks, NULL)))
return NULL;

View File

@ -7635,8 +7635,7 @@ testNodeDeviceMockCreateVport(testDriver *driver,
if (!xml)
goto cleanup;
if (!(def = virNodeDeviceDefParseString(xml, EXISTING_DEVICE, NULL, NULL,
NULL)))
if (!(def = virNodeDeviceDefParse(xml, NULL, EXISTING_DEVICE, NULL, NULL, NULL)))
goto cleanup;
VIR_FREE(def->name);
@ -7698,8 +7697,7 @@ testNodeDeviceCreateXML(virConnectPtr conn,
virCheckFlags(0, NULL);
if (!(def = virNodeDeviceDefParseString(xmlDesc, CREATE_DEVICE, NULL,
NULL, NULL)))
if (!(def = virNodeDeviceDefParse(xmlDesc, NULL, CREATE_DEVICE, NULL, NULL, NULL)))
goto cleanup;
/* We run this simply for validation - it essentially validates that

View File

@ -70,7 +70,7 @@ testMdevctlCmd(virMdevctlCommand cmd_type,
return -1;
}
if (!(def = virNodeDeviceDefParseFile(mdevxml, create, VIRT_TYPE,
if (!(def = virNodeDeviceDefParse(NULL, mdevxml, create, VIRT_TYPE,
&parser_callbacks, NULL)))
return -1;
@ -142,7 +142,7 @@ testMdevctlAutostart(const void *data G_GNUC_UNUSED)
abs_srcdir);
g_autoptr(virCommandDryRunToken) dryRunToken = virCommandDryRunTokenNew();
if (!(def = virNodeDeviceDefParseFile(mdevxml, CREATE_DEVICE, VIRT_TYPE,
if (!(def = virNodeDeviceDefParse(NULL, mdevxml, CREATE_DEVICE, VIRT_TYPE,
&parser_callbacks, NULL)))
return -1;

View File

@ -23,8 +23,7 @@ testCompareXMLToXMLFiles(const char *xml, const char *outfile)
if (virTestLoadFile(xml, &xmlData) < 0)
goto fail;
if (!(dev = virNodeDeviceDefParseString(xmlData, EXISTING_DEVICE, NULL,
NULL, NULL)))
if (!(dev = virNodeDeviceDefParse(xmlData, NULL, EXISTING_DEVICE, NULL, NULL, NULL)))
goto fail;
/* Calculate some things that are not read in */