Don't echo output in scripts.
[libguestfs.git] / ocaml / guestfs_c_actions.c
index acf8f92..73515cf 100644 (file)
@@ -2608,3 +2608,98 @@ ocaml_guestfs_mount_vfs (value gv, value optionsv, value vfstypev, value devicev
   CAMLreturn (rv);
 }
 
+CAMLprim value
+ocaml_guestfs_debug (value gv, value subcmdv, value extraargsv)
+{
+  CAMLparam3 (gv, subcmdv, extraargsv);
+  CAMLlocal1 (rv);
+
+  guestfs_h *g = Guestfs_val (gv);
+  if (g == NULL)
+    caml_failwith ("debug: used handle after closing it");
+
+  const char *subcmd = String_val (subcmdv);
+  char **extraargs = ocaml_guestfs_strings_val (extraargsv);
+  char *r;
+
+  caml_enter_blocking_section ();
+  r = guestfs_debug (g, subcmd, extraargs);
+  caml_leave_blocking_section ();
+  ocaml_guestfs_free_strings (extraargs);
+  if (r == NULL)
+    ocaml_guestfs_raise_error (g, "debug");
+
+  rv = caml_copy_string (r);
+  free (r);
+  CAMLreturn (rv);
+}
+
+CAMLprim value
+ocaml_guestfs_lvremove (value gv, value devicev)
+{
+  CAMLparam2 (gv, devicev);
+  CAMLlocal1 (rv);
+
+  guestfs_h *g = Guestfs_val (gv);
+  if (g == NULL)
+    caml_failwith ("lvremove: used handle after closing it");
+
+  const char *device = String_val (devicev);
+  int r;
+
+  caml_enter_blocking_section ();
+  r = guestfs_lvremove (g, device);
+  caml_leave_blocking_section ();
+  if (r == -1)
+    ocaml_guestfs_raise_error (g, "lvremove");
+
+  rv = Val_unit;
+  CAMLreturn (rv);
+}
+
+CAMLprim value
+ocaml_guestfs_vgremove (value gv, value vgnamev)
+{
+  CAMLparam2 (gv, vgnamev);
+  CAMLlocal1 (rv);
+
+  guestfs_h *g = Guestfs_val (gv);
+  if (g == NULL)
+    caml_failwith ("vgremove: used handle after closing it");
+
+  const char *vgname = String_val (vgnamev);
+  int r;
+
+  caml_enter_blocking_section ();
+  r = guestfs_vgremove (g, vgname);
+  caml_leave_blocking_section ();
+  if (r == -1)
+    ocaml_guestfs_raise_error (g, "vgremove");
+
+  rv = Val_unit;
+  CAMLreturn (rv);
+}
+
+CAMLprim value
+ocaml_guestfs_pvremove (value gv, value devicev)
+{
+  CAMLparam2 (gv, devicev);
+  CAMLlocal1 (rv);
+
+  guestfs_h *g = Guestfs_val (gv);
+  if (g == NULL)
+    caml_failwith ("pvremove: used handle after closing it");
+
+  const char *device = String_val (devicev);
+  int r;
+
+  caml_enter_blocking_section ();
+  r = guestfs_pvremove (g, device);
+  caml_leave_blocking_section ();
+  if (r == -1)
+    ocaml_guestfs_raise_error (g, "pvremove");
+
+  rv = Val_unit;
+  CAMLreturn (rv);
+}
+