VIR_FROM_AUTH = 46, /* Error from auth handling */
VIR_FROM_DBUS = 47, /* Error from DBus */
VIR_FROM_PARALLELS = 48, /* Error from Parallels */
+ VIR_FROM_DEVICE = 49, /* Error from Device */
# ifdef VIR_ENUM_SENTINELS
VIR_ERR_DOMAIN_LAST
gnulib/lib/gai_strerror.c
gnulib/lib/regcomp.c
src/conf/cpu_conf.c
+src/conf/device_conf.c
src/conf/domain_conf.c
src/conf/domain_event.c
src/conf/interface_conf.c
CONSOLE_CONF_SOURCES = \
conf/virconsole.c conf/virconsole.h
+# Device Helper APIs
+DEVICE_CONF_SOURCES = \
+ conf/device_conf.c conf/device_conf.h
+
CONF_SOURCES = \
$(NETDEV_CONF_SOURCES) \
$(DOMAIN_CONF_SOURCES) \
$(INTERFACE_CONF_SOURCES) \
$(SECRET_CONF_SOURCES) \
$(CPU_CONF_SOURCES) \
- $(CONSOLE_CONF_SOURCES)
+ $(CONSOLE_CONF_SOURCES) \
+ $(DEVICE_CONF_SOURCES)
# The remote RPC driver, covering domains, storage, networks, etc
REMOTE_DRIVER_GENERATED = \
--- /dev/null
+/*
+ * device_conf.c: device XML handling
+ *
+ * Copyright (C) 2006-2012 Red Hat, Inc.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; If not, see
+ * <http://www.gnu.org/licenses/>.
+ *
+ * Author: Daniel P. Berrange <berrange@redhat.com>
+ */
+
+#include <config.h>
+#include "virterror_internal.h"
+#include "datatypes.h"
+#include "memory.h"
+#include "xml.h"
+#include "uuid.h"
+#include "util.h"
+#include "buf.h"
+#include "device_conf.h"
+
+#define VIR_FROM_THIS VIR_FROM_DEVICE
+
+VIR_ENUM_IMPL(virDeviceAddressPciMulti,
+ VIR_DEVICE_ADDRESS_PCI_MULTI_LAST,
+ "default",
+ "on",
+ "off")
+
+int virDevicePCIAddressIsValid(virDevicePCIAddressPtr addr)
+{
+ /* PCI bus has 32 slots and 8 functions per slot */
+ if (addr->slot >= 32 || addr->function >= 8)
+ return 0;
+ return addr->domain || addr->bus || addr->slot;
+}
+
+
+int
+virDevicePCIAddressParseXML(xmlNodePtr node,
+ virDevicePCIAddressPtr addr)
+{
+ char *domain, *slot, *bus, *function, *multi;
+ int ret = -1;
+
+ memset(addr, 0, sizeof(*addr));
+
+ domain = virXMLPropString(node, "domain");
+ bus = virXMLPropString(node, "bus");
+ slot = virXMLPropString(node, "slot");
+ function = virXMLPropString(node, "function");
+ multi = virXMLPropString(node, "multifunction");
+
+ if (domain &&
+ virStrToLong_ui(domain, NULL, 0, &addr->domain) < 0) {
+ virReportError(VIR_ERR_INTERNAL_ERROR, "%s",
+ _("Cannot parse <address> 'domain' attribute"));
+ goto cleanup;
+ }
+
+ if (bus &&
+ virStrToLong_ui(bus, NULL, 0, &addr->bus) < 0) {
+ virReportError(VIR_ERR_INTERNAL_ERROR, "%s",
+ _("Cannot parse <address> 'bus' attribute"));
+ goto cleanup;
+ }
+
+ if (slot &&
+ virStrToLong_ui(slot, NULL, 0, &addr->slot) < 0) {
+ virReportError(VIR_ERR_INTERNAL_ERROR, "%s",
+ _("Cannot parse <address> 'slot' attribute"));
+ goto cleanup;
+ }
+
+ if (function &&
+ virStrToLong_ui(function, NULL, 0, &addr->function) < 0) {
+ virReportError(VIR_ERR_INTERNAL_ERROR, "%s",
+ _("Cannot parse <address> 'function' attribute"));
+ goto cleanup;
+ }
+
+ if (multi &&
+ ((addr->multi = virDeviceAddressPciMultiTypeFromString(multi)) <= 0)) {
+ virReportError(VIR_ERR_CONFIG_UNSUPPORTED,
+ _("Unknown value '%s' for <address> 'multifunction' attribute"),
+ multi);
+ goto cleanup;
+
+ }
+ if (!virDevicePCIAddressIsValid(addr)) {
+ virReportError(VIR_ERR_INTERNAL_ERROR, "%s",
+ _("Insufficient specification for PCI address"));
+ goto cleanup;
+ }
+
+ ret = 0;
+
+cleanup:
+ VIR_FREE(domain);
+ VIR_FREE(bus);
+ VIR_FREE(slot);
+ VIR_FREE(function);
+ VIR_FREE(multi);
+ return ret;
+}
+
+int
+virDevicePCIAddressFormat(virBufferPtr buf,
+ virDevicePCIAddress addr,
+ bool includeTypeInAddr)
+{
+ virBufferAsprintf(buf, "<address %sdomain='0x%.4x' bus='0x%.2x' "
+ "slot='0x%.2x' function='0x%.1x'/>\n",
+ includeTypeInAddr ? "type='pci' " : "",
+ addr.domain,
+ addr.bus,
+ addr.slot,
+ addr.function);
+ return 0;
+}
--- /dev/null
+/*
+ * device_conf.h: device XML handling entry points
+ *
+ * Copyright (C) 2006-2012 Red Hat, Inc.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; If not, see
+ * <http://www.gnu.org/licenses/>.
+ *
+ * Author: Daniel P. Berrange <berrange@redhat.com>
+ */
+
+#ifndef __DEVICE_CONF_H__
+# define __DEVICE_CONF_H__
+
+# include <libxml/parser.h>
+# include <libxml/tree.h>
+# include <libxml/xpath.h>
+
+# include "internal.h"
+# include "util.h"
+# include "threads.h"
+# include "buf.h"
+
+enum virDeviceAddressPciMulti {
+ VIR_DEVICE_ADDRESS_PCI_MULTI_DEFAULT = 0,
+ VIR_DEVICE_ADDRESS_PCI_MULTI_ON,
+ VIR_DEVICE_ADDRESS_PCI_MULTI_OFF,
+
+ VIR_DEVICE_ADDRESS_PCI_MULTI_LAST
+};
+
+typedef struct _virDevicePCIAddress virDevicePCIAddress;
+typedef virDevicePCIAddress *virDevicePCIAddressPtr;
+struct _virDevicePCIAddress {
+ unsigned int domain;
+ unsigned int bus;
+ unsigned int slot;
+ unsigned int function;
+ int multi; /* enum virDomainDeviceAddressPciMulti */
+};
+
+int virDevicePCIAddressIsValid(virDevicePCIAddressPtr addr);
+
+int virDevicePCIAddressParseXML(xmlNodePtr node,
+ virDevicePCIAddressPtr addr);
+
+int virDevicePCIAddressFormat(virBufferPtr buf,
+ virDevicePCIAddress addr,
+ bool includeTypeInAddr);
+
+
+VIR_ENUM_DECL(virDeviceAddressPciMulti)
+
+#endif /* __DEVICE_CONF_H__ */
#include "netdev_vport_profile_conf.h"
#include "netdev_bandwidth_conf.h"
#include "netdev_vlan_conf.h"
+#include "device_conf.h"
#define VIR_FROM_THIS VIR_FROM_DOMAIN
"spapr-vio",
"virtio-s390")
-VIR_ENUM_IMPL(virDomainDeviceAddressPciMulti,
- VIR_DOMAIN_DEVICE_ADDRESS_PCI_MULTI_LAST,
- "default",
- "on",
- "off")
-
VIR_ENUM_IMPL(virDomainDisk, VIR_DOMAIN_DISK_TYPE_LAST,
"block",
"file",
switch (info->type) {
case VIR_DOMAIN_DEVICE_ADDRESS_TYPE_PCI:
- return virDomainDevicePCIAddressIsValid(&info->addr.pci);
+ return virDevicePCIAddressIsValid(&info->addr.pci);
case VIR_DOMAIN_DEVICE_ADDRESS_TYPE_DRIVE:
return 1;
return 0;
}
-
-int virDomainDevicePCIAddressIsValid(virDomainDevicePCIAddressPtr addr)
-{
- /* PCI bus has 32 slots and 8 functions per slot */
- if (addr->slot >= 32 || addr->function >= 8)
- return 0;
- return addr->domain || addr->bus || addr->slot;
-}
-
-
static bool
virDomainDeviceInfoIsSet(virDomainDeviceInfoPtr info, unsigned int flags)
{
info->addr.pci.function);
if (info->addr.pci.multi) {
virBufferAsprintf(buf, " multifunction='%s'",
- virDomainDeviceAddressPciMultiTypeToString(info->addr.pci.multi));
+ virDeviceAddressPciMultiTypeToString(info->addr.pci.multi));
}
break;
return 0;
}
-static int
-virDomainDevicePCIAddressParseXML(xmlNodePtr node,
- virDomainDevicePCIAddressPtr addr)
-{
- char *domain, *slot, *bus, *function, *multi;
- int ret = -1;
-
- memset(addr, 0, sizeof(*addr));
-
- domain = virXMLPropString(node, "domain");
- bus = virXMLPropString(node, "bus");
- slot = virXMLPropString(node, "slot");
- function = virXMLPropString(node, "function");
- multi = virXMLPropString(node, "multifunction");
-
- if (domain &&
- virStrToLong_ui(domain, NULL, 0, &addr->domain) < 0) {
- virReportError(VIR_ERR_INTERNAL_ERROR, "%s",
- _("Cannot parse <address> 'domain' attribute"));
- goto cleanup;
- }
-
- if (bus &&
- virStrToLong_ui(bus, NULL, 0, &addr->bus) < 0) {
- virReportError(VIR_ERR_INTERNAL_ERROR, "%s",
- _("Cannot parse <address> 'bus' attribute"));
- goto cleanup;
- }
-
- if (slot &&
- virStrToLong_ui(slot, NULL, 0, &addr->slot) < 0) {
- virReportError(VIR_ERR_INTERNAL_ERROR, "%s",
- _("Cannot parse <address> 'slot' attribute"));
- goto cleanup;
- }
-
- if (function &&
- virStrToLong_ui(function, NULL, 0, &addr->function) < 0) {
- virReportError(VIR_ERR_INTERNAL_ERROR, "%s",
- _("Cannot parse <address> 'function' attribute"));
- goto cleanup;
- }
-
- if (multi &&
- ((addr->multi = virDomainDeviceAddressPciMultiTypeFromString(multi)) <= 0)) {
- virReportError(VIR_ERR_CONFIG_UNSUPPORTED,
- _("Unknown value '%s' for <address> 'multifunction' attribute"),
- multi);
- goto cleanup;
-
- }
- if (!virDomainDevicePCIAddressIsValid(addr)) {
- virReportError(VIR_ERR_INTERNAL_ERROR, "%s",
- _("Insufficient specification for PCI address"));
- goto cleanup;
- }
-
- ret = 0;
-
-cleanup:
- VIR_FREE(domain);
- VIR_FREE(bus);
- VIR_FREE(slot);
- VIR_FREE(function);
- VIR_FREE(multi);
- return ret;
-}
-
-
static int
virDomainDeviceDriveAddressParseXML(xmlNodePtr node,
virDomainDeviceDriveAddressPtr addr)
switch (info->type) {
case VIR_DOMAIN_DEVICE_ADDRESS_TYPE_PCI:
- if (virDomainDevicePCIAddressParseXML(address, &info->addr.pci) < 0)
+ if (virDevicePCIAddressParseXML(address, &info->addr.pci) < 0)
goto cleanup;
break;
static int
virDomainParseLegacyDeviceAddress(char *devaddr,
- virDomainDevicePCIAddressPtr pci)
+ virDevicePCIAddressPtr pci)
{
char *tmp;
while (cur != NULL) {
if (cur->type == XML_ELEMENT_NODE) {
if (xmlStrEqual(cur->name, BAD_CAST "address")) {
- virDomainDevicePCIAddressPtr addr =
+ virDevicePCIAddressPtr addr =
&def->source.subsys.u.pci;
- if (virDomainDevicePCIAddressParseXML(cur, addr) < 0)
+ if (virDevicePCIAddressParseXML(cur, addr) < 0)
goto out;
} else if ((flags & VIR_DOMAIN_XML_INTERNAL_STATUS) &&
xmlStrEqual(cur->name, BAD_CAST "state")) {
bool includeTypeInAddr)
{
virBufferAddLit(buf, "<source>\n");
+ virBufferAdjustIndent(buf, 2);
switch (def->source.subsys.type)
{
case VIR_DOMAIN_HOSTDEV_SUBSYS_TYPE_USB:
if (def->source.subsys.u.usb.vendor) {
- virBufferAsprintf(buf, " <vendor id='0x%.4x'/>\n",
+ virBufferAsprintf(buf, "<vendor id='0x%.4x'/>\n",
def->source.subsys.u.usb.vendor);
- virBufferAsprintf(buf, " <product id='0x%.4x'/>\n",
+ virBufferAsprintf(buf, "<product id='0x%.4x'/>\n",
def->source.subsys.u.usb.product);
}
if (def->source.subsys.u.usb.bus ||
def->source.subsys.u.usb.device) {
- virBufferAsprintf(buf, " <address %sbus='%d' device='%d'/>\n",
+ virBufferAsprintf(buf, "<address %sbus='%d' device='%d'/>\n",
includeTypeInAddr ? "type='usb' " : "",
def->source.subsys.u.usb.bus,
def->source.subsys.u.usb.device);
}
break;
case VIR_DOMAIN_HOSTDEV_SUBSYS_TYPE_PCI:
- virBufferAsprintf(buf, " <address %sdomain='0x%.4x' bus='0x%.2x' "
- "slot='0x%.2x' function='0x%.1x'/>\n",
- includeTypeInAddr ? "type='pci' " : "",
- def->source.subsys.u.pci.domain,
- def->source.subsys.u.pci.bus,
- def->source.subsys.u.pci.slot,
- def->source.subsys.u.pci.function);
+ if (virDevicePCIAddressFormat(buf,
+ def->source.subsys.u.pci,
+ includeTypeInAddr) != 0)
+ virReportError(VIR_ERR_INTERNAL_ERROR, "%s",
+ _("PCI address Formatting failed"));
if ((flags & VIR_DOMAIN_XML_INTERNAL_PCI_ORIG_STATES) &&
(def->origstates.states.pci.unbind_from_stub ||
def->origstates.states.pci.remove_slot ||
def->origstates.states.pci.reprobe)) {
- virBufferAddLit(buf, " <origstates>\n");
+ virBufferAddLit(buf, "<origstates>\n");
if (def->origstates.states.pci.unbind_from_stub)
- virBufferAddLit(buf, " <unbind/>\n");
+ virBufferAddLit(buf, " <unbind/>\n");
if (def->origstates.states.pci.remove_slot)
- virBufferAddLit(buf, " <removeslot/>\n");
+ virBufferAddLit(buf, " <removeslot/>\n");
if (def->origstates.states.pci.reprobe)
- virBufferAddLit(buf, " <reprobe/>\n");
- virBufferAddLit(buf, " </origstates>\n");
+ virBufferAddLit(buf, " <reprobe/>\n");
+ virBufferAddLit(buf, "</origstates>\n");
}
break;
default:
return -1;
}
+ virBufferAdjustIndent(buf, -2);
virBufferAddLit(buf, "</source>\n");
return 0;
}
# include "virnetdevbandwidth.h"
# include "virnetdevvlan.h"
# include "virobject.h"
+# include "device_conf.h"
/* forward declarations of all device types, required by
* virDomainDeviceDef
VIR_DOMAIN_DEVICE_ADDRESS_TYPE_LAST
};
-enum virDomainDeviceAddressPciMulti {
- VIR_DOMAIN_DEVICE_ADDRESS_PCI_MULTI_DEFAULT = 0,
- VIR_DOMAIN_DEVICE_ADDRESS_PCI_MULTI_ON,
- VIR_DOMAIN_DEVICE_ADDRESS_PCI_MULTI_OFF,
-
- VIR_DOMAIN_DEVICE_ADDRESS_PCI_MULTI_LAST
-};
-
enum virDomainPciRombarMode {
VIR_DOMAIN_PCI_ROMBAR_DEFAULT = 0,
VIR_DOMAIN_PCI_ROMBAR_ON,
VIR_DOMAIN_PCI_ROMBAR_LAST
};
-typedef struct _virDomainDevicePCIAddress virDomainDevicePCIAddress;
-typedef virDomainDevicePCIAddress *virDomainDevicePCIAddressPtr;
-struct _virDomainDevicePCIAddress {
- unsigned int domain;
- unsigned int bus;
- unsigned int slot;
- unsigned int function;
- int multi; /* enum virDomainDeviceAddressPciMulti */
-};
-
typedef struct _virDomainDeviceDriveAddress virDomainDeviceDriveAddress;
typedef virDomainDeviceDriveAddress *virDomainDeviceDriveAddressPtr;
struct _virDomainDeviceDriveAddress {
char *alias;
int type;
union {
- virDomainDevicePCIAddress pci;
+ virDevicePCIAddress pci;
virDomainDeviceDriveAddress drive;
virDomainDeviceVirtioSerialAddress vioserial;
virDomainDeviceCcidAddress ccid;
unsigned vendor;
unsigned product;
} usb;
- virDomainDevicePCIAddress pci; /* host address */
+ virDevicePCIAddress pci; /* host address */
} u;
};
virDomainDeviceDefPtr src);
int virDomainDeviceAddressIsValid(virDomainDeviceInfoPtr info,
int type);
-int virDomainDevicePCIAddressIsValid(virDomainDevicePCIAddressPtr addr);
void virDomainDeviceInfoClear(virDomainDeviceInfoPtr info);
void virDomainDefClearPCIAddresses(virDomainDefPtr def);
void virDomainDefClearDeviceAliases(virDomainDefPtr def);
VIR_ENUM_DECL(virDomainLifecycleCrash)
VIR_ENUM_DECL(virDomainDevice)
VIR_ENUM_DECL(virDomainDeviceAddress)
-VIR_ENUM_DECL(virDomainDeviceAddressPciMulti)
VIR_ENUM_DECL(virDomainDisk)
VIR_ENUM_DECL(virDomainDiskDevice)
VIR_ENUM_DECL(virDomainDiskBus)
virStreamClass;
+# device_conf.h
+virDeviceAddressPciMultiTypeFromString;
+virDeviceAddressPciMultiTypeToString;
+virDevicePCIAddressFormat;
+virDevicePCIAddressIsValid;
+virDevicePCIAddressParseXML;
+
# dnsmasq.h
dnsmasqAddDhcpHost;
dnsmasqAddHost;
virDomainDefParseString;
virDomainDeleteConfig;
virDomainDeviceAddressIsValid;
-virDomainDeviceAddressPciMultiTypeFromString;
-virDomainDeviceAddressPciMultiTypeToString;
virDomainDeviceAddressTypeToString;
virDomainDeviceDefCopy;
virDomainDeviceDefFree;
virDomainDeviceDefParse;
virDomainDeviceInfoIterate;
-virDomainDevicePCIAddressIsValid;
virDomainDeviceTypeToString;
virDomainDiskBusTypeToString;
virDomainDiskCacheTypeFromString;
#include "network/bridge_driver.h"
#include "virnetdevtap.h"
#include "base64.h"
+#include "device_conf.h"
#include <sys/utsname.h>
#include <sys/stat.h>
addr = NULL;
if ((info->addr.pci.function == 0) &&
- (info->addr.pci.multi != VIR_DOMAIN_DEVICE_ADDRESS_PCI_MULTI_ON)) {
+ (info->addr.pci.multi != VIR_DEVICE_ADDRESS_PCI_MULTI_ON)) {
/* a function 0 w/o multifunction=on must reserve the entire slot */
int function;
virDomainDeviceInfo temp_info = *info;
/* USB2 needs special handling to put all companions in the same slot */
if (IS_USB2_CONTROLLER(def->controllers[i])) {
- virDomainDevicePCIAddress addr = { 0, 0, 0, 0, false };
+ virDevicePCIAddress addr = { 0, 0, 0, 0, false };
for (j = 0 ; j < i ; j++) {
if (IS_USB2_CONTROLLER(def->controllers[j]) &&
def->controllers[j]->idx == def->controllers[i]->idx) {
break;
case VIR_DOMAIN_CONTROLLER_MODEL_USB_ICH9_UHCI1:
addr.function = 0;
- addr.multi = VIR_DOMAIN_DEVICE_ADDRESS_PCI_MULTI_ON;
+ addr.multi = VIR_DEVICE_ADDRESS_PCI_MULTI_ON;
break;
case VIR_DOMAIN_CONTROLLER_MODEL_USB_ICH9_UHCI2:
addr.function = 1;
"are supported with this QEMU binary"));
return -1;
}
- if (info->addr.pci.multi == VIR_DOMAIN_DEVICE_ADDRESS_PCI_MULTI_ON) {
+ if (info->addr.pci.multi == VIR_DEVICE_ADDRESS_PCI_MULTI_ON) {
virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s",
_("'multifunction=on' is not supported with "
"this QEMU binary"));
virBufferAsprintf(buf, ",bus=pci.0");
else
virBufferAsprintf(buf, ",bus=pci");
- if (info->addr.pci.multi == VIR_DOMAIN_DEVICE_ADDRESS_PCI_MULTI_ON)
+ if (info->addr.pci.multi == VIR_DEVICE_ADDRESS_PCI_MULTI_ON)
virBufferAddLit(buf, ",multifunction=on");
- else if (info->addr.pci.multi == VIR_DOMAIN_DEVICE_ADDRESS_PCI_MULTI_OFF)
+ else if (info->addr.pci.multi == VIR_DEVICE_ADDRESS_PCI_MULTI_OFF)
virBufferAddLit(buf, ",multifunction=off");
virBufferAsprintf(buf, ",addr=0x%x", info->addr.pci.slot);
if (info->addr.pci.function != 0)
#include "virnetdev.h"
#include "virnetdevbridge.h"
#include "virnetdevtap.h"
+#include "device_conf.h"
#define VIR_FROM_THIS VIR_FROM_QEMU
}
}
} else {
- virDomainDevicePCIAddress guestAddr = disk->info.addr.pci;
+ virDevicePCIAddress guestAddr = disk->info.addr.pci;
ret = qemuMonitorAddPCIDisk(priv->mon,
disk->src,
type,
char *netstr = NULL;
virNetDevVPortProfilePtr vport = NULL;
int ret = -1;
- virDomainDevicePCIAddress guestAddr;
+ virDevicePCIAddress guestAddr;
int vlan;
bool releaseaddr = false;
bool iface_connected = false;
configfd, configfd_name);
qemuDomainObjExitMonitorWithDriver(driver, vm);
} else {
- virDomainDevicePCIAddress guestAddr = hostdev->info->addr.pci;
+ virDevicePCIAddress guestAddr = hostdev->info->addr.pci;
qemuDomainObjEnterMonitorWithDriver(driver, vm);
ret = qemuMonitorAddPCIHostDevice(priv->mon,
int qemuMonitorAddPCIHostDevice(qemuMonitorPtr mon,
- virDomainDevicePCIAddress *hostAddr,
- virDomainDevicePCIAddress *guestAddr)
+ virDevicePCIAddress *hostAddr,
+ virDevicePCIAddress *guestAddr)
{
int ret;
VIR_DEBUG("mon=%p domain=%d bus=%d slot=%d function=%d",
int qemuMonitorAddPCIDisk(qemuMonitorPtr mon,
const char *path,
const char *bus,
- virDomainDevicePCIAddress *guestAddr)
+ virDevicePCIAddress *guestAddr)
{
int ret;
VIR_DEBUG("mon=%p path=%s bus=%s",
int qemuMonitorAddPCINetwork(qemuMonitorPtr mon,
const char *nicstr,
- virDomainDevicePCIAddress *guestAddr)
+ virDevicePCIAddress *guestAddr)
{
int ret;
VIR_DEBUG("mon=%p nicstr=%s", mon, nicstr);
int qemuMonitorRemovePCIDevice(qemuMonitorPtr mon,
- virDomainDevicePCIAddress *guestAddr)
+ virDevicePCIAddress *guestAddr)
{
int ret;
VIR_DEBUG("mon=%p domain=%d bus=%d slot=%d function=%d",
int qemuMonitorAttachPCIDiskController(qemuMonitorPtr mon,
const char *bus,
- virDomainDevicePCIAddress *guestAddr)
+ virDevicePCIAddress *guestAddr)
{
VIR_DEBUG("mon=%p type=%s", mon, bus);
int ret;
int qemuMonitorAttachDrive(qemuMonitorPtr mon,
const char *drivestr,
- virDomainDevicePCIAddress *controllerAddr,
+ virDevicePCIAddress *controllerAddr,
virDomainDeviceDriveAddress *driveAddr)
{
VIR_DEBUG("mon=%p drivestr=%s domain=%d bus=%d slot=%d function=%d",
# include "bitmap.h"
# include "virhash.h"
# include "json.h"
+# include "device_conf.h"
typedef struct _qemuMonitor qemuMonitor;
typedef qemuMonitor *qemuMonitorPtr;
int qemuMonitorAddPCIHostDevice(qemuMonitorPtr mon,
- virDomainDevicePCIAddress *hostAddr,
- virDomainDevicePCIAddress *guestAddr);
+ virDevicePCIAddress *hostAddr,
+ virDevicePCIAddress *guestAddr);
/* XXX disk driver type eg, qcow/etc.
* XXX cache mode
int qemuMonitorAddPCIDisk(qemuMonitorPtr mon,
const char *path,
const char *bus,
- virDomainDevicePCIAddress *guestAddr);
+ virDevicePCIAddress *guestAddr);
/* XXX do we really want to hardcode 'nicstr' as the
* sendable item here
*/
int qemuMonitorAddPCINetwork(qemuMonitorPtr mon,
const char *nicstr,
- virDomainDevicePCIAddress *guestAddr);
+ virDevicePCIAddress *guestAddr);
int qemuMonitorRemovePCIDevice(qemuMonitorPtr mon,
- virDomainDevicePCIAddress *guestAddr);
+ virDevicePCIAddress *guestAddr);
int qemuMonitorSendFileHandle(qemuMonitorPtr mon,
int qemuMonitorAttachPCIDiskController(qemuMonitorPtr mon,
const char *bus,
- virDomainDevicePCIAddress *guestAddr);
+ virDevicePCIAddress *guestAddr);
int qemuMonitorAttachDrive(qemuMonitorPtr mon,
const char *drivestr,
- virDomainDevicePCIAddress *controllerAddr,
+ virDevicePCIAddress *controllerAddr,
virDomainDeviceDriveAddress *driveAddr);
struct _qemuMonitorPCIAddress {
unsigned int vendor;
unsigned int product;
- virDomainDevicePCIAddress addr;
+ virDevicePCIAddress addr;
};
int qemuMonitorGetAllPCIAddresses(qemuMonitorPtr mon,
int qemuMonitorJSONAddPCIHostDevice(qemuMonitorPtr mon ATTRIBUTE_UNUSED,
- virDomainDevicePCIAddress *hostAddr ATTRIBUTE_UNUSED,
- virDomainDevicePCIAddress *guestAddr ATTRIBUTE_UNUSED)
+ virDevicePCIAddress *hostAddr ATTRIBUTE_UNUSED,
+ virDevicePCIAddress *guestAddr ATTRIBUTE_UNUSED)
{
virReportError(VIR_ERR_INTERNAL_ERROR, "%s",
_("pci_add not supported in JSON mode"));
int qemuMonitorJSONAddPCIDisk(qemuMonitorPtr mon ATTRIBUTE_UNUSED,
const char *path ATTRIBUTE_UNUSED,
const char *bus ATTRIBUTE_UNUSED,
- virDomainDevicePCIAddress *guestAddr ATTRIBUTE_UNUSED)
+ virDevicePCIAddress *guestAddr ATTRIBUTE_UNUSED)
{
virReportError(VIR_ERR_INTERNAL_ERROR, "%s",
_("pci_add not supported in JSON mode"));
int qemuMonitorJSONAddPCINetwork(qemuMonitorPtr mon ATTRIBUTE_UNUSED,
const char *nicstr ATTRIBUTE_UNUSED,
- virDomainDevicePCIAddress *guestAddr ATTRIBUTE_UNUSED)
+ virDevicePCIAddress *guestAddr ATTRIBUTE_UNUSED)
{
virReportError(VIR_ERR_INTERNAL_ERROR, "%s",
_("pci_add not supported in JSON mode"));
int qemuMonitorJSONRemovePCIDevice(qemuMonitorPtr mon ATTRIBUTE_UNUSED,
- virDomainDevicePCIAddress *guestAddr ATTRIBUTE_UNUSED)
+ virDevicePCIAddress *guestAddr ATTRIBUTE_UNUSED)
{
virReportError(VIR_ERR_INTERNAL_ERROR, "%s",
_("pci_del not supported in JSON mode"));
int qemuMonitorJSONAttachPCIDiskController(qemuMonitorPtr mon ATTRIBUTE_UNUSED,
const char *bus ATTRIBUTE_UNUSED,
- virDomainDevicePCIAddress *guestAddr ATTRIBUTE_UNUSED)
+ virDevicePCIAddress *guestAddr ATTRIBUTE_UNUSED)
{
virReportError(VIR_ERR_INTERNAL_ERROR, "%s",
_("pci_add not supported in JSON mode"));
int qemuMonitorJSONAttachDrive(qemuMonitorPtr mon,
const char *drivestr,
- virDomainDevicePCIAddress* controllerAddr,
+ virDevicePCIAddress* controllerAddr,
virDomainDeviceDriveAddress* driveAddr)
{
int ret;
int qemuMonitorJSONAddPCIHostDevice(qemuMonitorPtr mon,
- virDomainDevicePCIAddress *hostAddr,
- virDomainDevicePCIAddress *guestAddr);
+ virDevicePCIAddress *hostAddr,
+ virDevicePCIAddress *guestAddr);
int qemuMonitorJSONAddPCIDisk(qemuMonitorPtr mon,
const char *path,
const char *bus,
- virDomainDevicePCIAddress *guestAddr);
+ virDevicePCIAddress *guestAddr);
int qemuMonitorJSONAddPCINetwork(qemuMonitorPtr mon,
const char *nicstr,
- virDomainDevicePCIAddress *guestAddr);
+ virDevicePCIAddress *guestAddr);
int qemuMonitorJSONRemovePCIDevice(qemuMonitorPtr mon,
- virDomainDevicePCIAddress *guestAddr);
+ virDevicePCIAddress *guestAddr);
int qemuMonitorJSONSendFileHandle(qemuMonitorPtr mon,
const char *fdname,
int qemuMonitorJSONAttachPCIDiskController(qemuMonitorPtr mon,
const char *bus,
- virDomainDevicePCIAddress *guestAddr);
+ virDevicePCIAddress *guestAddr);
int qemuMonitorJSONAttachDrive(qemuMonitorPtr mon,
const char *drivestr,
- virDomainDevicePCIAddress *controllerAddr,
+ virDevicePCIAddress *controllerAddr,
virDomainDeviceDriveAddress *driveAddr);
int qemuMonitorJSONGetAllPCIAddresses(qemuMonitorPtr mon,
static int
qemuMonitorTextParsePciAddReply(qemuMonitorPtr mon ATTRIBUTE_UNUSED,
const char *reply,
- virDomainDevicePCIAddress *addr)
+ virDevicePCIAddress *addr)
{
char *s, *e;
int qemuMonitorTextAddPCIHostDevice(qemuMonitorPtr mon,
- virDomainDevicePCIAddress *hostAddr,
- virDomainDevicePCIAddress *guestAddr)
+ virDevicePCIAddress *hostAddr,
+ virDevicePCIAddress *guestAddr)
{
char *cmd;
char *reply = NULL;
int qemuMonitorTextAddPCIDisk(qemuMonitorPtr mon,
const char *path,
const char *bus,
- virDomainDevicePCIAddress *guestAddr)
+ virDevicePCIAddress *guestAddr)
{
char *cmd = NULL;
char *reply = NULL;
int qemuMonitorTextAddPCINetwork(qemuMonitorPtr mon,
const char *nicstr,
- virDomainDevicePCIAddress *guestAddr)
+ virDevicePCIAddress *guestAddr)
{
char *cmd;
char *reply = NULL;
int qemuMonitorTextRemovePCIDevice(qemuMonitorPtr mon,
- virDomainDevicePCIAddress *guestAddr)
+ virDevicePCIAddress *guestAddr)
{
char *cmd = NULL;
char *reply = NULL;
int qemuMonitorTextAttachPCIDiskController(qemuMonitorPtr mon,
const char *bus,
- virDomainDevicePCIAddress *guestAddr)
+ virDevicePCIAddress *guestAddr)
{
char *cmd = NULL;
char *reply = NULL;
int qemuMonitorTextAttachDrive(qemuMonitorPtr mon,
const char *drivestr,
- virDomainDevicePCIAddress *controllerAddr,
+ virDevicePCIAddress *controllerAddr,
virDomainDeviceDriveAddress *driveAddr)
{
char *cmd = NULL;
int qemuMonitorTextAddPCIHostDevice(qemuMonitorPtr mon,
- virDomainDevicePCIAddress *hostAddr,
- virDomainDevicePCIAddress *guestAddr);
+ virDevicePCIAddress *hostAddr,
+ virDevicePCIAddress *guestAddr);
int qemuMonitorTextAddPCIDisk(qemuMonitorPtr mon,
const char *path,
const char *bus,
- virDomainDevicePCIAddress *guestAddr);
+ virDevicePCIAddress *guestAddr);
int qemuMonitorTextAddPCINetwork(qemuMonitorPtr mon,
const char *nicstr,
- virDomainDevicePCIAddress *guestAddr);
+ virDevicePCIAddress *guestAddr);
int qemuMonitorTextRemovePCIDevice(qemuMonitorPtr mon,
- virDomainDevicePCIAddress *guestAddr);
+ virDevicePCIAddress *guestAddr);
int qemuMonitorTextSendFileHandle(qemuMonitorPtr mon,
const char *fdname,
int qemuMonitorTextAttachPCIDiskController(qemuMonitorPtr mon,
const char *bus,
- virDomainDevicePCIAddress *guestAddr);
+ virDevicePCIAddress *guestAddr);
int qemuMonitorTextAttachDrive(qemuMonitorPtr mon,
const char *drivestr,
- virDomainDevicePCIAddress *controllerAddr,
+ virDevicePCIAddress *controllerAddr,
virDomainDeviceDriveAddress *driveAddr);
int qemuMonitorTextGetAllPCIAddresses(qemuMonitorPtr mon,
"URI Utils", /* 45 */
"Authentication Utils",
"DBus Utils",
- "Parallels Cloud Server"
+ "Parallels Cloud Server",
+ "Device Config"
)
#include "count-one-bits.h"
#include "virfile.h"
#include "viruri.h"
+#include "device_conf.h"
/* required for cpumap_t */
#include <xen/dom0_ops.h>
if (xenFormatSxprOnePCI(dev->data.hostdev, &buf, 0) < 0)
goto cleanup;
- virDomainDevicePCIAddress PCIAddr;
+ virDevicePCIAddress PCIAddr;
PCIAddr = dev->data.hostdev->source.subsys.u.pci;
virAsprintf(&target, "PCI device: %.4x:%.2x:%.2x", PCIAddr.domain,