From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:58743) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ZXyrp-0000qf-V3 for qemu-devel@nongnu.org; Fri, 04 Sep 2015 17:49:57 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1ZXyrc-0001Ak-51 for qemu-devel@nongnu.org; Fri, 04 Sep 2015 17:49:43 -0400 Received: from mx1.redhat.com ([209.132.183.28]:56255) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ZXyrb-00018e-Tk for qemu-devel@nongnu.org; Fri, 04 Sep 2015 17:49:40 -0400 References: <55EA0ED2.50105@redhat.com> From: Eric Blake Message-ID: <55EA11E8.7080001@redhat.com> Date: Fri, 4 Sep 2015 15:49:28 -0600 MIME-Version: 1.0 In-Reply-To: <55EA0ED2.50105@redhat.com> Content-Type: multipart/signed; micalg=pgp-sha256; protocol="application/pgp-signature"; boundary="ckeffdWu8b146Cklta8uhCPwD2lsrrLUq" Subject: Re: [Qemu-devel] [PATCH v2 05/49] net: use Netdev instead of NetClientOptions in client init List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: =?UTF-8?B?S8WRdsOhZ8OzLCBab2x0w6Fu?= , qemu-devel@nongnu.org Cc: "Michael S. Tsirkin" , Jason Wang , Vincenzo Maffione , Gerd Hoffmann , Stefan Hajnoczi , Giuseppe Lettieri , Luigi Rizzo This is an OpenPGP/MIME signed message (RFC 4880 and 3156) --ckeffdWu8b146Cklta8uhCPwD2lsrrLUq Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable On 09/04/2015 03:36 PM, Eric Blake wrote: > On 08/21/2015 09:37 AM, K=C5=91v=C3=A1g=C3=B3, Zolt=C3=A1n wrote: >> This way we no longer need NetClientOptions and can convert Netdev >> into a flat union. >> >> Signed-off-by: K=C5=91v=C3=A1g=C3=B3, Zolt=C3=A1n >> --- >> net/clients.h | 20 ++++++++++---------- >> net/dump.c | 6 +++--- >> net/hub.c | 6 +++--- >> net/l2tpv3.c | 6 +++--- >> net/net.c | 29 ++++++++++++++--------------- >> net/netmap.c | 4 ++-- >> net/slirp.c | 6 +++--- >> net/socket.c | 6 +++--- >> net/tap-win32.c | 6 +++--- >> net/tap.c | 12 ++++++------ >> net/vde.c | 6 +++--- >> net/vhost-user.c | 6 +++--- >> 12 files changed, 56 insertions(+), 57 deletions(-) >=20 > Nice; you've already done some of the work that I saw as needing to be > done for my plans to convert QMP netdev_add to use a flat union instead= > of 'gen':false. >=20 > Conflicts with my s/kind/type/ in > https://lists.gnu.org/archive/html/qemu-devel/2015-08/msg02061.html, so= > whoever goes in first gets to avoid the obvious merge conflict > resolution. :) >=20 > Reviewed-by: Eric Blake By the way, I was able to get this patch to work without using 4/49 by changing the diff to net_client_init1() to be just the following: diff --git i/net/net.c w/net/net.c index 28a5597..4d99b48 100644 --- i/net/net.c +++ w/net/net.c @@ -914,11 +914,13 @@ static int (* const net_client_init_fun[NET_CLIENT_OPTIONS_KIND_MAX])( static int net_client_init1(const void *object, int is_netdev, Error **errp) { const NetClientOptions *opts; + Netdev legacy =3D {0}; + const Netdev *netdev; const char *name; NetClientState *peer =3D NULL; if (is_netdev) { - const Netdev *netdev =3D object; + netdev =3D object; opts =3D netdev->opts; name =3D netdev->id; @@ -931,7 +933,9 @@ static int net_client_init1(const void *object, int is_netdev, Error **errp) } } else { const NetLegacy *net =3D object; - opts =3D net->opts; + legacy.id =3D net->id; + opts =3D legacy.opts =3D net->opts; + netdev =3D &legacy; /* missing optional values have been initialized to "all bits zero" */ name =3D net->has_id ? net->id : net->name; @@ -958,7 +962,7 @@ static int net_client_init1(const void *object, int is_netdev, Error **errp) } } - if (net_client_init_fun[opts->kind](opts, name, peer, errp) < 0) { + if (net_client_init_fun[opts->kind](netdev, name, peer, errp) < 0) {= /* FIXME drop when all init functions store an Error */ if (errp && !*errp) { error_setg(errp, QERR_DEVICE_INIT_FAILED, I may end up using a modified version of your patch in my submission for QMP netdev_add, while still avoiding the merge of NetdevLegacy (I'm not sold on that one yet, because it exists only for the command line and not for QMP, while we want to make QMP become typesafe). --=20 Eric Blake eblake redhat com +1-919-301-3266 Libvirt virtualization library http://libvirt.org --ckeffdWu8b146Cklta8uhCPwD2lsrrLUq Content-Type: application/pgp-signature; name="signature.asc" Content-Description: OpenPGP digital signature Content-Disposition: attachment; filename="signature.asc" -----BEGIN PGP SIGNATURE----- Version: GnuPG v2 Comment: Public key at http://people.redhat.com/eblake/eblake.gpg Comment: Using GnuPG with Thunderbird - http://www.enigmail.net/ iQEcBAEBCAAGBQJV6hHoAAoJEKeha0olJ0NqLocH/i4jalCaAcjskJEdp8SyvUsL 2dQPnj7nVbuwIvrcheOFppr61zvUE6x4cZe5vFsabKSzURU+UqHtWeopUwjr6bPq pYHdigJYoi0hvJ0YwwM7xql1Y3zZIw0CsuJuLFQf60zlAzgs1Kfzb56q7pxDn9cT fU5wAbskdlxMy9YlXZoUIS917Bk8cpopRPLEVJuFyTIGWCEIF3AamNM5tC5jzNcw piwS2gRZmBJbFR4qrh8ann/EMa7b9zJC+Uyz4YtMZhhuChaQ2pft8xstajPpRZYr s2beUenjmQy4zFd7Np0Y3vaTrD6pLfhusbtUJmmtbAohPhLnb56S1G6uKSDS4M0= =t+ek -----END PGP SIGNATURE----- --ckeffdWu8b146Cklta8uhCPwD2lsrrLUq--