xmlXPathContextPtr ctxt,
virSysinfoBIOSDefPtr *bios)
{
+ VIR_XPATH_NODE_AUTORESTORE(ctxt);
int ret = -1;
virSysinfoBIOSDefPtr def;
+ ctxt->node = node;
+
if (!virXMLNodeNameEqual(node, "bios")) {
virReportError(VIR_ERR_XML_ERROR, "%s",
_("XML does not contain expected 'bios' element"));
unsigned char *domUUID,
bool uuid_generated)
{
+ VIR_XPATH_NODE_AUTORESTORE(ctxt);
int ret = -1;
virSysinfoSystemDefPtr def;
VIR_AUTOFREE(char *) tmpUUID = NULL;
+ ctxt->node = node;
+
if (!virXMLNodeNameEqual(node, "system")) {
virReportError(VIR_ERR_XML_ERROR, "%s",
_("XML does not contain expected 'system' element"));
static int
-virSysinfoOEMStringsParseXML(xmlXPathContextPtr ctxt,
+virSysinfoOEMStringsParseXML(xmlNodePtr node,
+ xmlXPathContextPtr ctxt,
virSysinfoOEMStringsDefPtr *oem)
{
+ VIR_XPATH_NODE_AUTORESTORE(ctxt);
int ret = -1;
virSysinfoOEMStringsDefPtr def;
int nstrings;
size_t i;
VIR_AUTOFREE(xmlNodePtr *) strings = NULL;
+ ctxt->node = node;
+
nstrings = virXPathNodeSet("./entry", ctxt, &strings);
if (nstrings < 0)
return -1;
xmlXPathContextPtr ctxt,
virSysinfoChassisDefPtr *chassisdef)
{
+ VIR_XPATH_NODE_AUTORESTORE(ctxt);
int ret = -1;
virSysinfoChassisDefPtr def;
+ ctxt->node = node;
+
if (!xmlStrEqual(node->name, BAD_CAST "chassis")) {
virReportError(VIR_ERR_XML_ERROR, "%s",
_("XML does not contain expected 'chassis' element"));
bool uuid_generated)
{
virSysinfoDefPtr def;
- xmlNodePtr oldnode, tmpnode;
+ xmlNodePtr tmpnode;
VIR_AUTOFREE(char *) type = NULL;
if (!virXMLNodeNameEqual(node, "sysinfo")) {
/* Extract BIOS related metadata */
if ((tmpnode = virXPathNode("./bios[1]", ctxt)) != NULL) {
- oldnode = ctxt->node;
- ctxt->node = tmpnode;
- if (virSysinfoBIOSParseXML(tmpnode, ctxt, &def->bios) < 0) {
- ctxt->node = oldnode;
+ if (virSysinfoBIOSParseXML(tmpnode, ctxt, &def->bios) < 0)
goto error;
- }
- ctxt->node = oldnode;
}
/* Extract system related metadata */
if ((tmpnode = virXPathNode("./system[1]", ctxt)) != NULL) {
- oldnode = ctxt->node;
- ctxt->node = tmpnode;
if (virSysinfoSystemParseXML(tmpnode, ctxt, &def->system,
- domUUID, uuid_generated) < 0) {
- ctxt->node = oldnode;
+ domUUID, uuid_generated) < 0)
goto error;
- }
- ctxt->node = oldnode;
}
/* Extract system base board metadata */
/* Extract chassis related metadata */
if ((tmpnode = virXPathNode("./chassis[1]", ctxt)) != NULL) {
- oldnode = ctxt->node;
- ctxt->node = tmpnode;
- if (virSysinfoChassisParseXML(tmpnode, ctxt, &def->chassis) < 0) {
- ctxt->node = oldnode;
+ if (virSysinfoChassisParseXML(tmpnode, ctxt, &def->chassis) < 0)
goto error;
- }
- ctxt->node = oldnode;
}
/* Extract system related metadata */
if ((tmpnode = virXPathNode("./oemStrings[1]", ctxt)) != NULL) {
- oldnode = ctxt->node;
- ctxt->node = tmpnode;
- if (virSysinfoOEMStringsParseXML(ctxt, &def->oemStrings) < 0) {
- ctxt->node = oldnode;
+ if (virSysinfoOEMStringsParseXML(tmpnode, ctxt, &def->oemStrings) < 0)
goto error;
- }
- ctxt->node = oldnode;
}
cleanup: