Received: from [140.186.70.92] (port=41684 helo=eggs.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1OELtK-0006RK-7k for qemu-devel@nongnu.org; Tue, 18 May 2010 08:27:23 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.69) (envelope-from ) id 1OELtI-0003E0-5f for qemu-devel@nongnu.org; Tue, 18 May 2010 08:27:22 -0400 Received: from mx1.redhat.com ([209.132.183.28]:8119) by eggs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1OELtH-0003Dr-Uk for qemu-devel@nongnu.org; Tue, 18 May 2010 08:27:20 -0400 From: Markus Armbruster Subject: Re: [Qemu-devel] Re: [PATCH 3/8] Add QBuffer References: <6e14cbfe3764b46d9bd6d2db61d41fd9c85dd54e.1273843151.git.jan.kiszka@siemens.com> <4BED9358.1000106@codemonkey.ws> <20100516173809.GA29814@shareable.org> <4BF0E6CD.7090909@redhat.com> <4BF0F2FD.90408@siemens.com> <4BF0F437.6040302@redhat.com> <4BF0F6D3.8020803@siemens.com> <4BF0FA13.10808@redhat.com> <4BF10481.7030900@siemens.com> Date: Tue, 18 May 2010 14:27:15 +0200 In-Reply-To: <4BF10481.7030900@siemens.com> (Jan Kiszka's message of "Mon, 17 May 2010 10:55:29 +0200") Message-ID: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii List-Id: qemu-devel.nongnu.org List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Jan Kiszka Cc: "qemu-devel@nongnu.org" , Anthony Liguori , Luiz Capitulino , Avi Kivity , Juan Quintela 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 distinguish between a number and text) yet C >>>>>> clients have to problem extracting typed information from it. >>>>>> >>>>>> Having __class__ everywhere means we're carrying the schema in every >>>>>> message instead of just once. >>>>>> >>>>>> >>>>> The device_show command is already an example where you don't have a >>>>> predefined schema. It is derived from the data stream the encodes the >>>>> vmstate fields. So far we have no collision between base64-encoded >>>>> buffers and real strings, but this may actually change when we start >>>>> annotating the fields with symbolic constants. >>>>> >>>>> >>>> What is the receiver to do with it? >>>> >>>> If it doesn't know the schema (and there is no schema), then all it can >>>> do is display the key/values. If it does know the schema, then >>>> __class__ is unnecessary. >>>> >>> There is a schema describing the fields (name, size, number of >>> elements), >> >> 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? >>> but their types (int, buffer, sub-field, array of X) are >>> derived from the JSON objects (ie. the JSON parser does this job). >>> >> >> 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. qdev device properties are similar. Right now, they occur only as arguments of device_add. When do_info_qtree() gets converted, they'll appear in results. [...]