On Wed, Feb 06, 2013 at 04:30:18PM +0100, Jiri Denemark wrote:
On Wed, Feb 06, 2013 at 11:54:50 +0000, Daniel P. Berrange wrote:
> From: "Daniel P. Berrange" <berrange(a)redhat.com>
>
> To avoid confusion between 'virCapsPtr' and 'qemuCapsPtr'
> do some renaming of various.
Sounds like you wanted to say something more or forgot to delete "to
various".
> All instances of 'qemuCapsPtr'
> are renamed to 'qemuCaps'. To avoid that clashing with
> the 'qemuCaps' typedef though, rename the latter to
> virQEMUCaps.
> ---
> src/qemu/qemu_capabilities.c | 860 +++++++++++++++++++++----------------------
> src/qemu/qemu_capabilities.h | 114 +++---
> src/qemu/qemu_command.c | 648 ++++++++++++++++----------------
> src/qemu/qemu_command.h | 60 +--
> src/qemu/qemu_conf.h | 2 +-
> src/qemu/qemu_domain.c | 20 +-
> src/qemu/qemu_domain.h | 2 +-
> src/qemu/qemu_driver.c | 130 +++----
> src/qemu/qemu_hotplug.c | 138 +++----
> src/qemu/qemu_migration.c | 18 +-
> src/qemu/qemu_process.c | 70 ++--
> tests/qemuhelptest.c | 32 +-
> tests/qemuxml2argvtest.c | 32 +-
> tests/qemuxmlnstest.c | 24 +-
> 14 files changed, 1076 insertions(+), 1074 deletions(-)
I'm not sure if it was intentional or not but the rename of all
qemuCapsPtr (now virQEMUCapsPtr) to qemuCaps is incomplete. Lots of
missed instances can be found in src/qemu/qemu_capabilities.[ch] and two
of them remained in src/qemu/qemu_process.c.
Hmm, yes that was an oversight.
Here is a delta-patch for review.
Daniel
diff --git a/src/qemu/qemu_capabilities.c b/src/qemu/qemu_capabilities.c
index 32b8ee2..4efe052 100644
--- a/src/qemu/qemu_capabilities.c
+++ b/src/qemu/qemu_capabilities.c
@@ -247,9 +247,9 @@ static void virQEMUCapsDispose(void *obj);
static int virQEMUCapsOnceInit(void)
{
if (!(virQEMUCapsClass = virClassNew(virClassForObject(),
- "virQEMUCaps",
- sizeof(virQEMUCaps),
- virQEMUCapsDispose)))
+ "virQEMUCaps",
+ sizeof(virQEMUCaps),
+ virQEMUCapsDispose)))
return -1;
return 0;
@@ -308,15 +308,15 @@ cleanup:
static virCommandPtr
virQEMUCapsProbeCommand(const char *qemu,
- virQEMUCapsPtr caps,
+ virQEMUCapsPtr qemuCaps,
virQEMUCapsHookDataPtr hookData)
{
virCommandPtr cmd = virCommandNew(qemu);
- if (caps) {
- if (virQEMUCapsGet(caps, QEMU_CAPS_NO_USER_CONFIG))
+ if (qemuCaps) {
+ if (virQEMUCapsGet(qemuCaps, QEMU_CAPS_NO_USER_CONFIG))
virCommandAddArg(cmd, "-no-user-config");
- else if (virQEMUCapsGet(caps, QEMU_CAPS_NODEFCONFIG))
+ else if (virQEMUCapsGet(qemuCaps, QEMU_CAPS_NODEFCONFIG))
virCommandAddArg(cmd, "-nodefconfig");
}
@@ -329,20 +329,20 @@ virQEMUCapsProbeCommand(const char *qemu,
static void
-virQEMUCapsSetDefaultMachine(virQEMUCapsPtr caps,
+virQEMUCapsSetDefaultMachine(virQEMUCapsPtr qemuCaps,
size_t defIdx)
{
- char *name = caps->machineTypes[defIdx];
- char *alias = caps->machineAliases[defIdx];
-
- memmove(caps->machineTypes + 1,
- caps->machineTypes,
- sizeof(caps->machineTypes[0]) * defIdx);
- memmove(caps->machineAliases + 1,
- caps->machineAliases,
- sizeof(caps->machineAliases[0]) * defIdx);
- caps->machineTypes[0] = name;
- caps->machineAliases[0] = alias;
+ char *name = qemuCaps->machineTypes[defIdx];
+ char *alias = qemuCaps->machineAliases[defIdx];
+
+ memmove(qemuCaps->machineTypes + 1,
+ qemuCaps->machineTypes,
+ sizeof(qemuCaps->machineTypes[0]) * defIdx);
+ memmove(qemuCaps->machineAliases + 1,
+ qemuCaps->machineAliases,
+ sizeof(qemuCaps->machineAliases[0]) * defIdx);
+ qemuCaps->machineTypes[0] = name;
+ qemuCaps->machineAliases[0] = alias;
}
/* Format is:
@@ -350,7 +350,7 @@ virQEMUCapsSetDefaultMachine(virQEMUCapsPtr caps,
*/
static int
virQEMUCapsParseMachineTypesStr(const char *output,
- virQEMUCapsPtr caps)
+ virQEMUCapsPtr qemuCaps)
{
const char *p = output;
const char *next;
@@ -375,7 +375,7 @@ virQEMUCapsParseMachineTypesStr(const char *output,
p = t;
if ((t = strstr(p, "(default)")) && (!next || t < next))
- defIdx = caps->nmachineTypes;
+ defIdx = qemuCaps->nmachineTypes;
if ((t = strstr(p, "(alias of ")) && (!next || t < next)) {
p = t + strlen("(alias of ");
@@ -388,25 +388,25 @@ virQEMUCapsParseMachineTypesStr(const char *output,
}
}
- if (VIR_REALLOC_N(caps->machineTypes, caps->nmachineTypes + 1) < 0 ||
- VIR_REALLOC_N(caps->machineAliases, caps->nmachineTypes + 1) < 0) {
+ if (VIR_REALLOC_N(qemuCaps->machineTypes, qemuCaps->nmachineTypes + 1) <
0 ||
+ VIR_REALLOC_N(qemuCaps->machineAliases, qemuCaps->nmachineTypes + 1)
< 0) {
VIR_FREE(name);
VIR_FREE(canonical);
goto no_memory;
}
- caps->nmachineTypes++;
+ qemuCaps->nmachineTypes++;
if (canonical) {
- caps->machineTypes[caps->nmachineTypes-1] = canonical;
- caps->machineAliases[caps->nmachineTypes-1] = name;
+ qemuCaps->machineTypes[qemuCaps->nmachineTypes-1] = canonical;
+ qemuCaps->machineAliases[qemuCaps->nmachineTypes-1] = name;
} else {
- caps->machineTypes[caps->nmachineTypes-1] = name;
- caps->machineAliases[caps->nmachineTypes-1] = NULL;
+ qemuCaps->machineTypes[qemuCaps->nmachineTypes-1] = name;
+ qemuCaps->machineAliases[qemuCaps->nmachineTypes-1] = NULL;
}
} while ((p = next));
if (defIdx)
- virQEMUCapsSetDefaultMachine(caps, defIdx);
+ virQEMUCapsSetDefaultMachine(qemuCaps, defIdx);
return 0;
@@ -416,7 +416,7 @@ no_memory:
}
static int
-virQEMUCapsProbeMachineTypes(virQEMUCapsPtr caps, virQEMUCapsHookDataPtr hookData)
+virQEMUCapsProbeMachineTypes(virQEMUCapsPtr qemuCaps, virQEMUCapsHookDataPtr hookData)
{
char *output;
int ret = -1;
@@ -427,13 +427,13 @@ virQEMUCapsProbeMachineTypes(virQEMUCapsPtr caps,
virQEMUCapsHookDataPtr hookDat
* Technically we could catch the exec() failure, but that's
* in a sub-process so it's hard to feed back a useful error.
*/
- if (!virFileIsExecutable(caps->binary)) {
+ if (!virFileIsExecutable(qemuCaps->binary)) {
virReportSystemError(errno, _("Cannot find QEMU binary %s"),
- caps->binary);
+ qemuCaps->binary);
return -1;
}
- cmd = virQEMUCapsProbeCommand(caps->binary, caps, hookData);
+ cmd = virQEMUCapsProbeCommand(qemuCaps->binary, qemuCaps, hookData);
virCommandAddArgList(cmd, "-M", "?", NULL);
virCommandSetOutputBuffer(cmd, &output);
@@ -441,7 +441,7 @@ virQEMUCapsProbeMachineTypes(virQEMUCapsPtr caps,
virQEMUCapsHookDataPtr hookDat
if (virCommandRun(cmd, &status) < 0)
goto cleanup;
- if (virQEMUCapsParseMachineTypesStr(output, caps) < 0)
+ if (virQEMUCapsParseMachineTypesStr(output, qemuCaps) < 0)
goto cleanup;
ret = 0;
@@ -456,7 +456,7 @@ cleanup:
typedef int
(*virQEMUCapsParseCPUModels)(const char *output,
- virQEMUCapsPtr caps);
+ virQEMUCapsPtr qemuCaps);
/* Format:
* <arch> <model>
@@ -465,7 +465,7 @@ typedef int
*/
static int
virQEMUCapsParseX86Models(const char *output,
- virQEMUCapsPtr caps)
+ virQEMUCapsPtr qemuCaps)
{
const char *p = output;
const char *next;
@@ -491,7 +491,7 @@ virQEMUCapsParseX86Models(const char *output,
if (*p == '\0' || *p == '\n')
continue;
- if (VIR_EXPAND_N(caps->cpuDefinitions, caps->ncpuDefinitions, 1) < 0) {
+ if (VIR_EXPAND_N(qemuCaps->cpuDefinitions, qemuCaps->ncpuDefinitions, 1)
< 0) {
virReportOOMError();
goto cleanup;
}
@@ -506,7 +506,7 @@ virQEMUCapsParseX86Models(const char *output,
len -= 2;
}
- if (!(caps->cpuDefinitions[caps->ncpuDefinitions - 1] = strndup(p, len)))
{
+ if (!(qemuCaps->cpuDefinitions[qemuCaps->ncpuDefinitions - 1] = strndup(p,
len))) {
virReportOOMError();
goto cleanup;
}
@@ -523,7 +523,7 @@ cleanup:
*/
static int
virQEMUCapsParsePPCModels(const char *output,
- virQEMUCapsPtr caps)
+ virQEMUCapsPtr qemuCaps)
{
const char *p = output;
const char *next;
@@ -552,14 +552,14 @@ virQEMUCapsParsePPCModels(const char *output,
if (*p == '\n')
continue;
- if (VIR_EXPAND_N(caps->cpuDefinitions, caps->ncpuDefinitions, 1) < 0) {
+ if (VIR_EXPAND_N(qemuCaps->cpuDefinitions, qemuCaps->ncpuDefinitions, 1)
< 0) {
virReportOOMError();
goto cleanup;
}
len = t - p - 1;
- if (!(caps->cpuDefinitions[caps->ncpuDefinitions - 1] = strndup(p, len)))
{
+ if (!(qemuCaps->cpuDefinitions[qemuCaps->ncpuDefinitions - 1] = strndup(p,
len))) {
virReportOOMError();
goto cleanup;
}
@@ -572,32 +572,32 @@ cleanup:
}
static int
-virQEMUCapsProbeCPUModels(virQEMUCapsPtr caps, virQEMUCapsHookDataPtr hookData)
+virQEMUCapsProbeCPUModels(virQEMUCapsPtr qemuCaps, virQEMUCapsHookDataPtr hookData)
{
char *output = NULL;
int ret = -1;
virQEMUCapsParseCPUModels parse;
virCommandPtr cmd;
- if (caps->arch == VIR_ARCH_I686 ||
- caps->arch == VIR_ARCH_X86_64)
+ if (qemuCaps->arch == VIR_ARCH_I686 ||
+ qemuCaps->arch == VIR_ARCH_X86_64)
parse = virQEMUCapsParseX86Models;
- else if (caps->arch == VIR_ARCH_PPC64)
+ else if (qemuCaps->arch == VIR_ARCH_PPC64)
parse = virQEMUCapsParsePPCModels;
else {
VIR_DEBUG("don't know how to parse %s CPU models",
- virArchToString(caps->arch));
+ virArchToString(qemuCaps->arch));
return 0;
}
- cmd = virQEMUCapsProbeCommand(caps->binary, caps, hookData);
+ cmd = virQEMUCapsProbeCommand(qemuCaps->binary, qemuCaps, hookData);
virCommandAddArgList(cmd, "-cpu", "?", NULL);
virCommandSetOutputBuffer(cmd, &output);
if (virCommandRun(cmd, NULL) < 0)
goto cleanup;
- if (parse(output, caps) < 0)
+ if (parse(output, qemuCaps) < 0)
goto cleanup;
ret = 0;
@@ -920,8 +920,8 @@ virCapsPtr virQEMUCapsInit(virQEMUCapsCachePtr cache)
*/
for (i = 0 ; i < VIR_ARCH_LAST ; i++)
if (virQEMUCapsInitGuest(caps, cache,
- virArchFromHost(),
- i) < 0)
+ virArchFromHost(),
+ i) < 0)
goto error;
/* QEMU Requires an emulator in the XML */
@@ -942,130 +942,130 @@ virQEMUCapsComputeCmdFlags(const char *help,
unsigned int version,
unsigned int is_kvm,
unsigned int kvm_version,
- virQEMUCapsPtr caps,
+ virQEMUCapsPtr qemuCaps,
bool check_yajl ATTRIBUTE_UNUSED)
{
const char *p;
const char *fsdev, *netdev;
if (strstr(help, "-no-kqemu"))
- virQEMUCapsSet(caps, QEMU_CAPS_KQEMU);
+ virQEMUCapsSet(qemuCaps, QEMU_CAPS_KQEMU);
if (strstr(help, "-enable-kqemu"))
- virQEMUCapsSet(caps, QEMU_CAPS_ENABLE_KQEMU);
+ virQEMUCapsSet(qemuCaps, QEMU_CAPS_ENABLE_KQEMU);
if (strstr(help, "-no-kvm"))
- virQEMUCapsSet(caps, QEMU_CAPS_KVM);
+ virQEMUCapsSet(qemuCaps, QEMU_CAPS_KVM);
if (strstr(help, "-enable-kvm"))
- virQEMUCapsSet(caps, QEMU_CAPS_ENABLE_KVM);
+ virQEMUCapsSet(qemuCaps, QEMU_CAPS_ENABLE_KVM);
if (strstr(help, "-no-reboot"))
- virQEMUCapsSet(caps, QEMU_CAPS_NO_REBOOT);
+ virQEMUCapsSet(qemuCaps, QEMU_CAPS_NO_REBOOT);
if (strstr(help, "-name")) {
- virQEMUCapsSet(caps, QEMU_CAPS_NAME);
+ virQEMUCapsSet(qemuCaps, QEMU_CAPS_NAME);
if (strstr(help, ",process="))
- virQEMUCapsSet(caps, QEMU_CAPS_NAME_PROCESS);
+ virQEMUCapsSet(qemuCaps, QEMU_CAPS_NAME_PROCESS);
}
if (strstr(help, "-uuid"))
- virQEMUCapsSet(caps, QEMU_CAPS_UUID);
+ virQEMUCapsSet(qemuCaps, QEMU_CAPS_UUID);
if (strstr(help, "-xen-domid"))
- virQEMUCapsSet(caps, QEMU_CAPS_XEN_DOMID);
+ virQEMUCapsSet(qemuCaps, QEMU_CAPS_XEN_DOMID);
else if (strstr(help, "-domid"))
- virQEMUCapsSet(caps, QEMU_CAPS_DOMID);
+ virQEMUCapsSet(qemuCaps, QEMU_CAPS_DOMID);
if (strstr(help, "-drive")) {
const char *cache = strstr(help, "cache=");
- virQEMUCapsSet(caps, QEMU_CAPS_DRIVE);
+ virQEMUCapsSet(qemuCaps, QEMU_CAPS_DRIVE);
if (cache && (p = strchr(cache, ']'))) {
if (memmem(cache, p - cache, "on|off", sizeof("on|off") -
1) == NULL)
- virQEMUCapsSet(caps, QEMU_CAPS_DRIVE_CACHE_V2);
+ virQEMUCapsSet(qemuCaps, QEMU_CAPS_DRIVE_CACHE_V2);
if (memmem(cache, p - cache, "directsync",
sizeof("directsync") - 1))
- virQEMUCapsSet(caps, QEMU_CAPS_DRIVE_CACHE_DIRECTSYNC);
+ virQEMUCapsSet(qemuCaps, QEMU_CAPS_DRIVE_CACHE_DIRECTSYNC);
if (memmem(cache, p - cache, "unsafe", sizeof("unsafe") -
1))
- virQEMUCapsSet(caps, QEMU_CAPS_DRIVE_CACHE_UNSAFE);
+ virQEMUCapsSet(qemuCaps, QEMU_CAPS_DRIVE_CACHE_UNSAFE);
}
if (strstr(help, "format="))
- virQEMUCapsSet(caps, QEMU_CAPS_DRIVE_FORMAT);
+ virQEMUCapsSet(qemuCaps, QEMU_CAPS_DRIVE_FORMAT);
if (strstr(help, "readonly="))
- virQEMUCapsSet(caps, QEMU_CAPS_DRIVE_READONLY);
+ virQEMUCapsSet(qemuCaps, QEMU_CAPS_DRIVE_READONLY);
if (strstr(help, "aio=threads|native"))
- virQEMUCapsSet(caps, QEMU_CAPS_DRIVE_AIO);
+ virQEMUCapsSet(qemuCaps, QEMU_CAPS_DRIVE_AIO);
if (strstr(help, "copy-on-read=on|off"))
- virQEMUCapsSet(caps, QEMU_CAPS_DRIVE_COPY_ON_READ);
+ virQEMUCapsSet(qemuCaps, QEMU_CAPS_DRIVE_COPY_ON_READ);
if (strstr(help, "bps="))
- virQEMUCapsSet(caps, QEMU_CAPS_DRIVE_IOTUNE);
+ virQEMUCapsSet(qemuCaps, QEMU_CAPS_DRIVE_IOTUNE);
}
if ((p = strstr(help, "-vga")) && !strstr(help,
"-std-vga")) {
const char *nl = strstr(p, "\n");
- virQEMUCapsSet(caps, QEMU_CAPS_VGA);
+ virQEMUCapsSet(qemuCaps, QEMU_CAPS_VGA);
if (strstr(p, "|qxl"))
- virQEMUCapsSet(caps, QEMU_CAPS_VGA_QXL);
+ virQEMUCapsSet(qemuCaps, QEMU_CAPS_VGA_QXL);
if ((p = strstr(p, "|none")) && p < nl)
- virQEMUCapsSet(caps, QEMU_CAPS_VGA_NONE);
+ virQEMUCapsSet(qemuCaps, QEMU_CAPS_VGA_NONE);
}
if (strstr(help, "-spice"))
- virQEMUCapsSet(caps, QEMU_CAPS_SPICE);
+ virQEMUCapsSet(qemuCaps, QEMU_CAPS_SPICE);
if (strstr(help, "-vnc"))
- virQEMUCapsSet(caps, QEMU_CAPS_VNC);
+ virQEMUCapsSet(qemuCaps, QEMU_CAPS_VNC);
if (strstr(help, "seamless-migration="))
- virQEMUCapsSet(caps, QEMU_CAPS_SEAMLESS_MIGRATION);
+ virQEMUCapsSet(qemuCaps, QEMU_CAPS_SEAMLESS_MIGRATION);
if (strstr(help, "boot=on"))
- virQEMUCapsSet(caps, QEMU_CAPS_DRIVE_BOOT);
+ virQEMUCapsSet(qemuCaps, QEMU_CAPS_DRIVE_BOOT);
if (strstr(help, "serial=s"))
- virQEMUCapsSet(caps, QEMU_CAPS_DRIVE_SERIAL);
+ virQEMUCapsSet(qemuCaps, QEMU_CAPS_DRIVE_SERIAL);
if (strstr(help, "-pcidevice"))
- virQEMUCapsSet(caps, QEMU_CAPS_PCIDEVICE);
+ virQEMUCapsSet(qemuCaps, QEMU_CAPS_PCIDEVICE);
if (strstr(help, "-mem-path"))
- virQEMUCapsSet(caps, QEMU_CAPS_MEM_PATH);
+ virQEMUCapsSet(qemuCaps, QEMU_CAPS_MEM_PATH);
if (strstr(help, "-chardev")) {
- virQEMUCapsSet(caps, QEMU_CAPS_CHARDEV);
+ virQEMUCapsSet(qemuCaps, QEMU_CAPS_CHARDEV);
if (strstr(help, "-chardev spicevmc"))
- virQEMUCapsSet(caps, QEMU_CAPS_CHARDEV_SPICEVMC);
+ virQEMUCapsSet(qemuCaps, QEMU_CAPS_CHARDEV_SPICEVMC);
}
if (strstr(help, "-balloon"))
- virQEMUCapsSet(caps, QEMU_CAPS_BALLOON);
+ virQEMUCapsSet(qemuCaps, QEMU_CAPS_BALLOON);
if (strstr(help, "-device")) {
- virQEMUCapsSet(caps, QEMU_CAPS_DEVICE);
+ virQEMUCapsSet(qemuCaps, QEMU_CAPS_DEVICE);
/*
* When -device was introduced, qemu already supported drive's
* readonly option but didn't advertise that.
*/
- virQEMUCapsSet(caps, QEMU_CAPS_DRIVE_READONLY);
+ virQEMUCapsSet(qemuCaps, QEMU_CAPS_DRIVE_READONLY);
}
if (strstr(help, "-nodefconfig"))
- virQEMUCapsSet(caps, QEMU_CAPS_NODEFCONFIG);
+ virQEMUCapsSet(qemuCaps, QEMU_CAPS_NODEFCONFIG);
if (strstr(help, "-no-user-config"))
- virQEMUCapsSet(caps, QEMU_CAPS_NO_USER_CONFIG);
+ virQEMUCapsSet(qemuCaps, QEMU_CAPS_NO_USER_CONFIG);
/* The trailing ' ' is important to avoid a bogus match */
if (strstr(help, "-rtc "))
- virQEMUCapsSet(caps, QEMU_CAPS_RTC);
+ virQEMUCapsSet(qemuCaps, QEMU_CAPS_RTC);
/* to wit */
if (strstr(help, "-rtc-td-hack"))
- virQEMUCapsSet(caps, QEMU_CAPS_RTC_TD_HACK);
+ virQEMUCapsSet(qemuCaps, QEMU_CAPS_RTC_TD_HACK);
if (strstr(help, "-no-hpet"))
- virQEMUCapsSet(caps, QEMU_CAPS_NO_HPET);
+ virQEMUCapsSet(qemuCaps, QEMU_CAPS_NO_HPET);
if (strstr(help, "-no-acpi"))
- virQEMUCapsSet(caps, QEMU_CAPS_NO_ACPI);
+ virQEMUCapsSet(qemuCaps, QEMU_CAPS_NO_ACPI);
if (strstr(help, "-no-kvm-pit-reinjection"))
- virQEMUCapsSet(caps, QEMU_CAPS_NO_KVM_PIT);
+ virQEMUCapsSet(qemuCaps, QEMU_CAPS_NO_KVM_PIT);
if (strstr(help, "-tdf"))
- virQEMUCapsSet(caps, QEMU_CAPS_TDF);
+ virQEMUCapsSet(qemuCaps, QEMU_CAPS_TDF);
if (strstr(help, "-enable-nesting"))
- virQEMUCapsSet(caps, QEMU_CAPS_NESTING);
+ virQEMUCapsSet(qemuCaps, QEMU_CAPS_NESTING);
if (strstr(help, ",menu=on"))
- virQEMUCapsSet(caps, QEMU_CAPS_BOOT_MENU);
+ virQEMUCapsSet(qemuCaps, QEMU_CAPS_BOOT_MENU);
if (strstr(help, ",reboot-timeout=rb_time"))
- virQEMUCapsSet(caps, QEMU_CAPS_REBOOT_TIMEOUT);
+ virQEMUCapsSet(qemuCaps, QEMU_CAPS_REBOOT_TIMEOUT);
if ((fsdev = strstr(help, "-fsdev"))) {
- virQEMUCapsSet(caps, QEMU_CAPS_FSDEV);
+ virQEMUCapsSet(qemuCaps, QEMU_CAPS_FSDEV);
if (strstr(fsdev, "readonly"))
- virQEMUCapsSet(caps, QEMU_CAPS_FSDEV_READONLY);
+ virQEMUCapsSet(qemuCaps, QEMU_CAPS_FSDEV_READONLY);
if (strstr(fsdev, "writeout"))
- virQEMUCapsSet(caps, QEMU_CAPS_FSDEV_WRITEOUT);
+ virQEMUCapsSet(qemuCaps, QEMU_CAPS_FSDEV_WRITEOUT);
}
if (strstr(help, "-smbios type"))
- virQEMUCapsSet(caps, QEMU_CAPS_SMBIOS_TYPE);
+ virQEMUCapsSet(qemuCaps, QEMU_CAPS_SMBIOS_TYPE);
if (strstr(help, "-sandbox"))
- virQEMUCapsSet(caps, QEMU_CAPS_SECCOMP_SANDBOX);
+ virQEMUCapsSet(qemuCaps, QEMU_CAPS_SECCOMP_SANDBOX);
if ((netdev = strstr(help, "-netdev"))) {
/* Disable -netdev on 0.12 since although it exists,
@@ -1074,26 +1074,26 @@ virQEMUCapsComputeCmdFlags(const char *help,
* But see below about RHEL build. */
if (version >= 13000) {
if (strstr(netdev, "bridge"))
- virQEMUCapsSet(caps, QEMU_CAPS_NETDEV_BRIDGE);
- virQEMUCapsSet(caps, QEMU_CAPS_NETDEV);
+ virQEMUCapsSet(qemuCaps, QEMU_CAPS_NETDEV_BRIDGE);
+ virQEMUCapsSet(qemuCaps, QEMU_CAPS_NETDEV);
}
}
if (strstr(help, "-sdl"))
- virQEMUCapsSet(caps, QEMU_CAPS_SDL);
+ virQEMUCapsSet(qemuCaps, QEMU_CAPS_SDL);
if (strstr(help, "cores=") &&
strstr(help, "threads=") &&
strstr(help, "sockets="))
- virQEMUCapsSet(caps, QEMU_CAPS_SMP_TOPOLOGY);
+ virQEMUCapsSet(qemuCaps, QEMU_CAPS_SMP_TOPOLOGY);
if (version >= 9000)
- virQEMUCapsSet(caps, QEMU_CAPS_VNC_COLON);
+ virQEMUCapsSet(qemuCaps, QEMU_CAPS_VNC_COLON);
if (is_kvm && (version >= 10000 || kvm_version >= 74))
- virQEMUCapsSet(caps, QEMU_CAPS_VNET_HDR);
+ virQEMUCapsSet(qemuCaps, QEMU_CAPS_VNET_HDR);
if (strstr(help, ",vhost=")) {
- virQEMUCapsSet(caps, QEMU_CAPS_VHOST_NET);
+ virQEMUCapsSet(qemuCaps, QEMU_CAPS_VHOST_NET);
}
/* Do not use -no-shutdown if qemu doesn't support it or SIGTERM handling
@@ -1101,10 +1101,10 @@ virQEMUCapsComputeCmdFlags(const char *help,
* 0.14.* and 0.15.0)
*/
if (strstr(help, "-no-shutdown") && (version < 14000 || version
> 15000))
- virQEMUCapsSet(caps, QEMU_CAPS_NO_SHUTDOWN);
+ virQEMUCapsSet(qemuCaps, QEMU_CAPS_NO_SHUTDOWN);
if (strstr(help, "dump-guest-core=on|off"))
- virQEMUCapsSet(caps, QEMU_CAPS_DUMP_GUEST_CORE);
+ virQEMUCapsSet(qemuCaps, QEMU_CAPS_DUMP_GUEST_CORE);
/*
* Handling of -incoming arg with varying features
@@ -1119,25 +1119,25 @@ virQEMUCapsComputeCmdFlags(const char *help,
* while waiting for data, so pretend it doesn't exist
*/
if (version >= 10000) {
- virQEMUCapsSet(caps, QEMU_CAPS_MIGRATE_QEMU_TCP);
- virQEMUCapsSet(caps, QEMU_CAPS_MIGRATE_QEMU_EXEC);
+ virQEMUCapsSet(qemuCaps, QEMU_CAPS_MIGRATE_QEMU_TCP);
+ virQEMUCapsSet(qemuCaps, QEMU_CAPS_MIGRATE_QEMU_EXEC);
if (version >= 12000) {
- virQEMUCapsSet(caps, QEMU_CAPS_MIGRATE_QEMU_UNIX);
- virQEMUCapsSet(caps, QEMU_CAPS_MIGRATE_QEMU_FD);
+ virQEMUCapsSet(qemuCaps, QEMU_CAPS_MIGRATE_QEMU_UNIX);
+ virQEMUCapsSet(qemuCaps, QEMU_CAPS_MIGRATE_QEMU_FD);
}
} else if (kvm_version >= 79) {
- virQEMUCapsSet(caps, QEMU_CAPS_MIGRATE_QEMU_TCP);
+ virQEMUCapsSet(qemuCaps, QEMU_CAPS_MIGRATE_QEMU_TCP);
if (kvm_version >= 80)
- virQEMUCapsSet(caps, QEMU_CAPS_MIGRATE_QEMU_EXEC);
+ virQEMUCapsSet(qemuCaps, QEMU_CAPS_MIGRATE_QEMU_EXEC);
} else if (kvm_version > 0) {
- virQEMUCapsSet(caps, QEMU_CAPS_MIGRATE_KVM_STDIO);
+ virQEMUCapsSet(qemuCaps, QEMU_CAPS_MIGRATE_KVM_STDIO);
}
if (version >= 10000)
- virQEMUCapsSet(caps, QEMU_CAPS_0_10);
+ virQEMUCapsSet(qemuCaps, QEMU_CAPS_0_10);
if (version >= 11000)
- virQEMUCapsSet(caps, QEMU_CAPS_VIRTIO_BLK_SG_IO);
+ virQEMUCapsSet(qemuCaps, QEMU_CAPS_VIRTIO_BLK_SG_IO);
/* While JSON mode was available in 0.12.0, it was too
* incomplete to contemplate using. The 0.13.0 release
@@ -1150,11 +1150,11 @@ virQEMUCapsComputeCmdFlags(const char *help,
*/
#if WITH_YAJL
if (version >= 13000) {
- virQEMUCapsSet(caps, QEMU_CAPS_MONITOR_JSON);
+ virQEMUCapsSet(qemuCaps, QEMU_CAPS_MONITOR_JSON);
} else if (version >= 12000 &&
strstr(help, "libvirt")) {
- virQEMUCapsSet(caps, QEMU_CAPS_MONITOR_JSON);
- virQEMUCapsSet(caps, QEMU_CAPS_NETDEV);
+ virQEMUCapsSet(qemuCaps, QEMU_CAPS_MONITOR_JSON);
+ virQEMUCapsSet(qemuCaps, QEMU_CAPS_NETDEV);
}
#else
/* Starting with qemu 0.15 and newer, upstream qemu no longer
@@ -1173,12 +1173,12 @@ virQEMUCapsComputeCmdFlags(const char *help,
"compiled with yajl"));
return -1;
}
- virQEMUCapsSet(caps, QEMU_CAPS_NETDEV);
+ virQEMUCapsSet(qemuCaps, QEMU_CAPS_NETDEV);
}
#endif
if (version >= 13000)
- virQEMUCapsSet(caps, QEMU_CAPS_PCI_MULTIFUNCTION);
+ virQEMUCapsSet(qemuCaps, QEMU_CAPS_PCI_MULTIFUNCTION);
/* Although very new versions of qemu advertise the presence of
* the rombar option in the output of "qemu -device pci-assign,?",
@@ -1191,13 +1191,13 @@ virQEMUCapsComputeCmdFlags(const char *help,
* log and refuse to start, so it would be immediately obvious).
*/
if (version >= 12000)
- virQEMUCapsSet(caps, QEMU_CAPS_PCI_ROMBAR);
+ virQEMUCapsSet(qemuCaps, QEMU_CAPS_PCI_ROMBAR);
if (version >= 11000)
- virQEMUCapsSet(caps, QEMU_CAPS_CPU_HOST);
+ virQEMUCapsSet(qemuCaps, QEMU_CAPS_CPU_HOST);
if (version >= 1002000)
- virQEMUCapsSet(caps, QEMU_CAPS_DEVICE_VIDEO_PRIMARY);
+ virQEMUCapsSet(qemuCaps, QEMU_CAPS_DEVICE_VIDEO_PRIMARY);
return 0;
}
@@ -1227,7 +1227,7 @@ virQEMUCapsComputeCmdFlags(const char *help,
int virQEMUCapsParseHelpStr(const char *qemu,
const char *help,
- virQEMUCapsPtr caps,
+ virQEMUCapsPtr qemuCaps,
unsigned int *version,
unsigned int *is_kvm,
unsigned int *kvm_version,
@@ -1288,10 +1288,10 @@ int virQEMUCapsParseHelpStr(const char *qemu,
*version = (major * 1000 * 1000) + (minor * 1000) + micro;
if (virQEMUCapsComputeCmdFlags(help, *version, *is_kvm, *kvm_version,
- caps, check_yajl) < 0)
+ qemuCaps, check_yajl) < 0)
goto cleanup;
- strflags = virBitmapString(caps->flags);
+ strflags = virBitmapString(qemuCaps->flags);
VIR_DEBUG("Version %u.%u.%u, cooked version %u, flags %s",
major, minor, micro, *version, NULLSTR(strflags));
VIR_FREE(strflags);
@@ -1433,7 +1433,7 @@ static struct virQEMUCapsObjectTypeProps virQEMUCapsObjectProps[] =
{
static void
-virQEMUCapsProcessStringFlags(virQEMUCapsPtr caps,
+virQEMUCapsProcessStringFlags(virQEMUCapsPtr qemuCaps,
size_t nflags,
struct virQEMUCapsStringFlags *flags,
size_t nvalues,
@@ -1443,7 +1443,7 @@ virQEMUCapsProcessStringFlags(virQEMUCapsPtr caps,
for (i = 0 ; i < nflags ; i++) {
for (j = 0 ; j < nvalues ; j++) {
if (STREQ(values[j], flags[i].value)) {
- virQEMUCapsSet(caps, flags[i].flag);
+ virQEMUCapsSet(qemuCaps, flags[i].flag);
break;
}
}
@@ -1563,7 +1563,7 @@ cleanup:
int
-virQEMUCapsParseDeviceStr(virQEMUCapsPtr caps, const char *str)
+virQEMUCapsParseDeviceStr(virQEMUCapsPtr qemuCaps, const char *str)
{
int nvalues;
char **values;
@@ -1571,28 +1571,28 @@ virQEMUCapsParseDeviceStr(virQEMUCapsPtr caps, const char *str)
if ((nvalues = virQEMUCapsParseDeviceStrObjectTypes(str, &values)) < 0)
return -1;
- virQEMUCapsProcessStringFlags(caps,
- ARRAY_CARDINALITY(virQEMUCapsObjectTypes),
- virQEMUCapsObjectTypes,
- nvalues, values);
+ virQEMUCapsProcessStringFlags(qemuCaps,
+ ARRAY_CARDINALITY(virQEMUCapsObjectTypes),
+ virQEMUCapsObjectTypes,
+ nvalues, values);
virQEMUCapsFreeStringList(nvalues, values);
for (i = 0 ; i < ARRAY_CARDINALITY(virQEMUCapsObjectProps); i++) {
const char *type = virQEMUCapsObjectProps[i].type;
if ((nvalues = virQEMUCapsParseDeviceStrObjectProps(str,
- type,
- &values)) < 0)
+ type,
+ &values)) < 0)
return -1;
- virQEMUCapsProcessStringFlags(caps,
- virQEMUCapsObjectProps[i].nprops,
- virQEMUCapsObjectProps[i].props,
- nvalues, values);
+ virQEMUCapsProcessStringFlags(qemuCaps,
+ virQEMUCapsObjectProps[i].nprops,
+ virQEMUCapsObjectProps[i].props,
+ nvalues, values);
virQEMUCapsFreeStringList(nvalues, values);
}
/* Prefer -chardev spicevmc (detected earlier) over -device spicevmc */
- if (virQEMUCapsGet(caps, QEMU_CAPS_CHARDEV_SPICEVMC))
- virQEMUCapsClear(caps, QEMU_CAPS_DEVICE_SPICEVMC);
+ if (virQEMUCapsGet(qemuCaps, QEMU_CAPS_CHARDEV_SPICEVMC))
+ virQEMUCapsClear(qemuCaps, QEMU_CAPS_DEVICE_SPICEVMC);
return 0;
}
@@ -1600,7 +1600,7 @@ virQEMUCapsParseDeviceStr(virQEMUCapsPtr caps, const char *str)
static int
virQEMUCapsExtractDeviceStr(const char *qemu,
- virQEMUCapsPtr caps,
+ virQEMUCapsPtr qemuCaps,
virQEMUCapsHookDataPtr hookData)
{
char *output = NULL;
@@ -1615,7 +1615,7 @@ virQEMUCapsExtractDeviceStr(const char *qemu,
* understand '-device name,?', and always exits with status 1 for
* the simpler '-device ?', so this function is really only useful
* if -help includes "device driver,?". */
- cmd = virQEMUCapsProbeCommand(qemu, caps, hookData);
+ cmd = virQEMUCapsProbeCommand(qemu, qemuCaps, hookData);
virCommandAddArgList(cmd,
"-device", "?",
"-device", "pci-assign,?",
@@ -1633,7 +1633,7 @@ virQEMUCapsExtractDeviceStr(const char *qemu,
if (virCommandRun(cmd, NULL) < 0)
goto cleanup;
- ret = virQEMUCapsParseDeviceStr(caps, output);
+ ret = virQEMUCapsParseDeviceStr(qemuCaps, output);
cleanup:
VIR_FREE(output);
@@ -1676,27 +1676,27 @@ int virQEMUCapsGetDefaultVersion(virCapsPtr caps,
virQEMUCapsPtr
virQEMUCapsNew(void)
{
- virQEMUCapsPtr caps;
+ virQEMUCapsPtr qemuCaps;
if (virQEMUCapsInitialize() < 0)
return NULL;
- if (!(caps = virObjectNew(virQEMUCapsClass)))
+ if (!(qemuCaps = virObjectNew(virQEMUCapsClass)))
return NULL;
- if (!(caps->flags = virBitmapNew(QEMU_CAPS_LAST)))
+ if (!(qemuCaps->flags = virBitmapNew(QEMU_CAPS_LAST)))
goto no_memory;
- return caps;
+ return qemuCaps;
no_memory:
virReportOOMError();
- virObjectUnref(caps);
+ virObjectUnref(qemuCaps);
return NULL;
}
-virQEMUCapsPtr virQEMUCapsNewCopy(virQEMUCapsPtr caps)
+virQEMUCapsPtr virQEMUCapsNewCopy(virQEMUCapsPtr qemuCaps)
{
virQEMUCapsPtr ret = virQEMUCapsNew();
size_t i;
@@ -1704,31 +1704,31 @@ virQEMUCapsPtr virQEMUCapsNewCopy(virQEMUCapsPtr caps)
if (!ret)
return NULL;
- virBitmapCopy(ret->flags, caps->flags);
+ virBitmapCopy(ret->flags, qemuCaps->flags);
- ret->usedQMP = caps->usedQMP;
- ret->version = caps->version;
- ret->kvmVersion = caps->kvmVersion;
- ret->arch = caps->arch;
+ ret->usedQMP = qemuCaps->usedQMP;
+ ret->version = qemuCaps->version;
+ ret->kvmVersion = qemuCaps->kvmVersion;
+ ret->arch = qemuCaps->arch;
- if (VIR_ALLOC_N(ret->cpuDefinitions, caps->ncpuDefinitions) < 0)
+ if (VIR_ALLOC_N(ret->cpuDefinitions, qemuCaps->ncpuDefinitions) < 0)
goto no_memory;
- ret->ncpuDefinitions = caps->ncpuDefinitions;
- for (i = 0 ; i < caps->ncpuDefinitions ; i++) {
- if (!(ret->cpuDefinitions[i] = strdup(caps->cpuDefinitions[i])))
+ ret->ncpuDefinitions = qemuCaps->ncpuDefinitions;
+ for (i = 0 ; i < qemuCaps->ncpuDefinitions ; i++) {
+ if (!(ret->cpuDefinitions[i] = strdup(qemuCaps->cpuDefinitions[i])))
goto no_memory;
}
- if (VIR_ALLOC_N(ret->machineTypes, caps->nmachineTypes) < 0)
+ if (VIR_ALLOC_N(ret->machineTypes, qemuCaps->nmachineTypes) < 0)
goto no_memory;
- if (VIR_ALLOC_N(ret->machineAliases, caps->nmachineTypes) < 0)
+ if (VIR_ALLOC_N(ret->machineAliases, qemuCaps->nmachineTypes) < 0)
goto no_memory;
- ret->nmachineTypes = caps->nmachineTypes;
- for (i = 0 ; i < caps->nmachineTypes ; i++) {
- if (!(ret->machineTypes[i] = strdup(caps->machineTypes[i])))
+ ret->nmachineTypes = qemuCaps->nmachineTypes;
+ for (i = 0 ; i < qemuCaps->nmachineTypes ; i++) {
+ if (!(ret->machineTypes[i] = strdup(qemuCaps->machineTypes[i])))
goto no_memory;
- if (caps->machineAliases[i] &&
- !(ret->machineAliases[i] = strdup(caps->machineAliases[i])))
+ if (qemuCaps->machineAliases[i] &&
+ !(ret->machineAliases[i] = strdup(qemuCaps->machineAliases[i])))
goto no_memory;
}
@@ -1743,98 +1743,98 @@ no_memory:
void virQEMUCapsDispose(void *obj)
{
- virQEMUCapsPtr caps = obj;
+ virQEMUCapsPtr qemuCaps = obj;
size_t i;
- for (i = 0 ; i < caps->nmachineTypes ; i++) {
- VIR_FREE(caps->machineTypes[i]);
- VIR_FREE(caps->machineAliases[i]);
+ for (i = 0 ; i < qemuCaps->nmachineTypes ; i++) {
+ VIR_FREE(qemuCaps->machineTypes[i]);
+ VIR_FREE(qemuCaps->machineAliases[i]);
}
- VIR_FREE(caps->machineTypes);
- VIR_FREE(caps->machineAliases);
+ VIR_FREE(qemuCaps->machineTypes);
+ VIR_FREE(qemuCaps->machineAliases);
- for (i = 0 ; i < caps->ncpuDefinitions ; i++) {
- VIR_FREE(caps->cpuDefinitions[i]);
+ for (i = 0 ; i < qemuCaps->ncpuDefinitions ; i++) {
+ VIR_FREE(qemuCaps->cpuDefinitions[i]);
}
- VIR_FREE(caps->cpuDefinitions);
+ VIR_FREE(qemuCaps->cpuDefinitions);
- virBitmapFree(caps->flags);
+ virBitmapFree(qemuCaps->flags);
- VIR_FREE(caps->binary);
+ VIR_FREE(qemuCaps->binary);
}
void
-virQEMUCapsSet(virQEMUCapsPtr caps,
+virQEMUCapsSet(virQEMUCapsPtr qemuCaps,
enum virQEMUCapsFlags flag)
{
- ignore_value(virBitmapSetBit(caps->flags, flag));
+ ignore_value(virBitmapSetBit(qemuCaps->flags, flag));
}
void
-virQEMUCapsSetList(virQEMUCapsPtr caps, ...)
+virQEMUCapsSetList(virQEMUCapsPtr qemuCaps, ...)
{
va_list list;
int flag;
- va_start(list, caps);
+ va_start(list, qemuCaps);
while ((flag = va_arg(list, int)) < QEMU_CAPS_LAST)
- ignore_value(virBitmapSetBit(caps->flags, flag));
+ ignore_value(virBitmapSetBit(qemuCaps->flags, flag));
va_end(list);
}
void
-virQEMUCapsClear(virQEMUCapsPtr caps,
+virQEMUCapsClear(virQEMUCapsPtr qemuCaps,
enum virQEMUCapsFlags flag)
{
- ignore_value(virBitmapClearBit(caps->flags, flag));
+ ignore_value(virBitmapClearBit(qemuCaps->flags, flag));
}
-char *virQEMUCapsFlagsString(virQEMUCapsPtr caps)
+char *virQEMUCapsFlagsString(virQEMUCapsPtr qemuCaps)
{
- return virBitmapString(caps->flags);
+ return virBitmapString(qemuCaps->flags);
}
bool
-virQEMUCapsGet(virQEMUCapsPtr caps,
+virQEMUCapsGet(virQEMUCapsPtr qemuCaps,
enum virQEMUCapsFlags flag)
{
bool b;
- if (!caps || virBitmapGetBit(caps->flags, flag, &b) < 0)
+ if (!qemuCaps || virBitmapGetBit(qemuCaps->flags, flag, &b) < 0)
return false;
else
return b;
}
-const char *virQEMUCapsGetBinary(virQEMUCapsPtr caps)
+const char *virQEMUCapsGetBinary(virQEMUCapsPtr qemuCaps)
{
- return caps->binary;
+ return qemuCaps->binary;
}
-virArch virQEMUCapsGetArch(virQEMUCapsPtr caps)
+virArch virQEMUCapsGetArch(virQEMUCapsPtr qemuCaps)
{
- return caps->arch;
+ return qemuCaps->arch;
}
-unsigned int virQEMUCapsGetVersion(virQEMUCapsPtr caps)
+unsigned int virQEMUCapsGetVersion(virQEMUCapsPtr qemuCaps)
{
- return caps->version;
+ return qemuCaps->version;
}
-unsigned int virQEMUCapsGetKVMVersion(virQEMUCapsPtr caps)
+unsigned int virQEMUCapsGetKVMVersion(virQEMUCapsPtr qemuCaps)
{
- return caps->kvmVersion;
+ return qemuCaps->kvmVersion;
}
-int virQEMUCapsAddCPUDefinition(virQEMUCapsPtr caps,
+int virQEMUCapsAddCPUDefinition(virQEMUCapsPtr qemuCaps,
const char *name)
{
char *tmp = strdup(name);
@@ -1842,34 +1842,34 @@ int virQEMUCapsAddCPUDefinition(virQEMUCapsPtr caps,
virReportOOMError();
return -1;
}
- if (VIR_EXPAND_N(caps->cpuDefinitions, caps->ncpuDefinitions, 1) < 0) {
+ if (VIR_EXPAND_N(qemuCaps->cpuDefinitions, qemuCaps->ncpuDefinitions, 1) <
0) {
VIR_FREE(tmp);
virReportOOMError();
return -1;
}
- caps->cpuDefinitions[caps->ncpuDefinitions-1] = tmp;
+ qemuCaps->cpuDefinitions[qemuCaps->ncpuDefinitions-1] = tmp;
return 0;
}
-size_t virQEMUCapsGetCPUDefinitions(virQEMUCapsPtr caps,
+size_t virQEMUCapsGetCPUDefinitions(virQEMUCapsPtr qemuCaps,
char ***names)
{
if (names)
- *names = caps->cpuDefinitions;
- return caps->ncpuDefinitions;
+ *names = qemuCaps->cpuDefinitions;
+ return qemuCaps->ncpuDefinitions;
}
-size_t virQEMUCapsGetMachineTypes(virQEMUCapsPtr caps,
+size_t virQEMUCapsGetMachineTypes(virQEMUCapsPtr qemuCaps,
char ***names)
{
if (names)
- *names = caps->machineTypes;
- return caps->nmachineTypes;
+ *names = qemuCaps->machineTypes;
+ return qemuCaps->nmachineTypes;
}
-int virQEMUCapsGetMachineTypesCaps(virQEMUCapsPtr caps,
+int virQEMUCapsGetMachineTypesCaps(virQEMUCapsPtr qemuCaps,
size_t *nmachines,
virCapsGuestMachinePtr **machines)
{
@@ -1877,21 +1877,21 @@ int virQEMUCapsGetMachineTypesCaps(virQEMUCapsPtr caps,
*nmachines = 0;
*machines = NULL;
- if (VIR_ALLOC_N(*machines, caps->nmachineTypes) < 0)
+ if (VIR_ALLOC_N(*machines, qemuCaps->nmachineTypes) < 0)
goto no_memory;
- *nmachines = caps->nmachineTypes;
+ *nmachines = qemuCaps->nmachineTypes;
- for (i = 0 ; i < caps->nmachineTypes ; i++) {
+ for (i = 0 ; i < qemuCaps->nmachineTypes ; i++) {
virCapsGuestMachinePtr mach;
if (VIR_ALLOC(mach) < 0)
goto no_memory;
- if (caps->machineAliases[i]) {
- if (!(mach->name = strdup(caps->machineAliases[i])))
+ if (qemuCaps->machineAliases[i]) {
+ if (!(mach->name = strdup(qemuCaps->machineAliases[i])))
goto no_memory;
- if (!(mach->canonical = strdup(caps->machineTypes[i])))
+ if (!(mach->canonical = strdup(qemuCaps->machineTypes[i])))
goto no_memory;
} else {
- if (!(mach->name = strdup(caps->machineTypes[i])))
+ if (!(mach->name = strdup(qemuCaps->machineTypes[i])))
goto no_memory;
}
(*machines)[i] = mach;
@@ -1909,7 +1909,7 @@ no_memory:
-const char *virQEMUCapsGetCanonicalMachine(virQEMUCapsPtr caps,
+const char *virQEMUCapsGetCanonicalMachine(virQEMUCapsPtr qemuCaps,
const char *name)
{
size_t i;
@@ -1917,11 +1917,11 @@ const char *virQEMUCapsGetCanonicalMachine(virQEMUCapsPtr caps,
if (!name)
return NULL;
- for (i = 0 ; i < caps->nmachineTypes ; i++) {
- if (!caps->machineAliases[i])
+ for (i = 0 ; i < qemuCaps->nmachineTypes ; i++) {
+ if (!qemuCaps->machineAliases[i])
continue;
- if (STREQ(caps->machineAliases[i], name))
- return caps->machineTypes[i];
+ if (STREQ(qemuCaps->machineAliases[i], name))
+ return qemuCaps->machineTypes[i];
}
return name;
@@ -1929,7 +1929,7 @@ const char *virQEMUCapsGetCanonicalMachine(virQEMUCapsPtr caps,
static int
-virQEMUCapsProbeQMPCommands(virQEMUCapsPtr caps,
+virQEMUCapsProbeQMPCommands(virQEMUCapsPtr qemuCaps,
qemuMonitorPtr mon)
{
char **commands = NULL;
@@ -1942,29 +1942,29 @@ virQEMUCapsProbeQMPCommands(virQEMUCapsPtr caps,
for (i = 0 ; i < ncommands ; i++) {
char *name = commands[i];
if (STREQ(name, "system_wakeup"))
- virQEMUCapsSet(caps, QEMU_CAPS_WAKEUP);
+ virQEMUCapsSet(qemuCaps, QEMU_CAPS_WAKEUP);
else if (STREQ(name, "transaction"))
- virQEMUCapsSet(caps, QEMU_CAPS_TRANSACTION);
+ virQEMUCapsSet(qemuCaps, QEMU_CAPS_TRANSACTION);
else if (STREQ(name, "block_job_cancel"))
- virQEMUCapsSet(caps, QEMU_CAPS_BLOCKJOB_SYNC);
+ virQEMUCapsSet(qemuCaps, QEMU_CAPS_BLOCKJOB_SYNC);
else if (STREQ(name, "block-job-cancel"))
- virQEMUCapsSet(caps, QEMU_CAPS_BLOCKJOB_ASYNC);
+ virQEMUCapsSet(qemuCaps, QEMU_CAPS_BLOCKJOB_ASYNC);
else if (STREQ(name, "dump-guest-memory"))
- virQEMUCapsSet(caps, QEMU_CAPS_DUMP_GUEST_MEMORY);
+ virQEMUCapsSet(qemuCaps, QEMU_CAPS_DUMP_GUEST_MEMORY);
else if (STREQ(name, "query-spice"))
- virQEMUCapsSet(caps, QEMU_CAPS_SPICE);
+ virQEMUCapsSet(qemuCaps, QEMU_CAPS_SPICE);
else if (STREQ(name, "query-kvm"))
- virQEMUCapsSet(caps, QEMU_CAPS_KVM);
+ virQEMUCapsSet(qemuCaps, QEMU_CAPS_KVM);
else if (STREQ(name, "block-commit"))
- virQEMUCapsSet(caps, QEMU_CAPS_BLOCK_COMMIT);
+ virQEMUCapsSet(qemuCaps, QEMU_CAPS_BLOCK_COMMIT);
else if (STREQ(name, "query-vnc"))
- virQEMUCapsSet(caps, QEMU_CAPS_VNC);
+ virQEMUCapsSet(qemuCaps, QEMU_CAPS_VNC);
else if (STREQ(name, "drive-mirror"))
- virQEMUCapsSet(caps, QEMU_CAPS_DRIVE_MIRROR);
+ virQEMUCapsSet(qemuCaps, QEMU_CAPS_DRIVE_MIRROR);
else if (STREQ(name, "blockdev-snapshot-sync"))
- virQEMUCapsSet(caps, QEMU_CAPS_DISK_SNAPSHOT);
+ virQEMUCapsSet(qemuCaps, QEMU_CAPS_DISK_SNAPSHOT);
else if (STREQ(name, "add-fd"))
- virQEMUCapsSet(caps, QEMU_CAPS_ADD_FD);
+ virQEMUCapsSet(qemuCaps, QEMU_CAPS_ADD_FD);
VIR_FREE(name);
}
VIR_FREE(commands);
@@ -1973,7 +1973,7 @@ virQEMUCapsProbeQMPCommands(virQEMUCapsPtr caps,
* management control of set numbering, and did not have a
* counterpart -add-fd command line option. We require the
* add-fd features from 1.3 or later. */
- if (virQEMUCapsGet(caps, QEMU_CAPS_ADD_FD)) {
+ if (virQEMUCapsGet(qemuCaps, QEMU_CAPS_ADD_FD)) {
int fd = open("/dev/null", O_RDONLY);
if (fd < 0) {
virReportError(VIR_ERR_INTERNAL_ERROR, "%s",
@@ -1981,7 +1981,7 @@ virQEMUCapsProbeQMPCommands(virQEMUCapsPtr caps,
return -1;
}
if (qemuMonitorAddFd(mon, 0, fd, "/dev/null") < 0)
- virQEMUCapsClear(caps, QEMU_CAPS_ADD_FD);
+ virQEMUCapsClear(qemuCaps, QEMU_CAPS_ADD_FD);
VIR_FORCE_CLOSE(fd);
}
@@ -1990,7 +1990,7 @@ virQEMUCapsProbeQMPCommands(virQEMUCapsPtr caps,
static int
-virQEMUCapsProbeQMPEvents(virQEMUCapsPtr caps,
+virQEMUCapsProbeQMPEvents(virQEMUCapsPtr qemuCaps,
qemuMonitorPtr mon)
{
char **events = NULL;
@@ -2004,9 +2004,9 @@ virQEMUCapsProbeQMPEvents(virQEMUCapsPtr caps,
char *name = events[i];
if (STREQ(name, "BALLOON_CHANGE"))
- virQEMUCapsSet(caps, QEMU_CAPS_BALLOON_EVENT);
+ virQEMUCapsSet(qemuCaps, QEMU_CAPS_BALLOON_EVENT);
if (STREQ(name, "SPICE_MIGRATE_COMPLETED"))
- virQEMUCapsSet(caps, QEMU_CAPS_SEAMLESS_MIGRATION);
+ virQEMUCapsSet(qemuCaps, QEMU_CAPS_SEAMLESS_MIGRATION);
VIR_FREE(name);
}
VIR_FREE(events);
@@ -2016,7 +2016,7 @@ virQEMUCapsProbeQMPEvents(virQEMUCapsPtr caps,
static int
-virQEMUCapsProbeQMPObjects(virQEMUCapsPtr caps,
+virQEMUCapsProbeQMPObjects(virQEMUCapsPtr qemuCaps,
qemuMonitorPtr mon)
{
int nvalues;
@@ -2025,10 +2025,10 @@ virQEMUCapsProbeQMPObjects(virQEMUCapsPtr caps,
if ((nvalues = qemuMonitorGetObjectTypes(mon, &values)) < 0)
return -1;
- virQEMUCapsProcessStringFlags(caps,
- ARRAY_CARDINALITY(virQEMUCapsObjectTypes),
- virQEMUCapsObjectTypes,
- nvalues, values);
+ virQEMUCapsProcessStringFlags(qemuCaps,
+ ARRAY_CARDINALITY(virQEMUCapsObjectTypes),
+ virQEMUCapsObjectTypes,
+ nvalues, values);
virQEMUCapsFreeStringList(nvalues, values);
for (i = 0 ; i < ARRAY_CARDINALITY(virQEMUCapsObjectProps); i++) {
@@ -2037,26 +2037,26 @@ virQEMUCapsProbeQMPObjects(virQEMUCapsPtr caps,
type,
&values)) < 0)
return -1;
- virQEMUCapsProcessStringFlags(caps,
- virQEMUCapsObjectProps[i].nprops,
- virQEMUCapsObjectProps[i].props,
- nvalues, values);
+ virQEMUCapsProcessStringFlags(qemuCaps,
+ virQEMUCapsObjectProps[i].nprops,
+ virQEMUCapsObjectProps[i].props,
+ nvalues, values);
virQEMUCapsFreeStringList(nvalues, values);
}
/* Prefer -chardev spicevmc (detected earlier) over -device spicevmc */
- if (virQEMUCapsGet(caps, QEMU_CAPS_CHARDEV_SPICEVMC))
- virQEMUCapsClear(caps, QEMU_CAPS_DEVICE_SPICEVMC);
+ if (virQEMUCapsGet(qemuCaps, QEMU_CAPS_CHARDEV_SPICEVMC))
+ virQEMUCapsClear(qemuCaps, QEMU_CAPS_DEVICE_SPICEVMC);
/* If qemu supports newer -device qxl it supports -vga qxl as well */
- if (virQEMUCapsGet(caps, QEMU_CAPS_DEVICE_QXL))
- virQEMUCapsSet(caps, QEMU_CAPS_VGA_QXL);
+ if (virQEMUCapsGet(qemuCaps, QEMU_CAPS_DEVICE_QXL))
+ virQEMUCapsSet(qemuCaps, QEMU_CAPS_VGA_QXL);
return 0;
}
static int
-virQEMUCapsProbeQMPMachineTypes(virQEMUCapsPtr caps,
+virQEMUCapsProbeQMPMachineTypes(virQEMUCapsPtr qemuCaps,
qemuMonitorPtr mon)
{
qemuMonitorMachineInfoPtr *machines = NULL;
@@ -2068,33 +2068,33 @@ virQEMUCapsProbeQMPMachineTypes(virQEMUCapsPtr caps,
if ((nmachines = qemuMonitorGetMachines(mon, &machines)) < 0)
goto cleanup;
- if (VIR_ALLOC_N(caps->machineTypes, nmachines) < 0) {
+ if (VIR_ALLOC_N(qemuCaps->machineTypes, nmachines) < 0) {
virReportOOMError();
goto cleanup;
}
- if (VIR_ALLOC_N(caps->machineAliases, nmachines) < 0) {
+ if (VIR_ALLOC_N(qemuCaps->machineAliases, nmachines) < 0) {
virReportOOMError();
goto cleanup;
}
for (i = 0 ; i < nmachines ; i++) {
if (machines[i]->alias) {
- if (!(caps->machineAliases[i] = strdup(machines[i]->alias))) {
+ if (!(qemuCaps->machineAliases[i] = strdup(machines[i]->alias))) {
virReportOOMError();
goto cleanup;
}
}
- if (!(caps->machineTypes[i] = strdup(machines[i]->name))) {
+ if (!(qemuCaps->machineTypes[i] = strdup(machines[i]->name))) {
virReportOOMError();
goto cleanup;
}
if (machines[i]->isDefault)
defIdx = i;
}
- caps->nmachineTypes = nmachines;
+ qemuCaps->nmachineTypes = nmachines;
if (defIdx)
- virQEMUCapsSetDefaultMachine(caps, defIdx);
+ virQEMUCapsSetDefaultMachine(qemuCaps, defIdx);
ret = 0;
@@ -2107,7 +2107,7 @@ cleanup:
static int
-virQEMUCapsProbeQMPCPUDefinitions(virQEMUCapsPtr caps,
+virQEMUCapsProbeQMPCPUDefinitions(virQEMUCapsPtr qemuCaps,
qemuMonitorPtr mon)
{
int ncpuDefinitions;
@@ -2116,21 +2116,21 @@ virQEMUCapsProbeQMPCPUDefinitions(virQEMUCapsPtr caps,
if ((ncpuDefinitions = qemuMonitorGetCPUDefinitions(mon, &cpuDefinitions)) <
0)
return -1;
- caps->ncpuDefinitions = ncpuDefinitions;
- caps->cpuDefinitions = cpuDefinitions;
+ qemuCaps->ncpuDefinitions = ncpuDefinitions;
+ qemuCaps->cpuDefinitions = cpuDefinitions;
return 0;
}
static int
-virQEMUCapsProbeQMPKVMState(virQEMUCapsPtr caps,
+virQEMUCapsProbeQMPKVMState(virQEMUCapsPtr qemuCaps,
qemuMonitorPtr mon)
{
bool enabled = false;
bool present = false;
- if (!virQEMUCapsGet(caps, QEMU_CAPS_KVM))
+ if (!virQEMUCapsGet(qemuCaps, QEMU_CAPS_KVM))
return 0;
if (qemuMonitorGetKVMState(mon, &enabled, &present) < 0)
@@ -2145,28 +2145,28 @@ virQEMUCapsProbeQMPKVMState(virQEMUCapsPtr caps,
* not enabled by default we need to change the flag.
*/
if (!present) {
- virQEMUCapsClear(caps, QEMU_CAPS_KVM);
+ virQEMUCapsClear(qemuCaps, QEMU_CAPS_KVM);
} else if (!enabled) {
- virQEMUCapsClear(caps, QEMU_CAPS_KVM);
- virQEMUCapsSet(caps, QEMU_CAPS_ENABLE_KVM);
+ virQEMUCapsClear(qemuCaps, QEMU_CAPS_KVM);
+ virQEMUCapsSet(qemuCaps, QEMU_CAPS_ENABLE_KVM);
}
return 0;
}
-int virQEMUCapsProbeQMP(virQEMUCapsPtr caps,
+int virQEMUCapsProbeQMP(virQEMUCapsPtr qemuCaps,
qemuMonitorPtr mon)
{
- VIR_DEBUG("caps=%p mon=%p", caps, mon);
+ VIR_DEBUG("qemuCaps=%p mon=%p", qemuCaps, mon);
- if (caps->usedQMP)
+ if (qemuCaps->usedQMP)
return 0;
- if (virQEMUCapsProbeQMPCommands(caps, mon) < 0)
+ if (virQEMUCapsProbeQMPCommands(qemuCaps, mon) < 0)
return -1;
- if (virQEMUCapsProbeQMPEvents(caps, mon) < 0)
+ if (virQEMUCapsProbeQMPEvents(qemuCaps, mon) < 0)
return -1;
return 0;
@@ -2176,7 +2176,7 @@ int virQEMUCapsProbeQMP(virQEMUCapsPtr caps,
#define QEMU_SYSTEM_PREFIX "qemu-system-"
static int
-virQEMUCapsInitHelp(virQEMUCapsPtr caps, uid_t runUid, gid_t runGid)
+virQEMUCapsInitHelp(virQEMUCapsPtr qemuCaps, uid_t runUid, gid_t runGid)
{
virCommandPtr cmd = NULL;
unsigned int is_kvm;
@@ -2185,55 +2185,55 @@ virQEMUCapsInitHelp(virQEMUCapsPtr caps, uid_t runUid, gid_t
runGid)
const char *tmp;
virQEMUCapsHookData hookData;
- VIR_DEBUG("caps=%p", caps);
+ VIR_DEBUG("qemuCaps=%p", qemuCaps);
- tmp = strstr(caps->binary, QEMU_SYSTEM_PREFIX);
+ tmp = strstr(qemuCaps->binary, QEMU_SYSTEM_PREFIX);
if (tmp) {
tmp += strlen(QEMU_SYSTEM_PREFIX);
- caps->arch = virQEMUCapsArchFromString(tmp);
+ qemuCaps->arch = virQEMUCapsArchFromString(tmp);
} else {
- caps->arch = virArchFromHost();
+ qemuCaps->arch = virArchFromHost();
}
hookData.runUid = runUid;
hookData.runGid = runGid;
- cmd = virQEMUCapsProbeCommand(caps->binary, NULL, &hookData);
+ cmd = virQEMUCapsProbeCommand(qemuCaps->binary, NULL, &hookData);
virCommandAddArgList(cmd, "-help", NULL);
virCommandSetOutputBuffer(cmd, &help);
if (virCommandRun(cmd, NULL) < 0)
goto cleanup;
- if (virQEMUCapsParseHelpStr(caps->binary,
- help, caps,
- &caps->version,
- &is_kvm,
- &caps->kvmVersion,
- false) < 0)
+ if (virQEMUCapsParseHelpStr(qemuCaps->binary,
+ help, qemuCaps,
+ &qemuCaps->version,
+ &is_kvm,
+ &qemuCaps->kvmVersion,
+ false) < 0)
goto cleanup;
/* Currently only x86_64 and i686 support PCI-multibus. */
- if (caps->arch == VIR_ARCH_X86_64 ||
- caps->arch == VIR_ARCH_I686) {
- virQEMUCapsSet(caps, QEMU_CAPS_PCI_MULTIBUS);
+ if (qemuCaps->arch == VIR_ARCH_X86_64 ||
+ qemuCaps->arch == VIR_ARCH_I686) {
+ virQEMUCapsSet(qemuCaps, QEMU_CAPS_PCI_MULTIBUS);
} else {
/* -no-acpi is not supported on other archs
* even if qemu reports it in -help */
- virQEMUCapsClear(caps, QEMU_CAPS_NO_ACPI);
+ virQEMUCapsClear(qemuCaps, QEMU_CAPS_NO_ACPI);
}
/* virQEMUCapsExtractDeviceStr will only set additional caps if qemu
* understands the 0.13.0+ notion of "-device driver,". */
- if (virQEMUCapsGet(caps, QEMU_CAPS_DEVICE) &&
+ if (virQEMUCapsGet(qemuCaps, QEMU_CAPS_DEVICE) &&
strstr(help, "-device driver,?") &&
- virQEMUCapsExtractDeviceStr(caps->binary, caps, &hookData) < 0)
+ virQEMUCapsExtractDeviceStr(qemuCaps->binary, qemuCaps, &hookData) <
0)
goto cleanup;
- if (virQEMUCapsProbeCPUModels(caps, &hookData) < 0)
+ if (virQEMUCapsProbeCPUModels(qemuCaps, &hookData) < 0)
goto cleanup;
- if (virQEMUCapsProbeMachineTypes(caps, &hookData) < 0)
+ if (virQEMUCapsProbeMachineTypes(qemuCaps, &hookData) < 0)
goto cleanup;
ret = 0;
@@ -2259,62 +2259,62 @@ static qemuMonitorCallbacks callbacks = {
* for QEMU >= 1.2.0
*/
static void
-virQEMUCapsInitQMPBasic(virQEMUCapsPtr caps)
+virQEMUCapsInitQMPBasic(virQEMUCapsPtr qemuCaps)
{
- virQEMUCapsSet(caps, QEMU_CAPS_VNC_COLON);
- virQEMUCapsSet(caps, QEMU_CAPS_NO_REBOOT);
- virQEMUCapsSet(caps, QEMU_CAPS_DRIVE);
- virQEMUCapsSet(caps, QEMU_CAPS_NAME);
- virQEMUCapsSet(caps, QEMU_CAPS_UUID);
- virQEMUCapsSet(caps, QEMU_CAPS_VNET_HDR);
- virQEMUCapsSet(caps, QEMU_CAPS_MIGRATE_QEMU_TCP);
- virQEMUCapsSet(caps, QEMU_CAPS_MIGRATE_QEMU_EXEC);
- virQEMUCapsSet(caps, QEMU_CAPS_DRIVE_CACHE_V2);
- virQEMUCapsSet(caps, QEMU_CAPS_DRIVE_FORMAT);
- virQEMUCapsSet(caps, QEMU_CAPS_VGA);
- virQEMUCapsSet(caps, QEMU_CAPS_0_10);
- virQEMUCapsSet(caps, QEMU_CAPS_MEM_PATH);
- virQEMUCapsSet(caps, QEMU_CAPS_DRIVE_SERIAL);
- virQEMUCapsSet(caps, QEMU_CAPS_MIGRATE_QEMU_UNIX);
- virQEMUCapsSet(caps, QEMU_CAPS_CHARDEV);
- virQEMUCapsSet(caps, QEMU_CAPS_MONITOR_JSON);
- virQEMUCapsSet(caps, QEMU_CAPS_BALLOON);
- virQEMUCapsSet(caps, QEMU_CAPS_DEVICE);
- virQEMUCapsSet(caps, QEMU_CAPS_SDL);
- virQEMUCapsSet(caps, QEMU_CAPS_SMP_TOPOLOGY);
- virQEMUCapsSet(caps, QEMU_CAPS_NETDEV);
- virQEMUCapsSet(caps, QEMU_CAPS_RTC);
- virQEMUCapsSet(caps, QEMU_CAPS_VHOST_NET);
- virQEMUCapsSet(caps, QEMU_CAPS_NO_HPET);
- virQEMUCapsSet(caps, QEMU_CAPS_NODEFCONFIG);
- virQEMUCapsSet(caps, QEMU_CAPS_BOOT_MENU);
- virQEMUCapsSet(caps, QEMU_CAPS_FSDEV);
- virQEMUCapsSet(caps, QEMU_CAPS_NAME_PROCESS);
- virQEMUCapsSet(caps, QEMU_CAPS_DRIVE_READONLY);
- virQEMUCapsSet(caps, QEMU_CAPS_SMBIOS_TYPE);
- virQEMUCapsSet(caps, QEMU_CAPS_VGA_NONE);
- virQEMUCapsSet(caps, QEMU_CAPS_MIGRATE_QEMU_FD);
- virQEMUCapsSet(caps, QEMU_CAPS_DRIVE_AIO);
- virQEMUCapsSet(caps, QEMU_CAPS_CHARDEV_SPICEVMC);
- virQEMUCapsSet(caps, QEMU_CAPS_DEVICE_QXL_VGA);
- virQEMUCapsSet(caps, QEMU_CAPS_DRIVE_CACHE_DIRECTSYNC);
- virQEMUCapsSet(caps, QEMU_CAPS_NO_SHUTDOWN);
- virQEMUCapsSet(caps, QEMU_CAPS_DRIVE_CACHE_UNSAFE);
- virQEMUCapsSet(caps, QEMU_CAPS_FSDEV_READONLY);
- virQEMUCapsSet(caps, QEMU_CAPS_VIRTIO_BLK_SG_IO);
- virQEMUCapsSet(caps, QEMU_CAPS_DRIVE_COPY_ON_READ);
- virQEMUCapsSet(caps, QEMU_CAPS_CPU_HOST);
- virQEMUCapsSet(caps, QEMU_CAPS_FSDEV_WRITEOUT);
- virQEMUCapsSet(caps, QEMU_CAPS_DRIVE_IOTUNE);
- virQEMUCapsSet(caps, QEMU_CAPS_WAKEUP);
- virQEMUCapsSet(caps, QEMU_CAPS_NO_USER_CONFIG);
- virQEMUCapsSet(caps, QEMU_CAPS_NETDEV_BRIDGE);
- virQEMUCapsSet(caps, QEMU_CAPS_SECCOMP_SANDBOX);
+ virQEMUCapsSet(qemuCaps, QEMU_CAPS_VNC_COLON);
+ virQEMUCapsSet(qemuCaps, QEMU_CAPS_NO_REBOOT);
+ virQEMUCapsSet(qemuCaps, QEMU_CAPS_DRIVE);
+ virQEMUCapsSet(qemuCaps, QEMU_CAPS_NAME);
+ virQEMUCapsSet(qemuCaps, QEMU_CAPS_UUID);
+ virQEMUCapsSet(qemuCaps, QEMU_CAPS_VNET_HDR);
+ virQEMUCapsSet(qemuCaps, QEMU_CAPS_MIGRATE_QEMU_TCP);
+ virQEMUCapsSet(qemuCaps, QEMU_CAPS_MIGRATE_QEMU_EXEC);
+ virQEMUCapsSet(qemuCaps, QEMU_CAPS_DRIVE_CACHE_V2);
+ virQEMUCapsSet(qemuCaps, QEMU_CAPS_DRIVE_FORMAT);
+ virQEMUCapsSet(qemuCaps, QEMU_CAPS_VGA);
+ virQEMUCapsSet(qemuCaps, QEMU_CAPS_0_10);
+ virQEMUCapsSet(qemuCaps, QEMU_CAPS_MEM_PATH);
+ virQEMUCapsSet(qemuCaps, QEMU_CAPS_DRIVE_SERIAL);
+ virQEMUCapsSet(qemuCaps, QEMU_CAPS_MIGRATE_QEMU_UNIX);
+ virQEMUCapsSet(qemuCaps, QEMU_CAPS_CHARDEV);
+ virQEMUCapsSet(qemuCaps, QEMU_CAPS_MONITOR_JSON);
+ virQEMUCapsSet(qemuCaps, QEMU_CAPS_BALLOON);
+ virQEMUCapsSet(qemuCaps, QEMU_CAPS_DEVICE);
+ virQEMUCapsSet(qemuCaps, QEMU_CAPS_SDL);
+ virQEMUCapsSet(qemuCaps, QEMU_CAPS_SMP_TOPOLOGY);
+ virQEMUCapsSet(qemuCaps, QEMU_CAPS_NETDEV);
+ virQEMUCapsSet(qemuCaps, QEMU_CAPS_RTC);
+ virQEMUCapsSet(qemuCaps, QEMU_CAPS_VHOST_NET);
+ virQEMUCapsSet(qemuCaps, QEMU_CAPS_NO_HPET);
+ virQEMUCapsSet(qemuCaps, QEMU_CAPS_NODEFCONFIG);
+ virQEMUCapsSet(qemuCaps, QEMU_CAPS_BOOT_MENU);
+ virQEMUCapsSet(qemuCaps, QEMU_CAPS_FSDEV);
+ virQEMUCapsSet(qemuCaps, QEMU_CAPS_NAME_PROCESS);
+ virQEMUCapsSet(qemuCaps, QEMU_CAPS_DRIVE_READONLY);
+ virQEMUCapsSet(qemuCaps, QEMU_CAPS_SMBIOS_TYPE);
+ virQEMUCapsSet(qemuCaps, QEMU_CAPS_VGA_NONE);
+ virQEMUCapsSet(qemuCaps, QEMU_CAPS_MIGRATE_QEMU_FD);
+ virQEMUCapsSet(qemuCaps, QEMU_CAPS_DRIVE_AIO);
+ virQEMUCapsSet(qemuCaps, QEMU_CAPS_CHARDEV_SPICEVMC);
+ virQEMUCapsSet(qemuCaps, QEMU_CAPS_DEVICE_QXL_VGA);
+ virQEMUCapsSet(qemuCaps, QEMU_CAPS_DRIVE_CACHE_DIRECTSYNC);
+ virQEMUCapsSet(qemuCaps, QEMU_CAPS_NO_SHUTDOWN);
+ virQEMUCapsSet(qemuCaps, QEMU_CAPS_DRIVE_CACHE_UNSAFE);
+ virQEMUCapsSet(qemuCaps, QEMU_CAPS_FSDEV_READONLY);
+ virQEMUCapsSet(qemuCaps, QEMU_CAPS_VIRTIO_BLK_SG_IO);
+ virQEMUCapsSet(qemuCaps, QEMU_CAPS_DRIVE_COPY_ON_READ);
+ virQEMUCapsSet(qemuCaps, QEMU_CAPS_CPU_HOST);
+ virQEMUCapsSet(qemuCaps, QEMU_CAPS_FSDEV_WRITEOUT);
+ virQEMUCapsSet(qemuCaps, QEMU_CAPS_DRIVE_IOTUNE);
+ virQEMUCapsSet(qemuCaps, QEMU_CAPS_WAKEUP);
+ virQEMUCapsSet(qemuCaps, QEMU_CAPS_NO_USER_CONFIG);
+ virQEMUCapsSet(qemuCaps, QEMU_CAPS_NETDEV_BRIDGE);
+ virQEMUCapsSet(qemuCaps, QEMU_CAPS_SECCOMP_SANDBOX);
}
static int
-virQEMUCapsInitQMP(virQEMUCapsPtr caps,
+virQEMUCapsInitQMP(virQEMUCapsPtr qemuCaps,
const char *libDir,
uid_t runUid,
gid_t runGid)
@@ -2362,7 +2362,7 @@ virQEMUCapsInitQMP(virQEMUCapsPtr caps,
config.data.nix.path = monpath;
config.data.nix.listen = false;
- VIR_DEBUG("Try to get caps via QMP caps=%p", caps);
+ VIR_DEBUG("Try to get caps via QMP qemuCaps=%p", qemuCaps);
/*
* We explicitly need to use -daemonize here, rather than
@@ -2371,7 +2371,7 @@ virQEMUCapsInitQMP(virQEMUCapsPtr caps,
* daemonize guarantees control won't return to libvirt
* until the socket is present.
*/
- cmd = virCommandNewArgList(caps->binary,
+ cmd = virCommandNewArgList(qemuCaps->binary,
"-S",
"-no-user-config",
"-nodefaults",
@@ -2392,7 +2392,7 @@ virQEMUCapsInitQMP(virQEMUCapsPtr caps,
if (status != 0) {
ret = 0;
- VIR_DEBUG("QEMU %s exited with status %d", caps->binary, status);
+ VIR_DEBUG("QEMU %s exited with status %d", qemuCaps->binary,
status);
goto cleanup;
}
@@ -2439,15 +2439,15 @@ virQEMUCapsInitQMP(virQEMUCapsPtr caps,
goto cleanup;
}
- caps->version = major * 1000000 + minor * 1000 + micro;
- caps->usedQMP = true;
+ qemuCaps->version = major * 1000000 + minor * 1000 + micro;
+ qemuCaps->usedQMP = true;
- virQEMUCapsInitQMPBasic(caps);
+ virQEMUCapsInitQMPBasic(qemuCaps);
if (!(archstr = qemuMonitorGetTargetArch(mon)))
goto cleanup;
- if ((caps->arch = virQEMUCapsArchFromString(archstr)) == VIR_ARCH_NONE) {
+ if ((qemuCaps->arch = virQEMUCapsArchFromString(archstr)) == VIR_ARCH_NONE) {
virReportError(VIR_ERR_INTERNAL_ERROR,
_("Unknown QEMU arch %s"), archstr);
VIR_FREE(archstr);
@@ -2456,23 +2456,23 @@ virQEMUCapsInitQMP(virQEMUCapsPtr caps,
VIR_FREE(archstr);
/* Currently only x86_64 and i686 support PCI-multibus and -no-acpi. */
- if (caps->arch == VIR_ARCH_X86_64 ||
- caps->arch == VIR_ARCH_I686) {
- virQEMUCapsSet(caps, QEMU_CAPS_PCI_MULTIBUS);
- virQEMUCapsSet(caps, QEMU_CAPS_NO_ACPI);
+ if (qemuCaps->arch == VIR_ARCH_X86_64 ||
+ qemuCaps->arch == VIR_ARCH_I686) {
+ virQEMUCapsSet(qemuCaps, QEMU_CAPS_PCI_MULTIBUS);
+ virQEMUCapsSet(qemuCaps, QEMU_CAPS_NO_ACPI);
}
- if (virQEMUCapsProbeQMPCommands(caps, mon) < 0)
+ if (virQEMUCapsProbeQMPCommands(qemuCaps, mon) < 0)
goto cleanup;
- if (virQEMUCapsProbeQMPEvents(caps, mon) < 0)
+ if (virQEMUCapsProbeQMPEvents(qemuCaps, mon) < 0)
goto cleanup;
- if (virQEMUCapsProbeQMPObjects(caps, mon) < 0)
+ if (virQEMUCapsProbeQMPObjects(qemuCaps, mon) < 0)
goto cleanup;
- if (virQEMUCapsProbeQMPMachineTypes(caps, mon) < 0)
+ if (virQEMUCapsProbeQMPMachineTypes(qemuCaps, mon) < 0)
goto cleanup;
- if (virQEMUCapsProbeQMPCPUDefinitions(caps, mon) < 0)
+ if (virQEMUCapsProbeQMPCPUDefinitions(qemuCaps, mon) < 0)
goto cleanup;
- if (virQEMUCapsProbeQMPKVMState(caps, mon) < 0)
+ if (virQEMUCapsProbeQMPKVMState(qemuCaps, mon) < 0)
goto cleanup;
ret = 0;
@@ -2509,11 +2509,11 @@ virQEMUCapsPtr virQEMUCapsNewForBinary(const char *binary,
uid_t runUid,
gid_t runGid)
{
- virQEMUCapsPtr caps = virQEMUCapsNew();
+ virQEMUCapsPtr qemuCaps = virQEMUCapsNew();
struct stat sb;
int rv;
- if (!(caps->binary = strdup(binary)))
+ if (!(qemuCaps->binary = strdup(binary)))
goto no_memory;
/* We would also want to check faccessat if we cared about ACLs,
@@ -2523,7 +2523,7 @@ virQEMUCapsPtr virQEMUCapsNewForBinary(const char *binary,
binary);
goto error;
}
- caps->mtime = sb.st_mtime;
+ qemuCaps->mtime = sb.st_mtime;
/* Make sure the binary we are about to try exec'ing exists.
* Technically we could catch the exec() failure, but that's
@@ -2535,35 +2535,35 @@ virQEMUCapsPtr virQEMUCapsNewForBinary(const char *binary,
goto error;
}
- if ((rv = virQEMUCapsInitQMP(caps, libDir, runUid, runGid)) < 0)
+ if ((rv = virQEMUCapsInitQMP(qemuCaps, libDir, runUid, runGid)) < 0)
goto error;
- if (!caps->usedQMP &&
- virQEMUCapsInitHelp(caps, runUid, runGid) < 0)
+ if (!qemuCaps->usedQMP &&
+ virQEMUCapsInitHelp(qemuCaps, runUid, runGid) < 0)
goto error;
- return caps;
+ return qemuCaps;
no_memory:
virReportOOMError();
error:
- virObjectUnref(caps);
- caps = NULL;
+ virObjectUnref(qemuCaps);
+ qemuCaps = NULL;
return NULL;
}
-bool virQEMUCapsIsValid(virQEMUCapsPtr caps)
+bool virQEMUCapsIsValid(virQEMUCapsPtr qemuCaps)
{
struct stat sb;
- if (!caps->binary)
+ if (!qemuCaps->binary)
return true;
- if (stat(caps->binary, &sb) < 0)
+ if (stat(qemuCaps->binary, &sb) < 0)
return false;
- return sb.st_mtime == caps->mtime;
+ return sb.st_mtime == qemuCaps->mtime;
}
@@ -2576,8 +2576,8 @@ virQEMUCapsHashDataFree(void *payload, const void *key
ATTRIBUTE_UNUSED)
virQEMUCapsCachePtr
virQEMUCapsCacheNew(const char *libDir,
- uid_t runUid,
- gid_t runGid)
+ uid_t runUid,
+ gid_t runGid)
{
virQEMUCapsCachePtr cache;
@@ -2628,7 +2628,7 @@ virQEMUCapsCacheLookup(virQEMUCapsCachePtr cache, const char
*binary)
VIR_DEBUG("Creating capabilities for %s",
binary);
ret = virQEMUCapsNewForBinary(binary, cache->libDir,
- cache->runUid, cache->runGid);
+ cache->runUid, cache->runGid);
if (ret) {
VIR_DEBUG("Caching capabilities %p for %s",
ret, binary);
@@ -2648,14 +2648,14 @@ virQEMUCapsCacheLookup(virQEMUCapsCachePtr cache, const char
*binary)
virQEMUCapsPtr
virQEMUCapsCacheLookupCopy(virQEMUCapsCachePtr cache, const char *binary)
{
- virQEMUCapsPtr caps = virQEMUCapsCacheLookup(cache, binary);
+ virQEMUCapsPtr qemuCaps = virQEMUCapsCacheLookup(cache, binary);
virQEMUCapsPtr ret;
- if (!caps)
+ if (!qemuCaps)
return NULL;
- ret = virQEMUCapsNewCopy(caps);
- virObjectUnref(caps);
+ ret = virQEMUCapsNewCopy(qemuCaps);
+ virObjectUnref(qemuCaps);
return ret;
}
@@ -2673,7 +2673,7 @@ virQEMUCapsCacheFree(virQEMUCapsCachePtr cache)
}
bool
-virQEMUCapsUsedQMP(virQEMUCapsPtr caps)
+virQEMUCapsUsedQMP(virQEMUCapsPtr qemuCaps)
{
- return caps->usedQMP;
+ return qemuCaps->usedQMP;
}
diff --git a/src/qemu/qemu_process.c b/src/qemu/qemu_process.c
index e632615..8e7c09c 100644
--- a/src/qemu/qemu_process.c
+++ b/src/qemu/qemu_process.c
@@ -1625,10 +1625,10 @@ qemuProcessLookupPTYs(virDomainChrDefPtr *devices,
static int
qemuProcessFindCharDevicePTYsMonitor(virDomainObjPtr vm,
- virQEMUCapsPtr caps,
+ virQEMUCapsPtr qemuCaps,
virHashTablePtr paths)
{
- bool chardevfmt = virQEMUCapsGet(caps, QEMU_CAPS_CHARDEV);
+ bool chardevfmt = virQEMUCapsGet(qemuCaps, QEMU_CAPS_CHARDEV);
int i = 0;
if (qemuProcessLookupPTYs(vm->def->serials, vm->def->nserials,
@@ -1753,7 +1753,7 @@ qemuProcessReadLogFD(int logfd, char *buf, int maxlen, int off)
static int
qemuProcessWaitForMonitor(virQEMUDriverPtr driver,
virDomainObjPtr vm,
- virQEMUCapsPtr caps,
+ virQEMUCapsPtr qemuCaps,
off_t pos)
{
char *buf = NULL;
@@ -1763,7 +1763,7 @@ qemuProcessWaitForMonitor(virQEMUDriverPtr driver,
virHashTablePtr paths = NULL;
qemuDomainObjPrivatePtr priv;
- if (!virQEMUCapsUsedQMP(caps) && pos != -1) {
+ if (!virQEMUCapsUsedQMP(qemuCaps) && pos != -1) {
if ((logfd = qemuDomainOpenLog(driver, vm, pos)) < 0)
return -1;
@@ -1798,7 +1798,7 @@ qemuProcessWaitForMonitor(virQEMUDriverPtr driver,
VIR_DEBUG("qemuMonitorGetPtyPaths returned %i", ret);
if (ret == 0)
- ret = qemuProcessFindCharDevicePTYsMonitor(vm, caps, paths);
+ ret = qemuProcessFindCharDevicePTYsMonitor(vm, qemuCaps, paths);
cleanup:
virHashFree(paths);
@@ -1806,7 +1806,7 @@ cleanup:
if (pos != -1 && kill(vm->pid, 0) == -1 && errno == ESRCH) {
/* VM is dead, any other error raised in the interim is probably
* not as important as the qemu cmdline output */
- if (virQEMUCapsUsedQMP(caps)) {
+ if (virQEMUCapsUsedQMP(qemuCaps)) {
if ((logfd = qemuDomainOpenLog(driver, vm, pos)) < 0)
return -1;
diff --git a/tests/qemuhelptest.c b/tests/qemuhelptest.c
index f5b37d5..720a188 100644
--- a/tests/qemuhelptest.c
+++ b/tests/qemuhelptest.c
@@ -53,7 +53,7 @@ static int testHelpStrParsing(const void *data)
goto cleanup;
if (virQEMUCapsParseHelpStr("QEMU", help, flags,
- &version, &is_kvm, &kvm_version, false) == -1)
+ &version, &is_kvm, &kvm_version, false) ==
-1)
goto cleanup;
# ifndef WITH_YAJL
--
|:
http://berrange.com -o-
http://www.flickr.com/photos/dberrange/ :|
|:
http://libvirt.org -o-
http://virt-manager.org :|
|:
http://autobuild.org -o-
http://search.cpan.org/~danberr/ :|
|:
http://entangle-photo.org -o-
http://live.gnome.org/gtk-vnc :|