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.
diff --git a/src/qemu/qemu_capabilities.c
b/src/qemu/qemu_capabilities.c
index ceed735..32b8ee2 100644
--- a/src/qemu/qemu_capabilities.c
+++ b/src/qemu/qemu_capabilities.c
...
@@ -241,23 +241,23 @@ struct _qemuCapsCache {
};
-static virClassPtr qemuCapsClass;
-static void qemuCapsDispose(void *obj);
+static virClassPtr virQEMUCapsClass;
+static void virQEMUCapsDispose(void *obj);
-static int qemuCapsOnceInit(void)
+static int virQEMUCapsOnceInit(void)
{
- if (!(qemuCapsClass = virClassNew(virClassForObject(),
- "qemuCaps",
- sizeof(qemuCaps),
- qemuCapsDispose)))
+ if (!(virQEMUCapsClass = virClassNew(virClassForObject(),
+ "virQEMUCaps",
+ sizeof(virQEMUCaps),
+ virQEMUCapsDispose)))
You forgot to adjust indentation.
return -1;
return 0;
}
-VIR_ONCE_GLOBAL_INIT(qemuCaps)
+VIR_ONCE_GLOBAL_INIT(virQEMUCaps)
-static virArch qemuCapsArchFromString(const char *arch)
+static virArch virQEMUCapsArchFromString(const char *arch)
{
if (STREQ(arch, "i386"))
return VIR_ARCH_I686;
...
@@ -919,7 +919,7 @@ virCapsPtr qemuCapsInit(qemuCapsCachePtr cache)
* if a qemu-system-$ARCH binary can't be found
*/
for (i = 0 ; i < VIR_ARCH_LAST ; i++)
- if (qemuCapsInitGuest(caps, cache,
+ if (virQEMUCapsInitGuest(caps, cache,
virArchFromHost(),
i) < 0)
Indentation.
goto error;
...
@@ -1287,7 +1287,7 @@ int qemuCapsParseHelpStr(const char *qemu,
*version = (major * 1000 * 1000) + (minor * 1000) + micro;
- if (qemuCapsComputeCmdFlags(help, *version, *is_kvm, *kvm_version,
+ if (virQEMUCapsComputeCmdFlags(help, *version, *is_kvm, *kvm_version,
caps, check_yajl) < 0)
Indentation.
goto cleanup;
...
@@ -1557,51 +1557,51 @@ qemuCapsParseDeviceStrObjectProps(const char
*str,
cleanup:
if (ret < 0)
- qemuCapsFreeStringList(nproplist, proplist);
+ virQEMUCapsFreeStringList(nproplist, proplist);
return ret;
}
int
-qemuCapsParseDeviceStr(qemuCapsPtr caps, const char *str)
+virQEMUCapsParseDeviceStr(virQEMUCapsPtr caps, const char *str)
{
int nvalues;
char **values;
size_t i;
- if ((nvalues = qemuCapsParseDeviceStrObjectTypes(str, &values)) < 0)
+ if ((nvalues = virQEMUCapsParseDeviceStrObjectTypes(str, &values)) < 0)
return -1;
- qemuCapsProcessStringFlags(caps,
- ARRAY_CARDINALITY(qemuCapsObjectTypes),
- qemuCapsObjectTypes,
+ virQEMUCapsProcessStringFlags(caps,
+ ARRAY_CARDINALITY(virQEMUCapsObjectTypes),
+ virQEMUCapsObjectTypes,
nvalues, values);
Indentation.
- qemuCapsFreeStringList(nvalues, values);
+ virQEMUCapsFreeStringList(nvalues, values);
- for (i = 0 ; i < ARRAY_CARDINALITY(qemuCapsObjectProps); i++) {
- const char *type = qemuCapsObjectProps[i].type;
- if ((nvalues = qemuCapsParseDeviceStrObjectProps(str,
+ for (i = 0 ; i < ARRAY_CARDINALITY(virQEMUCapsObjectProps); i++) {
+ const char *type = virQEMUCapsObjectProps[i].type;
+ if ((nvalues = virQEMUCapsParseDeviceStrObjectProps(str,
type,
&values)) < 0)
Indentation.
return -1;
- qemuCapsProcessStringFlags(caps,
- qemuCapsObjectProps[i].nprops,
- qemuCapsObjectProps[i].props,
+ virQEMUCapsProcessStringFlags(caps,
+ virQEMUCapsObjectProps[i].nprops,
+ virQEMUCapsObjectProps[i].props,
nvalues, values);
Indentation.
- qemuCapsFreeStringList(nvalues, values);
+ virQEMUCapsFreeStringList(nvalues, values);
}
/* Prefer -chardev spicevmc (detected earlier) over -device spicevmc */
- if (qemuCapsGet(caps, QEMU_CAPS_CHARDEV_SPICEVMC))
- qemuCapsClear(caps, QEMU_CAPS_DEVICE_SPICEVMC);
+ if (virQEMUCapsGet(caps, QEMU_CAPS_CHARDEV_SPICEVMC))
+ virQEMUCapsClear(caps, QEMU_CAPS_DEVICE_SPICEVMC);
return 0;
}
static int
-qemuCapsExtractDeviceStr(const char *qemu,
- qemuCapsPtr caps,
- qemuCapsHookDataPtr hookData)
+virQEMUCapsExtractDeviceStr(const char *qemu,
+ virQEMUCapsPtr caps,
+ virQEMUCapsHookDataPtr hookData)
{
char *output = NULL;
virCommandPtr cmd;
...
@@ -2025,39 +2025,39 @@ qemuCapsProbeQMPObjects(qemuCapsPtr caps,
if ((nvalues = qemuMonitorGetObjectTypes(mon, &values)) < 0)
return -1;
- qemuCapsProcessStringFlags(caps,
- ARRAY_CARDINALITY(qemuCapsObjectTypes),
- qemuCapsObjectTypes,
+ virQEMUCapsProcessStringFlags(caps,
+ ARRAY_CARDINALITY(virQEMUCapsObjectTypes),
+ virQEMUCapsObjectTypes,
nvalues, values);
Indentation.
> - qemuCapsFreeStringList(nvalues, values);
> + virQEMUCapsFreeStringList(nvalues, values);
>
> - for (i = 0 ; i < ARRAY_CARDINALITY(qemuCapsObjectProps); i++) {
> - const char *type = qemuCapsObjectProps[i].type;
> + for (i = 0 ; i < ARRAY_CARDINALITY(virQEMUCapsObjectProps); i++) {
> + const char *type = virQEMUCapsObjectProps[i].type;
> if ((nvalues = qemuMonitorGetObjectProps(mon,
> type,
> &values)) < 0)
return -1;
- qemuCapsProcessStringFlags(caps,
- qemuCapsObjectProps[i].nprops,
- qemuCapsObjectProps[i].props,
+ virQEMUCapsProcessStringFlags(caps,
+ virQEMUCapsObjectProps[i].nprops,
+ virQEMUCapsObjectProps[i].props,
nvalues, values);
Indentation.
- qemuCapsFreeStringList(nvalues, values);
+ virQEMUCapsFreeStringList(nvalues, values);
}
/* Prefer -chardev spicevmc (detected earlier) over -device spicevmc */
- if (qemuCapsGet(caps, QEMU_CAPS_CHARDEV_SPICEVMC))
- qemuCapsClear(caps, QEMU_CAPS_DEVICE_SPICEVMC);
+ if (virQEMUCapsGet(caps, QEMU_CAPS_CHARDEV_SPICEVMC))
+ virQEMUCapsClear(caps, QEMU_CAPS_DEVICE_SPICEVMC);
/* If qemu supports newer -device qxl it supports -vga qxl as well */
- if (qemuCapsGet(caps, QEMU_CAPS_DEVICE_QXL))
- qemuCapsSet(caps, QEMU_CAPS_VGA_QXL);
+ if (virQEMUCapsGet(caps, QEMU_CAPS_DEVICE_QXL))
+ virQEMUCapsSet(caps, QEMU_CAPS_VGA_QXL);
return 0;
}
static int
-qemuCapsProbeQMPMachineTypes(qemuCapsPtr caps,
- qemuMonitorPtr mon)
+virQEMUCapsProbeQMPMachineTypes(virQEMUCapsPtr caps,
+ qemuMonitorPtr mon)
{
qemuMonitorMachineInfoPtr *machines = NULL;
int nmachines = 0;
...
> @@ -2191,21 +2191,21 @@ qemuCapsInitHelp(qemuCapsPtr caps, uid_t runUid, gid_t
runGid)
> if (tmp) {
> tmp += strlen(QEMU_SYSTEM_PREFIX);
>
> - caps->arch = qemuCapsArchFromString(tmp);
> + caps->arch = virQEMUCapsArchFromString(tmp);
> } else {
> caps->arch = virArchFromHost();
> }
>
> hookData.runUid = runUid;
> hookData.runGid = runGid;
> - cmd = qemuCapsProbeCommand(caps->binary, NULL, &hookData);
> + cmd = virQEMUCapsProbeCommand(caps->binary, NULL, &hookData);
> virCommandAddArgList(cmd, "-help", NULL);
> virCommandSetOutputBuffer(cmd, &help);
>
> if (virCommandRun(cmd, NULL) < 0)
goto cleanup;
> - if (qemuCapsParseHelpStr(caps->binary,
> + if (virQEMUCapsParseHelpStr(caps->binary,
> help, caps,
> &caps->version,
> &is_kvm,
Indentation.
...
@@ -2568,18 +2568,18 @@ bool qemuCapsIsValid(qemuCapsPtr caps)
static void
-qemuCapsHashDataFree(void *payload, const void *key ATTRIBUTE_UNUSED)
+virQEMUCapsHashDataFree(void *payload, const void *key ATTRIBUTE_UNUSED)
{
virObjectUnref(payload);
}
-qemuCapsCachePtr
-qemuCapsCacheNew(const char *libDir,
+virQEMUCapsCachePtr
+virQEMUCapsCacheNew(const char *libDir,
uid_t runUid,
gid_t runGid)
Indentation.
{
- qemuCapsCachePtr cache;
+ virQEMUCapsCachePtr cache;
if (VIR_ALLOC(cache) < 0) {
virReportOOMError();
...
@@ -2627,7 +2627,7 @@ qemuCapsCacheLookup(qemuCapsCachePtr cache,
const char *binary)
if (!ret) {
VIR_DEBUG("Creating capabilities for %s",
binary);
- ret = qemuCapsNewForBinary(binary, cache->libDir,
+ ret = virQEMUCapsNewForBinary(binary, cache->libDir,
cache->runUid, cache->runGid);
Indentation.
if (ret) {
VIR_DEBUG("Caching capabilities %p for %s",
...
diff --git a/tests/qemuhelptest.c b/tests/qemuhelptest.c
index 68efd9c..f5b37d5 100644
--- a/tests/qemuhelptest.c
+++ b/tests/qemuhelptest.c
...
> @@ -49,19 +49,19 @@ static int testHelpStrParsing(const void *data)
> if (virtTestLoadFile(path, &help) < 0)
goto cleanup;
> - if (!(flags = qemuCapsNew()))
> + if (!(flags = virQEMUCapsNew()))
goto cleanup;
> - if (qemuCapsParseHelpStr("QEMU", help, flags,
> + if (virQEMUCapsParseHelpStr("QEMU", help, flags,
> &version, &is_kvm, &kvm_version, false) ==
-1)
Indentation.
goto cleanup;
> # ifndef WITH_YAJL
> - if (qemuCapsGet(info->flags, QEMU_CAPS_MONITOR_JSON))
> - qemuCapsSet(flags, QEMU_CAPS_MONITOR_JSON);
> + if (virQEMUCapsGet(info->flags, QEMU_CAPS_MONITOR_JSON))
> + virQEMUCapsSet(flags, QEMU_CAPS_MONITOR_JSON);
> # endif
>
> - if (qemuCapsGet(info->flags, QEMU_CAPS_DEVICE)) {
> + if (virQEMUCapsGet(info->flags, QEMU_CAPS_DEVICE)) {
> VIR_FREE(path);
> VIR_FREE(help);
> if (virAsprintf(&path, "%s/qemuhelpdata/%s-device",
abs_srcdir,
...
Jirka