From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:37769) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bFLH5-0001gy-68 for qemu-devel@nongnu.org; Tue, 21 Jun 2016 08:59:28 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1bFLH1-0006dF-TT for qemu-devel@nongnu.org; Tue, 21 Jun 2016 08:59:27 -0400 Received: from mx1.redhat.com ([209.132.183.28]:50385) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bFLH1-0006d3-LC for qemu-devel@nongnu.org; Tue, 21 Jun 2016 08:59:23 -0400 Received: from int-mx13.intmail.prod.int.phx2.redhat.com (int-mx13.intmail.prod.int.phx2.redhat.com [10.5.11.26]) (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 066794DAF8 for ; Tue, 21 Jun 2016 12:59:23 +0000 (UTC) Date: Tue, 21 Jun 2016 14:59:17 +0200 From: Igor Mammedov Message-ID: <20160621145917.0250b54a@igors-macbook-pro.local> In-Reply-To: <1466437983-27133-9-git-send-email-ehabkost@redhat.com> References: <1466437983-27133-1-git-send-email-ehabkost@redhat.com> <1466437983-27133-9-git-send-email-ehabkost@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit Subject: Re: [Qemu-devel] [PATCH v2 08/10] qdev: Eliminate GlobalProperty 'used' and 'user_provided' fields List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Eduardo Habkost Cc: qemu-devel@nongnu.org, Markus Armbruster , Paolo Bonzini , Marcel Apfelbaum On Mon, 20 Jun 2016 12:53:01 -0300 Eduardo Habkost wrote: > Those fields are not used for anyting and not needed anymore. > > Signed-off-by: Eduardo Habkost Reviewed-by: Igor Mammedov > --- > 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; > }