From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from [140.186.70.92] (port=37864 helo=eggs.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1PphWg-00057Y-Sq for qemu-devel@nongnu.org; Wed, 16 Feb 2011 08:34:39 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1PphWf-0000MJ-Dz for qemu-devel@nongnu.org; Wed, 16 Feb 2011 08:34:38 -0500 Received: from mail-qy0-f173.google.com ([209.85.216.173]:47062) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1PphWf-0000M5-BJ for qemu-devel@nongnu.org; Wed, 16 Feb 2011 08:34:37 -0500 Received: by qyl38 with SMTP id 38so3777942qyl.4 for ; Wed, 16 Feb 2011 05:34:36 -0800 (PST) Message-ID: <4D5BD259.3080804@codemonkey.ws> Date: Wed, 16 Feb 2011 07:34:17 -0600 From: Anthony Liguori MIME-Version: 1.0 Subject: Re: [Qemu-devel] KVM call minutes for Feb 15 References: <20110215162629.GN21720@x200.localdomain> <4D5B0889.4030303@codemonkey.ws> <4D5BA5E9.90307@redhat.com> In-Reply-To: <4D5BA5E9.90307@redhat.com> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit List-Id: qemu-devel.nongnu.org List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Avi Kivity Cc: Chris Wright , qemu-devel@nongnu.org, kvm@vger.kernel.org On 02/16/2011 04:24 AM, Avi Kivity wrote: > On 02/16/2011 01:13 AM, Anthony Liguori wrote: >> On 02/15/2011 10:26 AM, Chris Wright wrote: >>> QAPI and QMP >>> - Anthony adding a new wiki page to describe all of this >> >> http://wiki.qemu.org/Features/QAPI >> > > [ 'change', {'device': 'str', 'target': 'str'}, {'arg': 'str'}, > 'none' ] > -> > void qmp_change(const char *device, const char *target, bool > has_arg, const char *arg, Error **errp); > > AFAICT a json-string allows embedded NULs ('\0000'). There translate > to UTF-8 as '\0', terminating your char *s. Either we use some > length/pointer structure, or the parser has to look for them and kill > them, and we have to specify them as verboten. I feel like it would be safer for us to not accept strings with embedded NULs. There's no way we're going to consistently handle this correctly in QEMU since we expect NUL terminated strings. They won't work for any of the standard C functions either. > > BlockDeviceInfo *qmp_query_block_device_info(const char *device, Error > **errp) > { > BlockDeviceInfo *info; > BlockDriverState *bs; > Error *local_err = NULL; > > bs = bdrv_find(device,&local_err); > if (local_err) { > error_propagate(errp, local_err); > return NULL; > } > > info->file = qemu_strdup(bs->filename); > info->ro = bs->readonly; > info->drv = qemu_strdup(bs->drv); > info->encrypted = bs->encrypted; > if (bs->backing_file[0]) { > info->has_backing_file = true; > info->backing_file = qemu_strdup(info->backing_file); > } > > return info; > } > > > So, info and all its pointer-typed members are required to be > qemu_free() compatible, with just a single pointer pointing to an > object, and generated code will qemu_free() everything? Yes. > > Recommend translating '-' in identifiers to '_' so we can use '-' in > the schema as a word separator. Already do that and we make extensive use of that in the schema. Regards, Anthony Liguori