qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Gerd Hoffmann <kraxel@redhat.com>
To: qemu-devel@nongnu.org
Cc: Anthony Liguori <aliguori@us.ibm.com>, Gerd Hoffmann <kraxel@redhat.com>
Subject: [Qemu-devel] [PATCH 1/5] console: qom-ify QemuConsole
Date: Wed, 24 Apr 2013 11:33:18 +0200	[thread overview]
Message-ID: <1366796002-30135-2-git-send-email-kraxel@redhat.com> (raw)
In-Reply-To: <1366796002-30135-1-git-send-email-kraxel@redhat.com>

Just the minimal bits to turn QemuConsoles into Objects.

Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
---
 include/ui/console.h |   15 +++++++++++++++
 ui/console.c         |   15 ++++++++++++++-
 2 files changed, 29 insertions(+), 1 deletion(-)

diff --git a/include/ui/console.h b/include/ui/console.h
index e591d74..c8a274d 100644
--- a/include/ui/console.h
+++ b/include/ui/console.h
@@ -2,6 +2,7 @@
 #define CONSOLE_H
 
 #include "ui/qemu-pixman.h"
+#include "qom/object.h"
 #include "qapi/qmp/qdict.h"
 #include "qemu/notify.h"
 #include "monitor/monitor.h"
@@ -106,6 +107,20 @@ void kbd_put_keysym(int keysym);
 
 /* consoles */
 
+#define TYPE_QEMU_CONSOLE "qemu-console"
+#define QEMU_CONSOLE(obj) \
+    OBJECT_CHECK(QemuConsole, (obj), TYPE_QEMU_CONSOLE)
+#define QEMU_CONSOLE_GET_CLASS(obj) \
+    OBJECT_GET_CLASS(QemuConsoleClass, (obj), TYPE_QEMU_CONSOLE)
+#define QEMU_CONSOLE_CLASS(klass) \
+    OBJECT_CLASS_CHECK(QemuConsoleClass, (klass), TYPE_QEMU_CONSOLE)
+
+typedef struct QemuConsoleClass QemuConsoleClass;
+
+struct QemuConsoleClass {
+    ObjectClass parent_class;
+};
+
 #define QEMU_BIG_ENDIAN_FLAG    0x01
 #define QEMU_ALLOCATED_FLAG     0x02
 
diff --git a/ui/console.c b/ui/console.c
index 4f9219e..e9f3080 100644
--- a/ui/console.c
+++ b/ui/console.c
@@ -113,6 +113,8 @@ typedef enum {
 } console_type_t;
 
 struct QemuConsole {
+    Object parent;
+
     int index;
     console_type_t console_type;
     DisplayState *ds;
@@ -1197,12 +1199,14 @@ static void text_console_update(void *opaque, console_ch_t *chardata)
 
 static QemuConsole *new_console(DisplayState *ds, console_type_t console_type)
 {
+    Object *obj;
     QemuConsole *s;
     int i;
 
     if (nb_consoles >= MAX_CONSOLES)
         return NULL;
-    s = g_malloc0(sizeof(QemuConsole));
+    obj = object_new(TYPE_QEMU_CONSOLE);
+    s = QEMU_CONSOLE(obj);
     if (!active_console || ((active_console->console_type != GRAPHIC_CONSOLE) &&
         (console_type == GRAPHIC_CONSOLE))) {
         active_console = s;
@@ -1920,8 +1924,17 @@ static void qemu_chr_parse_vc(QemuOpts *opts, ChardevBackend *backend,
     }
 }
 
+static const TypeInfo qemu_console_info = {
+    .name = TYPE_QEMU_CONSOLE,
+    .parent = TYPE_OBJECT,
+    .instance_size = sizeof(QemuConsole),
+    .class_size = sizeof(QemuConsoleClass),
+};
+
+
 static void register_types(void)
 {
+    type_register_static(&qemu_console_info);
     register_char_driver_qapi("vc", CHARDEV_BACKEND_KIND_VC,
                               qemu_chr_parse_vc);
 }
-- 
1.7.9.7

  reply	other threads:[~2013-04-24  9:44 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-04-24  9:33 [Qemu-devel] [PULL 0/5] console: qom-ify consoles Gerd Hoffmann
2013-04-24  9:33 ` Gerd Hoffmann [this message]
2013-04-24  9:33 ` [Qemu-devel] [PATCH 2/5] console: add device link to QemuConsoles Gerd Hoffmann
2013-04-24  9:33 ` [Qemu-devel] [PATCH 3/5] console: add qemu_console_lookup_by_device Gerd Hoffmann
2013-04-24  9:33 ` [Qemu-devel] [PATCH 4/5] console: switch ppm_save to qemu_open Gerd Hoffmann
2013-04-24  9:33 ` [Qemu-devel] [PATCH 5/5] console: zap ds arg from register_displaychangelistener Gerd Hoffmann
2013-04-24 16:49 ` [Qemu-devel] [PULL 0/5] console: qom-ify consoles Anthony Liguori
  -- strict thread matches above, loose matches on Subject: below --
2013-04-18  9:01 [Qemu-devel] [RfC PATCH 0/5] console: qom-ify & extent screendump monitor command Gerd Hoffmann
2013-04-18  9:01 ` [Qemu-devel] [PATCH 1/5] console: qom-ify QemuConsole Gerd Hoffmann

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=1366796002-30135-2-git-send-email-kraxel@redhat.com \
    --to=kraxel@redhat.com \
    --cc=aliguori@us.ibm.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).