[PATCH v13 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 |   38 ++++++++++++++++++++------------------
 src/util/virhostdev.h |   10 +++++-----
 2 files changed, 25 insertions(+), 23 deletions(-)

diff --git a/src/util/virhostdev.c b/src/util/virhostdev.c
index e3b818e..9cd11d4 100644
--- a/src/util/virhostdev.c
+++ b/src/util/virhostdev.c
@@ -429,7 +429,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,
@@ -550,7 +550,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 */
@@ -667,7 +667,7 @@ qemuReattachPciDevice(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)
@@ -706,7 +706,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;
                 }
@@ -906,7 +906,7 @@ cleanup:
 static int
 virHostdevMarkUsbHostdevs(virHostdevManagerPtr mgr,
                           const char *drv_name,
-                          const char *name,
+                          const char *dom_name,
                           virUSBDeviceListPtr list)
 {
     size_t i, j;
@@ -936,9 +936,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,
@@ -1122,7 +1123,7 @@ cleanup:
 int
 virHostdevPrepareSCSIDevices(virHostdevManagerPtr hostdev_mgr,
                              const char *drv_name,
-                             const char *name,
+                             const char *dom_name,
                              virDomainHostdevDefPtr *hostdevs,
                              int nhostdevs)
 {
@@ -1192,10 +1193,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));
@@ -1234,7 +1235,7 @@ cleanup:
 void
 virHostdevReAttachUsbHostdevs(virHostdevManagerPtr hostdev_mgr,
                               const char *drv_name,
-                              const char *name,
+                              const char *dom_name,
                               virDomainHostdevDefPtr *hostdevs,
                               int nhostdevs)
 {
@@ -1261,7 +1262,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;
         }
 
@@ -1284,11 +1285,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);
         }
@@ -1299,7 +1300,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)
 {
@@ -1327,7 +1328,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;
         }
 
@@ -1350,9 +1351,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 bb097b0..3e8ca6d 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,
@@ -68,26 +68,26 @@ virHostdevPrepareUSBDevices(virHostdevManagerPtr hostdev_mgr,
 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.6.0.2

--
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]