[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] [PATCH 02/23] Add option to turn on JSON pretty printing in
From: |
Luiz Capitulino |
Subject: |
[Qemu-devel] [PATCH 02/23] Add option to turn on JSON pretty printing in monitor |
Date: |
Fri, 1 Oct 2010 15:19:06 -0300 |
From: Daniel P. Berrange <address@hidden>
Expaned '-mon' arg to allow a 'pretty=on' flag. This makes the
monitor pretty print its replies to easy human debugging / reading
Signed-off-by: Daniel P. Berrange <address@hidden>
Signed-off-by: Luiz Capitulino <address@hidden>
---
monitor.c | 5 ++++-
monitor.h | 1 +
qemu-config.c | 3 +++
vl.c | 3 +++
4 files changed, 11 insertions(+), 1 deletions(-)
diff --git a/monitor.c b/monitor.c
index e602480..a33cdc2 100644
--- a/monitor.c
+++ b/monitor.c
@@ -351,7 +351,10 @@ static void monitor_json_emitter(Monitor *mon, const
QObject *data)
{
QString *json;
- json = qobject_to_json(data);
+ if (mon->flags & MONITOR_USE_PRETTY)
+ json = qobject_to_json_pretty(data);
+ else
+ json = qobject_to_json(data);
assert(json != NULL);
qstring_append_chr(json, '\n');
diff --git a/monitor.h b/monitor.h
index 38b22a4..f2122b5 100644
--- a/monitor.h
+++ b/monitor.h
@@ -14,6 +14,7 @@ extern Monitor *default_mon;
#define MONITOR_IS_DEFAULT 0x01
#define MONITOR_USE_READLINE 0x02
#define MONITOR_USE_CONTROL 0x04
+#define MONITOR_USE_PRETTY 0x08
/* flags for monitor commands */
#define MONITOR_CMD_ASYNC 0x0001
diff --git a/qemu-config.c b/qemu-config.c
index e3b746c..6052a28 100644
--- a/qemu-config.c
+++ b/qemu-config.c
@@ -283,6 +283,9 @@ static QemuOptsList qemu_mon_opts = {
},{
.name = "default",
.type = QEMU_OPT_BOOL,
+ },{
+ .name = "pretty",
+ .type = QEMU_OPT_BOOL,
},
{ /* end of list */ }
},
diff --git a/vl.c b/vl.c
index d352d18..939ee87 100644
--- a/vl.c
+++ b/vl.c
@@ -1562,6 +1562,9 @@ static int mon_init_func(QemuOpts *opts, void *opaque)
exit(1);
}
+ if (qemu_opt_get_bool(opts, "pretty", 0))
+ flags |= MONITOR_USE_PRETTY;
+
if (qemu_opt_get_bool(opts, "default", 0))
flags |= MONITOR_IS_DEFAULT;
--
1.7.3.1.50.g1e633
- [Qemu-devel] [PULL 00/23]: Monitor queue, Luiz Capitulino, 2010/10/01
- [Qemu-devel] [PATCH 01/23] Add support for JSON pretty printing, Luiz Capitulino, 2010/10/01
- [Qemu-devel] [PATCH 02/23] Add option to turn on JSON pretty printing in monitor,
Luiz Capitulino <=
- [Qemu-devel] [PATCH 03/23] disable guest-provided stats on "info balloon" command, Luiz Capitulino, 2010/10/01
- [Qemu-devel] [PATCH 04/23] Monitor: Introduce search_dispatch_table(), Luiz Capitulino, 2010/10/01
- [Qemu-devel] [PATCH 05/23] QMP: handle_qmp_command(): Move 'cmd' sanity check, Luiz Capitulino, 2010/10/01
- [Qemu-devel] [PATCH 06/23] QMP: Don't use do_info(), Luiz Capitulino, 2010/10/01
- [Qemu-devel] [PATCH 08/23] Monitor: Drop is_async_return(), Luiz Capitulino, 2010/10/01
- [Qemu-devel] [PATCH 07/23] Monitor: Drop QMP bits from do_info(), Luiz Capitulino, 2010/10/01
- [Qemu-devel] [PATCH 09/23] Monitor: Convert do_info() back to HMP, Luiz Capitulino, 2010/10/01
- [Qemu-devel] [PATCH 10/23] Monitor: Introduce the qmp-commands.hx file, Luiz Capitulino, 2010/10/01
- [Qemu-devel] [PATCH 11/23] QMP: Introduce qmp_find_cmd(), Luiz Capitulino, 2010/10/01
- [Qemu-devel] [PATCH 12/23] QMP: Introduce command dispatch table, Luiz Capitulino, 2010/10/01