[PATCH 1/9] qemu_driver: Push qemuDomainInterfaceAddresses() a few lines down

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

 



If we place qemuDomainInterfaceAddresses() a few lines below the
two functions its using then we can drop forward declarations of
those functions.

Signed-off-by: Michal Privoznik <mprivozn@xxxxxxxxxx>
---
 src/qemu/qemu_driver.c | 125 ++++++++++++++++++++---------------------
 1 file changed, 60 insertions(+), 65 deletions(-)

diff --git a/src/qemu/qemu_driver.c b/src/qemu/qemu_driver.c
index 1911073f3e..1b9d6d16a1 100644
--- a/src/qemu/qemu_driver.c
+++ b/src/qemu/qemu_driver.c
@@ -151,13 +151,6 @@ static int qemuOpenFileAs(uid_t fallback_uid, gid_t fallback_gid,
                           const char *path, int oflags,
                           bool *needUnlink);
 
-static int qemuGetDHCPInterfaces(virDomainPtr dom,
-                                 virDomainObjPtr vm,
-                                 virDomainInterfacePtr **ifaces);
-
-static int qemuARPGetInterfaces(virDomainObjPtr vm,
-                                virDomainInterfacePtr **ifaces);
-
 static virQEMUDriverPtr qemu_driver;
 
 /* Looks up the domain object from snapshot and unlocks the
@@ -21554,64 +21547,6 @@ qemuDomainGetFSInfo(virDomainPtr dom,
     return ret;
 }
 
-static int
-qemuDomainInterfaceAddresses(virDomainPtr dom,
-                             virDomainInterfacePtr **ifaces,
-                             unsigned int source,
-                             unsigned int flags)
-{
-    virQEMUDriverPtr driver = dom->conn->privateData;
-    virDomainObjPtr vm = NULL;
-    qemuAgentPtr agent;
-    int ret = -1;
-
-    virCheckFlags(0, -1);
-
-    if (!(vm = qemuDomainObjFromDomain(dom)))
-        goto cleanup;
-
-    if (virDomainInterfaceAddressesEnsureACL(dom->conn, vm->def) < 0)
-        goto cleanup;
-
-    if (virDomainObjCheckActive(vm) < 0)
-        goto cleanup;
-
-    switch (source) {
-    case VIR_DOMAIN_INTERFACE_ADDRESSES_SRC_LEASE:
-        ret = qemuGetDHCPInterfaces(dom, vm, ifaces);
-        break;
-
-    case VIR_DOMAIN_INTERFACE_ADDRESSES_SRC_AGENT:
-        if (qemuDomainObjBeginAgentJob(driver, vm, QEMU_AGENT_JOB_QUERY) < 0)
-            goto cleanup;
-
-        if (!qemuDomainAgentAvailable(vm, true))
-            goto endjob;
-
-        agent = qemuDomainObjEnterAgent(vm);
-        ret = qemuAgentGetInterfaces(agent, ifaces);
-        qemuDomainObjExitAgent(vm, agent);
-
-    endjob:
-        qemuDomainObjEndAgentJob(vm);
-
-        break;
-
-    case VIR_DOMAIN_INTERFACE_ADDRESSES_SRC_ARP:
-        ret = qemuARPGetInterfaces(vm, ifaces);
-        break;
-
-    default:
-        virReportError(VIR_ERR_ARGUMENT_UNSUPPORTED,
-                       _("Unknown IP address data source %d"),
-                       source);
-        break;
-    }
-
- cleanup:
-    virDomainObjEndAPI(&vm);
-    return ret;
-}
 
 static int
 qemuGetDHCPInterfaces(virDomainPtr dom,
@@ -21764,6 +21699,66 @@ qemuARPGetInterfaces(virDomainObjPtr vm,
 }
 
 
+static int
+qemuDomainInterfaceAddresses(virDomainPtr dom,
+                             virDomainInterfacePtr **ifaces,
+                             unsigned int source,
+                             unsigned int flags)
+{
+    virQEMUDriverPtr driver = dom->conn->privateData;
+    virDomainObjPtr vm = NULL;
+    qemuAgentPtr agent;
+    int ret = -1;
+
+    virCheckFlags(0, -1);
+
+    if (!(vm = qemuDomainObjFromDomain(dom)))
+        goto cleanup;
+
+    if (virDomainInterfaceAddressesEnsureACL(dom->conn, vm->def) < 0)
+        goto cleanup;
+
+    if (virDomainObjCheckActive(vm) < 0)
+        goto cleanup;
+
+    switch (source) {
+    case VIR_DOMAIN_INTERFACE_ADDRESSES_SRC_LEASE:
+        ret = qemuGetDHCPInterfaces(dom, vm, ifaces);
+        break;
+
+    case VIR_DOMAIN_INTERFACE_ADDRESSES_SRC_AGENT:
+        if (qemuDomainObjBeginAgentJob(driver, vm, QEMU_AGENT_JOB_QUERY) < 0)
+            goto cleanup;
+
+        if (!qemuDomainAgentAvailable(vm, true))
+            goto endjob;
+
+        agent = qemuDomainObjEnterAgent(vm);
+        ret = qemuAgentGetInterfaces(agent, ifaces);
+        qemuDomainObjExitAgent(vm, agent);
+
+    endjob:
+        qemuDomainObjEndAgentJob(vm);
+
+        break;
+
+    case VIR_DOMAIN_INTERFACE_ADDRESSES_SRC_ARP:
+        ret = qemuARPGetInterfaces(vm, ifaces);
+        break;
+
+    default:
+        virReportError(VIR_ERR_ARGUMENT_UNSUPPORTED,
+                       _("Unknown IP address data source %d"),
+                       source);
+        break;
+    }
+
+ cleanup:
+    virDomainObjEndAPI(&vm);
+    return ret;
+}
+
+
 static int
 qemuDomainSetUserPassword(virDomainPtr dom,
                           const char *user,
-- 
2.23.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]

  Powered by Linux