qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Qemu-devel] [PATCH v2 08/10] qdev: Eliminate GlobalProperty 'used'


From: Igor Mammedov
Subject: Re: [Qemu-devel] [PATCH v2 08/10] qdev: Eliminate GlobalProperty 'used' and 'user_provided' fields
Date: Tue, 21 Jun 2016 14:59:17 +0200

On Mon, 20 Jun 2016 12:53:01 -0300
Eduardo Habkost <address@hidden> wrote:

> Those fields are not used for anyting and not needed anymore.
> 
> Signed-off-by: Eduardo Habkost <address@hidden>
Reviewed-by: Igor Mammedov <address@hidden>

> ---
> Changes v1 -> v2:
> * Remove "nouser" test case from test-qdev-global-props
> ---
>  hw/core/qdev-properties.c      |  2 --
>  include/hw/qdev-core.h         |  5 -----
>  tests/test-qdev-global-props.c | 40
> ++++------------------------------------
> vl.c                           |  1 - 4 files changed, 4
> insertions(+), 44 deletions(-)
> 
> diff --git a/hw/core/qdev-properties.c b/hw/core/qdev-properties.c
> index c14791d..733cc45 100644
> --- a/hw/core/qdev-properties.c
> +++ b/hw/core/qdev-properties.c
> @@ -1048,7 +1048,6 @@ static void
> qdev_prop_set_globals_for_type(DeviceState *dev, if (strcmp(typename,
> prop->driver) != 0) { continue;
>          }
> -        prop->used = true;
>          object_property_parse(OBJECT(dev), prop->value,
> prop->property, &err); if (err != NULL) {
>              error_prepend(&err, "can't apply global %s.%s=%s: ",
> @@ -1056,7 +1055,6 @@ static void
> qdev_prop_set_globals_for_type(DeviceState *dev, if (prop->errp) {
>                  error_propagate(prop->errp, err);
>              } else {
> -                assert(prop->user_provided);
>                  error_reportf_err(err, "Warning: ");
>              }
>          }
> diff --git a/include/hw/qdev-core.h b/include/hw/qdev-core.h
> index 1d1f861..7b6b007 100644
> --- a/include/hw/qdev-core.h
> +++ b/include/hw/qdev-core.h
> @@ -256,9 +256,6 @@ struct PropertyInfo {
>  
>  /**
>   * GlobalProperty:
> - * @user_provided: Set to true if property comes from user-provided
> config
> - * (command-line or config file).
> - * @used: Set to true if property was used when initializing a
> device.
>   * @errp: Error destination, used like first argument of error_setg()
>   *        in case property setting fails later. If @errp is NULL, we
>   *        print warnings instead of ignoring errors silently.
> @@ -267,8 +264,6 @@ typedef struct GlobalProperty {
>      const char *driver;
>      const char *property;
>      const char *value;
> -    bool user_provided;
> -    bool used;
>      Error **errp;
>  } GlobalProperty;
>  
> diff --git a/tests/test-qdev-global-props.c
> b/tests/test-qdev-global-props.c index c0fea84..37394fa 100644
> --- a/tests/test-qdev-global-props.c
> +++ b/tests/test-qdev-global-props.c
> @@ -183,10 +183,10 @@ static void test_dynamic_globalprop(void)
>  {
>      MyType *mt;
>      static GlobalProperty props[] = {
> -        { TYPE_DYNAMIC_PROPS, "prop1", "101", true },
> -        { TYPE_DYNAMIC_PROPS, "prop2", "102", true },
> -        { TYPE_UNUSED_HOTPLUG, "prop4", "104", true },
> -        { TYPE_UNUSED_NOHOTPLUG, "prop5", "105", true },
> +        { TYPE_DYNAMIC_PROPS, "prop1", "101", },
> +        { TYPE_DYNAMIC_PROPS, "prop2", "102", },
> +        { TYPE_UNUSED_HOTPLUG, "prop4", "104", },
> +        { TYPE_UNUSED_NOHOTPLUG, "prop5", "105", },
>          {}
>      };
>  
> @@ -197,35 +197,6 @@ static void test_dynamic_globalprop(void)
>  
>      g_assert_cmpuint(mt->prop1, ==, 101);
>      g_assert_cmpuint(mt->prop2, ==, 102);
> -    g_assert(props[0].used);
> -    g_assert(props[1].used);
> -    g_assert(!props[2].used);
> -    g_assert(!props[3].used);
> -}
> -
> -/* Test setting of dynamic properties using user_provided=false
> properties */ -static void test_dynamic_globalprop_nouser(void)
> -{
> -    MyType *mt;
> -    static GlobalProperty props[] = {
> -        { TYPE_DYNAMIC_PROPS, "prop1", "101" },
> -        { TYPE_DYNAMIC_PROPS, "prop2", "102" },
> -        { TYPE_UNUSED_HOTPLUG, "prop4", "104" },
> -        { TYPE_UNUSED_NOHOTPLUG, "prop5", "105" },
> -        {}
> -    };
> -
> -    qdev_prop_register_global_list(props);
> -
> -    mt = DYNAMIC_TYPE(object_new(TYPE_DYNAMIC_PROPS));
> -    qdev_init_nofail(DEVICE(mt));
> -
> -    g_assert_cmpuint(mt->prop1, ==, 101);
> -    g_assert_cmpuint(mt->prop2, ==, 102);
> -    g_assert(props[0].used);
> -    g_assert(props[1].used);
> -    g_assert(!props[2].used);
> -    g_assert(!props[3].used);
>  }
>  
>  int main(int argc, char **argv)
> @@ -248,9 +219,6 @@ int main(int argc, char **argv)
>      g_test_add_func("/qdev/properties/dynamic/global",
>                      test_dynamic_globalprop);
>  
> -    g_test_add_func("/qdev/properties/dynamic/global/nouser",
> -                    test_dynamic_globalprop_nouser);
> -
>      g_test_run();
>  
>      return 0;
> diff --git a/vl.c b/vl.c
> index 9472a26..ce28fcc 100644
> --- a/vl.c
> +++ b/vl.c
> @@ -2946,7 +2946,6 @@ static int global_init_func(void *opaque,
> QemuOpts *opts, Error **errp) g->driver   = driver;
>      g->property = prop;
>      g->value    = qemu_opt_get(opts, "value");
> -    g->user_provided = true;
>      qdev_prop_register_global(g);
>      return 0;
>  }




reply via email to

[Prev in Thread] Current Thread [Next in Thread]