static int
-virNodeDevCapsDefParseString(virConnectPtr conn,
- const char *xpath,
+virNodeDevCapsDefParseString(const char *xpath,
xmlXPathContextPtr ctxt,
char **string,
virNodeDeviceDefPtr def,
s = virXPathString(xpath, ctxt);
if (s == NULL) {
- virNodeDeviceReportError(conn, VIR_ERR_INTERNAL_ERROR,
+ virNodeDeviceReportError(VIR_ERR_INTERNAL_ERROR,
missing_error_fmt,
def->name);
return -1;
devs->count = 0;
}
-virNodeDeviceObjPtr virNodeDeviceAssignDef(virConnectPtr conn,
- virNodeDeviceObjListPtr devs,
+virNodeDeviceObjPtr virNodeDeviceAssignDef(virNodeDeviceObjListPtr devs,
const virNodeDeviceDefPtr def)
{
virNodeDeviceObjPtr device;
}
if (virMutexInit(&device->lock) < 0) {
- virNodeDeviceReportError(conn, VIR_ERR_INTERNAL_ERROR,
+ virNodeDeviceReportError(VIR_ERR_INTERNAL_ERROR,
"%s", _("cannot initialize mutex"));
VIR_FREE(device);
return NULL;
}
}
-char *virNodeDeviceDefFormat(virConnectPtr conn ATTRIBUTE_UNUSED /*TEMPORARY*/,
- const virNodeDeviceDefPtr def)
+char *virNodeDeviceDefFormat(const virNodeDeviceDefPtr def)
{
virBuffer buf = VIR_BUFFER_INITIALIZER;
virNodeDevCapsDefPtr caps;
}
static int
-virNodeDevCapsDefParseULong(virConnectPtr conn,
- const char *xpath,
+virNodeDevCapsDefParseULong(const char *xpath,
xmlXPathContextPtr ctxt,
unsigned *value,
virNodeDeviceDefPtr def,
ret = virXPathULong(xpath, ctxt, &val);
if (ret < 0) {
- virNodeDeviceReportError(conn, VIR_ERR_INTERNAL_ERROR,
+ virNodeDeviceReportError(VIR_ERR_INTERNAL_ERROR,
ret == -1 ? missing_error_fmt : invalid_error_fmt,
def->name);
return -1;
}
static int
-virNodeDevCapsDefParseULongLong(virConnectPtr conn,
- const char *xpath,
+virNodeDevCapsDefParseULongLong(const char *xpath,
xmlXPathContextPtr ctxt,
unsigned long long *value,
virNodeDeviceDefPtr def,
ret = virXPathULongLong(xpath, ctxt, &val);
if (ret < 0) {
- virNodeDeviceReportError(conn, VIR_ERR_INTERNAL_ERROR,
+ virNodeDeviceReportError(VIR_ERR_INTERNAL_ERROR,
ret == -1 ? missing_error_fmt : invalid_error_fmt,
def->name);
return -1;
}
static int
-virNodeDevCapStorageParseXML(virConnectPtr conn,
- xmlXPathContextPtr ctxt,
+virNodeDevCapStorageParseXML(xmlXPathContextPtr ctxt,
virNodeDeviceDefPtr def,
xmlNodePtr node,
union _virNodeDevCapData *data)
data->storage.block = virXPathString("string(./block[1])", ctxt);
if (!data->storage.block) {
- virNodeDeviceReportError(conn, VIR_ERR_INTERNAL_ERROR,
+ virNodeDeviceReportError(VIR_ERR_INTERNAL_ERROR,
_("no block device path supplied for '%s'"),
def->name);
goto out;
data->storage.serial = virXPathString("string(./serial[1])", ctxt);
if ((n = virXPathNodeSet("./capability", ctxt, &nodes)) < 0) {
- virNodeDeviceReportError(conn, VIR_ERR_INTERNAL_ERROR,
+ virNodeDeviceReportError(VIR_ERR_INTERNAL_ERROR,
_("error parsing storage capabilities for '%s'"),
def->name);
goto out;
char *type = virXMLPropString(nodes[i], "type");
if (!type) {
- virNodeDeviceReportError(conn, VIR_ERR_INTERNAL_ERROR,
+ virNodeDeviceReportError(VIR_ERR_INTERNAL_ERROR,
_("missing storage capability type for '%s'"),
def->name);
goto out;
data->storage.media_label = virXPathString("string(./media_label[1])", ctxt);
val = 0;
- if (virNodeDevCapsDefParseULongLong(conn, "number(./media_size[1])", ctxt, &val, def,
+ if (virNodeDevCapsDefParseULongLong("number(./media_size[1])", ctxt, &val, def,
_("no removable media size supplied for '%s'"),
_("invalid removable media size supplied for '%s'")) < 0) {
ctxt->node = orignode2;
ctxt->node = orignode2;
} else {
- virNodeDeviceReportError(conn, VIR_ERR_INTERNAL_ERROR,
+ virNodeDeviceReportError(VIR_ERR_INTERNAL_ERROR,
_("unknown storage capability type '%s' for '%s'"),
type, def->name);
VIR_FREE(type);
if (!(data->storage.flags & VIR_NODE_DEV_CAP_STORAGE_REMOVABLE)) {
val = 0;
- if (virNodeDevCapsDefParseULongLong(conn, "number(./size[1])", ctxt, &val, def,
+ if (virNodeDevCapsDefParseULongLong("number(./size[1])", ctxt, &val, def,
_("no size supplied for '%s'"),
_("invalid size supplied for '%s'")) < 0)
goto out;
}
static int
-virNodeDevCapScsiParseXML(virConnectPtr conn,
- xmlXPathContextPtr ctxt,
+virNodeDevCapScsiParseXML(xmlXPathContextPtr ctxt,
virNodeDeviceDefPtr def,
xmlNodePtr node,
union _virNodeDevCapData *data)
orignode = ctxt->node;
ctxt->node = node;
- if (virNodeDevCapsDefParseULong(conn, "number(./host[1])", ctxt,
+ if (virNodeDevCapsDefParseULong("number(./host[1])", ctxt,
&data->scsi.host, def,
_("no SCSI host ID supplied for '%s'"),
_("invalid SCSI host ID supplied for '%s'")) < 0)
goto out;
- if (virNodeDevCapsDefParseULong(conn, "number(./bus[1])", ctxt,
+ if (virNodeDevCapsDefParseULong("number(./bus[1])", ctxt,
&data->scsi.bus, def,
_("no SCSI bus ID supplied for '%s'"),
_("invalid SCSI bus ID supplied for '%s'")) < 0)
goto out;
- if (virNodeDevCapsDefParseULong(conn, "number(./target[1])", ctxt,
+ if (virNodeDevCapsDefParseULong("number(./target[1])", ctxt,
&data->scsi.target, def,
_("no SCSI target ID supplied for '%s'"),
_("invalid SCSI target ID supplied for '%s'")) < 0)
goto out;
- if (virNodeDevCapsDefParseULong(conn, "number(./lun[1])", ctxt,
+ if (virNodeDevCapsDefParseULong("number(./lun[1])", ctxt,
&data->scsi.lun, def,
_("no SCSI LUN ID supplied for '%s'"),
_("invalid SCSI LUN ID supplied for '%s'")) < 0)
static int
-virNodeDevCapScsiTargetParseXML(virConnectPtr conn,
- xmlXPathContextPtr ctxt,
+virNodeDevCapScsiTargetParseXML(xmlXPathContextPtr ctxt,
virNodeDeviceDefPtr def,
xmlNodePtr node,
union _virNodeDevCapData *data)
data->scsi_target.name = virXPathString("string(./name[1])", ctxt);
if (!data->scsi_target.name) {
- virNodeDeviceReportError(conn, VIR_ERR_INTERNAL_ERROR,
+ virNodeDeviceReportError(VIR_ERR_INTERNAL_ERROR,
_("no target name supplied for '%s'"),
def->name);
goto out;
static int
-virNodeDevCapScsiHostParseXML(virConnectPtr conn,
- xmlXPathContextPtr ctxt,
+virNodeDevCapScsiHostParseXML(xmlXPathContextPtr ctxt,
virNodeDeviceDefPtr def,
xmlNodePtr node,
union _virNodeDevCapData *data,
ctxt->node = node;
if (create == EXISTING_DEVICE &&
- virNodeDevCapsDefParseULong(conn, "number(./host[1])", ctxt,
+ virNodeDevCapsDefParseULong("number(./host[1])", ctxt,
&data->scsi_host.host, def,
_("no SCSI host ID supplied for '%s'"),
_("invalid SCSI host ID supplied for '%s'")) < 0) {
}
if ((n = virXPathNodeSet("./capability", ctxt, &nodes)) < 0) {
- virNodeDeviceReportError(conn, VIR_ERR_INTERNAL_ERROR,
+ virNodeDeviceReportError(VIR_ERR_INTERNAL_ERROR,
_("error parsing SCSI host capabilities for '%s'"),
def->name);
goto out;
type = virXMLPropString(nodes[i], "type");
if (!type) {
- virNodeDeviceReportError(conn, VIR_ERR_INTERNAL_ERROR,
+ virNodeDeviceReportError(VIR_ERR_INTERNAL_ERROR,
_("missing SCSI host capability type for '%s'"),
def->name);
goto out;
orignode2 = ctxt->node;
ctxt->node = nodes[i];
- if (virNodeDevCapsDefParseString(conn, "string(./wwnn[1])",
+ if (virNodeDevCapsDefParseString("string(./wwnn[1])",
ctxt,
&data->scsi_host.wwnn,
def,
goto out;
}
- if (virNodeDevCapsDefParseString(conn, "string(./wwpn[1])",
+ if (virNodeDevCapsDefParseString("string(./wwpn[1])",
ctxt,
&data->scsi_host.wwpn,
def,
ctxt->node = orignode2;
} else {
- virNodeDeviceReportError(conn, VIR_ERR_INTERNAL_ERROR,
+ virNodeDeviceReportError(VIR_ERR_INTERNAL_ERROR,
_("unknown SCSI host capability type '%s' for '%s'"),
type, def->name);
goto out;
static int
-virNodeDevCapNetParseXML(virConnectPtr conn,
- xmlXPathContextPtr ctxt,
+virNodeDevCapNetParseXML(xmlXPathContextPtr ctxt,
virNodeDeviceDefPtr def,
xmlNodePtr node,
union _virNodeDevCapData *data)
data->net.ifname = virXPathString("string(./interface[1])", ctxt);
if (!data->net.ifname) {
- virNodeDeviceReportError(conn, VIR_ERR_INTERNAL_ERROR,
+ virNodeDeviceReportError(VIR_ERR_INTERNAL_ERROR,
_("no network interface supplied for '%s'"),
def->name);
goto out;
int val = virNodeDevNetCapTypeFromString(tmp);
VIR_FREE(tmp);
if (val < 0) {
- virNodeDeviceReportError(conn, VIR_ERR_INTERNAL_ERROR,
+ virNodeDeviceReportError(VIR_ERR_INTERNAL_ERROR,
_("invalid network type supplied for '%s'"),
def->name);
goto out;
}
static int
-virNodeDevCapUsbInterfaceParseXML(virConnectPtr conn,
- xmlXPathContextPtr ctxt,
+virNodeDevCapUsbInterfaceParseXML(xmlXPathContextPtr ctxt,
virNodeDeviceDefPtr def,
xmlNodePtr node,
union _virNodeDevCapData *data)
orignode = ctxt->node;
ctxt->node = node;
- if (virNodeDevCapsDefParseULong(conn, "number(./number[1])", ctxt,
+ if (virNodeDevCapsDefParseULong("number(./number[1])", ctxt,
&data->usb_if.number, def,
_("no USB interface number supplied for '%s'"),
_("invalid USB interface number supplied for '%s'")) < 0)
goto out;
- if (virNodeDevCapsDefParseULong(conn, "number(./class[1])", ctxt,
+ if (virNodeDevCapsDefParseULong("number(./class[1])", ctxt,
&data->usb_if._class, def,
_("no USB interface class supplied for '%s'"),
_("invalid USB interface class supplied for '%s'")) < 0)
goto out;
- if (virNodeDevCapsDefParseULong(conn, "number(./subclass[1])", ctxt,
+ if (virNodeDevCapsDefParseULong("number(./subclass[1])", ctxt,
&data->usb_if.subclass, def,
_("no USB interface subclass supplied for '%s'"),
_("invalid USB interface subclass supplied for '%s'")) < 0)
goto out;
- if (virNodeDevCapsDefParseULong(conn, "number(./protocol[1])", ctxt,
+ if (virNodeDevCapsDefParseULong("number(./protocol[1])", ctxt,
&data->usb_if.protocol, def,
_("no USB interface protocol supplied for '%s'"),
_("invalid USB interface protocol supplied for '%s'")) < 0)
}
static int
-virNodeDevCapsDefParseHexId(virConnectPtr conn,
- const char *xpath,
+virNodeDevCapsDefParseHexId(const char *xpath,
xmlXPathContextPtr ctxt,
unsigned *value,
virNodeDeviceDefPtr def,
ret = virXPathULongHex(xpath, ctxt, &val);
if (ret < 0) {
- virNodeDeviceReportError(conn, VIR_ERR_INTERNAL_ERROR,
+ virNodeDeviceReportError(VIR_ERR_INTERNAL_ERROR,
ret == -1 ? missing_error_fmt : invalid_error_fmt,
def->name);
return -1;
}
static int
-virNodeDevCapUsbDevParseXML(virConnectPtr conn,
- xmlXPathContextPtr ctxt,
+virNodeDevCapUsbDevParseXML(xmlXPathContextPtr ctxt,
virNodeDeviceDefPtr def,
xmlNodePtr node,
union _virNodeDevCapData *data)
orignode = ctxt->node;
ctxt->node = node;
- if (virNodeDevCapsDefParseULong(conn, "number(./bus[1])", ctxt,
+ if (virNodeDevCapsDefParseULong("number(./bus[1])", ctxt,
&data->usb_dev.bus, def,
_("no USB bus number supplied for '%s'"),
_("invalid USB bus number supplied for '%s'")) < 0)
goto out;
- if (virNodeDevCapsDefParseULong(conn, "number(./device[1])", ctxt,
+ if (virNodeDevCapsDefParseULong("number(./device[1])", ctxt,
&data->usb_dev.device, def,
_("no USB device number supplied for '%s'"),
_("invalid USB device number supplied for '%s'")) < 0)
goto out;
- if (virNodeDevCapsDefParseHexId(conn, "string(./vendor[1]/@id)", ctxt,
+ if (virNodeDevCapsDefParseHexId("string(./vendor[1]/@id)", ctxt,
&data->usb_dev.vendor, def,
_("no USB vendor ID supplied for '%s'"),
_("invalid USB vendor ID supplied for '%s'")) < 0)
goto out;
- if (virNodeDevCapsDefParseHexId(conn, "string(./product[1]/@id)", ctxt,
+ if (virNodeDevCapsDefParseHexId("string(./product[1]/@id)", ctxt,
&data->usb_dev.product, def,
_("no USB product ID supplied for '%s'"),
_("invalid USB product ID supplied for '%s'")) < 0)
}
static int
-virNodeDevCapPciDevParseXML(virConnectPtr conn,
- xmlXPathContextPtr ctxt,
+virNodeDevCapPciDevParseXML(xmlXPathContextPtr ctxt,
virNodeDeviceDefPtr def,
xmlNodePtr node,
union _virNodeDevCapData *data)
orignode = ctxt->node;
ctxt->node = node;
- if (virNodeDevCapsDefParseULong(conn, "number(./domain[1])", ctxt,
+ if (virNodeDevCapsDefParseULong("number(./domain[1])", ctxt,
&data->pci_dev.domain, def,
_("no PCI domain ID supplied for '%s'"),
_("invalid PCI domain ID supplied for '%s'")) < 0)
goto out;
- if (virNodeDevCapsDefParseULong(conn, "number(./bus[1])", ctxt,
+ if (virNodeDevCapsDefParseULong("number(./bus[1])", ctxt,
&data->pci_dev.bus, def,
_("no PCI bus ID supplied for '%s'"),
_("invalid PCI bus ID supplied for '%s'")) < 0)
goto out;
- if (virNodeDevCapsDefParseULong(conn, "number(./slot[1])", ctxt,
+ if (virNodeDevCapsDefParseULong("number(./slot[1])", ctxt,
&data->pci_dev.slot, def,
_("no PCI slot ID supplied for '%s'"),
_("invalid PCI slot ID supplied for '%s'")) < 0)
goto out;
- if (virNodeDevCapsDefParseULong(conn, "number(./function[1])", ctxt,
+ if (virNodeDevCapsDefParseULong("number(./function[1])", ctxt,
&data->pci_dev.function, def,
_("no PCI function ID supplied for '%s'"),
_("invalid PCI function ID supplied for '%s'")) < 0)
goto out;
- if (virNodeDevCapsDefParseHexId(conn, "string(./vendor[1]/@id)", ctxt,
+ if (virNodeDevCapsDefParseHexId("string(./vendor[1]/@id)", ctxt,
&data->pci_dev.vendor, def,
_("no PCI vendor ID supplied for '%s'"),
_("invalid PCI vendor ID supplied for '%s'")) < 0)
goto out;
- if (virNodeDevCapsDefParseHexId(conn, "string(./product[1]/@id)", ctxt,
+ if (virNodeDevCapsDefParseHexId("string(./product[1]/@id)", ctxt,
&data->pci_dev.product, def,
_("no PCI product ID supplied for '%s'"),
_("invalid PCI product ID supplied for '%s'")) < 0)
}
static int
-virNodeDevCapSystemParseXML(virConnectPtr conn,
- xmlXPathContextPtr ctxt,
+virNodeDevCapSystemParseXML(xmlXPathContextPtr ctxt,
virNodeDeviceDefPtr def,
xmlNodePtr node,
union _virNodeDevCapData *data)
tmp = virXPathString("string(./hardware/uuid[1])", ctxt);
if (!tmp) {
- virNodeDeviceReportError(conn, VIR_ERR_INTERNAL_ERROR,
+ virNodeDeviceReportError(VIR_ERR_INTERNAL_ERROR,
_("no system UUID supplied for '%s'"), def->name);
goto out;
}
if (virUUIDParse(tmp, data->system.hardware.uuid) < 0) {
- virNodeDeviceReportError(conn, VIR_ERR_INTERNAL_ERROR,
+ virNodeDeviceReportError(VIR_ERR_INTERNAL_ERROR,
_("malformed uuid element for '%s'"), def->name);
VIR_FREE(tmp);
goto out;
}
static virNodeDevCapsDefPtr
-virNodeDevCapsDefParseXML(virConnectPtr conn,
- xmlXPathContextPtr ctxt,
+virNodeDevCapsDefParseXML(xmlXPathContextPtr ctxt,
virNodeDeviceDefPtr def,
xmlNodePtr node,
int create)
tmp = virXMLPropString(node, "type");
if (!tmp) {
- virNodeDeviceReportError(conn, VIR_ERR_INTERNAL_ERROR,
+ virNodeDeviceReportError(VIR_ERR_INTERNAL_ERROR,
"%s", _("missing capability type"));
goto error;
}
if ((val = virNodeDevCapTypeFromString(tmp)) < 0) {
- virNodeDeviceReportError(conn, VIR_ERR_INTERNAL_ERROR,
+ virNodeDeviceReportError(VIR_ERR_INTERNAL_ERROR,
_("unknown capability type '%s'"), tmp);
VIR_FREE(tmp);
goto error;
switch (caps->type) {
case VIR_NODE_DEV_CAP_SYSTEM:
- ret = virNodeDevCapSystemParseXML(conn, ctxt, def, node, &caps->data);
+ ret = virNodeDevCapSystemParseXML(ctxt, def, node, &caps->data);
break;
case VIR_NODE_DEV_CAP_PCI_DEV:
- ret = virNodeDevCapPciDevParseXML(conn, ctxt, def, node, &caps->data);
+ ret = virNodeDevCapPciDevParseXML(ctxt, def, node, &caps->data);
break;
case VIR_NODE_DEV_CAP_USB_DEV:
- ret = virNodeDevCapUsbDevParseXML(conn, ctxt, def, node, &caps->data);
+ ret = virNodeDevCapUsbDevParseXML(ctxt, def, node, &caps->data);
break;
case VIR_NODE_DEV_CAP_USB_INTERFACE:
- ret = virNodeDevCapUsbInterfaceParseXML(conn, ctxt, def, node, &caps->data);
+ ret = virNodeDevCapUsbInterfaceParseXML(ctxt, def, node, &caps->data);
break;
case VIR_NODE_DEV_CAP_NET:
- ret = virNodeDevCapNetParseXML(conn, ctxt, def, node, &caps->data);
+ ret = virNodeDevCapNetParseXML(ctxt, def, node, &caps->data);
break;
case VIR_NODE_DEV_CAP_SCSI_HOST:
- ret = virNodeDevCapScsiHostParseXML(conn, ctxt, def, node, &caps->data, create);
+ ret = virNodeDevCapScsiHostParseXML(ctxt, def, node, &caps->data, create);
break;
case VIR_NODE_DEV_CAP_SCSI_TARGET:
- ret = virNodeDevCapScsiTargetParseXML(conn, ctxt, def, node, &caps->data);
+ ret = virNodeDevCapScsiTargetParseXML(ctxt, def, node, &caps->data);
break;
case VIR_NODE_DEV_CAP_SCSI:
- ret = virNodeDevCapScsiParseXML(conn, ctxt, def, node, &caps->data);
+ ret = virNodeDevCapScsiParseXML(ctxt, def, node, &caps->data);
break;
case VIR_NODE_DEV_CAP_STORAGE:
- ret = virNodeDevCapStorageParseXML(conn, ctxt, def, node, &caps->data);
+ ret = virNodeDevCapStorageParseXML(ctxt, def, node, &caps->data);
break;
default:
- virNodeDeviceReportError(conn, VIR_ERR_INTERNAL_ERROR,
+ virNodeDeviceReportError(VIR_ERR_INTERNAL_ERROR,
_("unknown capability type '%d' for '%s'"),
caps->type, def->name);
ret = -1;
}
static virNodeDeviceDefPtr
-virNodeDeviceDefParseXML(virConnectPtr conn, xmlXPathContextPtr ctxt, int create)
+virNodeDeviceDefParseXML(xmlXPathContextPtr ctxt, int create)
{
virNodeDeviceDefPtr def;
virNodeDevCapsDefPtr *next_cap;
def->name = virXPathString("string(./name[1])", ctxt);
if (!def->name) {
- virNodeDeviceReportError(conn, VIR_ERR_NO_NAME, NULL);
+ virNodeDeviceReportError(VIR_ERR_NO_NAME, NULL);
goto error;
}
} else {
/* Parse device capabilities */
nodes = NULL;
if ((n = virXPathNodeSet("./capability", ctxt, &nodes)) <= 0) {
- virNodeDeviceReportError(conn, VIR_ERR_INTERNAL_ERROR,
+ virNodeDeviceReportError(VIR_ERR_INTERNAL_ERROR,
_("no device capabilities for '%s'"),
def->name);
goto error;
next_cap = &def->caps;
for (i = 0 ; i < n ; i++) {
- *next_cap = virNodeDevCapsDefParseXML(conn, ctxt, def, nodes[i], create);
+ *next_cap = virNodeDevCapsDefParseXML(ctxt, def, nodes[i], create);
if (!*next_cap) {
VIR_FREE(nodes);
goto error;
}
virNodeDeviceDefPtr
-virNodeDeviceDefParseNode(virConnectPtr conn,
- xmlDocPtr xml,
+virNodeDeviceDefParseNode(xmlDocPtr xml,
xmlNodePtr root,
int create)
{
virNodeDeviceDefPtr def = NULL;
if (!xmlStrEqual(root->name, BAD_CAST "device")) {
- virNodeDeviceReportError(conn, VIR_ERR_INTERNAL_ERROR,
+ virNodeDeviceReportError(VIR_ERR_INTERNAL_ERROR,
"%s", _("incorrect root element"));
return NULL;
}
}
ctxt->node = root;
- def = virNodeDeviceDefParseXML(conn, ctxt, create);
+ def = virNodeDeviceDefParseXML(ctxt, create);
cleanup:
xmlXPathFreeContext(ctxt);
xmlParserCtxtPtr ctxt = (xmlParserCtxtPtr) ctx;
if (ctxt) {
- virConnectPtr conn = ctxt->_private;
-
if (virGetLastError() == NULL &&
ctxt->lastError.level == XML_ERR_FATAL &&
ctxt->lastError.message != NULL) {
- virNodeDeviceReportError(conn, VIR_ERR_XML_DETAIL,
+ virNodeDeviceReportError(VIR_ERR_XML_DETAIL,
_("at line %d: %s"),
ctxt->lastError.line,
ctxt->lastError.message);
static virNodeDeviceDefPtr
-virNodeDeviceDefParse(virConnectPtr conn,
- const char *str,
+virNodeDeviceDefParse(const char *str,
const char *filename,
int create)
{
if (!pctxt || !pctxt->sax)
goto cleanup;
pctxt->sax->error = catchXMLError;
- pctxt->_private = conn;
- if (conn) virResetError (&conn->err);
if (filename) {
xml = xmlCtxtReadFile (pctxt, filename, NULL,
XML_PARSE_NOENT | XML_PARSE_NONET |
}
if (!xml) {
- if (conn && conn->err.code == VIR_ERR_NONE)
- virNodeDeviceReportError(conn, VIR_ERR_XML_ERROR,
- "%s", _("failed to parse xml document"));
+ if (virGetLastError() == NULL)
+ virNodeDeviceReportError(VIR_ERR_XML_ERROR,
+ "%s", _("failed to parse xml document"));
goto cleanup;
}
if ((root = xmlDocGetRootElement(xml)) == NULL) {
- virNodeDeviceReportError(conn, VIR_ERR_INTERNAL_ERROR,
+ virNodeDeviceReportError(VIR_ERR_INTERNAL_ERROR,
"%s", _("missing root element"));
goto cleanup;
}
- def = virNodeDeviceDefParseNode(conn, xml, root, create);
+ def = virNodeDeviceDefParseNode(xml, root, create);
cleanup:
xmlFreeParserCtxt(pctxt);
}
virNodeDeviceDefPtr
-virNodeDeviceDefParseString(virConnectPtr conn,
- const char *str,
+virNodeDeviceDefParseString(const char *str,
int create)
{
- return virNodeDeviceDefParse(conn, str, NULL, create);
+ return virNodeDeviceDefParse(str, NULL, create);
}
virNodeDeviceDefPtr
-virNodeDeviceDefParseFile(virConnectPtr conn,
- const char *filename,
+virNodeDeviceDefParseFile(const char *filename,
int create)
{
- return virNodeDeviceDefParse(conn, NULL, filename, create);
+ return virNodeDeviceDefParse(NULL, filename, create);
}
/*
* Return fc_host dev's WWNN and WWPN
*/
int
-virNodeDeviceGetWWNs(virConnectPtr conn,
- virNodeDeviceDefPtr def,
+virNodeDeviceGetWWNs(virNodeDeviceDefPtr def,
char **wwnn,
char **wwpn)
{
}
if (cap == NULL) {
- virNodeDeviceReportError(conn, VIR_ERR_NO_SUPPORT,
+ virNodeDeviceReportError(VIR_ERR_NO_SUPPORT,
"%s", _("Device is not a fibre channel HBA"));
ret = -1;
} else if (*wwnn == NULL || *wwpn == NULL) {
* Return the NPIV dev's parent device name
*/
int
-virNodeDeviceGetParentHost(virConnectPtr conn,
- const virNodeDeviceObjListPtr devs,
+virNodeDeviceGetParentHost(const virNodeDeviceObjListPtr devs,
const char *dev_name,
const char *parent_name,
int *parent_host)
parent = virNodeDeviceFindByName(devs, parent_name);
if (parent == NULL) {
- virNodeDeviceReportError(conn, VIR_ERR_INTERNAL_ERROR,
+ virNodeDeviceReportError(VIR_ERR_INTERNAL_ERROR,
_("Could not find parent HBA for '%s'"),
dev_name);
ret = -1;
}
if (cap == NULL) {
- virNodeDeviceReportError(conn, VIR_ERR_INTERNAL_ERROR,
+ virNodeDeviceReportError(VIR_ERR_INTERNAL_ERROR,
_("Parent HBA %s is not capable "
"of vport operations"),
parent->def->name);