From: Luiz Capitulino <lcapitulino@redhat.com>
To: qemu-devel@nongnu.org
Cc: aliguori@us.ibm.com, armbru@redhat.com
Subject: [Qemu-devel] [PATCH 2/4] QMP/monitor: update do_info_version() to output broken down version string
Date: Thu, 19 Aug 2010 13:33:34 -0300 [thread overview]
Message-ID: <1282235616-20988-3-git-send-email-lcapitulino@redhat.com> (raw)
In-Reply-To: <1282235616-20988-1-git-send-email-lcapitulino@redhat.com>
From: Miguel Di Ciurcio Filho <miguel.filho@gmail.com>
This code was originally developed by Daniel P. Berrange <berrange@redhat.com>
Signed-off-by: Miguel Di Ciurcio Filho <miguel.filho@gmail.com>
Signed-off-by: Luiz Capitulino <lcapitulino@redhat.com>
---
monitor.c | 23 +++++++++++++++++++----
1 files changed, 19 insertions(+), 4 deletions(-)
diff --git a/monitor.c b/monitor.c
index c313d5a..e27f8d8 100644
--- a/monitor.c
+++ b/monitor.c
@@ -669,17 +669,32 @@ help:
static void do_info_version_print(Monitor *mon, const QObject *data)
{
QDict *qdict;
+ QDict *qemu;
qdict = qobject_to_qdict(data);
+ qemu = qdict_get_qdict(qdict, "qemu");
- monitor_printf(mon, "%s%s\n", qdict_get_str(qdict, "qemu"),
- qdict_get_str(qdict, "package"));
+ monitor_printf(mon, "%" PRId64 ".%" PRId64 ".%" PRId64 "%s\n",
+ qdict_get_int(qemu, "major"),
+ qdict_get_int(qemu, "minor"),
+ qdict_get_int(qemu, "micro"),
+ qdict_get_str(qdict, "package"));
}
static void do_info_version(Monitor *mon, QObject **ret_data)
{
- *ret_data = qobject_from_jsonf("{ 'qemu': %s, 'package': %s }",
- QEMU_VERSION, QEMU_PKGVERSION);
+ const char *version = QEMU_VERSION;
+ int major = 0, minor = 0, micro = 0;
+ char *tmp;
+
+ major = strtol(version, &tmp, 10);
+ tmp++;
+ minor = strtol(tmp, &tmp, 10);
+ tmp++;
+ micro = strtol(tmp, &tmp, 10);
+
+ *ret_data = qobject_from_jsonf("{ 'qemu': { 'major': %d, 'minor': %d, \
+ 'micro': %d }, 'package': %s }", major, minor, micro, QEMU_PKGVERSION);
}
static void do_info_name_print(Monitor *mon, const QObject *data)
--
1.7.2.1.97.g3235b
next prev parent reply other threads:[~2010-08-19 16:34 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2010-08-19 16:33 [Qemu-devel] [master/0.13 0/4]: QMP: Stability related fixes Luiz Capitulino
2010-08-19 16:33 ` [Qemu-devel] [PATCH 1/4] QMP: update 'query-version' documentation Luiz Capitulino
2010-08-19 16:33 ` Luiz Capitulino [this message]
2010-08-19 16:33 ` [Qemu-devel] [PATCH 3/4] QMP doc: Add 'Stability Considerations' section Luiz Capitulino
2010-08-19 16:33 ` [Qemu-devel] [PATCH 4/4] QMP: Update README file Luiz Capitulino
2010-08-20 16:04 ` Markus Armbruster
2010-08-20 18:54 ` Luiz Capitulino
-- strict thread matches above, loose matches on Subject: below --
2010-08-20 19:42 [Qemu-devel] [master/0.13 v2 0/4]: QMP: Stability related fixes Luiz Capitulino
2010-08-20 19:42 ` [Qemu-devel] [PATCH 2/4] QMP/monitor: update do_info_version() to output broken down version string Luiz Capitulino
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1282235616-20988-3-git-send-email-lcapitulino@redhat.com \
--to=lcapitulino@redhat.com \
--cc=aliguori@us.ibm.com \
--cc=armbru@redhat.com \
--cc=qemu-devel@nongnu.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).