qemuProcessNew is one of the 4 public functions used to create and
manage a qemu process for QMP command exchanges outside of domain
operations.
Add descriptive comment block, Debug statement and make source
consistent with the cleanup / VIR_STEAL_PTR format used elsewhere.
No functional changes are made.
Signed-off-by: Chris Venteicher <cventeic(a)redhat.com>
---
src/qemu/qemu_process.c | 26 +++++++++++++++++++++-----
1 file changed, 21 insertions(+), 5 deletions(-)
diff --git a/src/qemu/qemu_process.c b/src/qemu/qemu_process.c
index af6b20713a..104ed58cea 100644
--- a/src/qemu/qemu_process.c
+++ b/src/qemu/qemu_process.c
@@ -8094,6 +8094,18 @@ qemuProcessFree(qemuProcessPtr proc)
}
+/**
+ * qemuProcessNew:
+ * @binary: Qemu binary
+ * @libDir: Directory for process and connection artifacts
+ * @runUid: UserId for Qemu Process
+ * @runGid: GroupId for Qemu Process
+ * @forceTCG: Force TCG mode if true
+ *
+ * Allocate and initialize domain structure encapsulating
+ * QEMU Process state and monitor connection to QEMU
+ * for completing QMP Queries.
+ */
qemuProcessPtr
qemuProcessNew(const char *binary,
const char *libDir,
@@ -8101,25 +8113,29 @@ qemuProcessNew(const char *binary,
gid_t runGid,
bool forceTCG)
{
+ qemuProcessPtr ret = NULL;
qemuProcessPtr proc = NULL;
+ VIR_DEBUG("exec=%s, libDir=%s, runUid=%u, runGid=%u, forceTCG=%d",
+ NULLSTR(binary), NULLSTR(libDir), runUid, runGid, forceTCG);
+
if (VIR_ALLOC(proc) < 0)
- goto error;
+ goto cleanup;
if (VIR_STRDUP(proc->binary, binary) < 0 ||
VIR_STRDUP(proc->libDir, libDir) < 0)
- goto error;
+ goto cleanup;
proc->forceTCG = forceTCG;
proc->runUid = runUid;
proc->runGid = runGid;
- return proc;
+ VIR_STEAL_PTR(ret, proc);
- error:
+ cleanup:
qemuProcessFree(proc);
- return NULL;
+ return ret;
}
--
2.17.1