From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([208.118.235.92]:52584) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1UaRF3-0004ZG-OY for qemu-devel@nongnu.org; Thu, 09 May 2013 09:50:43 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1UaRF2-00033Q-Cw for qemu-devel@nongnu.org; Thu, 09 May 2013 09:50:41 -0400 Received: from mail-ie0-x22f.google.com ([2607:f8b0:4001:c03::22f]:42054) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1UaRF2-00033L-7d for qemu-devel@nongnu.org; Thu, 09 May 2013 09:50:40 -0400 Received: by mail-ie0-f175.google.com with SMTP id s9so5327150iec.6 for ; Thu, 09 May 2013 06:50:39 -0700 (PDT) Sender: fluxion Date: Thu, 9 May 2013 08:49:53 -0500 From: mdroth Message-ID: <20130509134953.GB13213@vm> References: <1368056037-16350-1-git-send-email-mdroth@linux.vnet.ibm.com> <518BA51C.4080207@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <518BA51C.4080207@redhat.com> Subject: Re: [Qemu-devel] [PATCH 0/8] qapi: add support for lists of native types List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Laszlo Ersek Cc: akong@redhat.com, qemu-devel@nongnu.org, lcapitulino@redhat.com On Thu, May 09, 2013 at 03:31:08PM +0200, Laszlo Ersek wrote: > On 05/09/13 01:33, Michael Roth wrote: > > These patches apply on top of qemu.git master, and can also be obtained from: > > git://github.com/mdroth/qemu.git qapi-native-lists > > > > Sending this now since a number of series have popped up in the past that > > wanted this, and Amos has some pending patches (query-mac-tables) that rely > > on this as well. > > > > These patches add support for specifying lists of native qapi types > > (int/bool/str/number) like so: > > > > { 'type': 'foo', > > 'data': { 'bar': ['int'] }} > > > > for a 'bar' field that is a list of type 'int', > > > > { 'type': 'foo2', > > 'data': { 'bar2': ['str'] }} > > > > for a 'bar2' field that is a list of type 'str', and so on. > > > > This uses linked list types for the native C representations, just as we do > > for complex schema-defined types. In the future we may add schema annotations > > of some sort to specify a more natural/efficient array type for the C > > representations, but this should serve the majority of uses-cases for now. > > > > Makefile | 6 +- > > qapi-schema-test.json | 8 ++ > > scripts/qapi-types.py | 44 ++++++- > > scripts/qapi-visit.py | 36 ++++- > > scripts/qapi.py | 21 +++ > > tests/test-qmp-input-visitor.c | 181 +++++++++++++++++++++++++ > > tests/test-qmp-output-visitor.c | 172 ++++++++++++++++++++++++ > > tests/test-visitor-serialization.c | 256 +++++++++++++++++++++++++++++++++--- > > 8 files changed, 692 insertions(+), 32 deletions(-) > > > > > > Two notes: > - the remark I made for 6/8 (comparing empty strings), > > - for 7/8 and 8/8: the format specification %3.4f is not very useful. > "3" is the field width, "4" is the precision, and the latter means for > %f the number of digits printed after the radix character. It's not > useful to specify a smaller field width (which covers the entire output > string) than precision here. Yup, that's a mistake. The field width isn't useful at all for what I was intending actually (to constrain the whole portion of float so that the fractional portion wouldn't get truncated by snprintf and make the test less likely to catch re-encoding issues). I think just using %.4f should suffice since we have plenty of extra buffer space for the values we're working with (max being 32 / 3) so I'll do that for the next pass. > > Other than these nothing pokes me in the eye. > > Laszlo >