mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2025-01-11 07:17:44 +00:00
qemu_process: Document and cleanup qemuProcessQMPNew
qemuProcessQMPNew is one of the 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@redhat.com> Reviewed-by: Jiri Denemark <jdenemar@redhat.com> Reviewed-by: Ján Tomko <jtomko@redhat.com>
This commit is contained in:
parent
095d36d052
commit
e691b150e4
@ -8341,6 +8341,17 @@ 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 for completing QMP queries.
|
||||||
|
*/
|
||||||
qemuProcessQMPPtr
|
qemuProcessQMPPtr
|
||||||
qemuProcessQMPNew(const char *binary,
|
qemuProcessQMPNew(const char *binary,
|
||||||
const char *libDir,
|
const char *libDir,
|
||||||
@ -8348,24 +8359,28 @@ qemuProcessQMPNew(const char *binary,
|
|||||||
gid_t runGid,
|
gid_t runGid,
|
||||||
bool forceTCG)
|
bool forceTCG)
|
||||||
{
|
{
|
||||||
|
qemuProcessQMPPtr ret = NULL;
|
||||||
qemuProcessQMPPtr proc = 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)
|
if (VIR_ALLOC(proc) < 0)
|
||||||
goto error;
|
goto cleanup;
|
||||||
|
|
||||||
if (VIR_STRDUP(proc->binary, binary) < 0 ||
|
if (VIR_STRDUP(proc->binary, binary) < 0 ||
|
||||||
VIR_STRDUP(proc->libDir, libDir) < 0)
|
VIR_STRDUP(proc->libDir, libDir) < 0)
|
||||||
goto error;
|
goto cleanup;
|
||||||
|
|
||||||
proc->runUid = runUid;
|
proc->runUid = runUid;
|
||||||
proc->runGid = runGid;
|
proc->runGid = runGid;
|
||||||
proc->forceTCG = forceTCG;
|
proc->forceTCG = forceTCG;
|
||||||
|
|
||||||
return proc;
|
VIR_STEAL_PTR(ret, proc);
|
||||||
|
|
||||||
error:
|
cleanup:
|
||||||
qemuProcessQMPFree(proc);
|
qemuProcessQMPFree(proc);
|
||||||
return NULL;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user