Replace the thin wrappers virNodeDeviceDefParseString/File by directly calling the main parser. Signed-off-by: Peter Krempa <pkrempa@xxxxxxxxxx> --- src/conf/node_device_conf.c | 24 +----------------------- src/conf/node_device_conf.h | 18 ++++++------------ src/hypervisor/domain_driver.c | 7 +++---- src/libvirt_private.syms | 3 +-- src/node_device/node_device_driver.c | 8 ++++---- src/test/test_driver.c | 6 ++---- tests/nodedevmdevctltest.c | 8 ++++---- tests/nodedevxml2xmltest.c | 3 +-- 8 files changed, 22 insertions(+), 55 deletions(-) diff --git a/src/conf/node_device_conf.c b/src/conf/node_device_conf.c index 7e50904828..bdfbbab434 100644 --- a/src/conf/node_device_conf.c +++ b/src/conf/node_device_conf.c @@ -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 */ diff --git a/src/conf/node_device_conf.h b/src/conf/node_device_conf.h index feef22910d..a556358632 100644 --- a/src/conf/node_device_conf.h +++ b/src/conf/node_device_conf.h @@ -377,18 +377,12 @@ typedef struct _virNodeDeviceDefParserCallbacks { } virNodeDeviceDefParserCallbacks; virNodeDeviceDef * -virNodeDeviceDefParseString(const char *str, - int create, - const char *virt_type, - virNodeDeviceDefParserCallbacks *callbacks, - void *opaque); - -virNodeDeviceDef * -virNodeDeviceDefParseFile(const char *filename, - int create, - const char *virt_type, - virNodeDeviceDefParserCallbacks *callbacks, - void *opaque); +virNodeDeviceDefParse(const char *str, + const char *filename, + int create, + const char *virt_type, + virNodeDeviceDefParserCallbacks *parserCallbacks, + void *opaque); virNodeDeviceDef * virNodeDeviceDefParseXML(xmlXPathContextPtr ctxt, diff --git a/src/hypervisor/domain_driver.c b/src/hypervisor/domain_driver.c index bb1da7ac6b..c154f00eea 100644 --- a/src/hypervisor/domain_driver.c +++ b/src/hypervisor/domain_driver.c @@ -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; diff --git a/src/libvirt_private.syms b/src/libvirt_private.syms index ffab2b7c43..9cbbfef093 100644 --- a/src/libvirt_private.syms +++ b/src/libvirt_private.syms @@ -865,8 +865,7 @@ virNodeDevCapTypeToString; virNodeDeviceCapsListExport; virNodeDeviceDefFormat; virNodeDeviceDefFree; -virNodeDeviceDefParseFile; -virNodeDeviceDefParseString; +virNodeDeviceDefParse; virNodeDeviceDefParseXML; virNodeDeviceGetAPMatrixDynamicCaps; virNodeDeviceGetCSSDynamicCaps; diff --git a/src/node_device/node_device_driver.c b/src/node_device/node_device_driver.c index fa3cfcf24c..8e93b0dd6f 100644 --- a/src/node_device/node_device_driver.c +++ b/src/node_device/node_device_driver.c @@ -884,8 +884,8 @@ nodeDeviceCreateXML(virConnectPtr conn, virt_type = virConnectGetType(conn); - if (!(def = virNodeDeviceDefParseString(xmlDesc, CREATE_DEVICE, virt_type, - &driver->parserCallbacks, NULL))) + if (!(def = virNodeDeviceDefParse(xmlDesc, NULL, CREATE_DEVICE, virt_type, + &driver->parserCallbacks, NULL))) return NULL; if (virNodeDeviceCreateXMLEnsureACL(conn, def) < 0) @@ -1405,8 +1405,8 @@ nodeDeviceDefineXML(virConnect *conn, virt_type = virConnectGetType(conn); - if (!(def = virNodeDeviceDefParseString(xmlDesc, CREATE_DEVICE, virt_type, - &driver->parserCallbacks, NULL))) + if (!(def = virNodeDeviceDefParse(xmlDesc, NULL, CREATE_DEVICE, virt_type, + &driver->parserCallbacks, NULL))) return NULL; if (virNodeDeviceDefineXMLEnsureACL(conn, def) < 0) diff --git a/src/test/test_driver.c b/src/test/test_driver.c index 7c7ef1b924..72786da568 100644 --- a/src/test/test_driver.c +++ b/src/test/test_driver.c @@ -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 diff --git a/tests/nodedevmdevctltest.c b/tests/nodedevmdevctltest.c index dee4639922..02e85d4779 100644 --- a/tests/nodedevmdevctltest.c +++ b/tests/nodedevmdevctltest.c @@ -70,8 +70,8 @@ testMdevctlCmd(virMdevctlCommand cmd_type, return -1; } - if (!(def = virNodeDeviceDefParseFile(mdevxml, create, VIRT_TYPE, - &parser_callbacks, NULL))) + if (!(def = virNodeDeviceDefParse(NULL, mdevxml, create, VIRT_TYPE, + &parser_callbacks, NULL))) return -1; /* this function will set a stdin buffer containing the json configuration @@ -142,8 +142,8 @@ testMdevctlAutostart(const void *data G_GNUC_UNUSED) abs_srcdir); g_autoptr(virCommandDryRunToken) dryRunToken = virCommandDryRunTokenNew(); - if (!(def = virNodeDeviceDefParseFile(mdevxml, CREATE_DEVICE, VIRT_TYPE, - &parser_callbacks, NULL))) + if (!(def = virNodeDeviceDefParse(NULL, mdevxml, CREATE_DEVICE, VIRT_TYPE, + &parser_callbacks, NULL))) return -1; virCommandSetDryRun(dryRunToken, &buf, true, true, NULL, NULL); diff --git a/tests/nodedevxml2xmltest.c b/tests/nodedevxml2xmltest.c index 68a4041d8c..d1c0652e7d 100644 --- a/tests/nodedevxml2xmltest.c +++ b/tests/nodedevxml2xmltest.c @@ -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 */ -- 2.37.3