Re: [Qemu-devel] Re: [RFC 0/7] QError v1

2009-11-01 Thread Vincent Hanquez
On Fri, Oct 30, 2009 at 06:33:15PM +0100, Paolo Bonzini wrote: > On 10/30/2009 06:15 PM, Daniel P. Berrange wrote: >> If we're going to use JSON we should be 100% compliant with the JSON >> spec, not extend it. By adding custom QEMU extensions, we loose the >> ability for programming language to tr

Re: [Qemu-devel] Re: [RFC 0/7] QError v1

2009-10-30 Thread Anthony Liguori
Jamie Lokier wrote: Anthony Liguori wrote: Jamie Lokier wrote: Anthony Liguori wrote: Okay, let's get more clever then and do: #define QERR_DEV_NFOUND "{ 'code': 404, 'name': %s}" By the way, since you've already invented a non-standard JSON extension, which is

Re: [Qemu-devel] Re: [RFC 0/7] QError v1

2009-10-30 Thread Paolo Bonzini
On 10/30/2009 07:09 PM, Jamie Lokier wrote: Anthony Liguori wrote: Jamie Lokier wrote: Anthony Liguori wrote: Okay, let's get more clever then and do: #define QERR_DEV_NFOUND "{ 'code': 404, 'name': %s}" By the way, since you've already invented a non-standard JSON extension, which is the

Re: [Qemu-devel] Re: [RFC 0/7] QError v1

2009-10-30 Thread Jamie Lokier
Anthony Liguori wrote: > Jamie Lokier wrote: > >Anthony Liguori wrote: > > > >>Okay, let's get more clever then and do: > >> > >>#define QERR_DEV_NFOUND "{ 'code': 404, 'name': %s}" > >> > > > >By the way, since you've already invented a non-standard JSON > >extension, which is the single quo

Re: [Qemu-devel] Re: [RFC 0/7] QError v1

2009-10-30 Thread Anthony Liguori
Paolo Bonzini wrote: On 10/30/2009 06:15 PM, Daniel P. Berrange wrote: If we're going to use JSON we should be 100% compliant with the JSON spec, not extend it. By adding custom QEMU extensions, we loose the ability for programming language to trivially talk to QEMU using a standard JSON parser,

Re: [Qemu-devel] Re: [RFC 0/7] QError v1

2009-10-30 Thread Anthony Liguori
Jamie Lokier wrote: Anthony Liguori wrote: Okay, let's get more clever then and do: #define QERR_DEV_NFOUND "{ 'code': 404, 'name': %s}" By the way, since you've already invented a non-standard JSON extension, which is the single quotes, why not go a step further and permit the quotes

Re: [Qemu-devel] Re: [RFC 0/7] QError v1

2009-10-30 Thread Paolo Bonzini
On 10/30/2009 06:15 PM, Daniel P. Berrange wrote: If we're going to use JSON we should be 100% compliant with the JSON spec, not extend it. By adding custom QEMU extensions, we loose the ability for programming language to trivially talk to QEMU using a standard JSON parser, and instead everyone

Re: [Qemu-devel] Re: [RFC 0/7] QError v1

2009-10-30 Thread Daniel P. Berrange
On Fri, Oct 30, 2009 at 04:28:49PM +, Jamie Lokier wrote: > Anthony Liguori wrote: > > Okay, let's get more clever then and do: > > > > #define QERR_DEV_NFOUND "{ 'code': 404, 'name': %s}" > > By the way, since you've already invented a non-standard JSON > extension, which is the single quote

Re: [Qemu-devel] Re: [RFC 0/7] QError v1

2009-10-30 Thread Paolo Bonzini
On 10/30/2009 05:28 PM, Jamie Lokier wrote: By the way, since you've already invented a non-standard JSON extension, which is the single quotes, why not go a step further and permit the quotes to be omitted for simple tokens? #define QERR_DEV_NFOUND "{ code: 404, name: %s}" Much neater, IMHO.

Re: [Qemu-devel] Re: [RFC 0/7] QError v1

2009-10-30 Thread Jamie Lokier
Anthony Liguori wrote: > Okay, let's get more clever then and do: > > #define QERR_DEV_NFOUND "{ 'code': 404, 'name': %s}" By the way, since you've already invented a non-standard JSON extension, which is the single quotes, why not go a step further and permit the quotes to be omitted for simple

[Qemu-devel] Re: [RFC 0/7] QError v1

2009-10-30 Thread Luiz Capitulino
On Fri, 30 Oct 2009 08:59:43 -0500 Anthony Liguori wrote: > Luiz Capitulino wrote: > > Seems ok to me, but to make it harder to reuse existing error > > codes we'd have to: > > > > 1. Make mandatory the use of a macro in the qemu_error_structed() > >call > > 2. All macros would have to be de

[Qemu-devel] Re: [RFC 0/7] QError v1

2009-10-30 Thread Anthony Liguori
Luiz Capitulino wrote: Seems ok to me, but to make it harder to reuse existing error codes we'd have to: 1. Make mandatory the use of a macro in the qemu_error_structed() call 2. All macros would have to be defined in qerror.h Not really. All you need is to switch code to something tha

[Qemu-devel] Re: [RFC 0/7] QError v1

2009-10-30 Thread Luiz Capitulino
(Added Daniel Berrange to the CC list) On Fri, 30 Oct 2009 08:09:02 -0500 Anthony Liguori wrote: > Gerd Hoffmann wrote: > > On 10/30/09 13:28, Luiz Capitulino wrote: > -qemu_error("Device \"%s\" not found. Try -device '?' for > a list.\n", > - driver)

[Qemu-devel] Re: [RFC 0/7] QError v1

2009-10-30 Thread Paolo Bonzini
On 10/30/2009 02:09 PM, Anthony Liguori wrote: Okay, let's get more clever then and do: #define QERR_DEV_NFOUND "{ 'code': 404, 'name': %s}" So we can do: qemu_error_structured(QERR_DEV_NFOUND, driver); Such that we still get printf style parameter checking. That's clever indeed. :-) But

[Qemu-devel] Re: [RFC 0/7] QError v1

2009-10-30 Thread Anthony Liguori
Gerd Hoffmann wrote: On 10/30/09 13:28, Luiz Capitulino wrote: -qemu_error("Device \"%s\" not found. Try -device '?' for a list.\n", - driver); +qemu_error_structed(QERR_DEV_NFOUND, "{ 'name': %s }", driver); why not store the "{ 'name': %s }" in the qerror

[Qemu-devel] Re: [RFC 0/7] QError v1

2009-10-30 Thread Gerd Hoffmann
On 10/30/09 13:28, Luiz Capitulino wrote: -qemu_error("Device \"%s\" not found. Try -device '?' for a list.\n", - driver); +qemu_error_structed(QERR_DEV_NFOUND, "{ 'name': %s }", driver); why not store the "{ 'name': %s }" in the qerror_table? I guess you pla

[Qemu-devel] Re: [RFC 0/7] QError v1

2009-10-30 Thread Luiz Capitulino
On Thu, 29 Oct 2009 23:12:10 +0100 Paolo Bonzini wrote: > > A last note: this series is on top of the (to be merged) QJSon module, > > that's why it's a RFC and.. I didn't test it too much. :) > > I have just two comments: > > 1) you do > > > -qemu_error("Device \"%s\" not found. Tr

[Qemu-devel] Re: [RFC 0/7] QError v1

2009-10-29 Thread Paolo Bonzini
A last note: this series is on top of the (to be merged) QJSon module, that's why it's a RFC and.. I didn't test it too much. :) I have just two comments: 1) you do -qemu_error("Device \"%s\" not found. Try -device '?' for a list.\n", - driver); +qemu_erro