From: Igor Mammedov <imammedo@redhat.com>
To: Eduardo Habkost <ehabkost@redhat.com>
Cc: qemu-devel@nongnu.org, Markus Armbruster <armbru@redhat.com>,
Paolo Bonzini <pbonzini@redhat.com>,
Marcel Apfelbaum <marcel@redhat.com>
Subject: Re: [Qemu-devel] [PATCH 02/10] qdev: Eliminate qemu_add_globals() function
Date: Mon, 20 Jun 2016 14:03:26 +0200 [thread overview]
Message-ID: <20160620140326.6f39e48d@igors-macbook-pro.local> (raw)
In-Reply-To: <1466022773-8965-3-git-send-email-ehabkost@redhat.com>
On Wed, 15 Jun 2016 17:32:45 -0300
Eduardo Habkost <ehabkost@redhat.com> wrote:
> The function is just a helper to handle the -global options, it
> can stay in vl.c like most qemu_opts_foreach() calls.
>
> Signed-off-by: Eduardo Habkost <ehabkost@redhat.com>
Reviewed-by: Igor Mammedov <imammedo@redhat.com>
> ---
> 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 45eff56..d2d756a 100644
> --- a/vl.c
> +++ b/vl.c
> @@ -2932,6 +2932,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;
> @@ -4466,7 +4479,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
next prev parent reply other threads:[~2016-06-20 12:03 UTC|newest]
Thread overview: 27+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-06-15 20:32 [Qemu-devel] [PATCH 00/10] globals: Clean up validation and error checking Eduardo Habkost
2016-06-15 20:32 ` [Qemu-devel] [PATCH 01/10] qdev: Don't stop applying globals on first error Eduardo Habkost
2016-06-19 16:40 ` Marcel Apfelbaum
2016-06-20 7:43 ` Markus Armbruster
2016-06-15 20:32 ` [Qemu-devel] [PATCH 02/10] qdev: Eliminate qemu_add_globals() function Eduardo Habkost
2016-06-20 12:03 ` Igor Mammedov [this message]
2016-06-15 20:32 ` [Qemu-devel] [PATCH 03/10] vl: Reject invalid class names on -global Eduardo Habkost
2016-06-20 7:56 ` Markus Armbruster
2016-06-20 12:44 ` Igor Mammedov
2016-06-15 20:32 ` [Qemu-devel] [PATCH 04/10] qdev: Use error_prepend() for errors applying globals Eduardo Habkost
2016-06-20 8:02 ` Markus Armbruster
2016-06-20 13:43 ` Eduardo Habkost
2016-06-15 20:32 ` [Qemu-devel] [PATCH 05/10] qdev: GlobalProperty.errp field Eduardo Habkost
2016-06-20 8:14 ` Markus Armbruster
2016-06-20 13:45 ` Eduardo Habkost
2016-06-15 20:32 ` [Qemu-devel] [PATCH 06/10] machine: Add machine_register_compat_props() function Eduardo Habkost
2016-06-19 16:25 ` Marcel Apfelbaum
2016-06-15 20:32 ` [Qemu-devel] [PATCH 07/10] vl: Set errp to &error_abort on machine compat_props Eduardo Habkost
2016-06-19 16:27 ` Marcel Apfelbaum
2016-06-15 20:32 ` [Qemu-devel] [PATCH 08/10] qdev: Eliminate "global not used" warning Eduardo Habkost
2016-06-15 20:32 ` [Qemu-devel] [PATCH 09/10] qdev: Eliminate GlobalProperty 'used' and 'user_provided' fields Eduardo Habkost
2016-06-15 20:32 ` [Qemu-devel] [PATCH 10/10] machine: Skip global registration for non-existing classes Eduardo Habkost
2016-06-19 16:39 ` Marcel Apfelbaum
2016-06-19 16:50 ` Marcel Apfelbaum
2016-06-20 13:38 ` Eduardo Habkost
2016-06-20 13:11 ` [Qemu-devel] [PATCH 00/10] globals: Clean up validation and error checking Igor Mammedov
2016-06-20 13:48 ` Eduardo Habkost
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=20160620140326.6f39e48d@igors-macbook-pro.local \
--to=imammedo@redhat.com \
--cc=armbru@redhat.com \
--cc=ehabkost@redhat.com \
--cc=marcel@redhat.com \
--cc=pbonzini@redhat.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).