[PATCH v14 41/49] improve parameter name to let it more meaningful

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

 



Signed-off-by: Chunyan Liu <cyliu@xxxxxxxx>
---
 src/util/virhostdev.c | 44 +++++++++++++++++++++++---------------------
 src/util/virhostdev.h | 12 ++++++------
 2 files changed, 29 insertions(+), 27 deletions(-)

diff --git a/src/util/virhostdev.c b/src/util/virhostdev.c
index 4302385..2c8bdf9 100644
--- a/src/util/virhostdev.c
+++ b/src/util/virhostdev.c
@@ -457,7 +457,7 @@ virHostdevNetConfigRestore(virDomainHostdevDefPtr hostdev,
 int
 virHostdevPreparePCIDevices(virHostdevManagerPtr hostdev_mgr,
                             const char *drv_name,
-                            const char *name,
+                            const char *dom_name,
                             const unsigned char *uuid,
                             virDomainHostdevDefPtr *hostdevs,
                             int nhostdevs,
@@ -578,7 +578,7 @@ virHostdevPreparePCIDevices(virHostdevManagerPtr hostdev_mgr,
         activeDev = virPCIDeviceListFind(hostdev_mgr->activePciHostdevs, dev);
 
         if (activeDev)
-            virPCIDeviceSetUsedBy(activeDev, drv_name, name);
+            virPCIDeviceSetUsedBy(activeDev, drv_name, dom_name);
     }
 
     /* Loop 8: Now set the original states for hostdev def */
@@ -694,7 +694,7 @@ virHostdevReattachPciDevice(virPCIDevicePtr dev, virHostdevManagerPtr mgr)
 void
 virHostdevReAttachPCIDevices(virHostdevManagerPtr hostdev_mgr,
                              const char *drv_name,
-                             const char *name,
+                             const char *dom_name,
                              virDomainHostdevDefPtr *hostdevs,
                              int nhostdevs,
                              char *oldStateDir)
@@ -733,7 +733,7 @@ virHostdevReAttachPCIDevices(virHostdevManagerPtr hostdev_mgr,
             const char *usedby_domname;
             virPCIDeviceGetUsedBy(activeDev, &usedby_drvname, &usedby_domname);
             if (STRNEQ_NULLABLE(drv_name, usedby_drvname) ||
-                STRNEQ_NULLABLE(name, usedby_domname)) {
+                STRNEQ_NULLABLE(dom_name, usedby_domname)) {
                     virPCIDeviceListDel(pcidevs, dev);
                     continue;
                 }
@@ -931,7 +931,7 @@ cleanup:
 static int
 virHostdevMarkUsbHostdevs(virHostdevManagerPtr mgr,
                           const char *drv_name,
-                          const char *name,
+                          const char *dom_name,
                           virUSBDeviceListPtr list)
 {
     size_t i, j;
@@ -961,9 +961,10 @@ virHostdevMarkUsbHostdevs(virHostdevManagerPtr mgr,
             goto error;
         }
 
-        virUSBDeviceSetUsedBy(usb, drv_name, name);
+        virUSBDeviceSetUsedBy(usb, drv_name, dom_name);
         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
          * from the virUSBDeviceList that passed in on success,
@@ -1076,7 +1077,7 @@ out:
 int
 virHostdevPrepareUSBDevices(virHostdevManagerPtr hostdev_mgr,
                             const char *drv_name,
-                            const char *name,
+                            const char *dom_name,
                             virDomainHostdevDefPtr *hostdevs,
                             int nhostdevs,
                             unsigned int flags)
@@ -1121,11 +1122,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
      * wrong, perform rollback.
      */
-    if (virHostdevMarkUsbHostdevs(hostdev_mgr, drv_name, name, list) < 0)
+    if (virHostdevMarkUsbHostdevs(hostdev_mgr, drv_name, dom_name, list) < 0)
         goto cleanup;
 
     /* Loop 2: Temporary list was successfully merged with
@@ -1147,7 +1148,7 @@ cleanup:
 int
 virHostdevPrepareSCSIDevices(virHostdevManagerPtr hostdev_mgr,
                              const char *drv_name,
-                             const char *name,
+                             const char *dom_name,
                              virDomainHostdevDefPtr *hostdevs,
                              int nhostdevs)
 {
@@ -1217,10 +1218,10 @@ virHostdevPrepareSCSIDevices(virHostdevManagerPtr hostdev_mgr,
                 goto error;
             }
 
-            if (virSCSIDeviceSetUsedBy(tmp, drv_name, name) < 0)
+            if (virSCSIDeviceSetUsedBy(tmp, drv_name, dom_name) < 0)
                 goto error;
         } else {
-            if (virSCSIDeviceSetUsedBy(scsi, drv_name, name) < 0)
+            if (virSCSIDeviceSetUsedBy(scsi, drv_name, dom_name) < 0)
                 goto error;
 
             VIR_DEBUG("Adding %s to activeScsiHostdevs", virSCSIDeviceGetName(scsi));
@@ -1258,7 +1259,7 @@ cleanup:
 void
 virHostdevReAttachUsbHostdevs(virHostdevManagerPtr hostdev_mgr,
                               const char *drv_name,
-                              const char *name,
+                              const char *dom_name,
                               virDomainHostdevDefPtr *hostdevs,
                               int nhostdevs)
 {
@@ -1286,7 +1287,7 @@ virHostdevReAttachUsbHostdevs(virHostdevManagerPtr hostdev_mgr,
             VIR_WARN("Unable to reattach USB device %03d.%03d on domain %s",
                      hostdev->source.subsys.u.usb.bus,
                      hostdev->source.subsys.u.usb.device,
-                     name);
+                     dom_name);
             continue;
         }
 
@@ -1309,11 +1310,11 @@ virHostdevReAttachUsbHostdevs(virHostdevManagerPtr hostdev_mgr,
 
         virUSBDeviceGetUsedBy(tmp, &usedby_drvname, &usedby_domname);
         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",
                       hostdev->source.subsys.u.usb.bus,
                       hostdev->source.subsys.u.usb.device,
-                      name);
+                      dom_name);
 
             virUSBDeviceListDel(hostdev_mgr->activeUsbHostdevs, tmp);
         }
@@ -1324,7 +1325,7 @@ virHostdevReAttachUsbHostdevs(virHostdevManagerPtr hostdev_mgr,
 void
 virHostdevReAttachScsiHostdevs(virHostdevManagerPtr hostdev_mgr,
                                const char *drv_name,
-                               const char *name,
+                               const char *dom_name,
                                virDomainHostdevDefPtr *hostdevs,
                                int nhostdevs)
 {
@@ -1352,7 +1353,7 @@ virHostdevReAttachScsiHostdevs(virHostdevManagerPtr hostdev_mgr,
                      hostdev->source.subsys.u.scsi.bus,
                      hostdev->source.subsys.u.scsi.target,
                      hostdev->source.subsys.u.scsi.unit,
-                     name);
+                     dom_name);
             continue;
         }
 
@@ -1375,9 +1376,10 @@ virHostdevReAttachScsiHostdevs(virHostdevManagerPtr hostdev_mgr,
                    hostdev->source.subsys.u.scsi.bus,
                    hostdev->source.subsys.u.scsi.target,
                    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);
     }
     virObjectUnlock(hostdev_mgr->activeScsiHostdevs);
diff --git a/src/util/virhostdev.h b/src/util/virhostdev.h
index a502cfc..d28fb15 100644
--- a/src/util/virhostdev.h
+++ b/src/util/virhostdev.h
@@ -53,7 +53,7 @@ virHostdevManagerPtr virHostdevManagerGetDefault(void);
 int
 virHostdevPreparePCIDevices(virHostdevManagerPtr hostdev_mgr,
                             const char *drv_name,
-                            const char *name,
+                            const char *dom_name,
                             const unsigned char *uuid,
                             virDomainHostdevDefPtr *hostdevs,
                             int nhostdevs,
@@ -61,33 +61,33 @@ virHostdevPreparePCIDevices(virHostdevManagerPtr hostdev_mgr,
 int
 virHostdevPrepareUSBDevices(virHostdevManagerPtr hostdev_mgr,
                             const char *drv_name,
-                            const char *name,
+                            const char *dom_name,
                             virDomainHostdevDefPtr *hostdevs,
                             int nhostdevs,
                             unsigned int flags);
 int
 virHostdevPrepareSCSIDevices(virHostdevManagerPtr hostdev_mgr,
                              const char *drv_name,
-                             const char *name,
+                             const char *dom_name,
                              virDomainHostdevDefPtr *hostdevs,
                              int nhostdevs);
 void
 virHostdevReAttachPCIDevices(virHostdevManagerPtr hostdev_mgr,
                              const char *drv_name,
-                             const char *name,
+                             const char *dom_name,
                              virDomainHostdevDefPtr *hostdevs,
                              int nhostdevs,
                              char *oldStateDir);
 void
 virHostdevReAttachUsbHostdevs(virHostdevManagerPtr hostdev_mgr,
                               const char *drv_name,
-                              const char *name,
+                              const char *dom_name,
                               virDomainHostdevDefPtr *hostdevs,
                               int nhostdevs);
 void
 virHostdevReAttachScsiHostdevs(virHostdevManagerPtr hostdev_mgr,
                                const char *drv_name,
-                               const char *name,
+                               const char *dom_name,
                                virDomainHostdevDefPtr *hostdevs,
                                int nhostdevs);
 int
-- 
1.9.0

--
libvir-list mailing list
libvir-list@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/libvir-list




[Index of Archives]     [Virt Tools]     [Libvirt Users]     [Lib OS Info]     [Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [KDE Users]     [Fedora Tools]