[libvirt] [PATCH RFC 02/22] qemu_process: Use qemuProcess prefix

Chris Venteicher posted 22 patches 6 years ago
[libvirt] [PATCH RFC 02/22] qemu_process: Use qemuProcess prefix
Posted by Chris Venteicher 6 years ago
s/virQEMUCapsInitQMPCommand/qemuProcess/

No functionality change.

Use appropriate prefix in moved code.

Signed-off-by: Chris Venteicher <cventeic@redhat.com>
---
 src/qemu/qemu_capabilities.c | 14 +++++++-------
 src/qemu/qemu_process.c      | 28 ++++++++++++++--------------
 src/qemu/qemu_process.h      | 22 +++++++++++-----------
 3 files changed, 32 insertions(+), 32 deletions(-)

diff --git a/src/qemu/qemu_capabilities.c b/src/qemu/qemu_capabilities.c
index 0f70fdf46d..f6d97648ce 100644
--- a/src/qemu/qemu_capabilities.c
+++ b/src/qemu/qemu_capabilities.c
@@ -4219,15 +4219,15 @@ virQEMUCapsInitQMP(virQEMUCapsPtr qemuCaps,
                    gid_t runGid,
                    char **qmperr)
 {
-    virQEMUCapsInitQMPCommandPtr cmd = NULL;
+    qemuProcessPtr cmd = NULL;
     int ret = -1;
     int rc;
 
-    if (!(cmd = virQEMUCapsInitQMPCommandNew(qemuCaps->binary, libDir,
-                                             runUid, runGid, qmperr)))
+    if (!(proc = qemuProcessNew(qemuCaps->binary, libDir,
+                                runUid, runGid, qmperr)))
         goto cleanup;
 
-    if ((rc = virQEMUCapsInitQMPCommandRun(cmd, false)) != 0) {
+    if ((rc = qemuProcessRun(cmd, false)) != 0) {
         if (rc == 1)
             ret = 0;
         goto cleanup;
@@ -4237,8 +4237,8 @@ virQEMUCapsInitQMP(virQEMUCapsPtr qemuCaps,
         goto cleanup;
 
     if (virQEMUCapsGet(qemuCaps, QEMU_CAPS_KVM)) {
-        virQEMUCapsInitQMPCommandAbort(cmd);
-        if ((rc = virQEMUCapsInitQMPCommandRun(cmd, true)) != 0) {
+        qemuProcessAbort(cmd);
+        if ((rc = qemuProcessRun(cmd, true)) != 0) {
             if (rc == 1)
                 ret = 0;
             goto cleanup;
@@ -4251,7 +4251,7 @@ virQEMUCapsInitQMP(virQEMUCapsPtr qemuCaps,
     ret = 0;
 
  cleanup:
-    virQEMUCapsInitQMPCommandFree(cmd);
+    qemuProcessFree(cmd);
     return ret;
 }
 
diff --git a/src/qemu/qemu_process.c b/src/qemu/qemu_process.c
index 0b3922fa39..dff0482856 100644
--- a/src/qemu/qemu_process.c
+++ b/src/qemu/qemu_process.c
@@ -8081,12 +8081,12 @@ static qemuMonitorCallbacks callbacks = {
 
 
 void
-virQEMUCapsInitQMPCommandFree(virQEMUCapsInitQMPCommandPtr cmd)
+qemuProcessFree(qemuProcessPtr cmd)
 {
     if (!cmd)
         return;
 
-    virQEMUCapsInitQMPCommandAbort(cmd);
+    qemuProcessAbort(cmd);
     VIR_FREE(cmd->binary);
     VIR_FREE(cmd->monpath);
     VIR_FREE(cmd->monarg);
@@ -8095,14 +8095,14 @@ virQEMUCapsInitQMPCommandFree(virQEMUCapsInitQMPCommandPtr cmd)
 }
 
 
-virQEMUCapsInitQMPCommandPtr
-virQEMUCapsInitQMPCommandNew(char *binary,
-                             const char *libDir,
-                             uid_t runUid,
-                             gid_t runGid,
-                             char **qmperr)
+qemuProcessPtr
+qemuProcessNew(char *binary,
+               const char *libDir,
+               uid_t runUid,
+               gid_t runGid,
+               char **qmperr)
 {
-    virQEMUCapsInitQMPCommandPtr cmd = NULL;
+    qemuProcessPtr cmd = NULL;
 
     if (VIR_ALLOC(cmd) < 0)
         goto error;
@@ -8141,7 +8141,7 @@ virQEMUCapsInitQMPCommandNew(char *binary,
     return cmd;
 
  error:
-    virQEMUCapsInitQMPCommandFree(cmd);
+    qemuProcessFree(cmd);
     return NULL;
 }
 
@@ -8151,8 +8151,8 @@ virQEMUCapsInitQMPCommandNew(char *binary,
  *          1 when probing QEMU failed
  */
 int
-virQEMUCapsInitQMPCommandRun(virQEMUCapsInitQMPCommandPtr cmd,
-                             bool forceTCG)
+qemuProcessRun(qemuProcessPtr cmd,
+               bool forceTCG)
 {
     virDomainXMLOptionPtr xmlopt = NULL;
     const char *machine;
@@ -8222,7 +8222,7 @@ virQEMUCapsInitQMPCommandRun(virQEMUCapsInitQMPCommandPtr cmd,
 
  cleanup:
     if (!cmd->mon)
-        virQEMUCapsInitQMPCommandAbort(cmd);
+        qemuProcessAbort(cmd);
     virObjectUnref(xmlopt);
 
     return ret;
@@ -8234,7 +8234,7 @@ virQEMUCapsInitQMPCommandRun(virQEMUCapsInitQMPCommandPtr cmd,
 
 
 void
-virQEMUCapsInitQMPCommandAbort(virQEMUCapsInitQMPCommandPtr cmd)
+qemuProcessAbort(qemuProcessPtr cmd)
 {
     if (cmd->mon)
         virObjectUnlock(cmd->mon);
diff --git a/src/qemu/qemu_process.h b/src/qemu/qemu_process.h
index 4ba3988e3d..5417cb416f 100644
--- a/src/qemu/qemu_process.h
+++ b/src/qemu/qemu_process.h
@@ -214,9 +214,9 @@ int qemuProcessStartManagedPRDaemon(virDomainObjPtr vm);
 
 void qemuProcessKillManagedPRDaemon(virDomainObjPtr vm);
 
-typedef struct _virQEMUCapsInitQMPCommand virQEMUCapsInitQMPCommand;
-typedef virQEMUCapsInitQMPCommand *virQEMUCapsInitQMPCommandPtr;
-struct _virQEMUCapsInitQMPCommand {
+typedef struct _qemuProcess qemuProcess;
+typedef qemuProcess *qemuProcessPtr;
+struct _qemuProcess {
     char *binary;
     uid_t runUid;
     gid_t runGid;
@@ -231,16 +231,16 @@ struct _virQEMUCapsInitQMPCommand {
     virDomainObjPtr vm;
 };
 
-virQEMUCapsInitQMPCommandPtr virQEMUCapsInitQMPCommandNew(char *binary,
-                                                          const char *libDir,
-                                                          uid_t runUid,
-                                                          gid_t runGid,
-                                                          char **qmperr);
+qemuProcessPtr qemuProcessNew(char *binary,
+                              const char *libDir,
+                              uid_t runUid,
+                              gid_t runGid,
+                              char **qmperr);
 
-void virQEMUCapsInitQMPCommandFree(virQEMUCapsInitQMPCommandPtr cmd);
+void qemuProcessFree(qemuProcessPtr cmd);
 
-int virQEMUCapsInitQMPCommandRun(virQEMUCapsInitQMPCommandPtr cmd, bool forceTCG);
+int qemuProcessRun(qemuProcessPtr cmd, bool forceTCG);
 
-void virQEMUCapsInitQMPCommandAbort(virQEMUCapsInitQMPCommandPtr cmd);
+void qemuProcessAbort(qemuProcessPtr cmd);
 
 #endif /* __QEMU_PROCESS_H__ */
-- 
2.17.1

--
libvir-list mailing list
libvir-list@redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list
Re: [libvirt] [PATCH RFC 02/22] qemu_process: Use qemuProcess prefix
Posted by Michal Privoznik 6 years ago
On 11/11/2018 08:59 PM, Chris Venteicher wrote:
> s/virQEMUCapsInitQMPCommand/qemuProcess/
> 
> No functionality change.
> 
> Use appropriate prefix in moved code.
> 
> Signed-off-by: Chris Venteicher <cventeic@redhat.com>
> ---
>  src/qemu/qemu_capabilities.c | 14 +++++++-------
>  src/qemu/qemu_process.c      | 28 ++++++++++++++--------------
>  src/qemu/qemu_process.h      | 22 +++++++++++-----------
>  3 files changed, 32 insertions(+), 32 deletions(-)
> 
> diff --git a/src/qemu/qemu_capabilities.c b/src/qemu/qemu_capabilities.c
> index 0f70fdf46d..f6d97648ce 100644
> --- a/src/qemu/qemu_capabilities.c
> +++ b/src/qemu/qemu_capabilities.c
> @@ -4219,15 +4219,15 @@ virQEMUCapsInitQMP(virQEMUCapsPtr qemuCaps,
>                     gid_t runGid,
>                     char **qmperr)
>  {
> -    virQEMUCapsInitQMPCommandPtr cmd = NULL;
> +    qemuProcessPtr cmd = NULL;
>      int ret = -1;
>      int rc;
>  
> -    if (!(cmd = virQEMUCapsInitQMPCommandNew(qemuCaps->binary, libDir,
> -                                             runUid, runGid, qmperr)))
> +    if (!(proc = qemuProcessNew(qemuCaps->binary, libDir,

Ooops, this needs to stay @cmd. The idea is that after every single
commit one has to be able to 'make all syntax-check check'.

> +                                runUid, runGid, qmperr)))
>          goto cleanup;
>  

Michal

--
libvir-list mailing list
libvir-list@redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list
Re: [libvirt] [PATCH RFC 02/22] qemu_process: Use qemuProcess prefix
Posted by Jiri Denemark 6 years ago
On Sun, Nov 11, 2018 at 13:59:10 -0600, Chris Venteicher wrote:
> s/virQEMUCapsInitQMPCommand/qemuProcess/

I think the new prefix should be qemuProcessQMP rather than qemuProcess.
It's only ever used in the QMP code and while we may want to merge the
code with the "normal" process code when possible and useful, we're not
there yet. Thus the generic naming could be quite confusing.

Otherwise this looks OK.

Jirka

--
libvir-list mailing list
libvir-list@redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list