From: Ian Campbell <ian.campbell@citrix.com>
To: Olaf Hering <olaf@aepfle.de>
Cc: xen-devel@lists.xen.org
Subject: Re: ocaml libxl bindings and KeyedUnion
Date: Fri, 20 Mar 2015 09:25:39 +0000 [thread overview]
Message-ID: <1426843539.21742.92.camel@citrix.com> (raw)
In-Reply-To: <20150320081027.GA20008@aepfle.de>
On Fri, 2015-03-20 at 09:10 +0100, Olaf Hering wrote:
> Some change commited to staging earlier this week breaks ocaml bindings,
> as shown below. I think it was introduced between
> a68d1b65bb1bbb9b8db2d82695d32ac09c52a2d7..d4ea77c9d7b314001ff4e2eb7618b45f11551371:
>
> NotImplementedError: Cannot handle KeyedUnion fields which are not Structs
I don't see anything in that range which I would expect to cause
anything like this so...
> But now that I look at it, may it be my pvscsi change by any chance?
> https://github.com/olafhering/xen/commit/f0de53755f628efe64cd60d4511a9667485eba62
... yes, probably. Although surely it would have been easier for you to
confirm this yourself than asking everyone to speculate, especially if
you are going to start your mail blaming something in staging.
> diff --git a/tools/libxl/libxl_types.idl b/tools/libxl/libxl_types.idl
> index 48cd9af..2bd050d 100644
> --- a/tools/libxl/libxl_types.idl
> +++ b/tools/libxl/libxl_types.idl
> @@ -556,12 +556,21 @@ libxl_vscsi_hctl = Struct("vscsi_hctl", [
> ("lun", uint32),
> ])
>
> +libxl_vscsi_pdev = Struct("vscsi_pdev", [
> + ("p_devname", string),
> + ("u", KeyedUnion(None, libxl_vscsi_pdev_type, "type",
> + [
> + ("invalid", None),
> + ("dev", libxl_vscsi_hctl),
> + ("wwn", string),
> + ("hctl", libxl_vscsi_hctl),
Following the other examples in libxl_types.idl this would need to be
something like:
("invalid", None),
("dev", Struct(None, [(libxl_vscsi_hctl, "dev")])),
("wwn", Struct(None, [(string, "wwn")])),
("hctl", Struct(None, [(libxl_vscsi_hctl, "hctl")])),
^(*) ^(**)
Or you could teach the IDL machinery and code generators about
non-struct members of keyed unions but a) that will be a lot of faff and
b) it will make it hard to extend any one of the members in the future.
The name at (*) must be the enum member, which I've duplicated at (**)
but you might like to thing about whether (**) would have a better name
in the context of e.g. vscsi_dev->u.dev.dev or vscsi_dev->u.wwn.wwn.
Aside: What is the difference between dev and hctl in this context?
Ian.
next prev parent reply other threads:[~2015-03-20 9:25 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-03-20 8:10 ocaml libxl bindings and KeyedUnion Olaf Hering
2015-03-20 9:25 ` Ian Campbell [this message]
2015-03-20 16:44 ` Olaf Hering
2015-03-20 17:01 ` Ian Campbell
2015-03-24 12:18 ` Olaf Hering
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=1426843539.21742.92.camel@citrix.com \
--to=ian.campbell@citrix.com \
--cc=olaf@aepfle.de \
--cc=xen-devel@lists.xen.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.