From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:52350) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Wi81q-0008JC-OB for qemu-devel@nongnu.org; Wed, 07 May 2014 16:01:28 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1Wi81l-0006hL-LN for qemu-devel@nongnu.org; Wed, 07 May 2014 16:01:22 -0400 Received: from lputeaux-656-01-25-125.w80-12.abo.wanadoo.fr ([80.12.84.125]:51414 helo=paradis.irqsave.net) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Wi81l-0006hD-CW for qemu-devel@nongnu.org; Wed, 07 May 2014 16:01:17 -0400 Date: Wed, 7 May 2014 22:01:45 +0200 From: =?iso-8859-1?Q?Beno=EEt?= Canet Message-ID: <20140507200145.GC31788@irqsave.net> References: <20140502135218.31383.90270.stgit@fimbulvetr.bsc.es> <20140506130740.GA17717@irqsave.net> <20140506092725.4c195cbd@redhat.com> <5368F7F8.3090706@redhat.com> <87mwets7ax.fsf@blackfin.pond.sub.org> MIME-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Disposition: inline In-Reply-To: <87mwets7ax.fsf@blackfin.pond.sub.org> Content-Transfer-Encoding: quoted-printable Subject: Re: [Qemu-devel] [PATCH v12 0/4] qapi: Allow modularization of QAPI schema files List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Markus Armbruster Cc: =?iso-8859-1?Q?Beno=EEt?= Canet , Luiz Capitulino , qemu-devel@nongnu.org, =?iso-8859-1?Q?Llu=EDs?= Vilanova The Wednesday 07 May 2014 =E0 21:44:06 (+0200), Markus Armbruster wrote : > Eric Blake writes: >=20 > > On 05/06/2014 07:27 AM, Luiz Capitulino wrote: > >> On Tue, 6 May 2014 15:07:40 +0200 > >> Beno=EEt Canet wrote: > >>=20 > >>> I am trying to use this series to modularise the block API. > >>> > >>> Here are my finding. > >>> > >>> I tried to make a qmp/block.json including VM state related API. > >>> block.json include a qmp/block-core.json containing only true block= stuff. > >>> > >>> When generating and compiling block-core.json to link it with qemu-= nbd > >>> I saw that some of the block stuff needed ErrorClass so I went the = route > >>> of creating a qmp/common.json containing ErrorClass. > >>> > >>> common.json being included in block-core.json and in qapi-schema.js= on it > >>> quickly lead some code being generated in double and the > >>> compilation to choke. > >>> > >>> What do you think would be the best solution to fix this ? > >>> (Fix the generator ? Make include ignore second inclusion of the sa= me file ?) > >>=20 > >> Make qapi-schema.json a sort of master file and include everything? > > > > Won't cut it, if we want to support a subset of files in other contex= ts. > > You either have to do: > > > > qemu-schema.json: > > include common > > include block > > include other > > > > qemu-block: > > include common > > include block > > > > where block does not work in isolation, and has to be wrapped; but no= w > > we have two different wrappers depending on the two different clients > > that want a different subset. >=20 > Won't win beauty contests, but it isn't exactly terrible, either. >=20 > > Or you do: > > > > qemu-schema.json: > > include common > > include block > > include other > > block.json: > > include common > > > > now block.json is standalone, and qemu-schema.json ends up including > > common through two different paths. >=20 > Yes. >=20 > >> Eventually, we might want to have if/defs and whatnot. But having a = master > >> file seems a reasonable first step to me. I actually thought this wa= s the > >> intention. Unless I got it wrong, of course. > > > > Ifdefs may be a bit much. If we add them, then we can worry about > > explicit include guards, the same as the C preprocessor. But for now= , > > I'd be perfectly fine with a followup patch that includes a file's > > contents exactly once, no matter how many times it is included (that = is, > > act as if include guards were implicitly present, since we lack > > conditionals, so include files are currently idempotent). >=20 > As long as the meaning of an include doesn't depend on its environment > (and I don't see that change for QAPI schemata), making the include > idempotent is the right thing. >=20 > Beno=EEt, Llu=EDs, would either of you be willing to tackle this? I need it badly I will do it. Best regards Beno=EEt >=20