From patchwork Mon Mar 29 14:52:46 2010 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Kevin Wolf X-Patchwork-Id: 48858 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from lists.gnu.org (lists.gnu.org [199.232.76.165]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (Client did not present a certificate) by ozlabs.org (Postfix) with ESMTPS id E668CB7CD5 for ; Tue, 30 Mar 2010 02:03:28 +1100 (EST) Received: from localhost ([127.0.0.1]:59083 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1NwGUk-0006p5-Sq for incoming@patchwork.ozlabs.org; Mon, 29 Mar 2010 11:03:14 -0400 Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1NwGPy-0005ev-2g for qemu-devel@nongnu.org; Mon, 29 Mar 2010 10:58:18 -0400 Received: from [140.186.70.92] (port=46712 helo=eggs.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1NwGPw-0005Ly-Eh for qemu-devel@nongnu.org; Mon, 29 Mar 2010 10:58:17 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.69) (envelope-from ) id 1NwGLK-0002eD-Rv for qemu-devel@nongnu.org; Mon, 29 Mar 2010 10:53:40 -0400 Received: from mx1.redhat.com ([209.132.183.28]:53664) by eggs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1NwGLK-0002dp-KS for qemu-devel@nongnu.org; Mon, 29 Mar 2010 10:53:30 -0400 Received: from int-mx01.intmail.prod.int.phx2.redhat.com (int-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.11]) by mx1.redhat.com (8.13.8/8.13.8) with ESMTP id o2TErT4F010470 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK) for ; Mon, 29 Mar 2010 10:53:29 -0400 Received: from localhost.localdomain (dhcp-5-175.str.redhat.com [10.32.5.175]) by int-mx01.intmail.prod.int.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id o2TErLwF032108; Mon, 29 Mar 2010 10:53:28 -0400 From: Kevin Wolf To: qemu-devel@nongnu.org Date: Mon, 29 Mar 2010 16:52:46 +0200 Message-Id: <1269874368-31011-6-git-send-email-kwolf@redhat.com> In-Reply-To: <1269874368-31011-1-git-send-email-kwolf@redhat.com> References: <1269874368-31011-1-git-send-email-kwolf@redhat.com> X-Scanned-By: MIMEDefang 2.67 on 10.5.11.11 X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. Cc: kwolf@redhat.com Subject: [Qemu-devel] [PATCH v2 5/7] Make qemu-config available for tools X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: qemu-devel.nongnu.org List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org To be able to use config files for blkdebug, we need to make these functions available in the tools. This involves moving two functions that can only be built in the context of the emulator. Signed-off-by: Kevin Wolf --- Makefile.objs | 4 ++-- hw/qdev-properties.c | 19 ++++++++++++++++++- hw/qdev.h | 1 - qemu-config.c | 17 ----------------- 4 files changed, 20 insertions(+), 21 deletions(-) diff --git a/Makefile.objs b/Makefile.objs index 8c8f79b..03e49ec 100644 --- a/Makefile.objs +++ b/Makefile.objs @@ -8,7 +8,7 @@ qobject-obj-y += qerror.o # block-obj-y is code used by both qemu system emulation and qemu-img block-obj-y = cutils.o cache-utils.o qemu-malloc.o qemu-option.o module.o -block-obj-y += nbd.o block.o aio.o aes.o osdep.o +block-obj-y += nbd.o block.o aio.o aes.o osdep.o qemu-config.o block-obj-$(CONFIG_POSIX) += posix-aio-compat.o block-obj-$(CONFIG_LINUX_AIO) += linux-aio.o @@ -76,7 +76,7 @@ common-obj-y += buffered_file.o migration.o migration-tcp.o qemu-sockets.o common-obj-y += qemu-char.o savevm.o #aio.o common-obj-y += msmouse.o ps2.o common-obj-y += qdev.o qdev-properties.o -common-obj-y += qemu-config.o block-migration.o +common-obj-y += block-migration.o common-obj-$(CONFIG_BRLAPI) += baum.o common-obj-$(CONFIG_POSIX) += migration-exec.o migration-unix.o migration-fd.o diff --git a/hw/qdev-properties.c b/hw/qdev-properties.c index 157a111..9ffdba7 100644 --- a/hw/qdev-properties.c +++ b/hw/qdev-properties.c @@ -661,7 +661,7 @@ void qdev_prop_set_defaults(DeviceState *dev, Property *props) static QTAILQ_HEAD(, GlobalProperty) global_props = QTAILQ_HEAD_INITIALIZER(global_props); -void qdev_prop_register_global(GlobalProperty *prop) +static void qdev_prop_register_global(GlobalProperty *prop) { QTAILQ_INSERT_TAIL(&global_props, prop, next); } @@ -689,3 +689,20 @@ void qdev_prop_set_globals(DeviceState *dev) } } } + +static int qdev_add_one_global(QemuOpts *opts, void *opaque) +{ + GlobalProperty *g; + + g = qemu_mallocz(sizeof(*g)); + g->driver = qemu_opt_get(opts, "driver"); + g->property = qemu_opt_get(opts, "property"); + g->value = qemu_opt_get(opts, "value"); + qdev_prop_register_global(g); + return 0; +} + +void qemu_add_globals(void) +{ + qemu_opts_foreach(&qemu_global_opts, qdev_add_one_global, NULL, 0); +} diff --git a/hw/qdev.h b/hw/qdev.h index 9475705..3a8e801 100644 --- a/hw/qdev.h +++ b/hw/qdev.h @@ -273,7 +273,6 @@ void qdev_prop_set_macaddr(DeviceState *dev, const char *name, uint8_t *value); void qdev_prop_set_ptr(DeviceState *dev, const char *name, void *value); void qdev_prop_set_defaults(DeviceState *dev, Property *props); -void qdev_prop_register_global(GlobalProperty *prop); void qdev_prop_register_global_list(GlobalProperty *props); void qdev_prop_set_globals(DeviceState *dev); diff --git a/qemu-config.c b/qemu-config.c index dedf177..ad91133 100644 --- a/qemu-config.c +++ b/qemu-config.c @@ -378,23 +378,6 @@ int qemu_global_option(const char *str) return 0; } -static int qemu_add_one_global(QemuOpts *opts, void *opaque) -{ - GlobalProperty *g; - - g = qemu_mallocz(sizeof(*g)); - g->driver = qemu_opt_get(opts, "driver"); - g->property = qemu_opt_get(opts, "property"); - g->value = qemu_opt_get(opts, "value"); - qdev_prop_register_global(g); - return 0; -} - -void qemu_add_globals(void) -{ - qemu_opts_foreach(&qemu_global_opts, qemu_add_one_global, NULL, 0); -} - struct ConfigWriteData { QemuOptsList *list; FILE *fp;