Skip to contentSkip to conversation

console: Hook QemuConsoles into qom tree

PATCH Applied Gerd Hoffmann 2 participants 2 messages Jun 12, 2013 – Jul 1, 2013

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 console: Hook QemuConsoles into qom tree

Put them named "console[$index]" below "/backend", so you can list & inspect them via QMP.

---
 ui/console.c |   10 ++++++++++
 1 file changed, 10 insertions(+)
ui/console.c +10 -0
index 1a9ea93..07d4d63 100644
@@ -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;
Signature · 1 line
1.7.9.7