From mboxrd@z Thu Jan 1 00:00:00 1970 From: Olaf Hering Subject: Re: ocaml libxl bindings and KeyedUnion Date: Fri, 20 Mar 2015 17:44:17 +0100 Message-ID: <20150320164417.GA23886@aepfle.de> References: <20150320081027.GA20008@aepfle.de> <1426843539.21742.92.camel@citrix.com> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Return-path: Content-Disposition: inline In-Reply-To: <1426843539.21742.92.camel@citrix.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: Ian Campbell Cc: xen-devel@lists.xen.org List-Id: xen-devel@lists.xenproject.org On Fri, Mar 20, Ian Campbell wrote: > 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. Thanks Ian. For some reason I have ocaml disabled on my workstation. I made this change: +++ b/tools/libxl/libxl_types.idl @@ -571,9 +571,9 @@ libxl_vscsi_pdev = Struct("vscsi_pdev", [ ("u", KeyedUnion(None, libxl_vscsi_pdev_type, "type", [ ("invalid", None), - ("dev", libxl_vscsi_hctl), - ("wwn", string), - ("hctl", libxl_vscsi_hctl), + ("dev", Struct(None, [("m", libxl_vscsi_hctl)])), + ("wwn", Struct(None, [("m", string)])), + ("hctl", Struct(None, [("m", libxl_vscsi_hctl)])), ])), ]) > Aside: What is the difference between dev and hctl in this context? Its supposed to represent either "/dev/something" and "h:ct:l". The result in the "p-dev" property, which is used by the backend, is the same. But translating "p-dev" back into the config string for the scsi-list command needs some way to represent that. I'm not fully happy with the current way. Perhaps the code should just reuse the "p-devname" property to tell what was in the config file. Olaf