From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([208.118.235.92]:41611) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Tt1sS-0004Bb-VY for qemu-devel@nongnu.org; Wed, 09 Jan 2013 15:03:58 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1Tt1sR-0000fN-EP for qemu-devel@nongnu.org; Wed, 09 Jan 2013 15:03:56 -0500 Received: from mx1.redhat.com ([209.132.183.28]:61141) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Tt1sR-0000fJ-6k for qemu-devel@nongnu.org; Wed, 09 Jan 2013 15:03:55 -0500 Received: from int-mx11.intmail.prod.int.phx2.redhat.com (int-mx11.intmail.prod.int.phx2.redhat.com [10.5.11.24]) by mx1.redhat.com (8.14.4/8.14.4) with ESMTP id r09K3rZV017694 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK) for ; Wed, 9 Jan 2013 15:03:54 -0500 Message-ID: <50EDCD28.8020505@redhat.com> Date: Wed, 09 Jan 2013 13:03:52 -0700 From: Eric Blake MIME-Version: 1.0 References: <1357566928-25361-1-git-send-email-kraxel@redhat.com> <1357566928-25361-11-git-send-email-kraxel@redhat.com> In-Reply-To: <1357566928-25361-11-git-send-email-kraxel@redhat.com> Content-Type: multipart/signed; micalg=pgp-sha256; protocol="application/pgp-signature"; boundary="------------enig7441AB1697C42333EFFA62A0" Subject: Re: [Qemu-devel] [PATCH 10/11] chardev: add socket chardev support to chardev-add (qmp) List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Gerd Hoffmann Cc: qemu-devel@nongnu.org This is an OpenPGP/MIME signed message (RFC 2440 and 3156) --------------enig7441AB1697C42333EFFA62A0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable On 01/07/2013 06:55 AM, Gerd Hoffmann wrote: > qemu_chr_open_socket is splitted into two functions. All initializatio= n s/splitted/split/ > after creating the socket file handler is splitted away into the new and again > qemu_chr_open_socket_fd function. >=20 > chr->filename doesn't get filled from QemuOpts any more. Qemu gathers > the information using getsockname and getnameinfo instead. This way it= > will also work correctly for file handles passed via file descriptor > passing. >=20 > Finally qmp_chardev_open_socket() is the actual qmp hotplug > implementation which basically just calls socket_listen or > socket_connect and the new qemu_chr_open_socket_fd function. >=20 > Signed-off-by: Gerd Hoffmann > --- > qapi-schema.json | 13 +++- > qemu-char.c | 168 ++++++++++++++++++++++++++++++++++++----------= ------- > 2 files changed, 124 insertions(+), 57 deletions(-) >=20 > +++ b/qemu-char.c > @@ -2438,10 +2438,88 @@ static void tcp_chr_close(CharDriverState *chr)= > qemu_chr_be_event(chr, CHR_EVENT_CLOSED); > } > =20 > -static CharDriverState *qemu_chr_open_socket(QemuOpts *opts) > +static CharDriverState *qemu_chr_open_socket_fd(int fd, int do_nodelay= , > + int is_listen, int is_= telnet, > + int is_waitconnect, These three parameters sound like they might be better as 'bool' instead of 'int'. > @@ -2458,10 +2536,7 @@ static CharDriverState *qemu_chr_open_socket(Qem= uOpts *opts) > if (!is_listen) > is_waitconnect =3D 0; > =20 > - chr =3D g_malloc0(sizeof(CharDriverState)); > - s =3D g_malloc0(sizeof(TCPCharDriver)); > - > - if (is_unix) { > + if (is_unix) { Spurious re-indentation? > =20 > +static CharDriverState *qmp_chardev_open_socket(ChardevSocket *sock, > + Error **errp) > +{ > + SocketAddress *addr =3D sock->addr; > + bool do_nodelay =3D sock->has_delay ? !sock->delay : true; > + bool is_listen =3D sock->has_server ? sock->server : true; > + bool is_telnet =3D sock->has_telnet ? sock->telnet : false; > + bool is_waitconnect =3D sock->has_wait ? sock->wait : false; Especially since you are using bool here. --=20 Eric Blake eblake redhat com +1-919-301-3266 Libvirt virtualization library http://libvirt.org --------------enig7441AB1697C42333EFFA62A0 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 undefined - http://www.enigmail.net/ iQEcBAEBCAAGBQJQ7c0oAAoJEKeha0olJ0Nqac8IAJX8nGeMUg9LW76LL5FgYzzF 0iiqSiUXkO9oPEyFDy44QG3UeAWpuvJ+I2e6pdPxnrqvi1iJYbrRjhnmYqm463sh b6Hveo9/aRwVpxba86iu7v8+drHkCGinTN+4AYiqMaalxpmXKj8ctpju6fFrZ+2I X4IR/Z5RVXYoQ2jD6ciwugDw3Lms8BE60/V4dlkjc7drOD3yLuGcLOiqf2ltFYsv +JaqvkjBrp2LW6XYK6DN1/ZaoXUE8+hHXVEm4VrjQTXK0G2fzPNXKVjOii6NdeiJ 8mHDVOQ4ytRdXD6zNcl7SWHwILXI8W4JqufWsC/NEES4WMRoapQ8Y32mRQXiuak= =x3SP -----END PGP SIGNATURE----- --------------enig7441AB1697C42333EFFA62A0--