| 
         
xen-api
[Xen-API] 	[PATCH 1 of 3] Moves low-level functions with_{xal, xc, xs,	x
 
# HG changeset patch
# User Jonathan Knowles <jonathan.knowles@xxxxxxxxxxxxx>
# Date 1257937321 0
# Node ID 79497a2093dd6f376b1fc58b8c1fd192ede1470f
# 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 <jonathan.knowles@xxxxxxxxxxxxx>
diff -r 27928d01b164 -r 79497a2093dd 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 11:02:01 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 79497a2093dd ocaml/xenops/OMakefile
--- a/ocaml/xenops/OMakefile    Fri Nov 06 10:59:32 2009 +0000
+++ b/ocaml/xenops/OMakefile    Wed Nov 11 11:02:01 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)
diff -r 27928d01b164 -r 79497a2093dd ocaml/xenops/xenops_helpers.ml
--- /dev/null   Thu Jan 01 00:00:00 1970 +0000
+++ b/ocaml/xenops/xenops_helpers.ml    Wed Nov 11 11:02:01 2009 +0000
@@ -0,0 +1,32 @@
+(*
+ * Copyright (C) 2006-2009 Citrix Systems Inc.
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License as published
+ * by the Free Software Foundation; version 2.1 only. with the special
+ * exception on linking described in file LICENSE.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU Lesser General Public License for more details.
+ *)
+open Pervasiveext
+
+(** {2 XC, XS and XAL interface helpers.} *)
+
+let with_xc f = Xc.with_intf f
+
+let with_xs f =
+       let xs = Xs.daemon_open () in
+       finally (fun () -> f xs) (fun () -> Xs.close xs)
+
+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)
3 files changed, 40 insertions(+), 15 deletions(-)
ocaml/xapi/vmopshelpers.ml     |   21 +++++++--------------
ocaml/xenops/OMakefile         |    2 +-
ocaml/xenops/xenops_helpers.ml |   32 ++++++++++++++++++++++++++++++++
 
xen-api.hg-3.patch 
Description: Text Data 
_______________________________________________
xen-api mailing list
xen-api@xxxxxxxxxxxxxxxxxxx
http://lists.xensource.com/mailman/listinfo/xen-api
 
 |   
 
| <Prev in Thread] | 
Current Thread | 
[Next in Thread>
 |  
- [Xen-API] [PATCH 0 of 3] Adds a command-line utility	'memory-breakdown' which	displays a detailed breakdown of host and guest memory usage	(resending), Jonathan Knowles
- [Xen-API] 	[PATCH 1 of 3] 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,
Jonathan Knowles <=
 
- [Xen-API] [PATCH 2 of 3] Removes duplicate definitions of functions	(with_{xal, 	xc, xs, xc_and_xs, xs_and_xs_final}) from the Xenops layer, Jonathan Knowles
 
- [Xen-API] [PATCH 3 of 3] Adds a command-line utility	"memory-breakdown" which	displays a detailed breakdown of host and guest memory usage, Jonathan Knowles
 
 
 
 
 |  
  
| Previous by Date:  | 
[Xen-API] [PATCH 0 of 3] Adds a command-line utility	'memory-breakdown' which	displays a detailed breakdown of host and guest memory usage	(resending), Jonathan Knowles | 
 
| Next by Date:  | 
[Xen-API] [PATCH 2 of 3] Removes duplicate definitions of functions	(with_{xal, 	xc, xs, xc_and_xs, xs_and_xs_final}) from the Xenops layer, Jonathan Knowles | 
 
| Previous by Thread:  | 
[Xen-API] [PATCH 0 of 3] Adds a command-line utility	'memory-breakdown' which	displays a detailed breakdown of host and guest memory usage	(resending), Jonathan Knowles | 
 
| Next by Thread:  | 
[Xen-API] [PATCH 2 of 3] Removes duplicate definitions of functions	(with_{xal, 	xc, xs, xc_and_xs, xs_and_xs_final}) from the Xenops layer, Jonathan Knowles | 
 
| Indexes:  | 
[Date]
[Thread]
[Top]
[All Lists] | 
 
 
 
 | 
    |