xen-devel.lists.xenproject.org archive mirror
 help / color / mirror / Atom feed
From: George Dunlap <george.dunlap@citrix.com>
To: Nicholas Rosbrook <rosbrookn@ainfosec.com>,
	"xen-devel@lists.xenproject.org" <xen-devel@lists.xenproject.org>
Cc: "anthony.perard@citrix.com" <anthony.perard@citrix.com>,
	Brendan Kerrigan <kerriganb@ainfosec.com>,
	"ian.jackson@eu.citrix.com" <ian.jackson@eu.citrix.com>,
	Nicolas Belouin <nicolas.belouin@gandi.net>,
	"wl@xen.org" <wl@xen.org>
Subject: Re: [Xen-devel] [RFC] Generating Go bindings for libxl
Date: Fri, 2 Aug 2019 16:38:36 +0100	[thread overview]
Message-ID: <76c02038-fcce-2774-c4f5-73ab9e0fdeef@citrix.com> (raw)
In-Reply-To: <24acd142b70345038dc0dfdd61bb9520@ainfosec.com>

On 8/1/19 7:59 PM, Nicholas Rosbrook wrote:
>> With that said, what are your expectations for the generated Go code at this point?
>> Do you think we should try to generate the pieces that call into libxl? Or, do you think
>> the code generation should be limited to the structs and boiler-plate C <-> Go "type
>> marshaling?"
> 
> [...]
> 
>> I think we have a decent enough idea for what a c-for-go version of this might look like. So,
>> what are the next steps in exploring the custom generator route?
> 
> Sorry to answer my own question, but I wanted to follow up with some thoughts I came up
> with after I sent my last email.
> 
> I think maybe we should take the simpler approach. Meaning, the Go package would be
> constructed as follows:
> 
> 1. Generated code for Go types that are analogous to the C libxl types. The IDL should
> already be able to provide enough information for a simple Go code generator (like gentypes.py).
> 
> 2. Generated code to handle the marshaling between the pure-Go types and the C types. We
> could tailor this piece to address the short-comings of c-for-go, e.g. the num_disks issue, preventing
> use-after-free, etc.
> 
> 3. Hand-written wrappers. As you stated before, there is not much difference between the in-tree
> bindings calling C.libxl_domain_info, and my wrappers calling domainInfo() (besides the additional
> layer in mine). And, we agree that writing those simple wrappers is pretty painless.
> 
> I think this is more or less what you have been suggesting, but I wanted to articulate the point that
> I think if we go with a custom generator, we should not try do as much as c-for-go is trying do.

I was going to say, the idea of adding function signatures to the IDL
was just "exploring the state space" of approaches.  Parsing the
existing IDL to spit out Go structures and marshalling should be
reasonably straightforward.  Designing an IDL for the functions is a
fairly large design project, with all sorts of exciting
<strikethrough>bike sheds to paint</strikethrough> important design
decisions to make along the way: probably something to attempt if / when
we determine that it's worth the cost.

IOW, in response to GP, I was going to counter-suggest what you suggest
in this email. :-)

Are you up for taking a stab at something like `gengotypes.py`?

 -George

_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xenproject.org
https://lists.xenproject.org/mailman/listinfo/xen-devel

  reply	other threads:[~2019-08-02 15:39 UTC|newest]

Thread overview: 27+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-07-30 13:11 [Xen-devel] [RFC] Generating Go bindings for libxl Nicholas Rosbrook
2019-07-30 13:48 ` Tamas K Lengyel
2019-07-30 15:49   ` George Dunlap
2019-07-30 18:39     ` Tamas K Lengyel
2019-07-31 15:14       ` George Dunlap
2019-07-30 15:22 ` George Dunlap
2019-07-30 21:52   ` Nicholas Rosbrook
2019-07-31 15:06     ` George Dunlap
2019-07-31 21:22       ` Nicholas Rosbrook
2019-08-01 18:59         ` Nicholas Rosbrook
2019-08-02 15:38           ` George Dunlap [this message]
2019-08-02 19:09             ` Nicholas Rosbrook
2019-09-04  0:36             ` Nicholas Rosbrook
2019-09-04 16:52               ` George Dunlap
2019-09-04 16:59                 ` George Dunlap
2019-09-04 18:23                   ` Nicholas Rosbrook
2019-09-11 20:25                   ` Nicholas Rosbrook
2019-09-12 14:37                     ` George Dunlap
2019-09-12 17:35                       ` Nicholas Rosbrook
2019-09-13 11:21                         ` George Dunlap
2019-09-13 13:28                           ` Nicholas Rosbrook
2019-09-24  0:33                           ` Nicholas Rosbrook
2019-09-30 14:51                             ` George Dunlap
2019-09-30 18:08                               ` Nicholas Rosbrook
2019-09-04 18:15                 ` Nicholas Rosbrook
2019-08-02 15:55         ` George Dunlap
2019-07-30 16:27 ` George Dunlap

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=76c02038-fcce-2774-c4f5-73ab9e0fdeef@citrix.com \
    --to=george.dunlap@citrix.com \
    --cc=anthony.perard@citrix.com \
    --cc=ian.jackson@eu.citrix.com \
    --cc=kerriganb@ainfosec.com \
    --cc=nicolas.belouin@gandi.net \
    --cc=rosbrookn@ainfosec.com \
    --cc=wl@xen.org \
    --cc=xen-devel@lists.xenproject.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).