提交 1c6ee84c 编写于 作者: C Chunyan Liu 提交者: Daniel P. Berrange

improve parameter name to let it more meaningful

上级 1fabf06c
...@@ -454,7 +454,7 @@ virHostdevNetConfigRestore(virDomainHostdevDefPtr hostdev, ...@@ -454,7 +454,7 @@ virHostdevNetConfigRestore(virDomainHostdevDefPtr hostdev,
int int
virHostdevPreparePCIDevices(virHostdevManagerPtr hostdev_mgr, virHostdevPreparePCIDevices(virHostdevManagerPtr hostdev_mgr,
const char *drv_name, const char *drv_name,
const char *name, const char *dom_name,
const unsigned char *uuid, const unsigned char *uuid,
virDomainHostdevDefPtr *hostdevs, virDomainHostdevDefPtr *hostdevs,
int nhostdevs, int nhostdevs,
...@@ -575,7 +575,7 @@ virHostdevPreparePCIDevices(virHostdevManagerPtr hostdev_mgr, ...@@ -575,7 +575,7 @@ virHostdevPreparePCIDevices(virHostdevManagerPtr hostdev_mgr,
activeDev = virPCIDeviceListFind(hostdev_mgr->activePciHostdevs, dev); activeDev = virPCIDeviceListFind(hostdev_mgr->activePciHostdevs, dev);
if (activeDev) if (activeDev)
virPCIDeviceSetUsedBy(activeDev, drv_name, name); virPCIDeviceSetUsedBy(activeDev, drv_name, dom_name);
} }
/* Loop 8: Now set the original states for hostdev def */ /* Loop 8: Now set the original states for hostdev def */
...@@ -691,7 +691,7 @@ virHostdevReattachPciDevice(virPCIDevicePtr dev, virHostdevManagerPtr mgr) ...@@ -691,7 +691,7 @@ virHostdevReattachPciDevice(virPCIDevicePtr dev, virHostdevManagerPtr mgr)
void void
virHostdevReAttachPCIDevices(virHostdevManagerPtr hostdev_mgr, virHostdevReAttachPCIDevices(virHostdevManagerPtr hostdev_mgr,
const char *drv_name, const char *drv_name,
const char *name, const char *dom_name,
virDomainHostdevDefPtr *hostdevs, virDomainHostdevDefPtr *hostdevs,
int nhostdevs, int nhostdevs,
char *oldStateDir) char *oldStateDir)
...@@ -730,7 +730,7 @@ virHostdevReAttachPCIDevices(virHostdevManagerPtr hostdev_mgr, ...@@ -730,7 +730,7 @@ virHostdevReAttachPCIDevices(virHostdevManagerPtr hostdev_mgr,
const char *usedby_domname; const char *usedby_domname;
virPCIDeviceGetUsedBy(activeDev, &usedby_drvname, &usedby_domname); virPCIDeviceGetUsedBy(activeDev, &usedby_drvname, &usedby_domname);
if (STRNEQ_NULLABLE(drv_name, usedby_drvname) || if (STRNEQ_NULLABLE(drv_name, usedby_drvname) ||
STRNEQ_NULLABLE(name, usedby_domname)) { STRNEQ_NULLABLE(dom_name, usedby_domname)) {
virPCIDeviceListDel(pcidevs, dev); virPCIDeviceListDel(pcidevs, dev);
continue; continue;
} }
...@@ -928,7 +928,7 @@ cleanup: ...@@ -928,7 +928,7 @@ cleanup:
static int static int
virHostdevMarkUsbHostdevs(virHostdevManagerPtr mgr, virHostdevMarkUsbHostdevs(virHostdevManagerPtr mgr,
const char *drv_name, const char *drv_name,
const char *name, const char *dom_name,
virUSBDeviceListPtr list) virUSBDeviceListPtr list)
{ {
size_t i, j; size_t i, j;
...@@ -958,9 +958,10 @@ virHostdevMarkUsbHostdevs(virHostdevManagerPtr mgr, ...@@ -958,9 +958,10 @@ virHostdevMarkUsbHostdevs(virHostdevManagerPtr mgr,
goto error; goto error;
} }
virUSBDeviceSetUsedBy(usb, drv_name, name); virUSBDeviceSetUsedBy(usb, drv_name, dom_name);
VIR_DEBUG("Adding %03d.%03d dom=%s to activeUsbHostdevs", VIR_DEBUG("Adding %03d.%03d dom=%s to activeUsbHostdevs",
virUSBDeviceGetBus(usb), virUSBDeviceGetDevno(usb), name); virUSBDeviceGetBus(usb), virUSBDeviceGetDevno(usb),
dom_name);
/* /*
* The caller is responsible to steal these usb devices * The caller is responsible to steal these usb devices
* from the virUSBDeviceList that passed in on success, * from the virUSBDeviceList that passed in on success,
...@@ -1073,7 +1074,7 @@ out: ...@@ -1073,7 +1074,7 @@ out:
int int
virHostdevPrepareUSBDevices(virHostdevManagerPtr hostdev_mgr, virHostdevPrepareUSBDevices(virHostdevManagerPtr hostdev_mgr,
const char *drv_name, const char *drv_name,
const char *name, const char *dom_name,
virDomainHostdevDefPtr *hostdevs, virDomainHostdevDefPtr *hostdevs,
int nhostdevs, int nhostdevs,
unsigned int flags) unsigned int flags)
...@@ -1118,11 +1119,11 @@ virHostdevPrepareUSBDevices(virHostdevManagerPtr hostdev_mgr, ...@@ -1118,11 +1119,11 @@ virHostdevPrepareUSBDevices(virHostdevManagerPtr hostdev_mgr,
} }
} }
/* Mark devices in temporary list as used by @name /* Mark devices in temporary list as used by @dom_name
* 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, 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
...@@ -1144,7 +1145,7 @@ cleanup: ...@@ -1144,7 +1145,7 @@ cleanup:
int int
virHostdevPrepareSCSIDevices(virHostdevManagerPtr hostdev_mgr, virHostdevPrepareSCSIDevices(virHostdevManagerPtr hostdev_mgr,
const char *drv_name, const char *drv_name,
const char *name, const char *dom_name,
virDomainHostdevDefPtr *hostdevs, virDomainHostdevDefPtr *hostdevs,
int nhostdevs) int nhostdevs)
{ {
...@@ -1214,10 +1215,10 @@ virHostdevPrepareSCSIDevices(virHostdevManagerPtr hostdev_mgr, ...@@ -1214,10 +1215,10 @@ virHostdevPrepareSCSIDevices(virHostdevManagerPtr hostdev_mgr,
goto error; goto error;
} }
if (virSCSIDeviceSetUsedBy(tmp, drv_name, name) < 0) if (virSCSIDeviceSetUsedBy(tmp, drv_name, dom_name) < 0)
goto error; goto error;
} else { } else {
if (virSCSIDeviceSetUsedBy(scsi, drv_name, name) < 0) if (virSCSIDeviceSetUsedBy(scsi, drv_name, dom_name) < 0)
goto error; goto error;
VIR_DEBUG("Adding %s to activeScsiHostdevs", virSCSIDeviceGetName(scsi)); VIR_DEBUG("Adding %s to activeScsiHostdevs", virSCSIDeviceGetName(scsi));
...@@ -1255,7 +1256,7 @@ cleanup: ...@@ -1255,7 +1256,7 @@ cleanup:
void void
virHostdevReAttachUsbHostdevs(virHostdevManagerPtr hostdev_mgr, virHostdevReAttachUsbHostdevs(virHostdevManagerPtr hostdev_mgr,
const char *drv_name, const char *drv_name,
const char *name, const char *dom_name,
virDomainHostdevDefPtr *hostdevs, virDomainHostdevDefPtr *hostdevs,
int nhostdevs) int nhostdevs)
{ {
...@@ -1283,7 +1284,7 @@ virHostdevReAttachUsbHostdevs(virHostdevManagerPtr hostdev_mgr, ...@@ -1283,7 +1284,7 @@ virHostdevReAttachUsbHostdevs(virHostdevManagerPtr hostdev_mgr,
VIR_WARN("Unable to reattach USB device %03d.%03d on domain %s", VIR_WARN("Unable to reattach USB device %03d.%03d on domain %s",
hostdev->source.subsys.u.usb.bus, hostdev->source.subsys.u.usb.bus,
hostdev->source.subsys.u.usb.device, hostdev->source.subsys.u.usb.device,
name); dom_name);
continue; continue;
} }
...@@ -1306,11 +1307,11 @@ virHostdevReAttachUsbHostdevs(virHostdevManagerPtr hostdev_mgr, ...@@ -1306,11 +1307,11 @@ virHostdevReAttachUsbHostdevs(virHostdevManagerPtr hostdev_mgr,
virUSBDeviceGetUsedBy(tmp, &usedby_drvname, &usedby_domname); virUSBDeviceGetUsedBy(tmp, &usedby_drvname, &usedby_domname);
if (STREQ_NULLABLE(drv_name, usedby_drvname) && if (STREQ_NULLABLE(drv_name, usedby_drvname) &&
STREQ_NULLABLE(name, usedby_domname)) { STREQ_NULLABLE(dom_name, usedby_domname)) {
VIR_DEBUG("Removing %03d.%03d dom=%s from activeUsbHostdevs", VIR_DEBUG("Removing %03d.%03d dom=%s from activeUsbHostdevs",
hostdev->source.subsys.u.usb.bus, hostdev->source.subsys.u.usb.bus,
hostdev->source.subsys.u.usb.device, hostdev->source.subsys.u.usb.device,
name); dom_name);
virUSBDeviceListDel(hostdev_mgr->activeUsbHostdevs, tmp); virUSBDeviceListDel(hostdev_mgr->activeUsbHostdevs, tmp);
} }
...@@ -1321,7 +1322,7 @@ virHostdevReAttachUsbHostdevs(virHostdevManagerPtr hostdev_mgr, ...@@ -1321,7 +1322,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 *name, const char *dom_name,
virDomainHostdevDefPtr *hostdevs, virDomainHostdevDefPtr *hostdevs,
int nhostdevs) int nhostdevs)
{ {
...@@ -1349,7 +1350,7 @@ virHostdevReAttachScsiHostdevs(virHostdevManagerPtr hostdev_mgr, ...@@ -1349,7 +1350,7 @@ virHostdevReAttachScsiHostdevs(virHostdevManagerPtr hostdev_mgr,
hostdev->source.subsys.u.scsi.bus, hostdev->source.subsys.u.scsi.bus,
hostdev->source.subsys.u.scsi.target, hostdev->source.subsys.u.scsi.target,
hostdev->source.subsys.u.scsi.unit, hostdev->source.subsys.u.scsi.unit,
name); dom_name);
continue; continue;
} }
...@@ -1372,9 +1373,10 @@ virHostdevReAttachScsiHostdevs(virHostdevManagerPtr hostdev_mgr, ...@@ -1372,9 +1373,10 @@ virHostdevReAttachScsiHostdevs(virHostdevManagerPtr hostdev_mgr,
hostdev->source.subsys.u.scsi.bus, hostdev->source.subsys.u.scsi.bus,
hostdev->source.subsys.u.scsi.target, hostdev->source.subsys.u.scsi.target,
hostdev->source.subsys.u.scsi.unit, hostdev->source.subsys.u.scsi.unit,
name); dom_name);
virSCSIDeviceListDel(hostdev_mgr->activeScsiHostdevs, tmp, drv_name, name); virSCSIDeviceListDel(hostdev_mgr->activeScsiHostdevs, tmp,
drv_name, dom_name);
virSCSIDeviceFree(scsi); virSCSIDeviceFree(scsi);
} }
virObjectUnlock(hostdev_mgr->activeScsiHostdevs); virObjectUnlock(hostdev_mgr->activeScsiHostdevs);
......
...@@ -53,7 +53,7 @@ virHostdevManagerPtr virHostdevManagerGetDefault(void); ...@@ -53,7 +53,7 @@ virHostdevManagerPtr virHostdevManagerGetDefault(void);
int int
virHostdevPreparePCIDevices(virHostdevManagerPtr hostdev_mgr, virHostdevPreparePCIDevices(virHostdevManagerPtr hostdev_mgr,
const char *drv_name, const char *drv_name,
const char *name, const char *dom_name,
const unsigned char *uuid, const unsigned char *uuid,
virDomainHostdevDefPtr *hostdevs, virDomainHostdevDefPtr *hostdevs,
int nhostdevs, int nhostdevs,
...@@ -61,33 +61,33 @@ virHostdevPreparePCIDevices(virHostdevManagerPtr hostdev_mgr, ...@@ -61,33 +61,33 @@ virHostdevPreparePCIDevices(virHostdevManagerPtr hostdev_mgr,
int int
virHostdevPrepareUSBDevices(virHostdevManagerPtr hostdev_mgr, virHostdevPrepareUSBDevices(virHostdevManagerPtr hostdev_mgr,
const char *drv_name, const char *drv_name,
const char *name, const char *dom_name,
virDomainHostdevDefPtr *hostdevs, virDomainHostdevDefPtr *hostdevs,
int nhostdevs, int nhostdevs,
unsigned int flags); unsigned int flags);
int int
virHostdevPrepareSCSIDevices(virHostdevManagerPtr hostdev_mgr, virHostdevPrepareSCSIDevices(virHostdevManagerPtr hostdev_mgr,
const char *drv_name, const char *drv_name,
const char *name, const char *dom_name,
virDomainHostdevDefPtr *hostdevs, virDomainHostdevDefPtr *hostdevs,
int nhostdevs); int nhostdevs);
void void
virHostdevReAttachPCIDevices(virHostdevManagerPtr hostdev_mgr, virHostdevReAttachPCIDevices(virHostdevManagerPtr hostdev_mgr,
const char *drv_name, const char *drv_name,
const char *name, const char *dom_name,
virDomainHostdevDefPtr *hostdevs, virDomainHostdevDefPtr *hostdevs,
int nhostdevs, int nhostdevs,
char *oldStateDir); char *oldStateDir);
void void
virHostdevReAttachUsbHostdevs(virHostdevManagerPtr hostdev_mgr, virHostdevReAttachUsbHostdevs(virHostdevManagerPtr hostdev_mgr,
const char *drv_name, const char *drv_name,
const char *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 *name, const char *dom_name,
virDomainHostdevDefPtr *hostdevs, virDomainHostdevDefPtr *hostdevs,
int nhostdevs); int nhostdevs);
int int
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册