tools/ocaml: Re-introduce Xenctrl.with_intf wrapper
authorChristian Lindig <christian.lindig@citrix.com>
Thu, 1 Nov 2018 09:12:53 +0000 (09:12 +0000)
committerIan Jackson <ian.jackson@eu.citrix.com>
Thu, 1 Nov 2018 11:22:54 +0000 (11:22 +0000)
commit6230dde2ed4fa75a35d09c2b0e260d7566b679ce
treed9b8cdae06a00b19dba1767d9c6f6e826f8fd332
parentb72624aad5b00f2f6e976aef4d62eeda83fd0218
tools/ocaml: Re-introduce Xenctrl.with_intf wrapper

Commit 81946a73dc975a7dafe9017a8e61d1e64fdbedbf removed
Xenctrl.with_intf based on its undesirable behaviour of opening and
closing a Xenctrl connection with every invocation. This commit
re-introduces with_intf but with an updated behaviour: it maintains a
global Xenctrl connection which is opened upon first usage and kept
open. This handle can be obtained by clients using new functions
get_handle() and close_handle().

The main motivation of re-introducing with_intf is that otherwise
clients will have to implement this functionality individually.

Signed-off-by: Christian Lindig <christian.lindig@citrix.com>
Reviewed-by: Ian Jackson <ian.jackson@eu.citrix.com>
tools/ocaml/libs/xc/xenctrl.ml
tools/ocaml/libs/xc/xenctrl.mli