From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([208.118.235.92]:46369) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1TBoRy-0004PD-BJ for qemu-devel@nongnu.org; Wed, 12 Sep 2012 11:02:02 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1TBoRs-0005qj-Ck for qemu-devel@nongnu.org; Wed, 12 Sep 2012 11:01:58 -0400 Received: from mx1.redhat.com ([209.132.183.28]:23588) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1TBoRs-0005qb-3s for qemu-devel@nongnu.org; Wed, 12 Sep 2012 11:01:52 -0400 Message-ID: <5050A3D9.8030805@redhat.com> Date: Wed, 12 Sep 2012 09:01:45 -0600 From: Eric Blake MIME-Version: 1.0 References: <1347451046-5513-1-git-send-email-lilei@linux.vnet.ibm.com> <1347451046-5513-5-git-send-email-lilei@linux.vnet.ibm.com> In-Reply-To: <1347451046-5513-5-git-send-email-lilei@linux.vnet.ibm.com> Content-Type: multipart/signed; micalg=pgp-sha256; protocol="application/pgp-signature"; boundary="------------enig5A79B5B39EB3EF099472160B" Subject: Re: [Qemu-devel] [PATCH 4/5] QAPI: Introduce memchar-read QMP command List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Lei Li Cc: aliguori@us.ibm.com, lcapitulino@redhat.com, qemu-devel@nongnu.org, armbru@redhat.com This is an OpenPGP/MIME signed message (RFC 2440 and 3156) --------------enig5A79B5B39EB3EF099472160B Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable On 09/12/2012 05:57 AM, Lei Li wrote: > Signed-off-by: Lei Li > --- > hmp-commands.hx | 25 +++++++++++++++++++++++++ > hmp.c | 18 ++++++++++++++++++ > hmp.h | 1 + > qapi-schema.json | 27 +++++++++++++++++++++++++++ > qemu-char.c | 48 ++++++++++++++++++++++++++++++++++++++++++++++= ++ > qmp-commands.hx | 37 +++++++++++++++++++++++++++++++++++++ > 6 files changed, 156 insertions(+), 0 deletions(-) >=20 > +++ b/qapi-schema.json > @@ -305,6 +305,33 @@ > '*control': 'CongestionControl'} } > =20 > ## > +# @memchar-read: > +# > +# Provide read interface for CirMemCharDriver. Read from cirmemchar > +# char device and return the data. > +# > +# @chardev: the name of the cirmemchar char device. > +# > +# @size: the size to read in bytes. > +# > +# @format: #optional the format of the data want to read from > +# CirMemCharDriver, by default is 'utf8'. > +# > +# @control: #optional options for read and write command that specifie= s > +# behavior when the queue is full/empty. > +# > +# Returns: The data read from cirmemchar as string. > +# If @chardev is not a valid memchr device, DeviceNotFound > +# If an I/O error occurs while reading, IOError > +# > +# Since: 1.3 > +## > +{ 'command': 'memchar-read', > + 'data': {'chardev': 'str', 'size': 'int', '*format': 'DataFormat', > + '*control': 'CongestionControl'}, > + 'returns': 'str' } What happens if the data to be read contains embedded NUL, but the requested 'format' can't express that? What happens if there is less data available than the maximum requested size? I'm wondering if the return should be a JSON struct, { 'data':'str', 'size':'int' }, in order to allow for the case of short read returns. > +- "chardev": the name of the char device, must be unique (json-string)= > +- "size": the memory size in bytes, init size of the cirmemchar > + by default (json-int) > +- "format": the data format write to CirMemCharDriver, default is > + utf8. (json-string, optional) > + - Possible values: "utf8", "base64" Also, you probably want to make it crystal-clear whether size is referring to the unencoded size of the raw data, or the encoded size after conversion to utf8 or base64. --=20 Eric Blake eblake@redhat.com +1-919-301-3266 Libvirt virtualization library http://libvirt.org --------------enig5A79B5B39EB3EF099472160B Content-Type: application/pgp-signature; name="signature.asc" Content-Description: OpenPGP digital signature Content-Disposition: attachment; filename="signature.asc" -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.12 (GNU/Linux) Comment: Public key at http://people.redhat.com/eblake/eblake.gpg Comment: Using GnuPG with Mozilla - http://www.enigmail.net/ iQEcBAEBCAAGBQJQUKPZAAoJEKeha0olJ0NqYrUH/2lXuW6pAGmUPrn+Enst/Lxg f3o9SP6Ghn3ye8YolOvUJsxsxk65vM3CnvstI/FtaOCtm3o+8NcAwG+o4iYuIg8m Fje/WtfG8+q9heue5Xc7sAQ93LIhkwdHwNcX9fsBmOEBo38P/aJINdOOaFecnPG3 6BaeI0Q5N9LhrD+3SQ7KS/h6L7GzNJpHP+Q+xpifEn450iRDAp8Px6nX0pA/oHzw Q6Op7FkTjZxXQIbxy499XPSdCQ1Y1lCSp1xkbkz0pLAoPMdUYit+cTqb2tYVjpmS RbZn3lKB6iWiRRckA9+TuSKnMZmWbKvawm5wuCjBJC9Zz/J2Jdwb3otGZJjeenY= =lIXf -----END PGP SIGNATURE----- --------------enig5A79B5B39EB3EF099472160B--