[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] [PATCH 14/22] qapi: add query-version QMP command
From: |
Anthony Liguori |
Subject: |
[Qemu-devel] [PATCH 14/22] qapi: add query-version QMP command |
Date: |
Sun, 6 Mar 2011 19:22:56 -0600 |
This is used internally by QMP. It's also a pretty good example of a typical
command conversion.
Signed-off-by: Anthony Liguori <address@hidden>
diff --git a/Makefile.objs b/Makefile.objs
index 5dae800..e1a2756 100644
--- a/Makefile.objs
+++ b/Makefile.objs
@@ -103,7 +103,7 @@ common-obj-y += block-migration.o
common-obj-y += pflib.o
common-obj-y += bitmap.o bitops.o
common-obj-y += qmp-marshal-types.o qmp-marshal-types-core.o
-common-obj-y += qmp-core.o qmp-marshal.o
+common-obj-y += qmp-core.o qmp-marshal.o qmp.o
common-obj-$(CONFIG_BRLAPI) += baum.o
common-obj-$(CONFIG_POSIX) += migration-exec.o migration-unix.o migration-fd.o
diff --git a/qmp-schema.json b/qmp-schema.json
index e69de29..b343f5e 100644
--- a/qmp-schema.json
+++ b/qmp-schema.json
@@ -0,0 +1,38 @@
+# *-*- Mode: Python -*-*
+### 0.14.0 commands. Do not modify. ###
+
+##
+# @VersionInfo:
+#
+# A description of QEMU's version.
+#
+# @qemu.major: The major version of QEMU
+#
+# @qemu.minor: The minor version of QEMU
+#
+# @qemu.micro: The micro 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
+# signifies a stable release.
+#
+# @package: QEMU will always set this field to an empty string. Downstream
+# versions of QEMU should set this to a non-empty string. The
+# exact format depends on the downstream however it highly
+# recommended that a unique name is used.
+#
+# Since: 0.14.0
+##
+{ 'VersionInfo': {'qemu': {'major': 'int', 'minor': 'int', 'micro': 'int'},
+ 'package': 'str'} }
+
+##
+# @query-version:
+#
+# Returns the current version of QEMU.
+#
+# Returns: A @VersionInfo object describing the current version of QEMU.
+#
+# Since: 0.14.0
+##
+[ 'query-version', {}, {}, 'VersionInfo' ]
diff --git a/qmp.c b/qmp.c
new file mode 100644
index 0000000..7b626f5
--- /dev/null
+++ b/qmp.c
@@ -0,0 +1,31 @@
+/*
+ * QAPI
+ *
+ * Copyright IBM, Corp. 2011
+ *
+ * Authors:
+ * Anthony Liguori <address@hidden>
+ *
+ * This work is licensed under the terms of the GNU LGPL, version 2. See
+ * the COPYING.LIB file in the top-level directory.
+ */
+#include "qemu-common.h"
+#include "qmp-core.h"
+#include "qmp.h"
+
+VersionInfo *qmp_query_version(Error **err)
+{
+ VersionInfo *info = qmp_alloc_version_info();
+ const char *version = QEMU_VERSION;
+ char *tmp;
+
+ info->qemu.major = strtol(version, &tmp, 10);
+ tmp++;
+ info->qemu.minor = strtol(tmp, &tmp, 10);
+ tmp++;
+ info->qemu.micro = strtol(tmp, &tmp, 10);
+ info->package = qemu_strdup(QEMU_PKGVERSION);
+
+ return info;
+}
+
--
1.7.0.4
- Re: [Qemu-devel] [PATCH 10/22] qapi: add core QMP server support, (continued)
- [Qemu-devel] [PATCH 15/22] qapi: add new QMP server that uses CharDriverState, Anthony Liguori, 2011/03/06
- [Qemu-devel] [PATCH 14/22] qapi: add query-version QMP command,
Anthony Liguori <=
- Re: [Qemu-devel] [PATCH 14/22] qapi: add query-version QMP command, Stefan Hajnoczi, 2011/03/07
- Re: [Qemu-devel] [PATCH 14/22] qapi: add query-version QMP command, Anthony Liguori, 2011/03/07
- Re: [Qemu-devel] [PATCH 14/22] qapi: add query-version QMP command, Avi Kivity, 2011/03/09
- Re: [Qemu-devel] [PATCH 14/22] qapi: add query-version QMP command, Anthony Liguori, 2011/03/09
- Re: [Qemu-devel] [PATCH 14/22] qapi: add query-version QMP command, Avi Kivity, 2011/03/09
- Re: [Qemu-devel] [PATCH 14/22] qapi: add query-version QMP command, Anthony Liguori, 2011/03/09
Re: [Qemu-devel] [PATCH 14/22] qapi: add query-version QMP command, Avi Kivity, 2011/03/09