Generated code for grub-install command.
[libguestfs.git] / ocaml / guestfs_c_actions.c
index 73515cf..0656e72 100644 (file)
@@ -1744,7 +1744,7 @@ ocaml_guestfs_vgcreate (value gv, value volgroupv, value physvolsv)
     caml_failwith ("vgcreate: used handle after closing it");
 
   const char *volgroup = String_val (volgroupv);
-  char **physvols = ocaml_guestfs_strings_val (physvolsv);
+  char **physvols = ocaml_guestfs_strings_val (g, physvolsv);
   int r;
 
   caml_enter_blocking_section ();
@@ -1822,7 +1822,7 @@ ocaml_guestfs_sfdisk (value gv, value devicev, value cylsv, value headsv, value
   int cyls = Int_val (cylsv);
   int heads = Int_val (headsv);
   int sectors = Int_val (sectorsv);
-  char **lines = ocaml_guestfs_strings_val (linesv);
+  char **lines = ocaml_guestfs_strings_val (g, linesv);
   int r;
 
   caml_enter_blocking_section ();
@@ -1993,7 +1993,7 @@ ocaml_guestfs_command (value gv, value argumentsv)
   if (g == NULL)
     caml_failwith ("command: used handle after closing it");
 
-  char **arguments = ocaml_guestfs_strings_val (argumentsv);
+  char **arguments = ocaml_guestfs_strings_val (g, argumentsv);
   char *r;
 
   caml_enter_blocking_section ();
@@ -2018,7 +2018,7 @@ ocaml_guestfs_command_lines (value gv, value argumentsv)
   if (g == NULL)
     caml_failwith ("command_lines: used handle after closing it");
 
-  char **arguments = ocaml_guestfs_strings_val (argumentsv);
+  char **arguments = ocaml_guestfs_strings_val (g, argumentsv);
   int i;
   char **r;
 
@@ -2619,7 +2619,7 @@ ocaml_guestfs_debug (value gv, value subcmdv, value extraargsv)
     caml_failwith ("debug: used handle after closing it");
 
   const char *subcmd = String_val (subcmdv);
-  char **extraargs = ocaml_guestfs_strings_val (extraargsv);
+  char **extraargs = ocaml_guestfs_strings_val (g, extraargsv);
   char *r;
 
   caml_enter_blocking_section ();
@@ -2703,3 +2703,170 @@ ocaml_guestfs_pvremove (value gv, value devicev)
   CAMLreturn (rv);
 }
 
+CAMLprim value
+ocaml_guestfs_set_e2label (value gv, value devicev, value labelv)
+{
+  CAMLparam3 (gv, devicev, labelv);
+  CAMLlocal1 (rv);
+
+  guestfs_h *g = Guestfs_val (gv);
+  if (g == NULL)
+    caml_failwith ("set_e2label: used handle after closing it");
+
+  const char *device = String_val (devicev);
+  const char *label = String_val (labelv);
+  int r;
+
+  caml_enter_blocking_section ();
+  r = guestfs_set_e2label (g, device, label);
+  caml_leave_blocking_section ();
+  if (r == -1)
+    ocaml_guestfs_raise_error (g, "set_e2label");
+
+  rv = Val_unit;
+  CAMLreturn (rv);
+}
+
+CAMLprim value
+ocaml_guestfs_get_e2label (value gv, value devicev)
+{
+  CAMLparam2 (gv, devicev);
+  CAMLlocal1 (rv);
+
+  guestfs_h *g = Guestfs_val (gv);
+  if (g == NULL)
+    caml_failwith ("get_e2label: used handle after closing it");
+
+  const char *device = String_val (devicev);
+  char *r;
+
+  caml_enter_blocking_section ();
+  r = guestfs_get_e2label (g, device);
+  caml_leave_blocking_section ();
+  if (r == NULL)
+    ocaml_guestfs_raise_error (g, "get_e2label");
+
+  rv = caml_copy_string (r);
+  free (r);
+  CAMLreturn (rv);
+}
+
+CAMLprim value
+ocaml_guestfs_set_e2uuid (value gv, value devicev, value uuidv)
+{
+  CAMLparam3 (gv, devicev, uuidv);
+  CAMLlocal1 (rv);
+
+  guestfs_h *g = Guestfs_val (gv);
+  if (g == NULL)
+    caml_failwith ("set_e2uuid: used handle after closing it");
+
+  const char *device = String_val (devicev);
+  const char *uuid = String_val (uuidv);
+  int r;
+
+  caml_enter_blocking_section ();
+  r = guestfs_set_e2uuid (g, device, uuid);
+  caml_leave_blocking_section ();
+  if (r == -1)
+    ocaml_guestfs_raise_error (g, "set_e2uuid");
+
+  rv = Val_unit;
+  CAMLreturn (rv);
+}
+
+CAMLprim value
+ocaml_guestfs_get_e2uuid (value gv, value devicev)
+{
+  CAMLparam2 (gv, devicev);
+  CAMLlocal1 (rv);
+
+  guestfs_h *g = Guestfs_val (gv);
+  if (g == NULL)
+    caml_failwith ("get_e2uuid: used handle after closing it");
+
+  const char *device = String_val (devicev);
+  char *r;
+
+  caml_enter_blocking_section ();
+  r = guestfs_get_e2uuid (g, device);
+  caml_leave_blocking_section ();
+  if (r == NULL)
+    ocaml_guestfs_raise_error (g, "get_e2uuid");
+
+  rv = caml_copy_string (r);
+  free (r);
+  CAMLreturn (rv);
+}
+
+CAMLprim value
+ocaml_guestfs_fsck (value gv, value fstypev, value devicev)
+{
+  CAMLparam3 (gv, fstypev, devicev);
+  CAMLlocal1 (rv);
+
+  guestfs_h *g = Guestfs_val (gv);
+  if (g == NULL)
+    caml_failwith ("fsck: used handle after closing it");
+
+  const char *fstype = String_val (fstypev);
+  const char *device = String_val (devicev);
+  int r;
+
+  caml_enter_blocking_section ();
+  r = guestfs_fsck (g, fstype, device);
+  caml_leave_blocking_section ();
+  if (r == -1)
+    ocaml_guestfs_raise_error (g, "fsck");
+
+  rv = Val_int (r);
+  CAMLreturn (rv);
+}
+
+CAMLprim value
+ocaml_guestfs_zero (value gv, value devicev)
+{
+  CAMLparam2 (gv, devicev);
+  CAMLlocal1 (rv);
+
+  guestfs_h *g = Guestfs_val (gv);
+  if (g == NULL)
+    caml_failwith ("zero: used handle after closing it");
+
+  const char *device = String_val (devicev);
+  int r;
+
+  caml_enter_blocking_section ();
+  r = guestfs_zero (g, device);
+  caml_leave_blocking_section ();
+  if (r == -1)
+    ocaml_guestfs_raise_error (g, "zero");
+
+  rv = Val_unit;
+  CAMLreturn (rv);
+}
+
+CAMLprim value
+ocaml_guestfs_grub_install (value gv, value rootv, value devicev)
+{
+  CAMLparam3 (gv, rootv, devicev);
+  CAMLlocal1 (rv);
+
+  guestfs_h *g = Guestfs_val (gv);
+  if (g == NULL)
+    caml_failwith ("grub_install: used handle after closing it");
+
+  const char *root = String_val (rootv);
+  const char *device = String_val (devicev);
+  int r;
+
+  caml_enter_blocking_section ();
+  r = guestfs_grub_install (g, root, device);
+  caml_leave_blocking_section ();
+  if (r == -1)
+    ocaml_guestfs_raise_error (g, "grub_install");
+
+  rv = Val_unit;
+  CAMLreturn (rv);
+}
+