From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([208.118.235.92]:54516) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1T4QFq-00081D-Uw for qemu-devel@nongnu.org; Thu, 23 Aug 2012 01:47:01 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1T4QFp-0001yr-Q7 for qemu-devel@nongnu.org; Thu, 23 Aug 2012 01:46:54 -0400 Received: from mx1.redhat.com ([209.132.183.28]:53460) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1T4QFp-0001ym-Hh for qemu-devel@nongnu.org; Thu, 23 Aug 2012 01:46:53 -0400 Message-ID: <5035C3CA.6020503@redhat.com> Date: Wed, 22 Aug 2012 23:46:50 -0600 From: Eric Blake MIME-Version: 1.0 References: <1345698866-19794-1-git-send-email-lilei@linux.vnet.ibm.com> <1345698866-19794-5-git-send-email-lilei@linux.vnet.ibm.com> In-Reply-To: <1345698866-19794-5-git-send-email-lilei@linux.vnet.ibm.com> Content-Type: multipart/signed; micalg=pgp-sha256; protocol="application/pgp-signature"; boundary="------------enigA1AAC3ABF9CDB3B070564473" Subject: Re: [Qemu-devel] [PATCH 4/6] 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, qemu-devel@nongnu.org This is an OpenPGP/MIME signed message (RFC 2440 and 3156) --------------enigA1AAC3ABF9CDB3B070564473 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable On 08/22/2012 11:14 PM, Lei Li wrote: > Signed-off-by: Lei Li Again, subject line should use '-' not '_' for QMP. > --- > hmp-commands.hx | 16 ++++++++++++++++ > hmp.c | 15 +++++++++++++++ > hmp.h | 1 + > qapi-schema.json | 23 +++++++++++++++++++++++ > qemu-char.c | 32 ++++++++++++++++++++++++++++++++ > qmp-commands.hx | 31 +++++++++++++++++++++++++++++++ > 6 files changed, 118 insertions(+), 0 deletions(-) >=20 > diff --git a/hmp-commands.hx b/hmp-commands.hx > index 829aea1..9f61633 100644 > --- a/hmp-commands.hx > +++ b/hmp-commands.hx > @@ -813,6 +813,22 @@ to memchr char device with size @var{size}. > ETEXI > =20 > { > + .name =3D "memchar-read", while the HMP command should use '_' not '-'. > +++ b/qapi-schema.json > @@ -264,6 +264,29 @@ > '*format': 'DataFormat'} } > =20 > ## > +# @memchar-read: > +# > +# Provide read interface for memchardev. Read from memchar > +# char device and return the data. > +# > +# @chardev: the name of the memchar char device. Why two spaces? > +# > +# @size: the size to write in bytes. s/write/read/ > +# > +# @format: #optional the format of the data want to read from > +# memchardev, by default is 'utf8'. > +# > +# Returns: The data read from memchar as string. > +# If @chardev is not a valid memchr device, DeviceNotFound > +# If an I/O error occurs while reading, IOError > +# > +# Since: 1.2 1.3 > +## > +{ 'command': 'memchar-read', > + 'data': {'chardev': 'str', 'size': 'int', '*format': 'DataFormat'}, > + 'returns': 'str' } While writing can default to UTF-8, I'm worried about reading - does encoding in UTF-8 allow transmission of NUL bytes through JSON, or do you have to use base64 to allow full binary data through? What happens if the data read includes a NUL byte that can't be encoded back into the requested DataFormat? --=20 Eric Blake eblake@redhat.com +1-919-301-3266 Libvirt virtualization library http://libvirt.org --------------enigA1AAC3ABF9CDB3B070564473 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://enigmail.mozdev.org/ iQEcBAEBCAAGBQJQNcPKAAoJEKeha0olJ0Nqia4H/3X61T/fw0kFzlJWYom7sNUB uZPjFuzSKnyybcExln1LDbq6axWESqlzv8SiFYMyh168Yvq1VIehwLhbYRrg/UHT GmBHy859ELlsHN48A1DlxKOoJBpiM2jVMJYjmN45xQoXpBC/7+0xqmrFp2m98k0S TAUTYhRu61mP54dQB5Gjt0gnCan/dtHiA2qJoOUSPu+Pze5xqy6s/oU6ZckH20Qi 6CD6zUj+Ds6dpk5+SDBP4CRFalc0i8k+y/9KpuKQj/lBcPLdX38C7U370T1A7t24 siwubSdYm/W0cbmrO6m+Z0SGFEEah+StQFBLuKl175V6uwrpS1OgeJdPn2ownqs= =XNA6 -----END PGP SIGNATURE----- --------------enigA1AAC3ABF9CDB3B070564473--