summaryrefslogtreecommitdiffstats
path: root/ocaml
diff options
context:
space:
mode:
authorRichard W.M. Jones <rjones@redhat.com>2009-06-29 20:24:47 +0100
committerRichard W.M. Jones <rjones@redhat.com>2009-06-29 20:25:20 +0100
commitda8ddb2745c3d53c36e3ad7f09836a4c27a4d3e6 (patch)
tree5555f9addd140af8cf2b40c9526d1b1837abdd7f /ocaml
parent662617ae725c5e41c24128a037060419fbe4b026 (diff)
downloadlibguestfs-da8ddb2745c3d53c36e3ad7f09836a4c27a4d3e6.tar.gz
libguestfs-da8ddb2745c3d53c36e3ad7f09836a4c27a4d3e6.tar.xz
libguestfs-da8ddb2745c3d53c36e3ad7f09836a4c27a4d3e6.zip
Generated code for the 'mkswap*' commands.
Diffstat (limited to 'ocaml')
-rw-r--r--ocaml/guestfs.ml3
-rw-r--r--ocaml/guestfs.mli9
-rw-r--r--ocaml/guestfs_c_actions.c71
3 files changed, 83 insertions, 0 deletions
diff --git a/ocaml/guestfs.ml b/ocaml/guestfs.ml
index d9b652b7..c64e2576 100644
--- a/ocaml/guestfs.ml
+++ b/ocaml/guestfs.ml
@@ -296,3 +296,6 @@ external df_h : t -> string = "ocaml_guestfs_df_h"
external du : t -> string -> int64 = "ocaml_guestfs_du"
external initrd_list : t -> string -> string array = "ocaml_guestfs_initrd_list"
external mount_loop : t -> string -> string -> unit = "ocaml_guestfs_mount_loop"
+external mkswap : t -> string -> unit = "ocaml_guestfs_mkswap"
+external mkswap_L : t -> string -> string -> unit = "ocaml_guestfs_mkswap_L"
+external mkswap_U : t -> string -> string -> unit = "ocaml_guestfs_mkswap_U"
diff --git a/ocaml/guestfs.mli b/ocaml/guestfs.mli
index 612d0022..dc09056b 100644
--- a/ocaml/guestfs.mli
+++ b/ocaml/guestfs.mli
@@ -667,3 +667,12 @@ val initrd_list : t -> string -> string array
val mount_loop : t -> string -> string -> unit
(** mount a file using the loop device *)
+val mkswap : t -> string -> unit
+(** create a swap partition *)
+
+val mkswap_L : t -> string -> string -> unit
+(** create a swap partition with a label *)
+
+val mkswap_U : t -> string -> string -> unit
+(** create a swap partition with an explicit UUID *)
+
diff --git a/ocaml/guestfs_c_actions.c b/ocaml/guestfs_c_actions.c
index 8b018f6e..3eedbda6 100644
--- a/ocaml/guestfs_c_actions.c
+++ b/ocaml/guestfs_c_actions.c
@@ -4661,3 +4661,74 @@ ocaml_guestfs_mount_loop (value gv, value filev, value mountpointv)
CAMLreturn (rv);
}
+CAMLprim value
+ocaml_guestfs_mkswap (value gv, value devicev)
+{
+ CAMLparam2 (gv, devicev);
+ CAMLlocal1 (rv);
+
+ guestfs_h *g = Guestfs_val (gv);
+ if (g == NULL)
+ caml_failwith ("mkswap: used handle after closing it");
+
+ const char *device = String_val (devicev);
+ int r;
+
+ caml_enter_blocking_section ();
+ r = guestfs_mkswap (g, device);
+ caml_leave_blocking_section ();
+ if (r == -1)
+ ocaml_guestfs_raise_error (g, "mkswap");
+
+ rv = Val_unit;
+ CAMLreturn (rv);
+}
+
+CAMLprim value
+ocaml_guestfs_mkswap_L (value gv, value labelv, value devicev)
+{
+ CAMLparam3 (gv, labelv, devicev);
+ CAMLlocal1 (rv);
+
+ guestfs_h *g = Guestfs_val (gv);
+ if (g == NULL)
+ caml_failwith ("mkswap_L: used handle after closing it");
+
+ const char *label = String_val (labelv);
+ const char *device = String_val (devicev);
+ int r;
+
+ caml_enter_blocking_section ();
+ r = guestfs_mkswap_L (g, label, device);
+ caml_leave_blocking_section ();
+ if (r == -1)
+ ocaml_guestfs_raise_error (g, "mkswap_L");
+
+ rv = Val_unit;
+ CAMLreturn (rv);
+}
+
+CAMLprim value
+ocaml_guestfs_mkswap_U (value gv, value uuidv, value devicev)
+{
+ CAMLparam3 (gv, uuidv, devicev);
+ CAMLlocal1 (rv);
+
+ guestfs_h *g = Guestfs_val (gv);
+ if (g == NULL)
+ caml_failwith ("mkswap_U: used handle after closing it");
+
+ const char *uuid = String_val (uuidv);
+ const char *device = String_val (devicev);
+ int r;
+
+ caml_enter_blocking_section ();
+ r = guestfs_mkswap_U (g, uuid, device);
+ caml_leave_blocking_section ();
+ if (r == -1)
+ ocaml_guestfs_raise_error (g, "mkswap_U");
+
+ rv = Val_unit;
+ CAMLreturn (rv);
+}
+