[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]

[libvirt] [PATCH 16/24] hostdev: Rename hostdev_mgr -> mgr



We're in the hostdev module, so mgr is not an ambiguous name, and
in fact it's already used in some cases. Switch all the code over.

Take the chance to shorten declaration of
virHostdevIsPCINodeDeviceUsedData structures.
---
 src/util/virhostdev.c | 155 +++++++++++++++++++++++++-------------------------
 1 file changed, 76 insertions(+), 79 deletions(-)

diff --git a/src/util/virhostdev.c b/src/util/virhostdev.c
index 67e6e7b..46a385c 100644
--- a/src/util/virhostdev.c
+++ b/src/util/virhostdev.c
@@ -55,7 +55,7 @@ static void virHostdevManagerDispose(void *obj);
 static virHostdevManagerPtr virHostdevManagerNew(void);
 
 struct virHostdevIsPCINodeDeviceUsedData {
-    virHostdevManagerPtr hostdev_mgr;
+    virHostdevManagerPtr mgr;
     const char *domainName;
     const bool usesVfio;
 };
@@ -66,7 +66,7 @@ static int virHostdevIsPCINodeDeviceUsed(virPCIDeviceAddressPtr devAddr, void *o
     int ret = -1;
     struct virHostdevIsPCINodeDeviceUsedData *helperData = opaque;
 
-    other = virPCIDeviceListFindByIDs(helperData->hostdev_mgr->activePCIHostdevs,
+    other = virPCIDeviceListFindByIDs(helperData->mgr->activePCIHostdevs,
                                       devAddr->domain, devAddr->bus,
                                       devAddr->slot, devAddr->function);
     if (other) {
@@ -426,7 +426,7 @@ virHostdevNetConfigReplace(virDomainHostdevDefPtr hostdev,
  * For upgrade purpose:
  * To an existing VM on QEMU, the hostdev netconfig file is originally stored
  * in cfg->stateDir (/var/run/libvirt/qemu). Switch to new version, it uses new
- * location (hostdev_mgr->stateDir) but certainly will not find it. In this
+ * location (mgr->stateDir) but certainly will not find it. In this
  * case, try to find in the old state dir.
  */
 static int
@@ -475,7 +475,7 @@ virHostdevNetConfigRestore(virDomainHostdevDefPtr hostdev,
 }
 
 int
-virHostdevPreparePCIDevices(virHostdevManagerPtr hostdev_mgr,
+virHostdevPreparePCIDevices(virHostdevManagerPtr mgr,
                             const char *drv_name,
                             const char *dom_name,
                             const unsigned char *uuid,
@@ -492,8 +492,8 @@ virHostdevPreparePCIDevices(virHostdevManagerPtr hostdev_mgr,
     if (!nhostdevs)
         return 0;
 
-    virObjectLock(hostdev_mgr->activePCIHostdevs);
-    virObjectLock(hostdev_mgr->inactivePCIHostdevs);
+    virObjectLock(mgr->activePCIHostdevs);
+    virObjectLock(mgr->inactivePCIHostdevs);
 
     if (!(pcidevs = virHostdevGetPCIHostDeviceList(hostdevs, nhostdevs)))
         goto cleanup;
@@ -514,8 +514,7 @@ virHostdevPreparePCIDevices(virHostdevManagerPtr hostdev_mgr,
         virPCIDevicePtr dev = virPCIDeviceListGet(pcidevs, i);
         bool strict_acs_check = !!(flags & VIR_HOSTDEV_STRICT_ACS_CHECK);
         bool usesVfio = (virPCIDeviceGetStubDriver(dev) == VIR_PCI_STUB_DRIVER_VFIO);
-        struct virHostdevIsPCINodeDeviceUsedData data = {hostdev_mgr, dom_name,
-                                                         usesVfio};
+        struct virHostdevIsPCINodeDeviceUsedData data = { mgr, dom_name, usesVfio };
 
         if (!usesVfio && !virPCIDeviceIsAssignable(dev, strict_acs_check)) {
             virReportError(VIR_ERR_OPERATION_INVALID,
@@ -548,8 +547,8 @@ virHostdevPreparePCIDevices(virHostdevManagerPtr hostdev_mgr,
             VIR_DEBUG("Detaching managed PCI device %s",
                       virPCIDeviceGetName(dev));
             if (virPCIDeviceDetach(dev,
-                                   hostdev_mgr->activePCIHostdevs,
-                                   hostdev_mgr->inactivePCIHostdevs) < 0)
+                                   mgr->activePCIHostdevs,
+                                   mgr->inactivePCIHostdevs) < 0)
                 goto reattachdevs;
         } else {
             VIR_DEBUG("Not detaching unmanaged PCI device %s",
@@ -566,8 +565,8 @@ virHostdevPreparePCIDevices(virHostdevManagerPtr hostdev_mgr,
         virPCIDevicePtr dev = virPCIDeviceListGet(pcidevs, i);
 
         VIR_DEBUG("Resetting PCI device %s", virPCIDeviceGetName(dev));
-        if (virPCIDeviceReset(dev, hostdev_mgr->activePCIHostdevs,
-                              hostdev_mgr->inactivePCIHostdevs) < 0)
+        if (virPCIDeviceReset(dev, mgr->activePCIHostdevs,
+                              mgr->inactivePCIHostdevs) < 0)
             goto reattachdevs;
     }
 
@@ -578,7 +577,7 @@ virHostdevPreparePCIDevices(virHostdevManagerPtr hostdev_mgr,
          if (!virHostdevIsPCINetDevice(hostdev))
              continue;
          if (virHostdevNetConfigReplace(hostdev, uuid,
-                                        hostdev_mgr->stateDir) < 0) {
+                                        mgr->stateDir) < 0) {
              goto resetvfnetconfig;
          }
          last_processed_hostdev_vf = i;
@@ -590,7 +589,7 @@ virHostdevPreparePCIDevices(virHostdevManagerPtr hostdev_mgr,
 
         VIR_DEBUG("Adding PCI device %s to active list",
                   virPCIDeviceGetName(dev));
-        if (virPCIDeviceListAdd(hostdev_mgr->activePCIHostdevs, dev) < 0)
+        if (virPCIDeviceListAdd(mgr->activePCIHostdevs, dev) < 0)
             goto inactivedevs;
     }
 
@@ -600,7 +599,7 @@ virHostdevPreparePCIDevices(virHostdevManagerPtr hostdev_mgr,
 
         VIR_DEBUG("Removing PCI device %s from inactive list",
                   virPCIDeviceGetName(dev));
-        virPCIDeviceListDel(hostdev_mgr->inactivePCIHostdevs, dev);
+        virPCIDeviceListDel(mgr->inactivePCIHostdevs, dev);
     }
 
     /* Step 7: Now set the used_by_domain of the device in
@@ -610,7 +609,7 @@ virHostdevPreparePCIDevices(virHostdevManagerPtr hostdev_mgr,
         virPCIDevicePtr dev, activeDev;
 
         dev = virPCIDeviceListGet(pcidevs, i);
-        activeDev = virPCIDeviceListFind(hostdev_mgr->activePCIHostdevs, dev);
+        activeDev = virPCIDeviceListFind(mgr->activePCIHostdevs, dev);
 
         VIR_DEBUG("Setting driver and domain information for PCI device %s",
                   virPCIDeviceGetName(dev));
@@ -666,12 +665,12 @@ virHostdevPreparePCIDevices(virHostdevManagerPtr hostdev_mgr,
 
         VIR_DEBUG("Removing PCI device %s from active list",
                   virPCIDeviceGetName(dev));
-        virPCIDeviceListSteal(hostdev_mgr->activePCIHostdevs, dev);
+        virPCIDeviceListSteal(mgr->activePCIHostdevs, dev);
     }
 
  resetvfnetconfig:
     for (i = 0; i <= last_processed_hostdev_vf; i++)
-        virHostdevNetConfigRestore(hostdevs[i], hostdev_mgr->stateDir, NULL);
+        virHostdevNetConfigRestore(hostdevs[i], mgr->stateDir, NULL);
 
  reattachdevs:
     for (i = 0; i < virPCIDeviceListCount(pcidevs); i++) {
@@ -681,8 +680,8 @@ virHostdevPreparePCIDevices(virHostdevManagerPtr hostdev_mgr,
             VIR_DEBUG("Reattaching managed PCI device %s",
                       virPCIDeviceGetName(dev));
             ignore_value(virPCIDeviceReattach(dev,
-                                              hostdev_mgr->activePCIHostdevs,
-                                              hostdev_mgr->inactivePCIHostdevs));
+                                              mgr->activePCIHostdevs,
+                                              mgr->inactivePCIHostdevs));
         } else {
             VIR_DEBUG("Not reattaching unmanaged PCI device %s",
                       virPCIDeviceGetName(dev));
@@ -691,8 +690,8 @@ virHostdevPreparePCIDevices(virHostdevManagerPtr hostdev_mgr,
 
  cleanup:
     virObjectUnref(pcidevs);
-    virObjectUnlock(hostdev_mgr->activePCIHostdevs);
-    virObjectUnlock(hostdev_mgr->inactivePCIHostdevs);
+    virObjectUnlock(mgr->activePCIHostdevs);
+    virObjectUnlock(mgr->inactivePCIHostdevs);
 
     return ret;
 }
@@ -741,7 +740,7 @@ virHostdevReattachPCIDevice(virHostdevManagerPtr mgr,
  * For upgrade purpose: see virHostdevNetConfigRestore
  */
 void
-virHostdevReAttachPCIDevices(virHostdevManagerPtr hostdev_mgr,
+virHostdevReAttachPCIDevices(virHostdevManagerPtr mgr,
                              const char *drv_name,
                              const char *dom_name,
                              virDomainHostdevDefPtr *hostdevs,
@@ -754,8 +753,8 @@ virHostdevReAttachPCIDevices(virHostdevManagerPtr hostdev_mgr,
     if (!nhostdevs)
         return;
 
-    virObjectLock(hostdev_mgr->activePCIHostdevs);
-    virObjectLock(hostdev_mgr->inactivePCIHostdevs);
+    virObjectLock(mgr->activePCIHostdevs);
+    virObjectLock(mgr->inactivePCIHostdevs);
 
     if (!(pcidevs = virHostdevGetPCIHostDeviceList(hostdevs, nhostdevs))) {
         virErrorPtr err = virGetLastError();
@@ -776,7 +775,7 @@ virHostdevReAttachPCIDevices(virHostdevManagerPtr hostdev_mgr,
         virPCIDevicePtr dev = virPCIDeviceListGet(pcidevs, i);
         virPCIDevicePtr activeDev = NULL;
 
-        activeDev = virPCIDeviceListFind(hostdev_mgr->activePCIHostdevs, dev);
+        activeDev = virPCIDeviceListFind(mgr->activePCIHostdevs, dev);
         if (activeDev) {
             const char *usedby_drvname;
             const char *usedby_domname;
@@ -794,7 +793,7 @@ virHostdevReAttachPCIDevices(virHostdevManagerPtr hostdev_mgr,
 
         VIR_DEBUG("Removing PCI device %s from active list",
                   virPCIDeviceGetName(dev));
-        virPCIDeviceListDel(hostdev_mgr->activePCIHostdevs, dev);
+        virPCIDeviceListDel(mgr->activePCIHostdevs, dev);
         i++;
     }
 
@@ -821,7 +820,7 @@ virHostdevReAttachPCIDevices(virHostdevManagerPtr hostdev_mgr,
             if (dev) {
                 VIR_DEBUG("Restoring network configuration of PCI device %s",
                           virPCIDeviceGetName(dev));
-                virHostdevNetConfigRestore(hostdev, hostdev_mgr->stateDir,
+                virHostdevNetConfigRestore(hostdev, mgr->stateDir,
                                            oldStateDir);
             }
         }
@@ -832,8 +831,8 @@ virHostdevReAttachPCIDevices(virHostdevManagerPtr hostdev_mgr,
         virPCIDevicePtr dev = virPCIDeviceListGet(pcidevs, i);
 
         VIR_DEBUG("Resetting PCI device %s", virPCIDeviceGetName(dev));
-        if (virPCIDeviceReset(dev, hostdev_mgr->activePCIHostdevs,
-                              hostdev_mgr->inactivePCIHostdevs) < 0) {
+        if (virPCIDeviceReset(dev, mgr->activePCIHostdevs,
+                              mgr->inactivePCIHostdevs) < 0) {
             virErrorPtr err = virGetLastError();
             VIR_ERROR(_("Failed to reset PCI device: %s"),
                       err ? err->message : _("unknown error"));
@@ -846,13 +845,13 @@ virHostdevReAttachPCIDevices(virHostdevManagerPtr hostdev_mgr,
      */
     while (virPCIDeviceListCount(pcidevs) > 0) {
         virPCIDevicePtr dev = virPCIDeviceListStealIndex(pcidevs, 0);
-        virHostdevReattachPCIDevice(hostdev_mgr, dev);
+        virHostdevReattachPCIDevice(mgr, dev);
     }
 
     virObjectUnref(pcidevs);
  cleanup:
-    virObjectUnlock(hostdev_mgr->activePCIHostdevs);
-    virObjectUnlock(hostdev_mgr->inactivePCIHostdevs);
+    virObjectUnlock(mgr->activePCIHostdevs);
+    virObjectUnlock(mgr->inactivePCIHostdevs);
 }
 
 int
@@ -1185,7 +1184,7 @@ virHostdevFindUSBDevice(virDomainHostdevDefPtr hostdev,
 }
 
 int
-virHostdevPrepareUSBDevices(virHostdevManagerPtr hostdev_mgr,
+virHostdevPrepareUSBDevices(virHostdevManagerPtr mgr,
                             const char *drv_name,
                             const char *dom_name,
                             virDomainHostdevDefPtr *hostdevs,
@@ -1239,7 +1238,7 @@ virHostdevPrepareUSBDevices(virHostdevManagerPtr hostdev_mgr,
      * and add them do driver list. However, if something goes
      * wrong, perform rollback.
      */
-    if (virHostdevMarkUSBDevices(hostdev_mgr, drv_name, dom_name, list) < 0)
+    if (virHostdevMarkUSBDevices(mgr, drv_name, dom_name, list) < 0)
         goto cleanup;
 
     /* Loop 2: Temporary list was successfully merged with
@@ -1291,7 +1290,7 @@ virHostdevPrepareSCSIHostDevices(virDomainHostdevDefPtr hostdev,
 }
 
 int
-virHostdevPrepareSCSIDevices(virHostdevManagerPtr hostdev_mgr,
+virHostdevPrepareSCSIDevices(virHostdevManagerPtr mgr,
                              const char *drv_name,
                              const char *dom_name,
                              virDomainHostdevDefPtr *hostdevs,
@@ -1334,12 +1333,12 @@ virHostdevPrepareSCSIDevices(virHostdevManagerPtr hostdev_mgr,
      * and add them to driver list. However, if something goes
      * wrong, perform rollback.
      */
-    virObjectLock(hostdev_mgr->activeSCSIHostdevs);
+    virObjectLock(mgr->activeSCSIHostdevs);
     count = virSCSIDeviceListCount(list);
 
     for (i = 0; i < count; i++) {
         virSCSIDevicePtr scsi = virSCSIDeviceListGet(list, i);
-        if ((tmp = virSCSIDeviceListFind(hostdev_mgr->activeSCSIHostdevs,
+        if ((tmp = virSCSIDeviceListFind(mgr->activeSCSIHostdevs,
                                          scsi))) {
             bool scsi_shareable = virSCSIDeviceGetShareable(scsi);
             bool tmp_shareable = virSCSIDeviceGetShareable(tmp);
@@ -1361,12 +1360,12 @@ virHostdevPrepareSCSIDevices(virHostdevManagerPtr hostdev_mgr,
 
             VIR_DEBUG("Adding %s to activeSCSIHostdevs", virSCSIDeviceGetName(scsi));
 
-            if (virSCSIDeviceListAdd(hostdev_mgr->activeSCSIHostdevs, scsi) < 0)
+            if (virSCSIDeviceListAdd(mgr->activeSCSIHostdevs, scsi) < 0)
                 goto error;
         }
     }
 
-    virObjectUnlock(hostdev_mgr->activeSCSIHostdevs);
+    virObjectUnlock(mgr->activeSCSIHostdevs);
 
     /* Loop 3: Temporary list was successfully merged with
      * driver list, so steal all items to avoid freeing them
@@ -1383,16 +1382,16 @@ virHostdevPrepareSCSIDevices(virHostdevManagerPtr hostdev_mgr,
  error:
     for (j = 0; j < i; j++) {
         tmp = virSCSIDeviceListGet(list, i);
-        virSCSIDeviceListSteal(hostdev_mgr->activeSCSIHostdevs, tmp);
+        virSCSIDeviceListSteal(mgr->activeSCSIHostdevs, tmp);
     }
-    virObjectUnlock(hostdev_mgr->activeSCSIHostdevs);
+    virObjectUnlock(mgr->activeSCSIHostdevs);
  cleanup:
     virObjectUnref(list);
     return -1;
 }
 
 void
-virHostdevReAttachUSBDevices(virHostdevManagerPtr hostdev_mgr,
+virHostdevReAttachUSBDevices(virHostdevManagerPtr mgr,
                              const char *drv_name,
                              const char *dom_name,
                              virDomainHostdevDefPtr *hostdevs,
@@ -1403,7 +1402,7 @@ virHostdevReAttachUSBDevices(virHostdevManagerPtr hostdev_mgr,
     if (!nhostdevs)
         return;
 
-    virObjectLock(hostdev_mgr->activeUSBHostdevs);
+    virObjectLock(mgr->activeUSBHostdevs);
     for (i = 0; i < nhostdevs; i++) {
         virDomainHostdevDefPtr hostdev = hostdevs[i];
         virDomainHostdevSubsysUSBPtr usbsrc = &hostdev->source.subsys.u.usb;
@@ -1430,7 +1429,7 @@ virHostdevReAttachUSBDevices(virHostdevManagerPtr hostdev_mgr,
          * Therefore we want to steal only those devices from
          * the list which were taken by @name */
 
-        tmp = virUSBDeviceListFind(hostdev_mgr->activeUSBHostdevs, usb);
+        tmp = virUSBDeviceListFind(mgr->activeUSBHostdevs, usb);
         virUSBDeviceFree(usb);
 
         if (!tmp) {
@@ -1445,14 +1444,14 @@ virHostdevReAttachUSBDevices(virHostdevManagerPtr hostdev_mgr,
             STREQ_NULLABLE(dom_name, usedby_domname)) {
             VIR_DEBUG("Removing %03d.%03d dom=%s from activeUSBHostdevs",
                       usbsrc->bus, usbsrc->device, dom_name);
-            virUSBDeviceListDel(hostdev_mgr->activeUSBHostdevs, tmp);
+            virUSBDeviceListDel(mgr->activeUSBHostdevs, tmp);
         }
     }
-    virObjectUnlock(hostdev_mgr->activeUSBHostdevs);
+    virObjectUnlock(mgr->activeUSBHostdevs);
 }
 
 static void
-virHostdevReAttachSCSIHostDevices(virHostdevManagerPtr hostdev_mgr,
+virHostdevReAttachSCSIHostDevices(virHostdevManagerPtr mgr,
                                   virDomainHostdevDefPtr hostdev,
                                   virDomainHostdevSubsysSCSIPtr scsisrc,
                                   const char *drv_name,
@@ -1475,7 +1474,7 @@ virHostdevReAttachSCSIHostDevices(virHostdevManagerPtr hostdev_mgr,
     /* Only delete the devices which are marked as being used by @name,
      * because qemuProcessStart could fail half way through. */
 
-    if (!(tmp = virSCSIDeviceListFind(hostdev_mgr->activeSCSIHostdevs, scsi))) {
+    if (!(tmp = virSCSIDeviceListFind(mgr->activeSCSIHostdevs, scsi))) {
         VIR_WARN("Unable to find device %s:%u:%u:%llu "
                  "in list of active SCSI devices",
                  scsihostsrc->adapter, scsihostsrc->bus,
@@ -1488,13 +1487,13 @@ virHostdevReAttachSCSIHostDevices(virHostdevManagerPtr hostdev_mgr,
                scsihostsrc->adapter, scsihostsrc->bus, scsihostsrc->target,
                scsihostsrc->unit, dom_name);
 
-    virSCSIDeviceListDel(hostdev_mgr->activeSCSIHostdevs, tmp,
+    virSCSIDeviceListDel(mgr->activeSCSIHostdevs, tmp,
                          drv_name, dom_name);
     virSCSIDeviceFree(scsi);
 }
 
 void
-virHostdevReAttachSCSIDevices(virHostdevManagerPtr hostdev_mgr,
+virHostdevReAttachSCSIDevices(virHostdevManagerPtr mgr,
                               const char *drv_name,
                               const char *dom_name,
                               virDomainHostdevDefPtr *hostdevs,
@@ -1505,7 +1504,7 @@ virHostdevReAttachSCSIDevices(virHostdevManagerPtr hostdev_mgr,
     if (!nhostdevs)
         return;
 
-    virObjectLock(hostdev_mgr->activeSCSIHostdevs);
+    virObjectLock(mgr->activeSCSIHostdevs);
     for (i = 0; i < nhostdevs; i++) {
         virDomainHostdevDefPtr hostdev = hostdevs[i];
         virDomainHostdevSubsysSCSIPtr scsisrc = &hostdev->source.subsys.u.scsi;
@@ -1517,49 +1516,47 @@ virHostdevReAttachSCSIDevices(virHostdevManagerPtr hostdev_mgr,
         if (scsisrc->protocol == VIR_DOMAIN_HOSTDEV_SCSI_PROTOCOL_TYPE_ISCSI)
             continue; /* Not supported for iSCSI */
         else
-            virHostdevReAttachSCSIHostDevices(hostdev_mgr, hostdev, scsisrc,
+            virHostdevReAttachSCSIHostDevices(mgr, hostdev, scsisrc,
                                               drv_name, dom_name);
     }
-    virObjectUnlock(hostdev_mgr->activeSCSIHostdevs);
+    virObjectUnlock(mgr->activeSCSIHostdevs);
 }
 
 int
-virHostdevPCINodeDeviceDetach(virHostdevManagerPtr hostdev_mgr,
+virHostdevPCINodeDeviceDetach(virHostdevManagerPtr mgr,
                               virPCIDevicePtr pci)
 {
-    struct virHostdevIsPCINodeDeviceUsedData data = { hostdev_mgr, NULL,
-                                                     false };
+    struct virHostdevIsPCINodeDeviceUsedData data = { mgr, NULL, false };
     int ret = -1;
 
-    virObjectLock(hostdev_mgr->activePCIHostdevs);
-    virObjectLock(hostdev_mgr->inactivePCIHostdevs);
+    virObjectLock(mgr->activePCIHostdevs);
+    virObjectLock(mgr->inactivePCIHostdevs);
 
     if (virHostdevIsPCINodeDeviceUsed(virPCIDeviceGetAddress(pci), &data))
         goto cleanup;
 
-    if (virPCIDeviceDetach(pci, hostdev_mgr->activePCIHostdevs,
-                           hostdev_mgr->inactivePCIHostdevs) < 0)
+    if (virPCIDeviceDetach(pci, mgr->activePCIHostdevs,
+                           mgr->inactivePCIHostdevs) < 0)
         goto cleanup;
 
     ret = 0;
 
  cleanup:
-    virObjectUnlock(hostdev_mgr->inactivePCIHostdevs);
-    virObjectUnlock(hostdev_mgr->activePCIHostdevs);
+    virObjectUnlock(mgr->inactivePCIHostdevs);
+    virObjectUnlock(mgr->activePCIHostdevs);
 
     return ret;
 }
 
 int
-virHostdevPCINodeDeviceReAttach(virHostdevManagerPtr hostdev_mgr,
+virHostdevPCINodeDeviceReAttach(virHostdevManagerPtr mgr,
                                 virPCIDevicePtr pci)
 {
-    struct virHostdevIsPCINodeDeviceUsedData data = {hostdev_mgr, NULL,
-                                                     false};
+    struct virHostdevIsPCINodeDeviceUsedData data = { mgr, NULL, false };
     int ret = -1;
 
-    virObjectLock(hostdev_mgr->activePCIHostdevs);
-    virObjectLock(hostdev_mgr->inactivePCIHostdevs);
+    virObjectLock(mgr->activePCIHostdevs);
+    virObjectLock(mgr->inactivePCIHostdevs);
 
     if (virHostdevIsPCINodeDeviceUsed(virPCIDeviceGetAddress(pci), &data))
         goto cleanup;
@@ -1568,35 +1565,35 @@ virHostdevPCINodeDeviceReAttach(virHostdevManagerPtr hostdev_mgr,
     virPCIDeviceSetRemoveSlot(pci, true);
     virPCIDeviceSetReprobe(pci, true);
 
-    if (virPCIDeviceReattach(pci, hostdev_mgr->activePCIHostdevs,
-                             hostdev_mgr->inactivePCIHostdevs) < 0)
+    if (virPCIDeviceReattach(pci, mgr->activePCIHostdevs,
+                             mgr->inactivePCIHostdevs) < 0)
         goto cleanup;
 
     ret = 0;
 
  cleanup:
-    virObjectUnlock(hostdev_mgr->inactivePCIHostdevs);
-    virObjectUnlock(hostdev_mgr->activePCIHostdevs);
+    virObjectUnlock(mgr->inactivePCIHostdevs);
+    virObjectUnlock(mgr->activePCIHostdevs);
 
     return ret;
 }
 
 int
-virHostdevPCINodeDeviceReset(virHostdevManagerPtr hostdev_mgr,
+virHostdevPCINodeDeviceReset(virHostdevManagerPtr mgr,
                              virPCIDevicePtr pci)
 {
     int ret = -1;
 
-    virObjectLock(hostdev_mgr->activePCIHostdevs);
-    virObjectLock(hostdev_mgr->inactivePCIHostdevs);
-    if (virPCIDeviceReset(pci, hostdev_mgr->activePCIHostdevs,
-                          hostdev_mgr->inactivePCIHostdevs) < 0)
+    virObjectLock(mgr->activePCIHostdevs);
+    virObjectLock(mgr->inactivePCIHostdevs);
+    if (virPCIDeviceReset(pci, mgr->activePCIHostdevs,
+                          mgr->inactivePCIHostdevs) < 0)
         goto out;
 
     ret = 0;
  out:
-    virObjectUnlock(hostdev_mgr->inactivePCIHostdevs);
-    virObjectUnlock(hostdev_mgr->activePCIHostdevs);
+    virObjectUnlock(mgr->inactivePCIHostdevs);
+    virObjectUnlock(mgr->activePCIHostdevs);
     return ret;
 }
 
-- 
2.5.0


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]