From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([140.186.70.92]:51755) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1RbYKa-0006aj-3J for qemu-devel@nongnu.org; Fri, 16 Dec 2011 09:00:21 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1RbYKU-0002wH-33 for qemu-devel@nongnu.org; Fri, 16 Dec 2011 09:00:11 -0500 Received: from mail-iy0-f173.google.com ([209.85.210.173]:49484) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1RbYKT-0002vw-UM for qemu-devel@nongnu.org; Fri, 16 Dec 2011 09:00:06 -0500 Received: by iagj37 with SMTP id j37so5021439iag.4 for ; Fri, 16 Dec 2011 06:00:05 -0800 (PST) Message-ID: <4EEB4EE1.5030807@codemonkey.ws> Date: Fri, 16 Dec 2011 08:00:01 -0600 From: Anthony Liguori MIME-Version: 1.0 References: <1324036918-2405-1-git-send-email-pbonzini@redhat.com> <1324036918-2405-6-git-send-email-pbonzini@redhat.com> In-Reply-To: <1324036918-2405-6-git-send-email-pbonzini@redhat.com> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Subject: Re: [Qemu-devel] [PATCH 5/8] qom: introduce QERR_PROPERTY_VALUE_OUT_OF_RANGE List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Paolo Bonzini Cc: kwolf@redhat.com, qemu-devel@nongnu.org On 12/16/2011 06:01 AM, Paolo Bonzini wrote: > This will be used when reject invalid values for integer fields that > are less than 64-bits wide. > > Signed-off-by: Paolo Bonzini I'd rather use generic errors when possible. How about VALUE_OUT_OF_RANGE and we can make the message "'%(item)' doesn't take value..." and pass "%s.%s" % (device, property) for item. Regards, Anthony Liguori > --- > qerror.c | 5 +++++ > qerror.h | 3 +++ > 2 files changed, 8 insertions(+), 0 deletions(-) > > diff --git a/qerror.c b/qerror.c > index adde8a5..9a75d06 100644 > --- a/qerror.c > +++ b/qerror.c > @@ -206,6 +206,11 @@ static const QErrorStringTable qerror_table[] = { > .desc = "Property '%(device).%(property)' can't find value '%(value)'", > }, > { > + .error_fmt = QERR_PROPERTY_VALUE_OUT_OF_RANGE, > + .desc = "Property '%(device).%(property)' doesn't take " > + "value %(value) (minimum: %(min), maximum: %(max)'", > + }, > + { > .error_fmt = QERR_QMP_BAD_INPUT_OBJECT, > .desc = "Expected '%(expected)' in QMP input", > }, > diff --git a/qerror.h b/qerror.h > index 9190b02..efda232 100644 > --- a/qerror.h > +++ b/qerror.h > @@ -171,6 +171,9 @@ QError *qobject_to_qerror(const QObject *obj); > #define QERR_PROPERTY_VALUE_NOT_FOUND \ > "{ 'class': 'PropertyValueNotFound', 'data': { 'device': %s, 'property': %s, 'value': %s } }" > > +#define QERR_PROPERTY_VALUE_OUT_OF_RANGE \ > + "{ 'class': 'PropertyValueOutOfRange', 'data': { 'device': %s, 'property': %s, 'value': %"PRId64", 'min': %"PRId64", 'max': %"PRId64" } }" > + > #define QERR_QMP_BAD_INPUT_OBJECT \ > "{ 'class': 'QMPBadInputObject', 'data': { 'expected': %s } }" >