From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:51402) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bF1WF-0006kJ-8u for qemu-devel@nongnu.org; Mon, 20 Jun 2016 11:53:48 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1bF1W9-0005EF-93 for qemu-devel@nongnu.org; Mon, 20 Jun 2016 11:53:47 -0400 Received: from mx1.redhat.com ([209.132.183.28]:49129) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bF1W9-0005EB-01 for qemu-devel@nongnu.org; Mon, 20 Jun 2016 11:53:41 -0400 Received: from int-mx10.intmail.prod.int.phx2.redhat.com (int-mx10.intmail.prod.int.phx2.redhat.com [10.5.11.23]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 5F0811176B3 for ; Mon, 20 Jun 2016 15:53:40 +0000 (UTC) From: Eduardo Habkost Date: Mon, 20 Jun 2016 12:52:55 -0300 Message-Id: <1466437983-27133-3-git-send-email-ehabkost@redhat.com> In-Reply-To: <1466437983-27133-1-git-send-email-ehabkost@redhat.com> References: <1466437983-27133-1-git-send-email-ehabkost@redhat.com> Subject: [Qemu-devel] [PATCH v2 02/10] qdev: Eliminate qemu_add_globals() function List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-devel@nongnu.org, Markus Armbruster Cc: Paolo Bonzini , Marcel Apfelbaum , Igor Mammedov The function is just a helper to handle the -global options, it can stay in vl.c like most qemu_opts_foreach() calls. Reviewed-by: Igor Mammedov Signed-off-by: Eduardo Habkost --- hw/core/qdev-properties-system.c | 21 +-------------------- include/qemu/config-file.h | 1 - vl.c | 16 +++++++++++++++- 3 files changed, 16 insertions(+), 22 deletions(-) diff --git a/hw/core/qdev-properties-system.c b/hw/core/qdev-properties-system.c index 891219a..cf7139d 100644 --- a/hw/core/qdev-properties-system.c +++ b/hw/core/qdev-properties-system.c @@ -1,5 +1,5 @@ /* - * qdev property parsing and global properties + * qdev property parsing * (parts specific for qemu-system-*) * * This file is based on code from hw/qdev-properties.c from @@ -394,22 +394,3 @@ void qdev_set_nic_properties(DeviceState *dev, NICInfo *nd) } nd->instantiated = 1; } - -static int qdev_add_one_global(void *opaque, QemuOpts *opts, Error **errp) -{ - GlobalProperty *g; - - g = g_malloc0(sizeof(*g)); - g->driver = qemu_opt_get(opts, "driver"); - g->property = qemu_opt_get(opts, "property"); - g->value = qemu_opt_get(opts, "value"); - g->user_provided = true; - qdev_prop_register_global(g); - return 0; -} - -void qemu_add_globals(void) -{ - qemu_opts_foreach(qemu_find_opts("global"), - qdev_add_one_global, NULL, NULL); -} diff --git a/include/qemu/config-file.h b/include/qemu/config-file.h index 3b8ecb0..8603e86 100644 --- a/include/qemu/config-file.h +++ b/include/qemu/config-file.h @@ -12,7 +12,6 @@ void qemu_add_opts(QemuOptsList *list); void qemu_add_drive_opts(QemuOptsList *list); int qemu_set_option(const char *str); int qemu_global_option(const char *str); -void qemu_add_globals(void); void qemu_config_write(FILE *fp); int qemu_config_parse(FILE *fp, QemuOptsList **lists, const char *fname); diff --git a/vl.c b/vl.c index 2f63eb4..e9ca733 100644 --- a/vl.c +++ b/vl.c @@ -2928,6 +2928,19 @@ static void set_memory_options(uint64_t *ram_slots, ram_addr_t *maxram_size, loc_pop(&loc); } +static int global_init_func(void *opaque, QemuOpts *opts, Error **errp) +{ + GlobalProperty *g; + + g = g_malloc0(sizeof(*g)); + g->driver = qemu_opt_get(opts, "driver"); + g->property = qemu_opt_get(opts, "property"); + g->value = qemu_opt_get(opts, "value"); + g->user_provided = true; + qdev_prop_register_global(g); + return 0; +} + int main(int argc, char **argv, char **envp) { int i; @@ -4473,7 +4486,8 @@ int main(int argc, char **argv, char **envp) qdev_prop_register_global(p); } } - qemu_add_globals(); + qemu_opts_foreach(qemu_find_opts("global"), + global_init_func, NULL, NULL); /* This checkpoint is required by replay to separate prior clock reading from the other reads, because timer polling functions query -- 2.5.5