From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:57711) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ZcunK-0007zW-Tp for qemu-devel@nongnu.org; Fri, 18 Sep 2015 08:29:42 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1ZcunJ-0000a4-Ue for qemu-devel@nongnu.org; Fri, 18 Sep 2015 08:29:38 -0400 Received: from mx1.redhat.com ([209.132.183.28]:60360) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ZcunJ-0000Zx-O5 for qemu-devel@nongnu.org; Fri, 18 Sep 2015 08:29:37 -0400 References: <1441857991-7309-1-git-send-email-eblake@redhat.com> <1441857991-7309-28-git-send-email-eblake@redhat.com> <55FA84C5.8060206@cn.fujitsu.com> <55FACF90.408@redhat.com> <55FB1E65.6030402@redhat.com> <55FBD347.4020401@cn.fujitsu.com> From: Eric Blake Message-ID: <55FC03B0.8020904@redhat.com> Date: Fri, 18 Sep 2015 06:29:36 -0600 MIME-Version: 1.0 In-Reply-To: <55FBD347.4020401@cn.fujitsu.com> Content-Type: multipart/signed; micalg=pgp-sha256; protocol="application/pgp-signature"; boundary="0pQrpGfXeSq42UeSpa949VXiVijiLWG1R" Subject: Re: [Qemu-devel] [PATCH RFC v4 27/29] qapi: Change Netdev into a flat union List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Yang Hongyang , qemu-devel@nongnu.org, =?UTF-8?B?S8WRdsOhZ8OzLCBab2x0w6Fu?= This is an OpenPGP/MIME signed message (RFC 4880 and 3156) --0pQrpGfXeSq42UeSpa949VXiVijiLWG1R Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable On 09/18/2015 03:03 AM, Yang Hongyang wrote: >> Fix is simple: add this patch to your build: >> >> https://lists.gnu.org/archive/html/qemu-devel/2015-09/msg01650.html >> >> I've rebased my git repo accordingly for now, and will post v5 later o= n >> (I'm still working on other improvements, and may reshuffle patches >> before actually getting to v5). >> >> git fetch git://repo.or.cz/qemu/ericb.git qapi >> http://repo.or.cz/qemu/ericb.git/shortlog/refs/heads/qapi >=20 > I have to add a workaround in my previous netfilter v9 patchset(v10 and= > later > changed to QOM, so it won't have the problem) to get flat union work. > Seems that > you have already fixed it. Rather, Zolt=C3=A1n found it, and I just realized why it was important. = Your alternative is a bit simpler in implementation, though. >=20 > diff --git a/qapi/opts-visitor.c b/qapi/opts-visitor.c > index 7ae33b3..1271fab 100644 > --- a/qapi/opts-visitor.c > +++ b/qapi/opts-visitor.c > @@ -186,6 +186,20 @@ opts_end_struct(Visitor *v, Error **errp) > } >=20 >=20 > +static void opts_start_implicit_struct(Visitor *v, void **obj, > + size_t size, Error **errp) > +{ > + if (obj) { > + *obj =3D g_malloc0(size); > + } > +} > + > + > +static void opts_end_implicit_struct(Visitor *v, Error **errp) > +{ > +} > + > + > static GQueue * > lookup_distinct(const OptsVisitor *ov, const char *name, Error **errp)= > { > @@ -507,6 +521,8 @@ opts_visitor_new(const QemuOpts *opts) >=20 > ov->visitor.start_struct =3D &opts_start_struct; > ov->visitor.end_struct =3D &opts_end_struct; > + ov->visitor.start_implicit_struct =3D &opts_start_implicit_struct;= > + ov->visitor.end_implicit_struct =3D &opts_end_implicit_struct; >=20 > ov->visitor.start_list =3D &opts_start_list; > ov->visitor.next_list =3D &opts_next_list; >=20 >> >=20 --=20 Eric Blake eblake redhat com +1-919-301-3266 Libvirt virtualization library http://libvirt.org --0pQrpGfXeSq42UeSpa949VXiVijiLWG1R 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/ iQEcBAEBCAAGBQJV/AOwAAoJEKeha0olJ0Nqy5AH/0VvjsEa5e8dG0BVid3A5MV4 irNbCGmjZzgLFwU8KltnsvvenU+dxNKcSHmNjB0fPDsngZs7+jZdt6Htl6jfyzwS z19+cp77EeKXHIAvEJTkRumFKk+cxtGuoTlhp2DNNAzlb0iNm4IL0/1jX6KNLwzV 03eXFrSc6KW5WCWKmaa1tRkJXke6U0/OwxM+w16sWPbHgSxibq+4Pny+4Ap82RyV oYdojvTODczchQY6xq+XB9JARDpCpZZdCByPhaDQQYHHD+V0tE2WFrd0UEITCWNW qVEQbweeRk1W1/IVbcvAawCdFtV2PAnDKSQ+a3x3HIQtXNFPWL7Rc235V7eAr28= =qcTH -----END PGP SIGNATURE----- --0pQrpGfXeSq42UeSpa949VXiVijiLWG1R--