Re: [Qemu-devel] Re: [PATCH 3/8] Add QBuffer

2010-05-18 Thread Avi Kivity
On 05/18/2010 03:27 PM, Markus Armbruster wrote: Surely the schema has to describe the type as well? If it does, you can use the schema to generate a classes at compile time. Doesn't that tie you to a specific version of QMP at compile-time? The client needs to ignore anything n

Re: [Qemu-devel] Re: [PATCH 3/8] Add QBuffer

2010-05-18 Thread Markus Armbruster
Anthony Liguori writes: > On 05/17/2010 02:45 AM, Avi Kivity wrote: >> On 05/17/2010 10:40 AM, Jan Kiszka wrote: >>> The alternative is to have a schema. Sun RPC/XDR doesn't carry any type information (you can't even distinguish between a number and text) yet C clients h

Re: [Qemu-devel] Re: [PATCH 3/8] Add QBuffer

2010-05-18 Thread Markus Armbruster
Jan Kiszka writes: > Avi Kivity wrote: >> On 05/17/2010 10:57 AM, Jan Kiszka wrote: >>> Avi Kivity wrote: >>> On 05/17/2010 10:40 AM, Jan Kiszka wrote: >> The alternative is to have a schema. Sun RPC/XDR doesn't carry any type >> information (you can't even distinguis

[Qemu-devel] Re: [PATCH 3/8] Add QBuffer

2010-05-17 Thread Jamie Lokier
Jan Kiszka wrote: > Jamie Lokier wrote: > > Anthony Liguori wrote: > >> Instead of encoding just as a string, it would be a good idea to encode > >> it as something like: > >> > >> {'__class__': 'base64', 'data': ...} > > > > Is there a benefit to the class indirection, over simply a keyword?: >

[Qemu-devel] Re: [PATCH 3/8] Add QBuffer

2010-05-17 Thread Anthony Liguori
On 05/17/2010 02:45 AM, Avi Kivity wrote: On 05/17/2010 10:40 AM, Jan Kiszka wrote: The alternative is to have a schema. Sun RPC/XDR doesn't carry any type information (you can't even distinguish between a number and text) yet C clients have to problem extracting typed information from it.

[Qemu-devel] Re: [PATCH 3/8] Add QBuffer

2010-05-17 Thread Avi Kivity
On 05/17/2010 12:17 PM, Jan Kiszka wrote: Avi Kivity wrote: On 05/17/2010 11:55 AM, Jan Kiszka wrote: The names of fields are also type information. Not in the case of device_show. The clients have no idea of the vmstate structures before they were transfered. Granted, tha

[Qemu-devel] Re: [PATCH 3/8] Add QBuffer

2010-05-17 Thread Jan Kiszka
Avi Kivity wrote: > On 05/17/2010 11:55 AM, Jan Kiszka wrote: >>> The names of fields are also type information. >>> >> Not in the case of device_show. The clients have no idea of the vmstate >> structures before they were transfered. Granted, that will likely remain >> a special case in the

[Qemu-devel] Re: [PATCH 3/8] Add QBuffer

2010-05-17 Thread Avi Kivity
On 05/17/2010 11:55 AM, Jan Kiszka wrote: The names of fields are also type information. Not in the case of device_show. The clients have no idea of the vmstate structures before they were transfered. Granted, that will likely remain a special case in the QMP command set. For that

[Qemu-devel] Re: [PATCH 3/8] Add QBuffer

2010-05-17 Thread Jan Kiszka
Avi Kivity wrote: > On 05/17/2010 10:57 AM, Jan Kiszka wrote: >> Avi Kivity wrote: >> >>> On 05/17/2010 10:40 AM, Jan Kiszka wrote: >>> > The alternative is to have a schema. Sun RPC/XDR doesn't carry any type > information (you can't even distinguish between a number and text) y

[Qemu-devel] Re: [PATCH 3/8] Add QBuffer

2010-05-17 Thread Avi Kivity
On 05/17/2010 11:10 AM, Avi Kivity wrote: Another way of looking at it: if the client sees { __class__: foo, f1: 10, f2: 9 }, it cannot derive any information from __class__ unless it was aware of foo beforehand. If that's the case, let's make it part of the schema so it is available at comp

[Qemu-devel] Re: [PATCH 3/8] Add QBuffer

2010-05-17 Thread Avi Kivity
On 05/17/2010 10:57 AM, Jan Kiszka wrote: Avi Kivity wrote: On 05/17/2010 10:40 AM, Jan Kiszka wrote: The alternative is to have a schema. Sun RPC/XDR doesn't carry any type information (you can't even distinguish between a number and text) yet C clients have to problem extracting ty

[Qemu-devel] Re: [PATCH 3/8] Add QBuffer

2010-05-17 Thread Jan Kiszka
Avi Kivity wrote: > On 05/17/2010 10:40 AM, Jan Kiszka wrote: >>> The alternative is to have a schema. Sun RPC/XDR doesn't carry any type >>> information (you can't even distinguish between a number and text) yet C >>> clients have to problem extracting typed information from it. >>> >>> Having __

[Qemu-devel] Re: [PATCH 3/8] Add QBuffer

2010-05-17 Thread Avi Kivity
On 05/17/2010 10:40 AM, Jan Kiszka wrote: The alternative is to have a schema. Sun RPC/XDR doesn't carry any type information (you can't even distinguish between a number and text) yet C clients have to problem extracting typed information from it. Having __class__ everywhere means we're carr

[Qemu-devel] Re: [PATCH 3/8] Add QBuffer

2010-05-17 Thread Jan Kiszka
Avi Kivity wrote: > On 05/17/2010 03:12 AM, Anthony Liguori wrote: >> On Sun, May 16, 2010 at 12:38 PM, Jamie Lokier >> wrote: >> >>> Anthony Liguori wrote: >>> Instead of encoding just as a string, it would be a good idea to encode it as something like: {'__class__': '

[Qemu-devel] Re: [PATCH 3/8] Add QBuffer

2010-05-16 Thread Jan Kiszka
Jamie Lokier wrote: > Anthony Liguori wrote: >> Instead of encoding just as a string, it would be a good idea to encode >> it as something like: >> >> {'__class__': 'base64', 'data': ...} > > Is there a benefit to the class indirection, over simply a keyword?: > > {'__base64__': ...} > > __clas

[Qemu-devel] Re: [PATCH 3/8] Add QBuffer

2010-05-16 Thread Avi Kivity
On 05/16/2010 01:16 PM, Paolo Bonzini wrote: On 05/16/2010 11:50 AM, Avi Kivity wrote: On 05/16/2010 12:37 PM, Paolo Bonzini wrote: On 05/15/2010 07:31 PM, Avi Kivity wrote: On 05/15/2010 11:59 AM, Jan Kiszka wrote: Is this __class__ stuff documented anywhere? Not yet. Also, we should clar

[Qemu-devel] Re: [PATCH 3/8] Add QBuffer

2010-05-16 Thread Paolo Bonzini
On 05/16/2010 11:50 AM, Avi Kivity wrote: On 05/16/2010 12:37 PM, Paolo Bonzini wrote: On 05/15/2010 07:31 PM, Avi Kivity wrote: On 05/15/2010 11:59 AM, Jan Kiszka wrote: Is this __class__ stuff documented anywhere? Not yet. Also, we should clarify the proposed private extension section th

[Qemu-devel] Re: [PATCH 3/8] Add QBuffer

2010-05-16 Thread Jan Kiszka
Avi Kivity wrote: > On 05/16/2010 12:37 PM, Paolo Bonzini wrote: >> On 05/15/2010 07:31 PM, Avi Kivity wrote: >>> On 05/15/2010 11:59 AM, Jan Kiszka wrote: > Is this __class__ stuff documented anywhere? > Not yet. Also, we should clarify the proposed private extension section

[Qemu-devel] Re: [PATCH 3/8] Add QBuffer

2010-05-16 Thread Jan Kiszka
Avi Kivity wrote: > On 05/15/2010 11:59 AM, Jan Kiszka wrote: >> >>> Is this __class__ stuff documented anywhere? >>> >>> >> Not yet. Also, we should clarify the proposed private extension section >> that only "__some_key" is reserved for downstream, not >> '__some_other_key__' (i.e. downstre

[Qemu-devel] Re: [PATCH 3/8] Add QBuffer

2010-05-16 Thread Avi Kivity
On 05/16/2010 12:37 PM, Paolo Bonzini wrote: On 05/15/2010 07:31 PM, Avi Kivity wrote: On 05/15/2010 11:59 AM, Jan Kiszka wrote: Is this __class__ stuff documented anywhere? Not yet. Also, we should clarify the proposed private extension section that only "__some_key" is reserved for downst

[Qemu-devel] Re: [PATCH 3/8] Add QBuffer

2010-05-16 Thread Paolo Bonzini
On 05/15/2010 07:31 PM, Avi Kivity wrote: On 05/15/2010 11:59 AM, Jan Kiszka wrote: Is this __class__ stuff documented anywhere? Not yet. Also, we should clarify the proposed private extension section that only "__some_key" is reserved for downstream, not '__some_other_key__' (i.e. downstrea

[Qemu-devel] Re: [PATCH 3/8] Add QBuffer

2010-05-15 Thread Avi Kivity
On 05/15/2010 11:59 AM, Jan Kiszka wrote: Is this __class__ stuff documented anywhere? Not yet. Also, we should clarify the proposed private extension section that only "__some_key" is reserved for downstream, not '__some_other_key__' (i.e. downstream names must not end with '__').

[Qemu-devel] Re: [PATCH 3/8] Add QBuffer

2010-05-15 Thread Jan Kiszka
Avi Kivity wrote: > On 05/15/2010 11:45 AM, Jan Kiszka wrote: >> >>> Instead of encoding just as a string, it would be a good idea to encode >>> it as something like: >>> >>> {'__class__': 'base64', 'data': ...} >>> >>> We've discussed using hidden properties to describe special things like >>> abs

[Qemu-devel] Re: [PATCH 3/8] Add QBuffer

2010-05-15 Thread Avi Kivity
On 05/15/2010 11:45 AM, Jan Kiszka wrote: Instead of encoding just as a string, it would be a good idea to encode it as something like: {'__class__': 'base64', 'data': ...} We've discussed using hidden properties to describe special things like abstract classes and since we already have this

[Qemu-devel] Re: [PATCH 3/8] Add QBuffer

2010-05-15 Thread Jan Kiszka
Anthony Liguori wrote: > On 05/14/2010 08:20 AM, Jan Kiszka wrote: >> diff --git a/qjson.c b/qjson.c >> index 483c667..4d1c21a 100644 >> --- a/qjson.c >> +++ b/qjson.c >> @@ -19,7 +19,9 @@ >> #include "qlist.h" >> #include "qbool.h" >> #include "qfloat.h" >> +#include "qbuffer.h" >> #includ