# HG changeset patch # User Jonathan Knowles # Date 1257936514 0 # Node ID 94ea8c36bab4e6255630e99491f0d0202aea0a88 # Parent 27928d01b164e09574d8ae9f9e173c0f76c4803c Moves low-level functions with_{xal,xc,xs,xc_and_xs,xs_and_xs_final} from the Xapi layer into the Xenops layer, allowing greater reuse. Signed-off-by: Jonathan Knowles diff -r 27928d01b164 -r 94ea8c36bab4 ocaml/xapi/vmopshelpers.ml --- a/ocaml/xapi/vmopshelpers.ml Fri Nov 06 10:59:32 2009 +0000 +++ b/ocaml/xapi/vmopshelpers.ml Wed Nov 11 10:48:34 2009 +0000 @@ -16,22 +16,15 @@ module D = Debug.Debugger(struct let name="xapi" end) open D -(* xc and xs opening/cleaning interface helpers *) -let with_xc f = Xc.with_intf f +(** {2 XC, XS and XAL interface helpers.} *) -let with_xs f = - let xs = Xs.daemon_open () in - finally (fun () -> f xs) (fun () -> Xs.close xs) +open Xenops_helpers -let with_xal f = - let xal = Xal.init () in - finally (fun () -> f xal) (fun () -> Xal.close xal) - -let with_xc_and_xs f = - Xc.with_intf (fun xc -> with_xs (fun xs -> f xc xs)) - -let with_xc_and_xs_final f cf = - with_xc_and_xs (fun xc xs -> finally (fun () -> f xc xs) cf) +let with_xc = with_xc +let with_xs = with_xs +let with_xal = with_xal +let with_xc_and_xs = with_xc_and_xs +let with_xc_and_xs_final = with_xc_and_xs_final exception Vm_corresponding_to_domid_not_in_db of int let uuid_of_domid domid = diff -r 27928d01b164 -r 94ea8c36bab4 ocaml/xenops/OMakefile --- a/ocaml/xenops/OMakefile Fri Nov 06 10:59:32 2009 +0000 +++ b/ocaml/xenops/OMakefile Wed Nov 11 10:48:34 2009 +0000 @@ -7,7 +7,7 @@ OCAMLPACKS = threads xc xs stdext log OCAMLFLAGS += -thread -LIBFILES = xenbus balloon xenguestHelper domain hotplug device io statdev xal netman memory watch device_common squeeze squeeze_xen squeezed_rpc squeezed_state squeezed_rpc +LIBFILES = xenops_helpers xenbus balloon xenguestHelper domain hotplug device io statdev xal netman memory watch device_common squeeze squeeze_xen squeezed_rpc squeezed_state squeezed_rpc StaticCLibrary(statdev_stubs, statdev_stubs) OCamlLibraryClib(xenops, $(LIBFILES), statdev_stubs)