@@ -369,7 +369,7 @@ void vnc_display_init(DisplayState *ds);
void vnc_display_close(DisplayState *ds);
int vnc_display_open(DisplayState *ds, const char *display);
int vnc_display_password(DisplayState *ds, const char *password);
-void do_info_vnc_print(Monitor *mon, const QObject *data);
+void do_info_vnc(Monitor *mon);
void qmp_query_vnc(Monitor *mon, QObject **ret_data);
char *vnc_display_local_addr(DisplayState *ds);
@@ -2567,8 +2567,7 @@ static const mon_cmd_t info_cmds[] = {
.args_type = "",
.params = "",
.help = "show the vnc server status",
- .user_print = do_info_vnc_print,
- .mhandler.info_new = qmp_query_vnc,
+ .mhandler.info = do_info_vnc,
},
{
.name = "name",
@@ -302,15 +302,17 @@ static void info_vnc_iter(QObject *obj, void *opaque)
#endif
}
-void do_info_vnc_print(Monitor *mon, const QObject *data)
+void do_info_vnc(Monitor *mon)
{
QDict *server;
QList *clients;
+ QObject *data;
+ qmp_query_vnc(NULL, &data);
server = qobject_to_qdict(data);
if (qdict_get_bool(server, "enabled") == 0) {
monitor_printf(mon, "Server: disabled\n");
- return;
+ goto out;
}
monitor_printf(mon, "Server:\n");
@@ -325,6 +327,9 @@ void do_info_vnc_print(Monitor *mon, const QObject *data)
} else {
qlist_iter(clients, info_vnc_iter, mon);
}
+
+out:
+ qobject_decref(data);
}
void qmp_query_vnc(Monitor *mon, QObject **ret_data)
The new handler directly calls qmp_query_vnc() to gather data and then prints it. This change allows us to drop the user_print callback. Signed-off-by: Luiz Capitulino <lcapitulino@redhat.com> --- console.h | 2 +- monitor.c | 3 +-- ui/vnc.c | 9 +++++++-- 3 files changed, 9 insertions(+), 5 deletions(-)