From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from [140.186.70.92] (port=60637 helo=eggs.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1PyQCb-0008DF-BF for qemu-devel@nongnu.org; Sat, 12 Mar 2011 09:53:58 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1PyQCZ-0002xX-SS for qemu-devel@nongnu.org; Sat, 12 Mar 2011 09:53:57 -0500 Received: from mail-gy0-f173.google.com ([209.85.160.173]:44385) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1PyQCZ-0002xJ-L2 for qemu-devel@nongnu.org; Sat, 12 Mar 2011 09:53:55 -0500 Received: by gyf1 with SMTP id 1so459119gyf.4 for ; Sat, 12 Mar 2011 06:53:55 -0800 (PST) Message-ID: <4D7B8900.4080203@codemonkey.ws> Date: Sat, 12 Mar 2011 08:53:52 -0600 From: Anthony Liguori MIME-Version: 1.0 Subject: Re: [Qemu-devel] [PATCH 13/15] qapi: add code generator for libqmp (v2) References: <1299884745-521-1-git-send-email-aliguori@us.ibm.com> <1299884745-521-14-git-send-email-aliguori@us.ibm.com> In-Reply-To: Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit List-Id: qemu-devel.nongnu.org List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Blue Swirl Cc: qemu-devel@nongnu.org, Adam Litke , Luiz Capitulino , Markus Armbruster , Avi Kivity On 03/12/2011 05:10 AM, Blue Swirl wrote: > On Sat, Mar 12, 2011 at 1:05 AM, Anthony Liguori wrote: >> Signed-off-by: Anthony Liguori >> --- >> v1 -> v2 >> - update code generator to use multiline >> - proxy command support >> - async command support >> >> diff --git a/Makefile b/Makefile >> index 47a755d..5170675 100644 >> --- a/Makefile >> +++ b/Makefile >> @@ -4,7 +4,7 @@ GENERATED_HEADERS = config-host.h trace.h qemu-options.def >> ifeq ($(TRACE_BACKEND),dtrace) >> GENERATED_HEADERS += trace-dtrace.h >> endif >> -GENERATED_HEADERS += qmp-types.h qmp-marshal-types.h qmp.h >> +GENERATED_HEADERS += qmp-types.h qmp-marshal-types.h qmp.h libqmp.h >> >> ifneq ($(wildcard config-host.mak),) >> # Put the all: rule here so that config-host.mak can contain dependencies. >> @@ -165,9 +165,16 @@ qmp.h: $(SRC_PATH)/qmp-schema.json $(SRC_PATH)/qmp-gen.py >> qmp-marshal.c: $(SRC_PATH)/qmp-schema.json $(SRC_PATH)/qmp-gen.py >> $(call quiet-command,python $(SRC_PATH)/qmp-gen.py --body< $< > $@, " GEN $@") >> >> +libqmp.h: $(SRC_PATH)/qmp-schema.json $(SRC_PATH)/qmp-gen.py >> + $(call quiet-command,python $(SRC_PATH)/qmp-gen.py --lib-header< $< > $@, " GEN $@") >> + >> +libqmp.c: $(SRC_PATH)/qmp-schema.json $(SRC_PATH)/qmp-gen.py >> + $(call quiet-command,python $(SRC_PATH)/qmp-gen.py --lib-body< $< > $@, " GEN $@") >> + >> qmp-types.o: qmp-types.c qmp-types.h >> qmp-marshal-types.o: qmp-marshal-types.c qmp-marshal-types.h qmp-types.h >> qmp-marshal.o: qmp-marshal.c qmp.h qmp-types.h qmp-marshal-types.h >> +libqmp.o: libqmp.c libqmp.h qmp-types.h >> >> version.o: $(SRC_PATH)/version.rc config-host.mak >> $(call quiet-command,$(WINDRES) -I. -o $@ $<," RC $(TARGET_DIR)$@") >> diff --git a/libqmp-core.c b/libqmp-core.c >> new file mode 100644 >> index 0000000..4613d4f >> --- /dev/null >> +++ b/libqmp-core.c >> @@ -0,0 +1,361 @@ >> +/* >> + * QAPI >> + * >> + * Copyright IBM, Corp. 2011 >> + * >> + * Authors: >> + * Anthony Liguori >> + * >> + * This work is licensed under the terms of the GNU LGPL, version 2. See >> + * the COPYING.LIB file in the top-level directory. >> + */ >> +#include "libqmp.h" >> +#include "libqmp-internal.h" >> +#include "libqmp-core.h" >> +#include "json-streamer.h" >> +#include "json-parser.h" >> +#include "dirent.h" >> +#include >> +#include >> +#include >> + >> +#ifndef container_of >> +#define offset_of(type, field) \ >> + ((unsigned long)(&((type *)0)->field)) >> +#define container_of(obj, type, field) \ >> + ((type *)(((char *)obj) - offsetof(type, field))) >> +#endif > Why not use the existing definitions? libqmp builds outside of the normal QEMU code base (it's a client library). libqmp wants to be LGPL. It's not clear what the license of the stuff in osdep is. Regards, Anthony Liguori