Add support for zerofree command.
[libguestfs.git] / ocaml / guestfs_c_actions.c
index a707897..79a5c16 100644 (file)
@@ -556,6 +556,51 @@ ocaml_guestfs_get_path (value gv)
 }
 
 CAMLprim value
+ocaml_guestfs_set_append (value gv, value appendv)
+{
+  CAMLparam2 (gv, appendv);
+  CAMLlocal1 (rv);
+
+  guestfs_h *g = Guestfs_val (gv);
+  if (g == NULL)
+    caml_failwith ("set_append: used handle after closing it");
+
+  const char *append = String_val (appendv);
+  int r;
+
+  caml_enter_blocking_section ();
+  r = guestfs_set_append (g, append);
+  caml_leave_blocking_section ();
+  if (r == -1)
+    ocaml_guestfs_raise_error (g, "set_append");
+
+  rv = Val_unit;
+  CAMLreturn (rv);
+}
+
+CAMLprim value
+ocaml_guestfs_get_append (value gv)
+{
+  CAMLparam1 (gv);
+  CAMLlocal1 (rv);
+
+  guestfs_h *g = Guestfs_val (gv);
+  if (g == NULL)
+    caml_failwith ("get_append: used handle after closing it");
+
+  const char *r;
+
+  caml_enter_blocking_section ();
+  r = guestfs_get_append (g);
+  caml_leave_blocking_section ();
+  if (r == NULL)
+    ocaml_guestfs_raise_error (g, "get_append");
+
+  rv = caml_copy_string (r);
+  CAMLreturn (rv);
+}
+
+CAMLprim value
 ocaml_guestfs_set_autosync (value gv, value autosyncv)
 {
   CAMLparam2 (gv, autosyncv);
@@ -800,6 +845,28 @@ ocaml_guestfs_set_ready (value gv)
 }
 
 CAMLprim value
+ocaml_guestfs_end_busy (value gv)
+{
+  CAMLparam1 (gv);
+  CAMLlocal1 (rv);
+
+  guestfs_h *g = Guestfs_val (gv);
+  if (g == NULL)
+    caml_failwith ("end_busy: used handle after closing it");
+
+  int r;
+
+  caml_enter_blocking_section ();
+  r = guestfs_end_busy (g);
+  caml_leave_blocking_section ();
+  if (r == -1)
+    ocaml_guestfs_raise_error (g, "end_busy");
+
+  rv = Val_unit;
+  CAMLreturn (rv);
+}
+
+CAMLprim value
 ocaml_guestfs_mount (value gv, value devicev, value mountpointv)
 {
   CAMLparam3 (gv, devicev, mountpointv);
@@ -3111,3 +3178,26 @@ ocaml_guestfs_hexdump (value gv, value pathv)
   CAMLreturn (rv);
 }
 
+CAMLprim value
+ocaml_guestfs_zerofree (value gv, value devicev)
+{
+  CAMLparam2 (gv, devicev);
+  CAMLlocal1 (rv);
+
+  guestfs_h *g = Guestfs_val (gv);
+  if (g == NULL)
+    caml_failwith ("zerofree: used handle after closing it");
+
+  const char *device = String_val (devicev);
+  int r;
+
+  caml_enter_blocking_section ();
+  r = guestfs_zerofree (g, device);
+  caml_leave_blocking_section ();
+  if (r == -1)
+    ocaml_guestfs_raise_error (g, "zerofree");
+
+  rv = Val_unit;
+  CAMLreturn (rv);
+}
+