mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2025-03-07 17:28:15 +00:00
conf: move DevicePCIAddress functions to separate file
Move the functions the parse/format, and validate PCI addresses to their own file so they can be conveniently used in other places besides device_conf.c Refactoring existing code without causing any functional changes to prepare for new code. This patch makes the code reusable. Signed-off-by: Shradha Shah <sshah@solarflare.com>
This commit is contained in:
parent
395be3c2b8
commit
f9150c8158
@ -110,6 +110,7 @@ typedef enum {
|
||||
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
|
||||
|
@ -7,6 +7,7 @@ daemon/stream.c
|
||||
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
|
||||
|
@ -199,6 +199,10 @@ CPU_CONF_SOURCES = \
|
||||
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) \
|
||||
@ -211,7 +215,8 @@ 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 = \
|
||||
|
131
src/conf/device_conf.c
Normal file
131
src/conf/device_conf.c
Normal file
@ -0,0 +1,131 @@
|
||||
/*
|
||||
* 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;
|
||||
}
|
65
src/conf/device_conf.h
Normal file
65
src/conf/device_conf.h
Normal file
@ -0,0 +1,65 @@
|
||||
/*
|
||||
* 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__ */
|
@ -52,6 +52,7 @@
|
||||
#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
|
||||
|
||||
@ -153,12 +154,6 @@ VIR_ENUM_IMPL(virDomainDeviceAddress, VIR_DOMAIN_DEVICE_ADDRESS_TYPE_LAST,
|
||||
"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",
|
||||
@ -1893,7 +1888,7 @@ int virDomainDeviceAddressIsValid(virDomainDeviceInfoPtr info,
|
||||
|
||||
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;
|
||||
@ -1905,16 +1900,6 @@ int virDomainDeviceAddressIsValid(virDomainDeviceInfoPtr info,
|
||||
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)
|
||||
{
|
||||
@ -2139,7 +2124,7 @@ virDomainDeviceInfoFormat(virBufferPtr buf,
|
||||
info->addr.pci.function);
|
||||
if (info->addr.pci.multi) {
|
||||
virBufferAsprintf(buf, " multifunction='%s'",
|
||||
virDomainDeviceAddressPciMultiTypeToString(info->addr.pci.multi));
|
||||
virDeviceAddressPciMultiTypeToString(info->addr.pci.multi));
|
||||
}
|
||||
break;
|
||||
|
||||
@ -2186,75 +2171,6 @@ virDomainDeviceInfoFormat(virBufferPtr buf,
|
||||
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)
|
||||
@ -2616,7 +2532,7 @@ virDomainDeviceInfoParseXML(xmlNodePtr node,
|
||||
|
||||
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;
|
||||
|
||||
@ -2664,7 +2580,7 @@ cleanup:
|
||||
|
||||
static int
|
||||
virDomainParseLegacyDeviceAddress(char *devaddr,
|
||||
virDomainDevicePCIAddressPtr pci)
|
||||
virDevicePCIAddressPtr pci)
|
||||
{
|
||||
char *tmp;
|
||||
|
||||
@ -2849,10 +2765,10 @@ virDomainHostdevSubsysPciDefParseXML(const xmlNodePtr node,
|
||||
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")) {
|
||||
@ -11528,44 +11444,43 @@ virDomainHostdevSourceFormat(virBufferPtr buf,
|
||||
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:
|
||||
@ -11575,6 +11490,7 @@ virDomainHostdevSourceFormat(virBufferPtr buf,
|
||||
return -1;
|
||||
}
|
||||
|
||||
virBufferAdjustIndent(buf, -2);
|
||||
virBufferAddLit(buf, "</source>\n");
|
||||
return 0;
|
||||
}
|
||||
|
@ -45,6 +45,7 @@
|
||||
# include "virnetdevbandwidth.h"
|
||||
# include "virnetdevvlan.h"
|
||||
# include "virobject.h"
|
||||
# include "device_conf.h"
|
||||
|
||||
/* forward declarations of all device types, required by
|
||||
* virDomainDeviceDef
|
||||
@ -180,14 +181,6 @@ enum virDomainDeviceAddressType {
|
||||
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,
|
||||
@ -196,16 +189,6 @@ enum virDomainPciRombarMode {
|
||||
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 {
|
||||
@ -267,7 +250,7 @@ struct _virDomainDeviceInfo {
|
||||
char *alias;
|
||||
int type;
|
||||
union {
|
||||
virDomainDevicePCIAddress pci;
|
||||
virDevicePCIAddress pci;
|
||||
virDomainDeviceDriveAddress drive;
|
||||
virDomainDeviceVirtioSerialAddress vioserial;
|
||||
virDomainDeviceCcidAddress ccid;
|
||||
@ -378,7 +361,7 @@ struct _virDomainHostdevSubsys {
|
||||
unsigned vendor;
|
||||
unsigned product;
|
||||
} usb;
|
||||
virDomainDevicePCIAddress pci; /* host address */
|
||||
virDevicePCIAddress pci; /* host address */
|
||||
} u;
|
||||
};
|
||||
|
||||
@ -1896,7 +1879,6 @@ virDomainDeviceDefPtr virDomainDeviceDefCopy(virCapsPtr caps,
|
||||
virDomainDeviceDefPtr src);
|
||||
int virDomainDeviceAddressIsValid(virDomainDeviceInfoPtr info,
|
||||
int type);
|
||||
int virDomainDevicePCIAddressIsValid(virDomainDevicePCIAddressPtr addr);
|
||||
void virDomainDeviceInfoClear(virDomainDeviceInfoPtr info);
|
||||
void virDomainDefClearPCIAddresses(virDomainDefPtr def);
|
||||
void virDomainDefClearDeviceAliases(virDomainDefPtr def);
|
||||
@ -2168,7 +2150,6 @@ VIR_ENUM_DECL(virDomainLifecycle)
|
||||
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)
|
||||
|
@ -218,6 +218,13 @@ virStorageVolClass;
|
||||
virStreamClass;
|
||||
|
||||
|
||||
# device_conf.h
|
||||
virDeviceAddressPciMultiTypeFromString;
|
||||
virDeviceAddressPciMultiTypeToString;
|
||||
virDevicePCIAddressFormat;
|
||||
virDevicePCIAddressIsValid;
|
||||
virDevicePCIAddressParseXML;
|
||||
|
||||
# dnsmasq.h
|
||||
dnsmasqAddDhcpHost;
|
||||
dnsmasqAddHost;
|
||||
@ -297,14 +304,11 @@ virDomainDefParseNode;
|
||||
virDomainDefParseString;
|
||||
virDomainDeleteConfig;
|
||||
virDomainDeviceAddressIsValid;
|
||||
virDomainDeviceAddressPciMultiTypeFromString;
|
||||
virDomainDeviceAddressPciMultiTypeToString;
|
||||
virDomainDeviceAddressTypeToString;
|
||||
virDomainDeviceDefCopy;
|
||||
virDomainDeviceDefFree;
|
||||
virDomainDeviceDefParse;
|
||||
virDomainDeviceInfoIterate;
|
||||
virDomainDevicePCIAddressIsValid;
|
||||
virDomainDeviceTypeToString;
|
||||
virDomainDiskBusTypeToString;
|
||||
virDomainDiskCacheTypeFromString;
|
||||
|
@ -40,6 +40,7 @@
|
||||
#include "network/bridge_driver.h"
|
||||
#include "virnetdevtap.h"
|
||||
#include "base64.h"
|
||||
#include "device_conf.h"
|
||||
|
||||
#include <sys/utsname.h>
|
||||
#include <sys/stat.h>
|
||||
@ -1028,7 +1029,7 @@ static int qemuCollectPCIAddress(virDomainDefPtr def ATTRIBUTE_UNUSED,
|
||||
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;
|
||||
@ -1611,7 +1612,7 @@ qemuAssignDevicePCISlots(virDomainDefPtr def, qemuDomainPCIAddressSetPtr addrs)
|
||||
|
||||
/* 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) {
|
||||
@ -1626,7 +1627,7 @@ qemuAssignDevicePCISlots(virDomainDefPtr def, qemuDomainPCIAddressSetPtr addrs)
|
||||
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;
|
||||
@ -1780,7 +1781,7 @@ qemuBuildDeviceAddressStr(virBufferPtr buf,
|
||||
"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"));
|
||||
@ -1798,9 +1799,9 @@ qemuBuildDeviceAddressStr(virBufferPtr buf,
|
||||
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)
|
||||
|
@ -43,6 +43,7 @@
|
||||
#include "virnetdev.h"
|
||||
#include "virnetdevbridge.h"
|
||||
#include "virnetdevtap.h"
|
||||
#include "device_conf.h"
|
||||
|
||||
#define VIR_FROM_THIS VIR_FROM_QEMU
|
||||
|
||||
@ -258,7 +259,7 @@ int qemuDomainAttachPciDiskDevice(virConnectPtr conn,
|
||||
}
|
||||
}
|
||||
} else {
|
||||
virDomainDevicePCIAddress guestAddr = disk->info.addr.pci;
|
||||
virDevicePCIAddress guestAddr = disk->info.addr.pci;
|
||||
ret = qemuMonitorAddPCIDisk(priv->mon,
|
||||
disk->src,
|
||||
type,
|
||||
@ -655,7 +656,7 @@ int qemuDomainAttachNetDevice(virConnectPtr conn,
|
||||
char *netstr = NULL;
|
||||
virNetDevVPortProfilePtr vport = NULL;
|
||||
int ret = -1;
|
||||
virDomainDevicePCIAddress guestAddr;
|
||||
virDevicePCIAddress guestAddr;
|
||||
int vlan;
|
||||
bool releaseaddr = false;
|
||||
bool iface_connected = false;
|
||||
@ -974,7 +975,7 @@ int qemuDomainAttachHostPciDevice(struct qemud_driver *driver,
|
||||
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,
|
||||
|
@ -2151,8 +2151,8 @@ int qemuMonitorAddUSBDeviceMatch(qemuMonitorPtr 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",
|
||||
@ -2176,7 +2176,7 @@ int qemuMonitorAddPCIHostDevice(qemuMonitorPtr mon,
|
||||
int qemuMonitorAddPCIDisk(qemuMonitorPtr mon,
|
||||
const char *path,
|
||||
const char *bus,
|
||||
virDomainDevicePCIAddress *guestAddr)
|
||||
virDevicePCIAddress *guestAddr)
|
||||
{
|
||||
int ret;
|
||||
VIR_DEBUG("mon=%p path=%s bus=%s",
|
||||
@ -2198,7 +2198,7 @@ int qemuMonitorAddPCIDisk(qemuMonitorPtr mon,
|
||||
|
||||
int qemuMonitorAddPCINetwork(qemuMonitorPtr mon,
|
||||
const char *nicstr,
|
||||
virDomainDevicePCIAddress *guestAddr)
|
||||
virDevicePCIAddress *guestAddr)
|
||||
{
|
||||
int ret;
|
||||
VIR_DEBUG("mon=%p nicstr=%s", mon, nicstr);
|
||||
@ -2218,7 +2218,7 @@ int qemuMonitorAddPCINetwork(qemuMonitorPtr mon,
|
||||
|
||||
|
||||
int qemuMonitorRemovePCIDevice(qemuMonitorPtr mon,
|
||||
virDomainDevicePCIAddress *guestAddr)
|
||||
virDevicePCIAddress *guestAddr)
|
||||
{
|
||||
int ret;
|
||||
VIR_DEBUG("mon=%p domain=%d bus=%d slot=%d function=%d",
|
||||
@ -2454,7 +2454,7 @@ int qemuMonitorGetPtyPaths(qemuMonitorPtr mon,
|
||||
|
||||
int qemuMonitorAttachPCIDiskController(qemuMonitorPtr mon,
|
||||
const char *bus,
|
||||
virDomainDevicePCIAddress *guestAddr)
|
||||
virDevicePCIAddress *guestAddr)
|
||||
{
|
||||
VIR_DEBUG("mon=%p type=%s", mon, bus);
|
||||
int ret;
|
||||
@ -2476,7 +2476,7 @@ int qemuMonitorAttachPCIDiskController(qemuMonitorPtr mon,
|
||||
|
||||
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",
|
||||
|
@ -32,6 +32,7 @@
|
||||
# include "bitmap.h"
|
||||
# include "virhash.h"
|
||||
# include "json.h"
|
||||
# include "device_conf.h"
|
||||
|
||||
typedef struct _qemuMonitor qemuMonitor;
|
||||
typedef qemuMonitor *qemuMonitorPtr;
|
||||
@ -415,8 +416,8 @@ int qemuMonitorAddUSBDeviceMatch(qemuMonitorPtr mon,
|
||||
|
||||
|
||||
int qemuMonitorAddPCIHostDevice(qemuMonitorPtr mon,
|
||||
virDomainDevicePCIAddress *hostAddr,
|
||||
virDomainDevicePCIAddress *guestAddr);
|
||||
virDevicePCIAddress *hostAddr,
|
||||
virDevicePCIAddress *guestAddr);
|
||||
|
||||
/* XXX disk driver type eg, qcow/etc.
|
||||
* XXX cache mode
|
||||
@ -424,17 +425,17 @@ int qemuMonitorAddPCIHostDevice(qemuMonitorPtr mon,
|
||||
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,
|
||||
@ -473,11 +474,11 @@ int qemuMonitorGetPtyPaths(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);
|
||||
|
||||
|
||||
@ -485,7 +486,7 @@ typedef struct _qemuMonitorPCIAddress qemuMonitorPCIAddress;
|
||||
struct _qemuMonitorPCIAddress {
|
||||
unsigned int vendor;
|
||||
unsigned int product;
|
||||
virDomainDevicePCIAddress addr;
|
||||
virDevicePCIAddress addr;
|
||||
};
|
||||
|
||||
int qemuMonitorGetAllPCIAddresses(qemuMonitorPtr mon,
|
||||
|
@ -2628,8 +2628,8 @@ int qemuMonitorJSONAddUSBDeviceMatch(qemuMonitorPtr mon ATTRIBUTE_UNUSED,
|
||||
|
||||
|
||||
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"));
|
||||
@ -2640,7 +2640,7 @@ int qemuMonitorJSONAddPCIHostDevice(qemuMonitorPtr mon ATTRIBUTE_UNUSED,
|
||||
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"));
|
||||
@ -2650,7 +2650,7 @@ int qemuMonitorJSONAddPCIDisk(qemuMonitorPtr mon ATTRIBUTE_UNUSED,
|
||||
|
||||
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"));
|
||||
@ -2659,7 +2659,7 @@ int qemuMonitorJSONAddPCINetwork(qemuMonitorPtr mon ATTRIBUTE_UNUSED,
|
||||
|
||||
|
||||
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"));
|
||||
@ -2916,7 +2916,7 @@ int qemuMonitorJSONGetPtyPaths(qemuMonitorPtr mon,
|
||||
|
||||
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"));
|
||||
@ -2955,7 +2955,7 @@ qemuMonitorJSONGetGuestDriveAddress(virJSONValuePtr reply,
|
||||
|
||||
int qemuMonitorJSONAttachDrive(qemuMonitorPtr mon,
|
||||
const char *drivestr,
|
||||
virDomainDevicePCIAddress* controllerAddr,
|
||||
virDevicePCIAddress* controllerAddr,
|
||||
virDomainDeviceDriveAddress* driveAddr)
|
||||
{
|
||||
int ret;
|
||||
|
@ -163,20 +163,20 @@ int qemuMonitorJSONAddUSBDeviceMatch(qemuMonitorPtr mon,
|
||||
|
||||
|
||||
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,
|
||||
@ -203,11 +203,11 @@ int qemuMonitorJSONGetPtyPaths(qemuMonitorPtr mon,
|
||||
|
||||
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,
|
||||
|
@ -1898,7 +1898,7 @@ int qemuMonitorTextAddUSBDeviceMatch(qemuMonitorPtr mon,
|
||||
static int
|
||||
qemuMonitorTextParsePciAddReply(qemuMonitorPtr mon ATTRIBUTE_UNUSED,
|
||||
const char *reply,
|
||||
virDomainDevicePCIAddress *addr)
|
||||
virDevicePCIAddress *addr)
|
||||
{
|
||||
char *s, *e;
|
||||
|
||||
@ -1960,8 +1960,8 @@ qemuMonitorTextParsePciAddReply(qemuMonitorPtr mon ATTRIBUTE_UNUSED,
|
||||
|
||||
|
||||
int qemuMonitorTextAddPCIHostDevice(qemuMonitorPtr mon,
|
||||
virDomainDevicePCIAddress *hostAddr,
|
||||
virDomainDevicePCIAddress *guestAddr)
|
||||
virDevicePCIAddress *hostAddr,
|
||||
virDevicePCIAddress *guestAddr)
|
||||
{
|
||||
char *cmd;
|
||||
char *reply = NULL;
|
||||
@ -2006,7 +2006,7 @@ cleanup:
|
||||
int qemuMonitorTextAddPCIDisk(qemuMonitorPtr mon,
|
||||
const char *path,
|
||||
const char *bus,
|
||||
virDomainDevicePCIAddress *guestAddr)
|
||||
virDevicePCIAddress *guestAddr)
|
||||
{
|
||||
char *cmd = NULL;
|
||||
char *reply = NULL;
|
||||
@ -2058,7 +2058,7 @@ cleanup:
|
||||
|
||||
int qemuMonitorTextAddPCINetwork(qemuMonitorPtr mon,
|
||||
const char *nicstr,
|
||||
virDomainDevicePCIAddress *guestAddr)
|
||||
virDevicePCIAddress *guestAddr)
|
||||
{
|
||||
char *cmd;
|
||||
char *reply = NULL;
|
||||
@ -2091,7 +2091,7 @@ cleanup:
|
||||
|
||||
|
||||
int qemuMonitorTextRemovePCIDevice(qemuMonitorPtr mon,
|
||||
virDomainDevicePCIAddress *guestAddr)
|
||||
virDevicePCIAddress *guestAddr)
|
||||
{
|
||||
char *cmd = NULL;
|
||||
char *reply = NULL;
|
||||
@ -2439,7 +2439,7 @@ cleanup:
|
||||
|
||||
int qemuMonitorTextAttachPCIDiskController(qemuMonitorPtr mon,
|
||||
const char *bus,
|
||||
virDomainDevicePCIAddress *guestAddr)
|
||||
virDevicePCIAddress *guestAddr)
|
||||
{
|
||||
char *cmd = NULL;
|
||||
char *reply = NULL;
|
||||
@ -2528,7 +2528,7 @@ qemudParseDriveAddReply(const char *reply,
|
||||
|
||||
int qemuMonitorTextAttachDrive(qemuMonitorPtr mon,
|
||||
const char *drivestr,
|
||||
virDomainDevicePCIAddress *controllerAddr,
|
||||
virDevicePCIAddress *controllerAddr,
|
||||
virDomainDeviceDriveAddress *driveAddr)
|
||||
{
|
||||
char *cmd = NULL;
|
||||
|
@ -147,20 +147,20 @@ int qemuMonitorTextAddUSBDeviceMatch(qemuMonitorPtr mon,
|
||||
|
||||
|
||||
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,
|
||||
@ -187,11 +187,11 @@ int qemuMonitorTextGetPtyPaths(qemuMonitorPtr mon,
|
||||
|
||||
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,
|
||||
|
@ -112,7 +112,8 @@ VIR_ENUM_IMPL(virErrorDomain, VIR_ERR_DOMAIN_LAST,
|
||||
"URI Utils", /* 45 */
|
||||
"Authentication Utils",
|
||||
"DBus Utils",
|
||||
"Parallels Cloud Server"
|
||||
"Parallels Cloud Server",
|
||||
"Device Config"
|
||||
)
|
||||
|
||||
|
||||
|
@ -46,6 +46,7 @@
|
||||
#include "count-one-bits.h"
|
||||
#include "virfile.h"
|
||||
#include "viruri.h"
|
||||
#include "device_conf.h"
|
||||
|
||||
/* required for cpumap_t */
|
||||
#include <xen/dom0_ops.h>
|
||||
@ -2725,7 +2726,7 @@ xenDaemonAttachDeviceFlags(virDomainPtr domain, const char *xml,
|
||||
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,
|
||||
|
Loading…
x
Reference in New Issue
Block a user