mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2025-01-22 04:25:18 +00:00
conf: node_device: Remove virNodeDeviceDefParseNode
Both callers be easily made to call virNodeDeviceDefParseXML directly. Signed-off-by: Peter Krempa <pkrempa@redhat.com> Reviewed-by: Ján Tomko <jtomko@redhat.com>
This commit is contained in:
parent
5ea1d04322
commit
23f301bd2d
@ -2370,7 +2370,7 @@ virNodeDevCapsDefParseXML(xmlXPathContextPtr ctxt,
|
||||
}
|
||||
|
||||
|
||||
static virNodeDeviceDef *
|
||||
virNodeDeviceDef *
|
||||
virNodeDeviceDefParseXML(xmlXPathContextPtr ctxt,
|
||||
int create,
|
||||
const char *virt_type)
|
||||
@ -2473,30 +2473,6 @@ virNodeDeviceDefParseXML(xmlXPathContextPtr ctxt,
|
||||
}
|
||||
|
||||
|
||||
virNodeDeviceDef *
|
||||
virNodeDeviceDefParseNode(xmlDocPtr xml,
|
||||
xmlNodePtr root,
|
||||
int create,
|
||||
const char *virt_type)
|
||||
{
|
||||
g_autoptr(xmlXPathContext) ctxt = NULL;
|
||||
|
||||
if (!virXMLNodeNameEqual(root, "device")) {
|
||||
virReportError(VIR_ERR_XML_ERROR,
|
||||
_("unexpected root element <%s> "
|
||||
"expecting <device>"),
|
||||
root->name);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
if (!(ctxt = virXMLXPathContextNew(xml)))
|
||||
return NULL;
|
||||
|
||||
ctxt->node = root;
|
||||
return virNodeDeviceDefParseXML(ctxt, create, virt_type);
|
||||
}
|
||||
|
||||
|
||||
static virNodeDeviceDef *
|
||||
virNodeDeviceDefParse(const char *str,
|
||||
const char *filename,
|
||||
@ -2506,12 +2482,14 @@ virNodeDeviceDefParse(const char *str,
|
||||
void *opaque)
|
||||
{
|
||||
g_autoptr(xmlDoc) xml = NULL;
|
||||
g_autoptr(xmlXPathContext) ctxt = NULL;
|
||||
g_autoptr(virNodeDeviceDef) def = NULL;
|
||||
|
||||
if (!(xml = virXMLParse(filename, str, _("(node_device_definition)"),
|
||||
NULL, NULL, NULL, false)) ||
|
||||
!(def = virNodeDeviceDefParseNode(xml, xmlDocGetRootElement(xml),
|
||||
create, virt_type)))
|
||||
"device", &ctxt, NULL, false)))
|
||||
return NULL;
|
||||
|
||||
if (!(def = virNodeDeviceDefParseXML(ctxt, create, virt_type)))
|
||||
return NULL;
|
||||
|
||||
if (parserCallbacks) {
|
||||
|
@ -391,10 +391,9 @@ virNodeDeviceDefParseFile(const char *filename,
|
||||
void *opaque);
|
||||
|
||||
virNodeDeviceDef *
|
||||
virNodeDeviceDefParseNode(xmlDocPtr xml,
|
||||
xmlNodePtr root,
|
||||
int create,
|
||||
const char *virt_type);
|
||||
virNodeDeviceDefParseXML(xmlXPathContextPtr ctxt,
|
||||
int create,
|
||||
const char *virt_type);
|
||||
|
||||
int
|
||||
virNodeDeviceGetWWNs(virNodeDeviceDef *def,
|
||||
|
@ -866,8 +866,8 @@ virNodeDeviceCapsListExport;
|
||||
virNodeDeviceDefFormat;
|
||||
virNodeDeviceDefFree;
|
||||
virNodeDeviceDefParseFile;
|
||||
virNodeDeviceDefParseNode;
|
||||
virNodeDeviceDefParseString;
|
||||
virNodeDeviceDefParseXML;
|
||||
virNodeDeviceGetAPMatrixDynamicCaps;
|
||||
virNodeDeviceGetCSSDynamicCaps;
|
||||
virNodeDeviceGetMdevParentDynamicCaps;
|
||||
|
@ -1236,6 +1236,7 @@ testParseNodedevs(testDriver *privconn,
|
||||
const char *file,
|
||||
xmlXPathContextPtr ctxt)
|
||||
{
|
||||
VIR_XPATH_NODE_AUTORESTORE(ctxt)
|
||||
int num;
|
||||
size_t i;
|
||||
virNodeDeviceObj *obj;
|
||||
@ -1247,13 +1248,11 @@ testParseNodedevs(testDriver *privconn,
|
||||
|
||||
for (i = 0; i < num; i++) {
|
||||
virNodeDeviceDef *def;
|
||||
xmlNodePtr node = testParseXMLDocFromFile(nodes[i], file);
|
||||
|
||||
if (!node)
|
||||
if (!(ctxt->node = testParseXMLDocFromFile(nodes[i], file)))
|
||||
return -1;
|
||||
|
||||
def = virNodeDeviceDefParseNode(ctxt->doc, node, 0, NULL);
|
||||
if (!def)
|
||||
if (!(def = virNodeDeviceDefParseXML(ctxt, 0, NULL)))
|
||||
return -1;
|
||||
|
||||
if (!(obj = virNodeDeviceObjListAssignDef(privconn->devs, def))) {
|
||||
|
Loading…
x
Reference in New Issue
Block a user