From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:40212) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1UmjaB-000574-Cv for qemu-devel@nongnu.org; Wed, 12 Jun 2013 07:51:20 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1Umja5-0002Jb-Hf for qemu-devel@nongnu.org; Wed, 12 Jun 2013 07:51:19 -0400 Received: from mx1.redhat.com ([209.132.183.28]:7263) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Umja5-0002JN-9f for qemu-devel@nongnu.org; Wed, 12 Jun 2013 07:51:13 -0400 From: Gerd Hoffmann Date: Wed, 12 Jun 2013 13:51:09 +0200 Message-Id: <1371037869-14768-1-git-send-email-kraxel@redhat.com> Subject: [Qemu-devel] [PATCH] console: Hook QemuConsoles into qom tree List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-devel@nongnu.org Cc: Anthony Liguori , Gerd Hoffmann Put them named "console[$index]" below "/backend", so you can list & inspect them via QMP. Signed-off-by: Gerd Hoffmann --- ui/console.c | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/ui/console.c b/ui/console.c index 1a9ea93..07d4d63 100644 --- a/ui/console.c +++ b/ui/console.c @@ -1581,6 +1581,8 @@ static DisplayState *get_alloc_displaystate(void) */ DisplayState *init_displaystate(void) { + Error *local_err = NULL; + gchar *name; int i; if (!display_state) { @@ -1592,6 +1594,14 @@ DisplayState *init_displaystate(void) consoles[i]->ds == NULL) { text_console_do_init(consoles[i]->chr, display_state); } + + /* Hook up into the qom tree here (not in new_console()), once + * all QemuConsoles are created and the order / numbering + * doesn't change any more */ + name = g_strdup_printf("console[%d]", i); + object_property_add_child(container_get(object_get_root(), "/backend"), + name, OBJECT(consoles[i]), &local_err); + g_free(name); } return display_state; -- 1.7.9.7