[PATCH] vz: code refactoring

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

 



In prlsdkAddNet() Attach/DetachNet() functions
privconn should be the first argument
---
 src/vz/vz_driver.c |  4 ++--
 src/vz/vz_sdk.c    | 16 ++++++++--------
 src/vz/vz_sdk.h    |  4 ++--
 3 files changed, 12 insertions(+), 12 deletions(-)

diff --git a/src/vz/vz_driver.c b/src/vz/vz_driver.c
index b02e59f..604e7a8 100644
--- a/src/vz/vz_driver.c
+++ b/src/vz/vz_driver.c
@@ -1088,7 +1088,7 @@ static int vzDomainAttachDeviceFlags(virDomainPtr dom, const char *xml,
         }
         break;
     case VIR_DOMAIN_DEVICE_NET:
-        ret = prlsdkAttachNet(privdom, privconn, dev->data.net);
+        ret = prlsdkAttachNet(privconn, privdom, dev->data.net);
         if (ret) {
             virReportError(VIR_ERR_INTERNAL_ERROR, "%s",
                            _("network attach failed"));
@@ -1165,7 +1165,7 @@ static int vzDomainDetachDeviceFlags(virDomainPtr dom, const char *xml,
         }
         break;
     case VIR_DOMAIN_DEVICE_NET:
-        ret = prlsdkDetachNet(privdom, privconn, dev->data.net);
+        ret = prlsdkDetachNet(privconn, privdom, dev->data.net);
         if (ret) {
             virReportError(VIR_ERR_INTERNAL_ERROR, "%s",
                            _("network detach failed"));
diff --git a/src/vz/vz_sdk.c b/src/vz/vz_sdk.c
index 1473866..c0fb4fb 100644
--- a/src/vz/vz_sdk.c
+++ b/src/vz/vz_sdk.c
@@ -2608,8 +2608,8 @@ static const char * prlsdkFormatMac(virMacAddrPtr mac, char *macstr)
     return macstr;
 }
 
-static int prlsdkAddNet(PRL_HANDLE sdkdom,
-                        vzConnPtr privconn,
+static int prlsdkAddNet(vzConnPtr privconn,
+                        PRL_HANDLE sdkdom,
                         virDomainNetDefPtr net,
                         bool isCt)
 {
@@ -2865,8 +2865,8 @@ prlsdkCleanupBridgedNet(vzConnPtr privconn, virDomainNetDefPtr net)
     PrlHandle_Free(vnet);
 }
 
-int prlsdkAttachNet(virDomainObjPtr dom,
-                    vzConnPtr privconn,
+int prlsdkAttachNet(vzConnPtr privconn,
+                    virDomainObjPtr dom,
                     virDomainNetDefPtr net)
 {
     int ret = -1;
@@ -2883,7 +2883,7 @@ int prlsdkAttachNet(virDomainObjPtr dom,
     if (PRL_FAILED(waitJob(job)))
         return ret;
 
-    ret = prlsdkAddNet(privdom->sdkdom, privconn, net, IS_CT(dom->def));
+    ret = prlsdkAddNet(privconn, privdom->sdkdom, net, IS_CT(dom->def));
     if (ret == 0) {
         job = PrlVm_CommitEx(privdom->sdkdom, PVCF_DETACH_HDD_BUNDLE);
         if (PRL_FAILED(waitJob(job)))
@@ -2930,8 +2930,8 @@ prlsdkFindNetByMAC(PRL_HANDLE sdkdom, virMacAddrPtr mac)
     return adapter;
 }
 
-int prlsdkDetachNet(virDomainObjPtr dom,
-                    vzConnPtr privconn,
+int prlsdkDetachNet(vzConnPtr privconn,
+                    virDomainObjPtr dom,
                     virDomainNetDefPtr net)
 {
     int ret = -1;
@@ -3372,7 +3372,7 @@ prlsdkDoApplyConfig(virConnectPtr conn,
     }
 
     for (i = 0; i < def->nnets; i++) {
-        if (prlsdkAddNet(sdkdom, conn->privateData, def->nets[i], IS_CT(def)) < 0)
+        if (prlsdkAddNet(conn->privateData, sdkdom, def->nets[i], IS_CT(def)) < 0)
             goto error;
     }
 
diff --git a/src/vz/vz_sdk.h b/src/vz/vz_sdk.h
index 8a38797..2f11d4f 100644
--- a/src/vz/vz_sdk.h
+++ b/src/vz/vz_sdk.h
@@ -69,9 +69,9 @@ prlsdkDetachVolume(virDomainObjPtr dom, virDomainDiskDefPtr disk);
 int
 prlsdkGetBlockStats(virDomainObjPtr dom, virDomainDiskDefPtr disk, virDomainBlockStatsPtr stats);
 int
-prlsdkAttachNet(virDomainObjPtr dom, vzConnPtr privconn, virDomainNetDefPtr net);
+prlsdkAttachNet(vzConnPtr privconn, virDomainObjPtr dom, virDomainNetDefPtr net);
 int
-prlsdkDetachNet(virDomainObjPtr dom, vzConnPtr privconn, virDomainNetDefPtr net);
+prlsdkDetachNet(vzConnPtr privconn, virDomainObjPtr dom, virDomainNetDefPtr net);
 int
 prlsdkGetNetStats(virDomainObjPtr dom, const char *path, virDomainInterfaceStatsPtr stats);
 int
-- 
1.8.3.1

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