[PATCH 05/14] qemu: pass virDomainObjPtr to qemuBuildCommandLine

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

 



Extract the required data inside a function instead of passing it
all as arguments.

Signed-off-by: Pavel Hrdina <phrdina@xxxxxxxxxx>
---
 src/qemu/qemu_command.c | 18 ++++++++++--------
 src/qemu/qemu_command.h | 11 ++---------
 src/qemu/qemu_process.c | 19 ++++---------------
 3 files changed, 16 insertions(+), 32 deletions(-)

diff --git a/src/qemu/qemu_command.c b/src/qemu/qemu_command.c
index 6b6de08e47..935b05226d 100644
--- a/src/qemu/qemu_command.c
+++ b/src/qemu/qemu_command.c
@@ -9947,26 +9947,28 @@ qemuBuildCommandLineValidate(virQEMUDriverPtr driver,
 virCommandPtr
 qemuBuildCommandLine(virQEMUDriverPtr driver,
                      virLogManagerPtr logManager,
-                     virDomainDefPtr def,
-                     virDomainChrSourceDefPtr monitor_chr,
-                     bool monitor_json,
-                     virQEMUCapsPtr qemuCaps,
+                     virDomainObjPtr vm,
                      const char *migrateURI,
                      virDomainSnapshotObjPtr snapshot,
                      virNetDevVPortProfileOp vmop,
                      bool standalone,
                      bool enableFips,
-                     virBitmapPtr nodeset,
                      size_t *nnicindexes,
-                     int **nicindexes,
-                     const char *domainLibDir,
-                     bool chardevStdioLogd)
+                     int **nicindexes)
 {
     size_t i;
     char uuid[VIR_UUID_STRING_BUFLEN];
     virCommandPtr cmd = NULL;
     virQEMUDriverConfigPtr cfg = virQEMUDriverGetConfig(driver);
     unsigned int bootHostdevNet = 0;
+    qemuDomainObjPrivatePtr priv = vm->privateData;
+    virDomainDefPtr def = vm->def;
+    virDomainChrSourceDefPtr monitor_chr = priv->monConfig;
+    bool monitor_json = priv->monJSON;
+    virQEMUCapsPtr qemuCaps = priv->qemuCaps;
+    virBitmapPtr nodeset = priv->autoNodeset;
+    const char *domainLibDir = priv->libDir;
+    bool chardevStdioLogd = priv->chardevStdioLogd;
 
     VIR_DEBUG("driver=%p def=%p mon=%p json=%d "
               "qemuCaps=%p migrateURI=%s snapshot=%p vmop=%d",
diff --git a/src/qemu/qemu_command.h b/src/qemu/qemu_command.h
index 94e4592ccd..e1ddc43d62 100644
--- a/src/qemu/qemu_command.h
+++ b/src/qemu/qemu_command.h
@@ -45,21 +45,14 @@ VIR_ENUM_DECL(qemuVideo)
 
 virCommandPtr qemuBuildCommandLine(virQEMUDriverPtr driver,
                                    virLogManagerPtr logManager,
-                                   virDomainDefPtr def,
-                                   virDomainChrSourceDefPtr monitor_chr,
-                                   bool monitor_json,
-                                   virQEMUCapsPtr qemuCaps,
+                                   virDomainObjPtr vm,
                                    const char *migrateURI,
                                    virDomainSnapshotObjPtr snapshot,
                                    virNetDevVPortProfileOp vmop,
                                    bool standalone,
                                    bool enableFips,
-                                   virBitmapPtr nodeset,
                                    size_t *nnicindexes,
-                                   int **nicindexes,
-                                   const char *domainLibDir,
-                                   bool chardevStdioLogd)
-    ATTRIBUTE_NONNULL(15);
+                                   int **nicindexes);
 
 
 /* Generate the object properties for a secret */
diff --git a/src/qemu/qemu_process.c b/src/qemu/qemu_process.c
index 1898d1c8a3..11914a72f3 100644
--- a/src/qemu/qemu_process.c
+++ b/src/qemu/qemu_process.c
@@ -5650,16 +5650,12 @@ qemuProcessLaunch(virConnectPtr conn,
     VIR_DEBUG("Building emulator command line");
     if (!(cmd = qemuBuildCommandLine(driver,
                                      qemuDomainLogContextGetManager(logCtxt),
-                                     vm->def, priv->monConfig,
-                                     priv->monJSON, priv->qemuCaps,
+                                     vm,
                                      incoming ? incoming->launchURI : NULL,
                                      snapshot, vmop,
                                      false,
                                      qemuCheckFips(),
-                                     priv->autoNodeset,
-                                     &nnicindexes, &nicindexes,
-                                     priv->libDir,
-                                     priv->chardevStdioLogd)))
+                                     &nnicindexes, &nicindexes)))
         goto cleanup;
 
     if (incoming && incoming->fd != -1)
@@ -6086,7 +6082,6 @@ qemuProcessCreatePretendCmd(virConnectPtr conn,
                             bool standalone,
                             unsigned int flags)
 {
-    qemuDomainObjPrivatePtr priv = vm->privateData;
     virCommandPtr cmd = NULL;
 
     virCheckFlagsGoto(VIR_QEMU_PROCESS_START_COLD |
@@ -6106,20 +6101,14 @@ qemuProcessCreatePretendCmd(virConnectPtr conn,
     VIR_DEBUG("Building emulator command line");
     cmd = qemuBuildCommandLine(driver,
                                NULL,
-                               vm->def,
-                               priv->monConfig,
-                               priv->monJSON,
-                               priv->qemuCaps,
+                               vm,
                                migrateURI,
                                NULL,
                                VIR_NETDEV_VPORT_PROFILE_OP_NO_OP,
                                standalone,
                                enableFips,
-                               priv->autoNodeset,
-                               NULL,
                                NULL,
-                               priv->libDir,
-                               priv->chardevStdioLogd);
+                               NULL);
 
  cleanup:
     return cmd;
-- 
2.13.6

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