qemuProcessQMPNew 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. Signed-off-by: Chris Venteicher <cventeic@xxxxxxxxxx> --- src/qemu/qemu_process.c | 29 ++++++++++++++++++++++++----- 1 file changed, 24 insertions(+), 5 deletions(-) diff --git a/src/qemu/qemu_process.c b/src/qemu/qemu_process.c index 91532c19ce..58842a0f1c 100644 --- a/src/qemu/qemu_process.c +++ b/src/qemu/qemu_process.c @@ -8220,6 +8220,18 @@ qemuProcessQMPFree(qemuProcessQMPPtr proc) } +/** + * qemuProcessQMPNew: + * @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. + */ qemuProcessQMPPtr qemuProcessQMPNew(const char *binary, const char *libDir, @@ -8227,24 +8239,31 @@ qemuProcessQMPNew(const char *binary, gid_t runGid, bool forceTCG) { + qemuProcessQMPPtr ret = NULL; qemuProcessQMPPtr proc = NULL; + VIR_DEBUG("exec=%s, libDir=%s, runUid=%u, runGid=%u, forceTCG=%d", + binary, 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->runUid = runUid; proc->runGid = runGid; proc->forceTCG = forceTCG; - return proc; + VIR_STEAL_PTR(ret, proc); - error: + cleanup: qemuProcessQMPFree(proc); - return NULL; + + VIR_DEBUG("ret=%p", ret); + + return ret; } -- 2.17.1 -- libvir-list mailing list libvir-list@xxxxxxxxxx https://www.redhat.com/mailman/listinfo/libvir-list