From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:47766) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bFLn4-0006tq-9v for qemu-devel@nongnu.org; Tue, 21 Jun 2016 09:32:33 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1bFLmx-0005c0-4V for qemu-devel@nongnu.org; Tue, 21 Jun 2016 09:32:29 -0400 Received: from mx1.redhat.com ([209.132.183.28]:54297) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bFLmw-0005bv-Uq for qemu-devel@nongnu.org; Tue, 21 Jun 2016 09:32:23 -0400 Received: from int-mx09.intmail.prod.int.phx2.redhat.com (int-mx09.intmail.prod.int.phx2.redhat.com [10.5.11.22]) (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 79EA97AE85 for ; Tue, 21 Jun 2016 13:32:22 +0000 (UTC) Date: Tue, 21 Jun 2016 10:32:19 -0300 From: Eduardo Habkost Message-ID: <20160621133219.GG2048@thinpad.lan.raisama.net> References: <1466437983-27133-1-git-send-email-ehabkost@redhat.com> <1466437983-27133-5-git-send-email-ehabkost@redhat.com> <20160621101128.6d9a268b@igors-macbook-pro.local> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20160621101128.6d9a268b@igors-macbook-pro.local> Subject: Re: [Qemu-devel] [PATCH v2 04/10] qdev: GlobalProperty.errp field List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Igor Mammedov Cc: qemu-devel@nongnu.org, Markus Armbruster , Marcel Apfelbaum , Paolo Bonzini On Tue, Jun 21, 2016 at 10:11:28AM +0200, Igor Mammedov wrote: > On Mon, 20 Jun 2016 12:52:57 -0300 > Eduardo Habkost wrote: > > > The new field will allow error handling to be configured by > > qdev_prop_register_global() callers: &error_fatal and > > &error_abort can be used to make QEMU exit or abort if any errors > > are reported when applying the properties. > > > > While doing it, change the error message from "global %s.%s=%s > > ignored" to "can't apply global %s.%s=%s". > > > > Suggested-by: Paolo Bonzini > > Signed-off-by: Eduardo Habkost > > --- > > Changes v1 -> v2: > > * Reword doc comments > > * Suggested-by: Markus Armbruster > > * Squashed with patch "Use error_prepend() for errors applying > > globals" > > * Suggested-by: Markus Armbruster > > * Moved to the end of struct to not break test-qdev-global-props > > --- > > hw/core/qdev-properties.c | 11 ++++++++--- > > include/hw/qdev-core.h | 4 ++++ > > 2 files changed, 12 insertions(+), 3 deletions(-) > > > > diff --git a/hw/core/qdev-properties.c b/hw/core/qdev-properties.c > > index 64e17aa..0fe7214 100644 > > --- a/hw/core/qdev-properties.c > > +++ b/hw/core/qdev-properties.c > > @@ -1078,9 +1078,14 @@ static void > > qdev_prop_set_globals_for_type(DeviceState *dev, prop->used = true; > > object_property_parse(OBJECT(dev), prop->value, > > prop->property, &err); if (err != NULL) { > > - assert(prop->user_provided); > > - error_reportf_err(err, "Warning: global %s.%s=%s > > ignored: ", > > - prop->driver, prop->property, > > prop->value); > > + error_prepend(&err, "can't apply global %s.%s=%s: ", > > + prop->driver, prop->property, prop->value); > > + if (prop->errp) { > > + error_propagate(prop->errp, err); > > + } else { > > + assert(prop->user_provided); > > + error_reportf_err(err, "Warning: "); > this will never print warning as assert will trigger first, but in > 8/10 assert is removed so > Assert won't trigger and warning will be printed if (prop->user_provided && !prop->errp). > Reviewed-by: Igor Mammedov Thanks! -- Eduardo