From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([208.118.235.92]:55425) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1S4I78-0007iU-1A for qemu-devel@nongnu.org; Sun, 04 Mar 2012 15:33:08 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1S4I6m-0006Mg-EX for qemu-devel@nongnu.org; Sun, 04 Mar 2012 15:33:05 -0500 Received: from cantor2.suse.de ([195.135.220.15]:40938 helo=mx2.suse.de) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1S4I6m-0006MU-12 for qemu-devel@nongnu.org; Sun, 04 Mar 2012 15:32:44 -0500 From: =?UTF-8?q?Andreas=20F=C3=A4rber?= Date: Sun, 4 Mar 2012 21:32:36 +0100 Message-Id: <1330893156-26569-4-git-send-email-afaerber@suse.de> In-Reply-To: <1330893156-26569-1-git-send-email-afaerber@suse.de> References: <1330893156-26569-1-git-send-email-afaerber@suse.de> MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable Subject: [Qemu-devel] [PATCH v4 3/3] qom: Add QOM support to user emulators List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-devel@nongnu.org Cc: =?UTF-8?q?Andreas=20F=C3=A4rber?= , anthony@codemonkey.ws, lcapitulino@redhat.com Link the Object base class and the module infrastructure for class registration. Introduce $(universal-obj-y) for objects that are more common than $(common-obj-y), so that those only get built once. Call QOM module init for type registration. Signed-off-by: Andreas F=C3=A4rber Cc: Anthony Liguori --- Makefile | 6 +++--- Makefile.objs | 23 ++++++++++++++++++----- Makefile.target | 4 ++++ Makefile.user | 1 + bsd-user/main.c | 2 ++ darwin-user/main.c | 3 +++ linux-user/main.c | 2 ++ qemu-user.c | 37 +++++++++++++++++++++++++++++++++++++ 8 files changed, 70 insertions(+), 8 deletions(-) create mode 100644 qemu-user.c diff --git a/Makefile b/Makefile index 49c775b..cc24fea 100644 --- a/Makefile +++ b/Makefile @@ -97,12 +97,12 @@ ifneq ($(wildcard config-host.mak),) include $(SRC_PATH)/Makefile.objs endif =20 -$(common-obj-y): $(GENERATED_HEADERS) +$(universal-obj-y) $(common-obj-y): $(GENERATED_HEADERS) subdir-libcacard: $(oslib-obj-y) $(trace-obj-y) qemu-timer-common.o =20 -$(filter %-softmmu,$(SUBDIR_RULES)): $(trace-obj-y) $(common-obj-y) subd= ir-libdis +$(filter %-softmmu,$(SUBDIR_RULES)): $(universal-obj-y) $(trace-obj-y) $= (common-obj-y) subdir-libdis =20 -$(filter %-user,$(SUBDIR_RULES)): $(GENERATED_HEADERS) $(trace-obj-y) su= bdir-libdis-user subdir-libuser +$(filter %-user,$(SUBDIR_RULES)): $(GENERATED_HEADERS) $(universal-obj-y= ) $(trace-obj-y) subdir-libdis-user subdir-libuser =20 ROMSUBDIR_RULES=3D$(patsubst %,romsubdir-%, $(ROMS)) romsubdir-%: diff --git a/Makefile.objs b/Makefile.objs index 808de6a..f912fbb 100644 --- a/Makefile.objs +++ b/Makefile.objs @@ -1,9 +1,22 @@ ####################################################################### +# Target-independent parts used in system and user emulation +universal-obj-y =3D + +####################################################################### # QObject qobject-obj-y =3D qint.o qstring.o qdict.o qlist.o qfloat.o qbool.o qobject-obj-y +=3D qjson.o json-lexer.o json-streamer.o json-parser.o qobject-obj-y +=3D qerror.o error.o qemu-error.o =20 +universal-obj-y +=3D $(qobject-obj-y) + +####################################################################### +# QOM +include $(SRC_PATH)/qom/Makefile +qom-obj-y =3D $(addprefix qom/, $(qom-y)) + +universal-obj-y +=3D $(qom-obj-y) + ####################################################################### # oslib-obj-y is code depending on the OS (win32 vs posix) oslib-obj-y =3D osdep.o @@ -76,7 +89,6 @@ fsdev-obj-$(CONFIG_VIRTFS) +=3D $(addprefix fsdev/, $(f= sdev-nested-y)) =20 common-obj-y =3D $(block-obj-y) blockdev.o common-obj-y +=3D $(net-obj-y) -common-obj-y +=3D $(qobject-obj-y) common-obj-$(CONFIG_LINUX) +=3D $(fsdev-obj-$(CONFIG_LINUX)) common-obj-y +=3D readline.o console.o cursor.o common-obj-y +=3D $(oslib-obj-y) @@ -124,9 +136,6 @@ common-obj-$(CONFIG_WIN32) +=3D version.o =20 common-obj-$(CONFIG_SPICE) +=3D ui/spice-core.o ui/spice-input.o ui/spic= e-display.o spice-qemu-char.o =20 -include $(SRC_PATH)/qom/Makefile -common-obj-y +=3D $(addprefix qom/, $(qom-y)) - audio-obj-y =3D audio.o noaudio.o wavaudio.o mixeng.o audio-obj-$(CONFIG_SDL) +=3D sdlaudio.o audio-obj-$(CONFIG_OSS) +=3D ossaudio.o @@ -182,6 +191,8 @@ user-obj-y =3D user-obj-y +=3D envlist.o path.o user-obj-y +=3D tcg-runtime.o host-utils.o user-obj-y +=3D cutils.o cache-utils.o +user-obj-y +=3D module.o +user-obj-y +=3D qemu-user.o user-obj-y +=3D $(trace-obj-y) =20 ###################################################################### @@ -418,9 +429,11 @@ qapi-nested-y +=3D qmp-output-visitor.o qmp-registry= .o qmp-dispatch.o qapi-nested-y +=3D string-input-visitor.o string-output-visitor.o qapi-obj-y =3D $(addprefix qapi/, $(qapi-nested-y)) =20 -common-obj-y +=3D qmp-marshal.o qapi-visit.o qapi-types.o $(qapi-obj-y) +common-obj-y +=3D qmp-marshal.o qapi-visit.o qapi-types.o common-obj-y +=3D qmp.o hmp.o =20 +universal-obj-y +=3D $(qapi-obj-y) + ###################################################################### # guest agent =20 diff --git a/Makefile.target b/Makefile.target index 343eb78..ac4ebfe 100644 --- a/Makefile.target +++ b/Makefile.target @@ -136,6 +136,7 @@ obj-m68k-y +=3D m68k-sim.o m68k-semi.o =20 $(obj-y) $(obj-$(TARGET_BASE_ARCH)-y): $(GENERATED_HEADERS) =20 +obj-y +=3D $(addprefix ../, $(universal-obj-y)) obj-y +=3D $(addprefix ../libuser/, $(user-obj-y)) obj-y +=3D $(addprefix ../libdis-user/, $(libdis-y)) obj-y +=3D $(libobj-y) @@ -163,6 +164,7 @@ obj-i386-y +=3D ioport-user.o =20 $(obj-y) $(obj-$(TARGET_BASE_ARCH)-y): $(GENERATED_HEADERS) =20 +obj-y +=3D $(addprefix ../, $(universal-obj-y)) obj-y +=3D $(addprefix ../libuser/, $(user-obj-y)) obj-y +=3D $(addprefix ../libdis-user/, $(libdis-y)) obj-y +=3D $(libobj-y) @@ -185,6 +187,7 @@ obj-i386-y +=3D ioport-user.o =20 $(obj-y) $(obj-$(TARGET_BASE_ARCH)-y): $(GENERATED_HEADERS) =20 +obj-y +=3D $(addprefix ../, $(universal-obj-y)) obj-y +=3D $(addprefix ../libuser/, $(user-obj-y)) obj-y +=3D $(addprefix ../libdis-user/, $(libdis-y)) obj-y +=3D $(libobj-y) @@ -401,6 +404,7 @@ monitor.o: hmp-commands.h qmp-commands-old.h =20 $(obj-y) $(obj-$(TARGET_BASE_ARCH)-y): $(GENERATED_HEADERS) =20 +obj-y +=3D $(addprefix ../, $(universal-obj-y)) obj-y +=3D $(addprefix ../, $(common-obj-y)) obj-y +=3D $(addprefix ../libdis/, $(libdis-y)) obj-y +=3D $(libobj-y) diff --git a/Makefile.user b/Makefile.user index 2b1e4d1..b717820 100644 --- a/Makefile.user +++ b/Makefile.user @@ -9,6 +9,7 @@ include $(SRC_PATH)/rules.mak $(call set-vpath, $(SRC_PATH)) =20 QEMU_CFLAGS+=3D-I.. +QEMU_CFLAGS +=3D -I$(SRC_PATH)/include =20 include $(SRC_PATH)/Makefile.objs =20 diff --git a/bsd-user/main.c b/bsd-user/main.c index cc7d4a3..cdb0d0a 100644 --- a/bsd-user/main.c +++ b/bsd-user/main.c @@ -748,6 +748,8 @@ int main(int argc, char **argv) if (argc <=3D 1) usage(); =20 + module_call_init(MODULE_INIT_QOM); + if ((envlist =3D envlist_create()) =3D=3D NULL) { (void) fprintf(stderr, "Unable to allocate envlist\n"); exit(1); diff --git a/darwin-user/main.c b/darwin-user/main.c index 9b57c20..e1519c7 100644 --- a/darwin-user/main.c +++ b/darwin-user/main.c @@ -28,6 +28,7 @@ #include =20 #include "qemu.h" +#include "qemu-common.h" =20 #define DEBUG_LOGFILE "/tmp/qemu.log" =20 @@ -749,6 +750,8 @@ int main(int argc, char **argv) if (argc <=3D 1) usage(); =20 + module_call_init(MODULE_INIT_QOM); + optind =3D 1; for(;;) { if (optind >=3D argc) diff --git a/linux-user/main.c b/linux-user/main.c index 14bf5f0..bd47489 100644 --- a/linux-user/main.c +++ b/linux-user/main.c @@ -3285,6 +3285,8 @@ int main(int argc, char **argv, char **envp) int i; int ret; =20 + module_call_init(MODULE_INIT_QOM); + qemu_cache_utils_init(envp); =20 if ((envlist =3D envlist_create()) =3D=3D NULL) { diff --git a/qemu-user.c b/qemu-user.c new file mode 100644 index 0000000..08ccb0f --- /dev/null +++ b/qemu-user.c @@ -0,0 +1,37 @@ +/* + * Stubs for QEMU user emulation + * + * Copyright (c) 2012 SUSE LINUX Products GmbH + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, see + * + */ + +#include "qemu-common.h" +#include "monitor.h" + +Monitor *cur_mon; + +int monitor_cur_is_qmp(void) +{ + return 0; +} + +void monitor_vprintf(Monitor *mon, const char *fmt, va_list ap) +{ +} + +void monitor_set_error(Monitor *mon, QError *qerror) +{ +} --=20 1.7.7