提交 7be4bdde 编写于 作者: C Chunyan Liu 提交者: Daniel P. Berrange

Capitalize USB, PCI and SCSI in hostdev methods

Change any method names with Usb, Pci or Scsi to use
USB, PCI and SCSI since they are abbreviations.
Signed-off-by: NDaniel P. Berrange <berrange@redhat.com>
上级 b4bbaeef
...@@ -1299,18 +1299,18 @@ virHookPresent; ...@@ -1299,18 +1299,18 @@ virHookPresent;
#util/virhostdev.h #util/virhostdev.h
virHostdevManagerGetDefault; virHostdevManagerGetDefault;
virHostdevPciNodeDeviceDetach; virHostdevPCINodeDeviceDetach;
virHostdevPciNodeDeviceReAttach; virHostdevPCINodeDeviceReAttach;
virHostdevPciNodeDeviceReset; virHostdevPCINodeDeviceReset;
virHostdevPreparePCIDevices; virHostdevPreparePCIDevices;
virHostdevPrepareSCSIDevices; virHostdevPrepareSCSIDevices;
virHostdevPrepareUSBDevices; virHostdevPrepareUSBDevices;
virHostdevReAttachPCIDevices; virHostdevReAttachPCIDevices;
virHostdevReAttachScsiHostdevs; virHostdevReAttachSCSIHostdevs;
virHostdevReAttachUsbHostdevs; virHostdevReAttachUSBHostdevs;
virHostdevUpdateActivePciHostdevs; virHostdevUpdateActivePCIHostdevs;
virHostdevUpdateActiveScsiHostdevs; virHostdevUpdateActiveSCSIHostdevs;
virHostdevUpdateActiveUsbHostdevs; virHostdevUpdateActiveUSBHostdevs;
# util/viridentity.h # util/viridentity.h
virIdentityGetAttr; virIdentityGetAttr;
......
...@@ -11231,7 +11231,7 @@ qemuDomainMigrateConfirm3Params(virDomainPtr domain, ...@@ -11231,7 +11231,7 @@ qemuDomainMigrateConfirm3Params(virDomainPtr domain,
static int static int
qemuNodeDeviceGetPciInfo(virNodeDeviceDefPtr def, qemuNodeDeviceGetPCIInfo(virNodeDeviceDefPtr def,
unsigned *domain, unsigned *domain,
unsigned *bus, unsigned *bus,
unsigned *slot, unsigned *slot,
...@@ -11292,7 +11292,7 @@ qemuNodeDeviceDetachFlags(virNodeDevicePtr dev, ...@@ -11292,7 +11292,7 @@ qemuNodeDeviceDetachFlags(virNodeDevicePtr dev,
if (virNodeDeviceDetachFlagsEnsureACL(dev->conn, def) < 0) if (virNodeDeviceDetachFlagsEnsureACL(dev->conn, def) < 0)
goto cleanup; goto cleanup;
if (qemuNodeDeviceGetPciInfo(def, &domain, &bus, &slot, &function) < 0) if (qemuNodeDeviceGetPCIInfo(def, &domain, &bus, &slot, &function) < 0)
goto cleanup; goto cleanup;
pci = virPCIDeviceNew(domain, bus, slot, function); pci = virPCIDeviceNew(domain, bus, slot, function);
...@@ -11336,7 +11336,7 @@ qemuNodeDeviceDetachFlags(virNodeDevicePtr dev, ...@@ -11336,7 +11336,7 @@ qemuNodeDeviceDetachFlags(virNodeDevicePtr dev,
goto cleanup; goto cleanup;
} }
ret = virHostdevPciNodeDeviceDetach(hostdev_mgr, pci); ret = virHostdevPCINodeDeviceDetach(hostdev_mgr, pci);
cleanup: cleanup:
virPCIDeviceFree(pci); virPCIDeviceFree(pci);
virNodeDeviceDefFree(def); virNodeDeviceDefFree(def);
...@@ -11372,14 +11372,14 @@ qemuNodeDeviceReAttach(virNodeDevicePtr dev) ...@@ -11372,14 +11372,14 @@ qemuNodeDeviceReAttach(virNodeDevicePtr dev)
if (virNodeDeviceReAttachEnsureACL(dev->conn, def) < 0) if (virNodeDeviceReAttachEnsureACL(dev->conn, def) < 0)
goto cleanup; goto cleanup;
if (qemuNodeDeviceGetPciInfo(def, &domain, &bus, &slot, &function) < 0) if (qemuNodeDeviceGetPCIInfo(def, &domain, &bus, &slot, &function) < 0)
goto cleanup; goto cleanup;
pci = virPCIDeviceNew(domain, bus, slot, function); pci = virPCIDeviceNew(domain, bus, slot, function);
if (!pci) if (!pci)
goto cleanup; goto cleanup;
ret = virHostdevPciNodeDeviceReAttach(hostdev_mgr, pci); ret = virHostdevPCINodeDeviceReAttach(hostdev_mgr, pci);
virPCIDeviceFree(pci); virPCIDeviceFree(pci);
cleanup: cleanup:
...@@ -11410,14 +11410,14 @@ qemuNodeDeviceReset(virNodeDevicePtr dev) ...@@ -11410,14 +11410,14 @@ qemuNodeDeviceReset(virNodeDevicePtr dev)
if (virNodeDeviceResetEnsureACL(dev->conn, def) < 0) if (virNodeDeviceResetEnsureACL(dev->conn, def) < 0)
goto cleanup; goto cleanup;
if (qemuNodeDeviceGetPciInfo(def, &domain, &bus, &slot, &function) < 0) if (qemuNodeDeviceGetPCIInfo(def, &domain, &bus, &slot, &function) < 0)
goto cleanup; goto cleanup;
pci = virPCIDeviceNew(domain, bus, slot, function); pci = virPCIDeviceNew(domain, bus, slot, function);
if (!pci) if (!pci)
goto cleanup; goto cleanup;
ret = virHostdevPciNodeDeviceReset(hostdev_mgr, pci); ret = virHostdevPCINodeDeviceReset(hostdev_mgr, pci);
virPCIDeviceFree(pci); virPCIDeviceFree(pci);
cleanup: cleanup:
......
...@@ -42,7 +42,7 @@ ...@@ -42,7 +42,7 @@
#define VIR_FROM_THIS VIR_FROM_QEMU #define VIR_FROM_THIS VIR_FROM_QEMU
int int
qemuUpdateActivePciHostdevs(virQEMUDriverPtr driver, qemuUpdateActivePCIHostdevs(virQEMUDriverPtr driver,
virDomainDefPtr def) virDomainDefPtr def)
{ {
virHostdevManagerPtr mgr = driver->hostdevMgr; virHostdevManagerPtr mgr = driver->hostdevMgr;
...@@ -50,11 +50,11 @@ qemuUpdateActivePciHostdevs(virQEMUDriverPtr driver, ...@@ -50,11 +50,11 @@ qemuUpdateActivePciHostdevs(virQEMUDriverPtr driver,
if (!def->nhostdevs) if (!def->nhostdevs)
return 0; return 0;
return virHostdevUpdateActivePciHostdevs(mgr, QEMU_DRIVER_NAME, def); return virHostdevUpdateActivePCIHostdevs(mgr, QEMU_DRIVER_NAME, def);
} }
int int
qemuUpdateActiveUsbHostdevs(virQEMUDriverPtr driver, qemuUpdateActiveUSBHostdevs(virQEMUDriverPtr driver,
virDomainDefPtr def) virDomainDefPtr def)
{ {
virHostdevManagerPtr mgr = driver->hostdevMgr; virHostdevManagerPtr mgr = driver->hostdevMgr;
...@@ -62,11 +62,11 @@ qemuUpdateActiveUsbHostdevs(virQEMUDriverPtr driver, ...@@ -62,11 +62,11 @@ qemuUpdateActiveUsbHostdevs(virQEMUDriverPtr driver,
if (!def->nhostdevs) if (!def->nhostdevs)
return 0; return 0;
return virHostdevUpdateActiveUsbHostdevs(mgr, QEMU_DRIVER_NAME, def); return virHostdevUpdateActiveUSBHostdevs(mgr, QEMU_DRIVER_NAME, def);
} }
int int
qemuUpdateActiveScsiHostdevs(virQEMUDriverPtr driver, qemuUpdateActiveSCSIHostdevs(virQEMUDriverPtr driver,
virDomainDefPtr def) virDomainDefPtr def)
{ {
virHostdevManagerPtr mgr = driver->hostdevMgr; virHostdevManagerPtr mgr = driver->hostdevMgr;
...@@ -74,7 +74,7 @@ qemuUpdateActiveScsiHostdevs(virQEMUDriverPtr driver, ...@@ -74,7 +74,7 @@ qemuUpdateActiveScsiHostdevs(virQEMUDriverPtr driver,
if (!def->nhostdevs) if (!def->nhostdevs)
return 0; return 0;
return virHostdevUpdateActiveScsiHostdevs(mgr, QEMU_DRIVER_NAME, def); return virHostdevUpdateActiveSCSIHostdevs(mgr, QEMU_DRIVER_NAME, def);
} }
...@@ -317,19 +317,19 @@ qemuDomainReAttachHostdevDevices(virQEMUDriverPtr driver, ...@@ -317,19 +317,19 @@ qemuDomainReAttachHostdevDevices(virQEMUDriverPtr driver,
} }
void void
qemuDomainReAttachHostUsbDevices(virQEMUDriverPtr driver, qemuDomainReAttachHostUSBDevices(virQEMUDriverPtr driver,
const char *name, const char *name,
virDomainHostdevDefPtr *hostdevs, virDomainHostdevDefPtr *hostdevs,
int nhostdevs) int nhostdevs)
{ {
virHostdevManagerPtr hostdev_mgr = driver->hostdevMgr; virHostdevManagerPtr hostdev_mgr = driver->hostdevMgr;
virHostdevReAttachUsbHostdevs(hostdev_mgr, QEMU_DRIVER_NAME, virHostdevReAttachUSBHostdevs(hostdev_mgr, QEMU_DRIVER_NAME,
name, hostdevs, nhostdevs); name, hostdevs, nhostdevs);
} }
void void
qemuDomainReAttachHostScsiDevices(virQEMUDriverPtr driver, qemuDomainReAttachHostSCSIDevices(virQEMUDriverPtr driver,
const char *name, const char *name,
virDomainHostdevDefPtr *hostdevs, virDomainHostdevDefPtr *hostdevs,
int nhostdevs) int nhostdevs)
...@@ -347,7 +347,7 @@ qemuDomainReAttachHostScsiDevices(virQEMUDriverPtr driver, ...@@ -347,7 +347,7 @@ qemuDomainReAttachHostScsiDevices(virQEMUDriverPtr driver,
ignore_value(qemuRemoveSharedDevice(driver, &dev, name)); ignore_value(qemuRemoveSharedDevice(driver, &dev, name));
} }
virHostdevReAttachScsiHostdevs(hostdev_mgr, QEMU_DRIVER_NAME, virHostdevReAttachSCSIHostdevs(hostdev_mgr, QEMU_DRIVER_NAME,
name, hostdevs, nhostdevs); name, hostdevs, nhostdevs);
} }
...@@ -361,9 +361,9 @@ qemuDomainReAttachHostDevices(virQEMUDriverPtr driver, ...@@ -361,9 +361,9 @@ qemuDomainReAttachHostDevices(virQEMUDriverPtr driver,
qemuDomainReAttachHostdevDevices(driver, def->name, def->hostdevs, qemuDomainReAttachHostdevDevices(driver, def->name, def->hostdevs,
def->nhostdevs); def->nhostdevs);
qemuDomainReAttachHostUsbDevices(driver, def->name, def->hostdevs, qemuDomainReAttachHostUSBDevices(driver, def->name, def->hostdevs,
def->nhostdevs); def->nhostdevs);
qemuDomainReAttachHostScsiDevices(driver, def->name, def->hostdevs, qemuDomainReAttachHostSCSIDevices(driver, def->name, def->hostdevs,
def->nhostdevs); def->nhostdevs);
} }
...@@ -27,11 +27,11 @@ ...@@ -27,11 +27,11 @@
# include "qemu_conf.h" # include "qemu_conf.h"
# include "domain_conf.h" # include "domain_conf.h"
int qemuUpdateActivePciHostdevs(virQEMUDriverPtr driver, int qemuUpdateActivePCIHostdevs(virQEMUDriverPtr driver,
virDomainDefPtr def); virDomainDefPtr def);
int qemuUpdateActiveUsbHostdevs(virQEMUDriverPtr driver, int qemuUpdateActiveUSBHostdevs(virQEMUDriverPtr driver,
virDomainDefPtr def); virDomainDefPtr def);
int qemuUpdateActiveScsiHostdevs(virQEMUDriverPtr driver, int qemuUpdateActiveSCSIHostdevs(virQEMUDriverPtr driver,
virDomainDefPtr def); virDomainDefPtr def);
bool qemuHostdevHostSupportsPassthroughLegacy(void); bool qemuHostdevHostSupportsPassthroughLegacy(void);
bool qemuHostdevHostSupportsPassthroughVFIO(void); bool qemuHostdevHostSupportsPassthroughVFIO(void);
...@@ -57,11 +57,11 @@ int qemuPrepareHostDevices(virQEMUDriverPtr driver, ...@@ -57,11 +57,11 @@ int qemuPrepareHostDevices(virQEMUDriverPtr driver,
virQEMUCapsPtr qemuCaps, virQEMUCapsPtr qemuCaps,
unsigned int flags); unsigned int flags);
void void
qemuDomainReAttachHostUsbDevices(virQEMUDriverPtr driver, qemuDomainReAttachHostUSBDevices(virQEMUDriverPtr driver,
const char *name, const char *name,
virDomainHostdevDefPtr *hostdevs, virDomainHostdevDefPtr *hostdevs,
int nhostdevs); int nhostdevs);
void qemuDomainReAttachHostScsiDevices(virQEMUDriverPtr driver, void qemuDomainReAttachHostSCSIDevices(virQEMUDriverPtr driver,
const char *name, const char *name,
virDomainHostdevDefPtr *hostdevs, virDomainHostdevDefPtr *hostdevs,
int nhostdevs); int nhostdevs);
......
...@@ -597,7 +597,7 @@ error: ...@@ -597,7 +597,7 @@ error:
static int static int
qemuDomainAttachUsbMassstorageDevice(virConnectPtr conn, qemuDomainAttachUSBMassstorageDevice(virConnectPtr conn,
virQEMUDriverPtr driver, virQEMUDriverPtr driver,
virDomainObjPtr vm, virDomainObjPtr vm,
virDomainDiskDefPtr disk) virDomainDiskDefPtr disk)
...@@ -769,7 +769,7 @@ qemuDomainAttachDeviceDiskLive(virConnectPtr conn, ...@@ -769,7 +769,7 @@ qemuDomainAttachDeviceDiskLive(virConnectPtr conn,
_("disk device='lun' is not supported for usb bus")); _("disk device='lun' is not supported for usb bus"));
break; break;
} }
ret = qemuDomainAttachUsbMassstorageDevice(conn, driver, vm, ret = qemuDomainAttachUSBMassstorageDevice(conn, driver, vm,
disk); disk);
} else if (disk->bus == VIR_DOMAIN_DISK_BUS_VIRTIO) { } else if (disk->bus == VIR_DOMAIN_DISK_BUS_VIRTIO) {
ret = qemuDomainAttachVirtioDiskDevice(conn, driver, vm, disk); ret = qemuDomainAttachVirtioDiskDevice(conn, driver, vm, disk);
...@@ -1147,7 +1147,7 @@ try_remove: ...@@ -1147,7 +1147,7 @@ try_remove:
static int static int
qemuDomainAttachHostPciDevice(virQEMUDriverPtr driver, qemuDomainAttachHostPCIDevice(virQEMUDriverPtr driver,
virDomainObjPtr vm, virDomainObjPtr vm,
virDomainHostdevDefPtr hostdev) virDomainHostdevDefPtr hostdev)
{ {
...@@ -1463,7 +1463,7 @@ cleanup: ...@@ -1463,7 +1463,7 @@ cleanup:
} }
static int static int
qemuDomainAttachHostUsbDevice(virQEMUDriverPtr driver, qemuDomainAttachHostUSBDevice(virQEMUDriverPtr driver,
virDomainObjPtr vm, virDomainObjPtr vm,
virDomainHostdevDefPtr hostdev) virDomainHostdevDefPtr hostdev)
{ {
...@@ -1522,14 +1522,14 @@ cleanup: ...@@ -1522,14 +1522,14 @@ cleanup:
vm->def, hostdev, NULL) < 0) vm->def, hostdev, NULL) < 0)
VIR_WARN("Unable to restore host device labelling on hotplug fail"); VIR_WARN("Unable to restore host device labelling on hotplug fail");
if (added) if (added)
qemuDomainReAttachHostUsbDevices(driver, vm->def->name, &hostdev, 1); qemuDomainReAttachHostUSBDevices(driver, vm->def->name, &hostdev, 1);
} }
VIR_FREE(devstr); VIR_FREE(devstr);
return ret; return ret;
} }
static int static int
qemuDomainAttachHostScsiDevice(virQEMUDriverPtr driver, qemuDomainAttachHostSCSIDevice(virQEMUDriverPtr driver,
virDomainObjPtr vm, virDomainObjPtr vm,
virDomainHostdevDefPtr hostdev) virDomainHostdevDefPtr hostdev)
{ {
...@@ -1611,7 +1611,7 @@ qemuDomainAttachHostScsiDevice(virQEMUDriverPtr driver, ...@@ -1611,7 +1611,7 @@ qemuDomainAttachHostScsiDevice(virQEMUDriverPtr driver,
ret = 0; ret = 0;
cleanup: cleanup:
if (ret < 0) { if (ret < 0) {
qemuDomainReAttachHostScsiDevices(driver, vm->def->name, &hostdev, 1); qemuDomainReAttachHostSCSIDevices(driver, vm->def->name, &hostdev, 1);
if (teardowncgroup && qemuTeardownHostdevCgroup(vm, hostdev) < 0) if (teardowncgroup && qemuTeardownHostdevCgroup(vm, hostdev) < 0)
VIR_WARN("Unable to remove host device cgroup ACL on hotplug fail"); VIR_WARN("Unable to remove host device cgroup ACL on hotplug fail");
if (teardownlabel && if (teardownlabel &&
...@@ -1637,19 +1637,19 @@ int qemuDomainAttachHostDevice(virQEMUDriverPtr driver, ...@@ -1637,19 +1637,19 @@ int qemuDomainAttachHostDevice(virQEMUDriverPtr driver,
switch (hostdev->source.subsys.type) { switch (hostdev->source.subsys.type) {
case VIR_DOMAIN_HOSTDEV_SUBSYS_TYPE_PCI: case VIR_DOMAIN_HOSTDEV_SUBSYS_TYPE_PCI:
if (qemuDomainAttachHostPciDevice(driver, vm, if (qemuDomainAttachHostPCIDevice(driver, vm,
hostdev) < 0) hostdev) < 0)
goto error; goto error;
break; break;
case VIR_DOMAIN_HOSTDEV_SUBSYS_TYPE_USB: case VIR_DOMAIN_HOSTDEV_SUBSYS_TYPE_USB:
if (qemuDomainAttachHostUsbDevice(driver, vm, if (qemuDomainAttachHostUSBDevice(driver, vm,
hostdev) < 0) hostdev) < 0)
goto error; goto error;
break; break;
case VIR_DOMAIN_HOSTDEV_SUBSYS_TYPE_SCSI: case VIR_DOMAIN_HOSTDEV_SUBSYS_TYPE_SCSI:
if (qemuDomainAttachHostScsiDevice(driver, vm, if (qemuDomainAttachHostSCSIDevice(driver, vm,
hostdev) < 0) hostdev) < 0)
goto error; goto error;
break; break;
...@@ -2537,7 +2537,7 @@ qemuDomainRemoveUSBHostDevice(virQEMUDriverPtr driver, ...@@ -2537,7 +2537,7 @@ qemuDomainRemoveUSBHostDevice(virQEMUDriverPtr driver,
virDomainObjPtr vm, virDomainObjPtr vm,
virDomainHostdevDefPtr hostdev) virDomainHostdevDefPtr hostdev)
{ {
qemuDomainReAttachHostUsbDevices(driver, vm->def->name, &hostdev, 1); qemuDomainReAttachHostUSBDevices(driver, vm->def->name, &hostdev, 1);
} }
static void static void
...@@ -2545,7 +2545,7 @@ qemuDomainRemoveSCSIHostDevice(virQEMUDriverPtr driver, ...@@ -2545,7 +2545,7 @@ qemuDomainRemoveSCSIHostDevice(virQEMUDriverPtr driver,
virDomainObjPtr vm, virDomainObjPtr vm,
virDomainHostdevDefPtr hostdev) virDomainHostdevDefPtr hostdev)
{ {
qemuDomainReAttachHostScsiDevices(driver, vm->def->name, &hostdev, 1); qemuDomainReAttachHostSCSIDevices(driver, vm->def->name, &hostdev, 1);
} }
static void static void
...@@ -3123,7 +3123,7 @@ cleanup: ...@@ -3123,7 +3123,7 @@ cleanup:
} }
static int static int
qemuDomainDetachHostPciDevice(virQEMUDriverPtr driver, qemuDomainDetachHostPCIDevice(virQEMUDriverPtr driver,
virDomainObjPtr vm, virDomainObjPtr vm,
virDomainHostdevDefPtr detach) virDomainHostdevDefPtr detach)
{ {
...@@ -3160,7 +3160,7 @@ qemuDomainDetachHostPciDevice(virQEMUDriverPtr driver, ...@@ -3160,7 +3160,7 @@ qemuDomainDetachHostPciDevice(virQEMUDriverPtr driver,
} }
static int static int
qemuDomainDetachHostUsbDevice(virQEMUDriverPtr driver, qemuDomainDetachHostUSBDevice(virQEMUDriverPtr driver,
virDomainObjPtr vm, virDomainObjPtr vm,
virDomainHostdevDefPtr detach) virDomainHostdevDefPtr detach)
{ {
...@@ -3189,7 +3189,7 @@ qemuDomainDetachHostUsbDevice(virQEMUDriverPtr driver, ...@@ -3189,7 +3189,7 @@ qemuDomainDetachHostUsbDevice(virQEMUDriverPtr driver,
} }
static int static int
qemuDomainDetachHostScsiDevice(virQEMUDriverPtr driver, qemuDomainDetachHostSCSIDevice(virQEMUDriverPtr driver,
virDomainObjPtr vm, virDomainObjPtr vm,
virDomainHostdevDefPtr detach) virDomainHostdevDefPtr detach)
{ {
...@@ -3249,13 +3249,13 @@ qemuDomainDetachThisHostDevice(virQEMUDriverPtr driver, ...@@ -3249,13 +3249,13 @@ qemuDomainDetachThisHostDevice(virQEMUDriverPtr driver,
switch (detach->source.subsys.type) { switch (detach->source.subsys.type) {
case VIR_DOMAIN_HOSTDEV_SUBSYS_TYPE_PCI: case VIR_DOMAIN_HOSTDEV_SUBSYS_TYPE_PCI:
ret = qemuDomainDetachHostPciDevice(driver, vm, detach); ret = qemuDomainDetachHostPCIDevice(driver, vm, detach);
break; break;
case VIR_DOMAIN_HOSTDEV_SUBSYS_TYPE_USB: case VIR_DOMAIN_HOSTDEV_SUBSYS_TYPE_USB:
ret = qemuDomainDetachHostUsbDevice(driver, vm, detach); ret = qemuDomainDetachHostUSBDevice(driver, vm, detach);
break; break;
case VIR_DOMAIN_HOSTDEV_SUBSYS_TYPE_SCSI: case VIR_DOMAIN_HOSTDEV_SUBSYS_TYPE_SCSI:
ret = qemuDomainDetachHostScsiDevice(driver, vm, detach); ret = qemuDomainDetachHostSCSIDevice(driver, vm, detach);
break; break;
default: default:
virReportError(VIR_ERR_CONFIG_UNSUPPORTED, virReportError(VIR_ERR_CONFIG_UNSUPPORTED,
......
...@@ -3158,14 +3158,14 @@ qemuProcessReconnect(void *opaque) ...@@ -3158,14 +3158,14 @@ qemuProcessReconnect(void *opaque)
priv->agentError = true; priv->agentError = true;
} }
if (qemuUpdateActivePciHostdevs(driver, obj->def) < 0) { if (qemuUpdateActivePCIHostdevs(driver, obj->def) < 0) {
goto error; goto error;
} }
if (qemuUpdateActiveUsbHostdevs(driver, obj->def) < 0) if (qemuUpdateActiveUSBHostdevs(driver, obj->def) < 0)
goto error; goto error;
if (qemuUpdateActiveScsiHostdevs(driver, obj->def) < 0) if (qemuUpdateActiveSCSIHostdevs(driver, obj->def) < 0)
goto error; goto error;
if (qemuConnectCgroup(driver, obj) < 0) if (qemuConnectCgroup(driver, obj) < 0)
......
...@@ -131,7 +131,7 @@ virHostdevManagerGetDefault(void) ...@@ -131,7 +131,7 @@ virHostdevManagerGetDefault(void)
} }
static virPCIDeviceListPtr static virPCIDeviceListPtr
virHostdevGetPciHostDeviceList(virDomainHostdevDefPtr *hostdevs, int nhostdevs) virHostdevGetPCIHostDeviceList(virDomainHostdevDefPtr *hostdevs, int nhostdevs)
{ {
virPCIDeviceListPtr list; virPCIDeviceListPtr list;
size_t i; size_t i;
...@@ -183,7 +183,7 @@ virHostdevGetPciHostDeviceList(virDomainHostdevDefPtr *hostdevs, int nhostdevs) ...@@ -183,7 +183,7 @@ virHostdevGetPciHostDeviceList(virDomainHostdevDefPtr *hostdevs, int nhostdevs)
/* /*
* virHostdevGetActivePciHostDeviceList - make a new list with a *copy* of * virHostdevGetActivePCIHostDeviceList - make a new list with a *copy* of
* every virPCIDevice object that is found on the activePciHostdevs * every virPCIDevice object that is found on the activePciHostdevs
* list *and* is in the hostdev list for this domain. * list *and* is in the hostdev list for this domain.
* *
...@@ -192,7 +192,7 @@ virHostdevGetPciHostDeviceList(virDomainHostdevDefPtr *hostdevs, int nhostdevs) ...@@ -192,7 +192,7 @@ virHostdevGetPciHostDeviceList(virDomainHostdevDefPtr *hostdevs, int nhostdevs)
* Pre-condition: activePciHostdevs is locked * Pre-condition: activePciHostdevs is locked
*/ */
static virPCIDeviceListPtr static virPCIDeviceListPtr
virHostdevGetActivePciHostDeviceList(virHostdevManagerPtr mgr, virHostdevGetActivePCIHostDeviceList(virHostdevManagerPtr mgr,
virDomainHostdevDefPtr *hostdevs, virDomainHostdevDefPtr *hostdevs,
int nhostdevs) int nhostdevs)
{ {
...@@ -226,7 +226,7 @@ virHostdevGetActivePciHostDeviceList(virHostdevManagerPtr mgr, ...@@ -226,7 +226,7 @@ virHostdevGetActivePciHostDeviceList(virHostdevManagerPtr mgr,
} }
static int static int
virHostdevPciSysfsPath(virDomainHostdevDefPtr hostdev, virHostdevPCISysfsPath(virDomainHostdevDefPtr hostdev,
char **sysfs_path) char **sysfs_path)
{ {
virPCIDeviceAddress config_address; virPCIDeviceAddress config_address;
...@@ -246,7 +246,7 @@ virHostdevIsVirtualFunction(virDomainHostdevDefPtr hostdev) ...@@ -246,7 +246,7 @@ virHostdevIsVirtualFunction(virDomainHostdevDefPtr hostdev)
char *sysfs_path = NULL; char *sysfs_path = NULL;
int ret = -1; int ret = -1;
if (virHostdevPciSysfsPath(hostdev, &sysfs_path) < 0) if (virHostdevPCISysfsPath(hostdev, &sysfs_path) < 0)
return ret; return ret;
ret = virPCIIsVirtualFunction(sysfs_path); ret = virPCIIsVirtualFunction(sysfs_path);
...@@ -264,7 +264,7 @@ virHostdevNetDevice(virDomainHostdevDefPtr hostdev, char **linkdev, ...@@ -264,7 +264,7 @@ virHostdevNetDevice(virDomainHostdevDefPtr hostdev, char **linkdev,
int ret = -1; int ret = -1;
char *sysfs_path = NULL; char *sysfs_path = NULL;
if (virHostdevPciSysfsPath(hostdev, &sysfs_path) < 0) if (virHostdevPCISysfsPath(hostdev, &sysfs_path) < 0)
return ret; return ret;
if (virPCIIsVirtualFunction(sysfs_path) == 1) { if (virPCIIsVirtualFunction(sysfs_path) == 1) {
...@@ -468,7 +468,7 @@ virHostdevPreparePCIDevices(virHostdevManagerPtr hostdev_mgr, ...@@ -468,7 +468,7 @@ virHostdevPreparePCIDevices(virHostdevManagerPtr hostdev_mgr,
virObjectLock(hostdev_mgr->activePciHostdevs); virObjectLock(hostdev_mgr->activePciHostdevs);
virObjectLock(hostdev_mgr->inactivePciHostdevs); virObjectLock(hostdev_mgr->inactivePciHostdevs);
if (!(pcidevs = virHostdevGetPciHostDeviceList(hostdevs, nhostdevs))) if (!(pcidevs = virHostdevGetPCIHostDeviceList(hostdevs, nhostdevs)))
goto cleanup; goto cleanup;
/* We have to use 9 loops here. *All* devices must /* We have to use 9 loops here. *All* devices must
...@@ -654,7 +654,7 @@ cleanup: ...@@ -654,7 +654,7 @@ cleanup:
* are locked * are locked
*/ */
static void static void
virHostdevReattachPciDevice(virPCIDevicePtr dev, virHostdevManagerPtr mgr) virHostdevReattachPCIDevice(virPCIDevicePtr dev, virHostdevManagerPtr mgr)
{ {
/* If the device is not managed and was attached to guest /* If the device is not managed and was attached to guest
* successfully, it must have been inactive. * successfully, it must have been inactive.
...@@ -702,7 +702,7 @@ virHostdevReAttachPCIDevices(virHostdevManagerPtr hostdev_mgr, ...@@ -702,7 +702,7 @@ virHostdevReAttachPCIDevices(virHostdevManagerPtr hostdev_mgr,
virObjectLock(hostdev_mgr->activePciHostdevs); virObjectLock(hostdev_mgr->activePciHostdevs);
virObjectLock(hostdev_mgr->inactivePciHostdevs); virObjectLock(hostdev_mgr->inactivePciHostdevs);
if (!(pcidevs = virHostdevGetActivePciHostDeviceList(hostdev_mgr, if (!(pcidevs = virHostdevGetActivePCIHostDeviceList(hostdev_mgr,
hostdevs, hostdevs,
nhostdevs))) { nhostdevs))) {
virErrorPtr err = virGetLastError(); virErrorPtr err = virGetLastError();
...@@ -765,7 +765,7 @@ virHostdevReAttachPCIDevices(virHostdevManagerPtr hostdev_mgr, ...@@ -765,7 +765,7 @@ virHostdevReAttachPCIDevices(virHostdevManagerPtr hostdev_mgr,
while (virPCIDeviceListCount(pcidevs) > 0) { while (virPCIDeviceListCount(pcidevs) > 0) {
virPCIDevicePtr dev = virPCIDeviceListStealIndex(pcidevs, 0); virPCIDevicePtr dev = virPCIDeviceListStealIndex(pcidevs, 0);
virHostdevReattachPciDevice(dev, hostdev_mgr); virHostdevReattachPCIDevice(dev, hostdev_mgr);
} }
virObjectUnref(pcidevs); virObjectUnref(pcidevs);
...@@ -775,7 +775,7 @@ cleanup: ...@@ -775,7 +775,7 @@ cleanup:
} }
int int
virHostdevUpdateActivePciHostdevs(virHostdevManagerPtr mgr, virHostdevUpdateActivePCIHostdevs(virHostdevManagerPtr mgr,
const char *drv_name, const char *drv_name,
virDomainDefPtr def) virDomainDefPtr def)
{ {
...@@ -834,7 +834,7 @@ cleanup: ...@@ -834,7 +834,7 @@ cleanup:
} }
int int
virHostdevUpdateActiveUsbHostdevs(virHostdevManagerPtr mgr, virHostdevUpdateActiveUSBHostdevs(virHostdevManagerPtr mgr,
const char *drv_name, const char *drv_name,
virDomainDefPtr def) virDomainDefPtr def)
{ {
...@@ -877,7 +877,7 @@ cleanup: ...@@ -877,7 +877,7 @@ cleanup:
} }
int int
virHostdevUpdateActiveScsiHostdevs(virHostdevManagerPtr mgr, virHostdevUpdateActiveSCSIHostdevs(virHostdevManagerPtr mgr,
const char *drv_name, const char *drv_name,
virDomainDefPtr def) virDomainDefPtr def)
{ {
...@@ -926,7 +926,7 @@ cleanup: ...@@ -926,7 +926,7 @@ cleanup:
} }
static int static int
virHostdevMarkUsbHostdevs(virHostdevManagerPtr mgr, virHostdevMarkUSBHostdevs(virHostdevManagerPtr mgr,
const char *drv_name, const char *drv_name,
const char *dom_name, const char *dom_name,
virUSBDeviceListPtr list) virUSBDeviceListPtr list)
...@@ -1123,7 +1123,7 @@ virHostdevPrepareUSBDevices(virHostdevManagerPtr hostdev_mgr, ...@@ -1123,7 +1123,7 @@ virHostdevPrepareUSBDevices(virHostdevManagerPtr hostdev_mgr,
* and add them do driver list. However, if something goes * and add them do driver list. However, if something goes
* wrong, perform rollback. * wrong, perform rollback.
*/ */
if (virHostdevMarkUsbHostdevs(hostdev_mgr, drv_name, dom_name, list) < 0) if (virHostdevMarkUSBHostdevs(hostdev_mgr, drv_name, dom_name, list) < 0)
goto cleanup; goto cleanup;
/* Loop 2: Temporary list was successfully merged with /* Loop 2: Temporary list was successfully merged with
...@@ -1254,7 +1254,7 @@ cleanup: ...@@ -1254,7 +1254,7 @@ cleanup:
} }
void void
virHostdevReAttachUsbHostdevs(virHostdevManagerPtr hostdev_mgr, virHostdevReAttachUSBHostdevs(virHostdevManagerPtr hostdev_mgr,
const char *drv_name, const char *drv_name,
const char *dom_name, const char *dom_name,
virDomainHostdevDefPtr *hostdevs, virDomainHostdevDefPtr *hostdevs,
...@@ -1320,7 +1320,7 @@ virHostdevReAttachUsbHostdevs(virHostdevManagerPtr hostdev_mgr, ...@@ -1320,7 +1320,7 @@ virHostdevReAttachUsbHostdevs(virHostdevManagerPtr hostdev_mgr,
} }
void void
virHostdevReAttachScsiHostdevs(virHostdevManagerPtr hostdev_mgr, virHostdevReAttachSCSIHostdevs(virHostdevManagerPtr hostdev_mgr,
const char *drv_name, const char *drv_name,
const char *dom_name, const char *dom_name,
virDomainHostdevDefPtr *hostdevs, virDomainHostdevDefPtr *hostdevs,
...@@ -1383,7 +1383,7 @@ virHostdevReAttachScsiHostdevs(virHostdevManagerPtr hostdev_mgr, ...@@ -1383,7 +1383,7 @@ virHostdevReAttachScsiHostdevs(virHostdevManagerPtr hostdev_mgr,
} }
int int
virHostdevPciNodeDeviceDetach(virHostdevManagerPtr hostdev_mgr, virHostdevPCINodeDeviceDetach(virHostdevManagerPtr hostdev_mgr,
virPCIDevicePtr pci) virPCIDevicePtr pci)
{ {
int ret = -1; int ret = -1;
...@@ -1404,7 +1404,7 @@ out: ...@@ -1404,7 +1404,7 @@ out:
} }
int int
virHostdevPciNodeDeviceReAttach(virHostdevManagerPtr hostdev_mgr, virHostdevPCINodeDeviceReAttach(virHostdevManagerPtr hostdev_mgr,
virPCIDevicePtr pci) virPCIDevicePtr pci)
{ {
virPCIDevicePtr other; virPCIDevicePtr other;
...@@ -1445,7 +1445,7 @@ out: ...@@ -1445,7 +1445,7 @@ out:
} }
int int
virHostdevPciNodeDeviceReset(virHostdevManagerPtr hostdev_mgr, virHostdevPCINodeDeviceReset(virHostdevManagerPtr hostdev_mgr,
virPCIDevicePtr pci) virPCIDevicePtr pci)
{ {
int ret = -1; int ret = -1;
......
...@@ -79,36 +79,36 @@ virHostdevReAttachPCIDevices(virHostdevManagerPtr hostdev_mgr, ...@@ -79,36 +79,36 @@ virHostdevReAttachPCIDevices(virHostdevManagerPtr hostdev_mgr,
int nhostdevs, int nhostdevs,
const char *oldStateDir); const char *oldStateDir);
void void
virHostdevReAttachUsbHostdevs(virHostdevManagerPtr hostdev_mgr, virHostdevReAttachUSBHostdevs(virHostdevManagerPtr hostdev_mgr,
const char *drv_name, const char *drv_name,
const char *dom_name, const char *dom_name,
virDomainHostdevDefPtr *hostdevs, virDomainHostdevDefPtr *hostdevs,
int nhostdevs); int nhostdevs);
void void
virHostdevReAttachScsiHostdevs(virHostdevManagerPtr hostdev_mgr, virHostdevReAttachSCSIHostdevs(virHostdevManagerPtr hostdev_mgr,
const char *drv_name, const char *drv_name,
const char *dom_name, const char *dom_name,
virDomainHostdevDefPtr *hostdevs, virDomainHostdevDefPtr *hostdevs,
int nhostdevs); int nhostdevs);
int int
virHostdevUpdateActivePciHostdevs(virHostdevManagerPtr mgr, virHostdevUpdateActivePCIHostdevs(virHostdevManagerPtr mgr,
const char *drv_name, const char *drv_name,
virDomainDefPtr def); virDomainDefPtr def);
int int
virHostdevUpdateActiveUsbHostdevs(virHostdevManagerPtr mgr, virHostdevUpdateActiveUSBHostdevs(virHostdevManagerPtr mgr,
const char *drv_name, const char *drv_name,
virDomainDefPtr def); virDomainDefPtr def);
int int
virHostdevUpdateActiveScsiHostdevs(virHostdevManagerPtr mgr, virHostdevUpdateActiveSCSIHostdevs(virHostdevManagerPtr mgr,
const char *drv_name, const char *drv_name,
virDomainDefPtr def); virDomainDefPtr def);
/* functions used by NodeDevDetach/Reattach/Reset */ /* functions used by NodeDevDetach/Reattach/Reset */
int virHostdevPciNodeDeviceDetach(virHostdevManagerPtr mgr, int virHostdevPCINodeDeviceDetach(virHostdevManagerPtr mgr,
virPCIDevicePtr pci); virPCIDevicePtr pci);
int virHostdevPciNodeDeviceReAttach(virHostdevManagerPtr mgr, int virHostdevPCINodeDeviceReAttach(virHostdevManagerPtr mgr,
virPCIDevicePtr pci); virPCIDevicePtr pci);
int virHostdevPciNodeDeviceReset(virHostdevManagerPtr mgr, int virHostdevPCINodeDeviceReset(virHostdevManagerPtr mgr,
virPCIDevicePtr pci); virPCIDevicePtr pci);
#endif /* __VIR_HOSTDEV_H__ */ #endif /* __VIR_HOSTDEV_H__ */
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册