[PATCH 2/4] storage_conf: Refactor arguments to matchSCSIAdapter

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

 



Rather than pass the virStoragePoolObjPtr and virStoragePoolDefPtr
for the source adapter checks - just pass the virStoragePoolSourceAdapter's

Cuts down on typing and makes future patches a bit easier

Signed-off-by: John Ferlan <jferlan@xxxxxxxxxx>
---
 src/conf/storage_conf.c | 27 ++++++++++++++-------------
 1 file changed, 14 insertions(+), 13 deletions(-)

diff --git a/src/conf/storage_conf.c b/src/conf/storage_conf.c
index 19b6589..ac41307 100644
--- a/src/conf/storage_conf.c
+++ b/src/conf/storage_conf.c
@@ -2063,17 +2063,17 @@ virStoragePoolObjIsDuplicate(virStoragePoolObjListPtr pools,
 }
 
 static bool
-matchSCSIAdapterParent(virStoragePoolObjPtr pool,
-                       virStoragePoolDefPtr def)
+matchSCSIAdapterParent(virStoragePoolSourceAdapter poolAdapter,
+                       virStoragePoolSourceAdapter defAdapter)
 {
     virDevicePCIAddressPtr pooladdr =
-        &pool->def->source.adapter.data.scsi_host.parentaddr;
+        &poolAdapter.data.scsi_host.parentaddr;
     virDevicePCIAddressPtr defaddr =
-        &def->source.adapter.data.scsi_host.parentaddr;
+        &defAdapter.data.scsi_host.parentaddr;
     int pool_unique_id =
-        pool->def->source.adapter.data.scsi_host.unique_id;
+        poolAdapter.data.scsi_host.unique_id;
     int def_unique_id =
-        def->source.adapter.data.scsi_host.unique_id;
+        defAdapter.data.scsi_host.unique_id;
     if (pooladdr->domain == defaddr->domain &&
         pooladdr->bus == defaddr->bus &&
         pooladdr->slot == defaddr->slot &&
@@ -2085,14 +2085,14 @@ matchSCSIAdapterParent(virStoragePoolObjPtr pool,
 }
 
 static bool
-matchSCSIAdapter(virStoragePoolObjPtr pool,
-                 virStoragePoolDefPtr def)
+matchSCSIAdapter(virStoragePoolSourceAdapter poolAdapter,
+                 virStoragePoolSourceAdapter defAdapter)
 {
-    if (pool->def->source.adapter.data.scsi_host.name) {
-        return STREQ(pool->def->source.adapter.data.scsi_host.name,
-                     def->source.adapter.data.scsi_host.name);
+    if (poolAdapter.data.scsi_host.name) {
+        return STREQ(poolAdapter.data.scsi_host.name,
+                     defAdapter.data.scsi_host.name);
     } else {
-        return matchSCSIAdapterParent(pool, def);
+        return matchSCSIAdapterParent(poolAdapter, defAdapter);
     }
 }
 
@@ -2142,7 +2142,8 @@ virStoragePoolSourceFindDuplicate(virStoragePoolObjListPtr pools,
                        VIR_STORAGE_POOL_SOURCE_ADAPTER_TYPE_SCSI_HOST &&
                        def->source.adapter.type ==
                        VIR_STORAGE_POOL_SOURCE_ADAPTER_TYPE_SCSI_HOST) {
-                if (matchSCSIAdapter(pool, def))
+                if (matchSCSIAdapter(pool->def->source.adapter,
+                                     def->source.adapter))
                     matchpool = pool;
             }
             break;
-- 
1.9.3

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