aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--hmp.c2
-rw-r--r--qapi/common.json26
-rw-r--r--qmp.c9
3 files changed, 25 insertions, 12 deletions
diff --git a/hmp.c b/hmp.c
index d85d913a79..97d9c2c05f 100644
--- a/hmp.c
+++ b/hmp.c
@@ -60,7 +60,7 @@ void hmp_info_version(Monitor *mon, const QDict *qdict)
info = qmp_query_version(NULL);
monitor_printf(mon, "%" PRId64 ".%" PRId64 ".%" PRId64 "%s\n",
- info->qemu.major, info->qemu.minor, info->qemu.micro,
+ info->qemu->major, info->qemu->minor, info->qemu->micro,
info->package);
qapi_free_VersionInfo(info);
diff --git a/qapi/common.json b/qapi/common.json
index 12431c691b..bad56bf688 100644
--- a/qapi/common.json
+++ b/qapi/common.json
@@ -29,15 +29,28 @@
'DeviceNotActive', 'DeviceNotFound', 'KVMMissingCap' ] }
##
-# @VersionInfo:
+# @VersionTriple
#
-# A description of QEMU's version.
+# A three-part version number.
+#
+# @qemu.major: The major version number.
#
-# @qemu.major: The major version of QEMU
+# @qemu.minor: The minor version number.
#
-# @qemu.minor: The minor version of QEMU
+# @qemu.micro: The micro version number.
+#
+# Since: 2.4
+##
+{ 'struct': 'VersionTriple',
+ 'data': {'major': 'int', 'minor': 'int', 'micro': 'int'} }
+
+
+##
+# @VersionInfo:
+#
+# A description of QEMU's version.
#
-# @qemu.micro: The micro version of QEMU. By current convention, a micro
+# @qemu: The version of QEMU. By current convention, a micro
# version of 50 signifies a development branch. A micro version
# greater than or equal to 90 signifies a release candidate for
# the next minor version. A micro version of less than 50
@@ -51,8 +64,7 @@
# Since: 0.14.0
##
{ 'struct': 'VersionInfo',
- 'data': {'qemu': {'major': 'int', 'minor': 'int', 'micro': 'int'},
- 'package': 'str'} }
+ 'data': {'qemu': 'VersionTriple', 'package': 'str'} }
##
# @query-version:
diff --git a/qmp.c b/qmp.c
index e6c70504df..3f5dfe3f51 100644
--- a/qmp.c
+++ b/qmp.c
@@ -45,15 +45,16 @@ NameInfo *qmp_query_name(Error **errp)
VersionInfo *qmp_query_version(Error **errp)
{
- VersionInfo *info = g_malloc0(sizeof(*info));
+ VersionInfo *info = g_new0(VersionInfo, 1);
const char *version = QEMU_VERSION;
char *tmp;
- info->qemu.major = strtol(version, &tmp, 10);
+ info->qemu = g_new0(VersionTriple, 1);
+ info->qemu->major = strtol(version, &tmp, 10);
tmp++;
- info->qemu.minor = strtol(tmp, &tmp, 10);
+ info->qemu->minor = strtol(tmp, &tmp, 10);
tmp++;
- info->qemu.micro = strtol(tmp, &tmp, 10);
+ info->qemu->micro = strtol(tmp, &tmp, 10);
info->package = g_strdup(QEMU_PKGVERSION);
return info;