From: Ian Campbell Subject: Re: [PATCH v7 5/9] libxl IDL: generate code to parse libxl__json_object to libxl_FOO struct Date: Tue, 24 Jun 2014 10:10:53 +0100 Message-ID: <1403601053.10204.1.camel@kazak.uk.xensource.com> References: <1402997549-23136-1-git-send-email-wei.liu2@citrix.com> <1402997549-23136-6-git-send-email-wei.liu2@citrix.com> <1403101333.6568.46.camel@kazak.uk.xensource.com> <20140618172115.GL20819@zion.uk.xensource.com> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Return-path: In-Reply-To: <20140618172115.GL20819@zion.uk.xensource.com> List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Sender: xen-devel-bounces@lists.xen.org Errors-To: xen-devel-bounces@lists.xen.org To: Wei Liu Cc: ian.jackson@eu.citrix.com, xen-devel@lists.xen.org List-Id: xen-devel@lists.xenproject.org On Wed, 2014-06-18 at 18:21 +0100, Wei Liu wrote: > On Wed, Jun 18, 2014 at 03:22:13PM +0100, Ian Campbell wrote: > > On Tue, 2014-06-17 at 10:32 +0100, Wei Liu wrote: > > > libxl_FOO_parse_json functions are generated. > > > > > > Note that these functions are used to parse libxl__json_object to > > > libxl__FOO struct. They don't consume JSON string. > > > > > > The new function definitions are generated to new header files called > > > __libxl_types_*_json_internal.h so that they don't contaiminate public > > > header. > > > > "contaminate". > > > > I'm a bit confused what is going into this file. It seems to be these > > two: > > > > f.write("int %s_parse_json(libxl__gc *gc, const libxl__json_object *%s, %s)\n" % (ty.typename,"o",ty.make_arg("p", passby=idl.PASS_BY_REFERENCE))) > > f.write("int %s_from_json(libxl_ctx *ctx, %s, const char *s)\n" % (ty.typename, ty.make_arg("p", passby=idl.PASS_BY_REFERENCE))) > > > > This hunk is in fact generating the implementation. Sorry, somehow I thought this was the prototype. > I don't see the need > to separate them to different implementation files. Indeed, there is no reason to do so. My confusion. > > The first looks internal (it takes const libxl__json_object which is > > internal) but it is in the libxl_ namespace. > > > > The second looks like it should be public in _libxl_json.h, shouldn't > > it? > > > > I agree with you that the public functions should to go _libxl_types.h > -- it's done like that in this version already. So actually nothing to > worry about with regard to header files. Smashing. I'll have another look at this patch with that in mind once I've dealt with my backlog from being away. Ian.