+ CAMLparam2 (gv, directoryv);
+ CAMLlocal1 (rv);
+
+ guestfs_h *g = Guestfs_val (gv);
+ if (g == NULL)
+ caml_failwith ("ls: used handle after closing it");
+
+ const char *directory = String_val (directoryv);
+ int i;
+ char **r;
+
+ caml_enter_blocking_section ();
+ r = guestfs_ls (g, directory);
+ caml_leave_blocking_section ();
+ if (r == NULL)
+ ocaml_guestfs_raise_error (g, "ls");
+
+ rv = caml_copy_string_array ((const char **) r);
+ for (i = 0; r[i] != NULL; ++i) free (r[i]);
+ free (r);
+ CAMLreturn (rv);
+}
+
+CAMLprim value
+ocaml_guestfs_list_devices (value gv)
+{
+ CAMLparam1 (gv);
+ CAMLlocal1 (rv);
+
+ guestfs_h *g = Guestfs_val (gv);
+ if (g == NULL)
+ caml_failwith ("list_devices: used handle after closing it");
+
+ int i;
+ char **r;
+
+ caml_enter_blocking_section ();
+ r = guestfs_list_devices (g);
+ caml_leave_blocking_section ();
+ if (r == NULL)
+ ocaml_guestfs_raise_error (g, "list_devices");
+
+ rv = caml_copy_string_array ((const char **) r);
+ for (i = 0; r[i] != NULL; ++i) free (r[i]);
+ free (r);
+ CAMLreturn (rv);
+}
+
+CAMLprim value
+ocaml_guestfs_list_partitions (value gv)
+{
+ CAMLparam1 (gv);
+ CAMLlocal1 (rv);
+
+ guestfs_h *g = Guestfs_val (gv);
+ if (g == NULL)
+ caml_failwith ("list_partitions: used handle after closing it");
+
+ int i;
+ char **r;
+
+ caml_enter_blocking_section ();
+ r = guestfs_list_partitions (g);
+ caml_leave_blocking_section ();
+ if (r == NULL)
+ ocaml_guestfs_raise_error (g, "list_partitions");
+
+ rv = caml_copy_string_array ((const char **) r);
+ for (i = 0; r[i] != NULL; ++i) free (r[i]);
+ free (r);
+ CAMLreturn (rv);
+}
+
+CAMLprim value
+ocaml_guestfs_pvs (value gv)
+{
+ CAMLparam1 (gv);
+ CAMLlocal1 (rv);
+
+ guestfs_h *g = Guestfs_val (gv);
+ if (g == NULL)
+ caml_failwith ("pvs: used handle after closing it");
+
+ int i;
+ char **r;
+
+ caml_enter_blocking_section ();
+ r = guestfs_pvs (g);
+ caml_leave_blocking_section ();
+ if (r == NULL)
+ ocaml_guestfs_raise_error (g, "pvs");
+
+ rv = caml_copy_string_array ((const char **) r);
+ for (i = 0; r[i] != NULL; ++i) free (r[i]);
+ free (r);
+ CAMLreturn (rv);
+}
+
+CAMLprim value
+ocaml_guestfs_vgs (value gv)
+{
+ CAMLparam1 (gv);
+ CAMLlocal1 (rv);
+
+ guestfs_h *g = Guestfs_val (gv);
+ if (g == NULL)
+ caml_failwith ("vgs: used handle after closing it");
+
+ int i;
+ char **r;
+
+ caml_enter_blocking_section ();
+ r = guestfs_vgs (g);
+ caml_leave_blocking_section ();
+ if (r == NULL)
+ ocaml_guestfs_raise_error (g, "vgs");
+
+ rv = caml_copy_string_array ((const char **) r);
+ for (i = 0; r[i] != NULL; ++i) free (r[i]);
+ free (r);
+ CAMLreturn (rv);
+}
+
+CAMLprim value
+ocaml_guestfs_lvs (value gv)
+{
+ CAMLparam1 (gv);
+ CAMLlocal1 (rv);
+
+ guestfs_h *g = Guestfs_val (gv);
+ if (g == NULL)
+ caml_failwith ("lvs: used handle after closing it");
+
+ int i;
+ char **r;
+
+ caml_enter_blocking_section ();
+ r = guestfs_lvs (g);
+ caml_leave_blocking_section ();
+ if (r == NULL)
+ ocaml_guestfs_raise_error (g, "lvs");
+
+ rv = caml_copy_string_array ((const char **) r);
+ for (i = 0; r[i] != NULL; ++i) free (r[i]);
+ free (r);
+ CAMLreturn (rv);
+}
+
+CAMLprim value
+ocaml_guestfs_pvs_full (value gv)
+{
+ CAMLparam1 (gv);
+ CAMLlocal1 (rv);
+
+ guestfs_h *g = Guestfs_val (gv);
+ if (g == NULL)
+ caml_failwith ("pvs_full: used handle after closing it");
+
+ struct guestfs_lvm_pv_list *r;
+
+ caml_enter_blocking_section ();
+ r = guestfs_pvs_full (g);
+ caml_leave_blocking_section ();
+ if (r == NULL)
+ ocaml_guestfs_raise_error (g, "pvs_full");
+
+ rv = copy_lvm_pv_list (r);
+ guestfs_free_lvm_pv_list (r);
+ CAMLreturn (rv);
+}
+
+CAMLprim value
+ocaml_guestfs_vgs_full (value gv)
+{
+ CAMLparam1 (gv);
+ CAMLlocal1 (rv);
+
+ guestfs_h *g = Guestfs_val (gv);
+ if (g == NULL)
+ caml_failwith ("vgs_full: used handle after closing it");
+
+ struct guestfs_lvm_vg_list *r;
+
+ caml_enter_blocking_section ();
+ r = guestfs_vgs_full (g);
+ caml_leave_blocking_section ();
+ if (r == NULL)
+ ocaml_guestfs_raise_error (g, "vgs_full");
+
+ rv = copy_lvm_vg_list (r);
+ guestfs_free_lvm_vg_list (r);
+ CAMLreturn (rv);
+}
+
+CAMLprim value
+ocaml_guestfs_lvs_full (value gv)
+{
+ CAMLparam1 (gv);
+ CAMLlocal1 (rv);
+
+ guestfs_h *g = Guestfs_val (gv);
+ if (g == NULL)
+ caml_failwith ("lvs_full: used handle after closing it");
+
+ struct guestfs_lvm_lv_list *r;
+
+ caml_enter_blocking_section ();
+ r = guestfs_lvs_full (g);
+ caml_leave_blocking_section ();
+ if (r == NULL)
+ ocaml_guestfs_raise_error (g, "lvs_full");
+
+ rv = copy_lvm_lv_list (r);
+ guestfs_free_lvm_lv_list (r);
+ CAMLreturn (rv);
+}
+
+CAMLprim value
+ocaml_guestfs_read_lines (value gv, value pathv)
+{
+ CAMLparam2 (gv, pathv);
+ CAMLlocal1 (rv);
+
+ guestfs_h *g = Guestfs_val (gv);
+ if (g == NULL)
+ caml_failwith ("read_lines: used handle after closing it");
+
+ const char *path = String_val (pathv);
+ int i;
+ char **r;
+
+ caml_enter_blocking_section ();
+ r = guestfs_read_lines (g, path);
+ caml_leave_blocking_section ();
+ if (r == NULL)
+ ocaml_guestfs_raise_error (g, "read_lines");
+
+ rv = caml_copy_string_array ((const char **) r);
+ for (i = 0; r[i] != NULL; ++i) free (r[i]);
+ free (r);
+ CAMLreturn (rv);
+}
+
+CAMLprim value
+ocaml_guestfs_aug_init (value gv, value rootv, value flagsv)
+{
+ CAMLparam3 (gv, rootv, flagsv);
+ CAMLlocal1 (rv);
+
+ guestfs_h *g = Guestfs_val (gv);
+ if (g == NULL)
+ caml_failwith ("aug_init: used handle after closing it");
+
+ const char *root = String_val (rootv);
+ int flags = Int_val (flagsv);
+ int r;
+
+ caml_enter_blocking_section ();
+ r = guestfs_aug_init (g, root, flags);
+ caml_leave_blocking_section ();
+ if (r == -1)
+ ocaml_guestfs_raise_error (g, "aug_init");
+
+ rv = Val_unit;
+ CAMLreturn (rv);
+}
+
+CAMLprim value
+ocaml_guestfs_aug_close (value gv)
+{
+ CAMLparam1 (gv);
+ CAMLlocal1 (rv);
+
+ guestfs_h *g = Guestfs_val (gv);
+ if (g == NULL)
+ caml_failwith ("aug_close: used handle after closing it");
+
+ int r;
+
+ caml_enter_blocking_section ();
+ r = guestfs_aug_close (g);
+ caml_leave_blocking_section ();
+ if (r == -1)
+ ocaml_guestfs_raise_error (g, "aug_close");
+
+ rv = Val_unit;
+ CAMLreturn (rv);
+}
+
+CAMLprim value
+ocaml_guestfs_aug_defvar (value gv, value namev, value exprv)
+{
+ CAMLparam3 (gv, namev, exprv);
+ CAMLlocal1 (rv);
+
+ guestfs_h *g = Guestfs_val (gv);
+ if (g == NULL)
+ caml_failwith ("aug_defvar: used handle after closing it");
+
+ const char *name = String_val (namev);
+ const char *expr =
+ exprv != Val_int (0) ? String_val (Field (exprv, 0)) : NULL;
+ int r;
+
+ caml_enter_blocking_section ();
+ r = guestfs_aug_defvar (g, name, expr);
+ caml_leave_blocking_section ();
+ if (r == -1)
+ ocaml_guestfs_raise_error (g, "aug_defvar");
+
+ rv = Val_int (r);
+ CAMLreturn (rv);
+}
+
+CAMLprim value
+ocaml_guestfs_aug_defnode (value gv, value namev, value exprv, value valv)
+{
+ CAMLparam4 (gv, namev, exprv, valv);
+ CAMLlocal1 (rv);
+
+ guestfs_h *g = Guestfs_val (gv);
+ if (g == NULL)
+ caml_failwith ("aug_defnode: used handle after closing it");
+
+ const char *name = String_val (namev);
+ const char *expr = String_val (exprv);
+ const char *val = String_val (valv);
+ struct guestfs_int_bool *r;
+
+ caml_enter_blocking_section ();
+ r = guestfs_aug_defnode (g, name, expr, val);
+ caml_leave_blocking_section ();
+ if (r == NULL)
+ ocaml_guestfs_raise_error (g, "aug_defnode");
+
+ rv = caml_alloc (2, 0);
+ Store_field (rv, 0, Val_int (r->i));
+ Store_field (rv, 1, Val_bool (r->b));
+ guestfs_free_int_bool (r);
+ CAMLreturn (rv);
+}
+
+CAMLprim value
+ocaml_guestfs_aug_get (value gv, value pathv)
+{
+ CAMLparam2 (gv, pathv);
+ CAMLlocal1 (rv);
+
+ guestfs_h *g = Guestfs_val (gv);
+ if (g == NULL)
+ caml_failwith ("aug_get: used handle after closing it");
+
+ const char *path = String_val (pathv);
+ char *r;
+
+ caml_enter_blocking_section ();
+ r = guestfs_aug_get (g, path);
+ caml_leave_blocking_section ();
+ if (r == NULL)
+ ocaml_guestfs_raise_error (g, "aug_get");
+
+ rv = caml_copy_string (r);
+ free (r);
+ CAMLreturn (rv);
+}
+
+CAMLprim value
+ocaml_guestfs_aug_set (value gv, value pathv, value valv)
+{
+ CAMLparam3 (gv, pathv, valv);
+ CAMLlocal1 (rv);
+
+ guestfs_h *g = Guestfs_val (gv);
+ if (g == NULL)
+ caml_failwith ("aug_set: used handle after closing it");
+
+ const char *path = String_val (pathv);
+ const char *val = String_val (valv);
+ int r;
+
+ caml_enter_blocking_section ();
+ r = guestfs_aug_set (g, path, val);
+ caml_leave_blocking_section ();
+ if (r == -1)
+ ocaml_guestfs_raise_error (g, "aug_set");
+
+ rv = Val_unit;
+ CAMLreturn (rv);
+}
+
+CAMLprim value
+ocaml_guestfs_aug_insert (value gv, value pathv, value labelv, value beforev)
+{
+ CAMLparam4 (gv, pathv, labelv, beforev);
+ CAMLlocal1 (rv);
+
+ guestfs_h *g = Guestfs_val (gv);
+ if (g == NULL)
+ caml_failwith ("aug_insert: used handle after closing it");
+
+ const char *path = String_val (pathv);
+ const char *label = String_val (labelv);
+ int before = Bool_val (beforev);
+ int r;
+
+ caml_enter_blocking_section ();
+ r = guestfs_aug_insert (g, path, label, before);
+ caml_leave_blocking_section ();
+ if (r == -1)
+ ocaml_guestfs_raise_error (g, "aug_insert");
+
+ rv = Val_unit;
+ CAMLreturn (rv);
+}
+
+CAMLprim value
+ocaml_guestfs_aug_rm (value gv, value pathv)
+{
+ CAMLparam2 (gv, pathv);
+ CAMLlocal1 (rv);
+
+ guestfs_h *g = Guestfs_val (gv);
+ if (g == NULL)
+ caml_failwith ("aug_rm: used handle after closing it");
+
+ const char *path = String_val (pathv);
+ int r;
+
+ caml_enter_blocking_section ();
+ r = guestfs_aug_rm (g, path);
+ caml_leave_blocking_section ();
+ if (r == -1)
+ ocaml_guestfs_raise_error (g, "aug_rm");
+
+ rv = Val_int (r);
+ CAMLreturn (rv);
+}
+
+CAMLprim value
+ocaml_guestfs_aug_mv (value gv, value srcv, value destv)
+{
+ CAMLparam3 (gv, srcv, destv);
+ CAMLlocal1 (rv);
+
+ guestfs_h *g = Guestfs_val (gv);
+ if (g == NULL)
+ caml_failwith ("aug_mv: used handle after closing it");
+
+ const char *src = String_val (srcv);
+ const char *dest = String_val (destv);
+ int r;
+
+ caml_enter_blocking_section ();
+ r = guestfs_aug_mv (g, src, dest);
+ caml_leave_blocking_section ();
+ if (r == -1)
+ ocaml_guestfs_raise_error (g, "aug_mv");
+
+ rv = Val_unit;
+ CAMLreturn (rv);
+}
+
+CAMLprim value
+ocaml_guestfs_aug_match (value gv, value pathv)
+{
+ CAMLparam2 (gv, pathv);
+ CAMLlocal1 (rv);
+
+ guestfs_h *g = Guestfs_val (gv);
+ if (g == NULL)
+ caml_failwith ("aug_match: used handle after closing it");
+
+ const char *path = String_val (pathv);
+ int i;
+ char **r;
+
+ caml_enter_blocking_section ();
+ r = guestfs_aug_match (g, path);
+ caml_leave_blocking_section ();
+ if (r == NULL)
+ ocaml_guestfs_raise_error (g, "aug_match");
+
+ rv = caml_copy_string_array ((const char **) r);
+ for (i = 0; r[i] != NULL; ++i) free (r[i]);
+ free (r);
+ CAMLreturn (rv);
+}
+
+CAMLprim value
+ocaml_guestfs_aug_save (value gv)
+{
+ CAMLparam1 (gv);
+ CAMLlocal1 (rv);
+
+ guestfs_h *g = Guestfs_val (gv);
+ if (g == NULL)
+ caml_failwith ("aug_save: used handle after closing it");
+
+ int r;
+
+ caml_enter_blocking_section ();
+ r = guestfs_aug_save (g);
+ caml_leave_blocking_section ();
+ if (r == -1)
+ ocaml_guestfs_raise_error (g, "aug_save");
+
+ rv = Val_unit;
+ CAMLreturn (rv);
+}
+
+CAMLprim value
+ocaml_guestfs_aug_load (value gv)
+{
+ CAMLparam1 (gv);
+ CAMLlocal1 (rv);
+
+ guestfs_h *g = Guestfs_val (gv);
+ if (g == NULL)
+ caml_failwith ("aug_load: used handle after closing it");
+
+ int r;
+
+ caml_enter_blocking_section ();
+ r = guestfs_aug_load (g);
+ caml_leave_blocking_section ();
+ if (r == -1)
+ ocaml_guestfs_raise_error (g, "aug_load");
+
+ rv = Val_unit;
+ CAMLreturn (rv);
+}
+
+CAMLprim value
+ocaml_guestfs_aug_ls (value gv, value pathv)
+{
+ CAMLparam2 (gv, pathv);
+ CAMLlocal1 (rv);
+
+ guestfs_h *g = Guestfs_val (gv);
+ if (g == NULL)
+ caml_failwith ("aug_ls: used handle after closing it");
+
+ const char *path = String_val (pathv);
+ int i;
+ char **r;
+
+ caml_enter_blocking_section ();
+ r = guestfs_aug_ls (g, path);
+ caml_leave_blocking_section ();
+ if (r == NULL)
+ ocaml_guestfs_raise_error (g, "aug_ls");
+
+ rv = caml_copy_string_array ((const char **) r);
+ for (i = 0; r[i] != NULL; ++i) free (r[i]);
+ free (r);
+ CAMLreturn (rv);
+}
+
+CAMLprim value
+ocaml_guestfs_rm (value gv, value pathv)
+{
+ CAMLparam2 (gv, pathv);
+ CAMLlocal1 (rv);
+
+ guestfs_h *g = Guestfs_val (gv);
+ if (g == NULL)
+ caml_failwith ("rm: used handle after closing it");
+
+ const char *path = String_val (pathv);
+ int r;
+
+ caml_enter_blocking_section ();
+ r = guestfs_rm (g, path);
+ caml_leave_blocking_section ();
+ if (r == -1)
+ ocaml_guestfs_raise_error (g, "rm");
+
+ rv = Val_unit;
+ CAMLreturn (rv);
+}
+
+CAMLprim value
+ocaml_guestfs_rmdir (value gv, value pathv)
+{
+ CAMLparam2 (gv, pathv);
+ CAMLlocal1 (rv);
+
+ guestfs_h *g = Guestfs_val (gv);
+ if (g == NULL)
+ caml_failwith ("rmdir: used handle after closing it");
+
+ const char *path = String_val (pathv);
+ int r;
+
+ caml_enter_blocking_section ();
+ r = guestfs_rmdir (g, path);
+ caml_leave_blocking_section ();
+ if (r == -1)
+ ocaml_guestfs_raise_error (g, "rmdir");
+
+ rv = Val_unit;
+ CAMLreturn (rv);
+}
+
+CAMLprim value
+ocaml_guestfs_rm_rf (value gv, value pathv)
+{
+ CAMLparam2 (gv, pathv);
+ CAMLlocal1 (rv);
+
+ guestfs_h *g = Guestfs_val (gv);
+ if (g == NULL)
+ caml_failwith ("rm_rf: used handle after closing it");
+
+ const char *path = String_val (pathv);
+ int r;
+
+ caml_enter_blocking_section ();
+ r = guestfs_rm_rf (g, path);
+ caml_leave_blocking_section ();
+ if (r == -1)
+ ocaml_guestfs_raise_error (g, "rm_rf");
+
+ rv = Val_unit;
+ CAMLreturn (rv);
+}
+
+CAMLprim value
+ocaml_guestfs_mkdir (value gv, value pathv)
+{
+ CAMLparam2 (gv, pathv);
+ CAMLlocal1 (rv);
+
+ guestfs_h *g = Guestfs_val (gv);
+ if (g == NULL)
+ caml_failwith ("mkdir: used handle after closing it");
+
+ const char *path = String_val (pathv);
+ int r;
+
+ caml_enter_blocking_section ();
+ r = guestfs_mkdir (g, path);
+ caml_leave_blocking_section ();
+ if (r == -1)
+ ocaml_guestfs_raise_error (g, "mkdir");
+
+ rv = Val_unit;
+ CAMLreturn (rv);
+}
+
+CAMLprim value
+ocaml_guestfs_mkdir_p (value gv, value pathv)
+{
+ CAMLparam2 (gv, pathv);
+ CAMLlocal1 (rv);
+
+ guestfs_h *g = Guestfs_val (gv);
+ if (g == NULL)
+ caml_failwith ("mkdir_p: used handle after closing it");
+
+ const char *path = String_val (pathv);
+ int r;
+
+ caml_enter_blocking_section ();
+ r = guestfs_mkdir_p (g, path);
+ caml_leave_blocking_section ();
+ if (r == -1)
+ ocaml_guestfs_raise_error (g, "mkdir_p");
+
+ rv = Val_unit;
+ CAMLreturn (rv);
+}
+
+CAMLprim value
+ocaml_guestfs_chmod (value gv, value modev, value pathv)
+{
+ CAMLparam3 (gv, modev, pathv);
+ CAMLlocal1 (rv);
+
+ guestfs_h *g = Guestfs_val (gv);
+ if (g == NULL)
+ caml_failwith ("chmod: used handle after closing it");
+
+ int mode = Int_val (modev);
+ const char *path = String_val (pathv);
+ int r;
+
+ caml_enter_blocking_section ();
+ r = guestfs_chmod (g, mode, path);
+ caml_leave_blocking_section ();
+ if (r == -1)
+ ocaml_guestfs_raise_error (g, "chmod");
+
+ rv = Val_unit;
+ CAMLreturn (rv);
+}
+
+CAMLprim value
+ocaml_guestfs_chown (value gv, value ownerv, value groupv, value pathv)
+{
+ CAMLparam4 (gv, ownerv, groupv, pathv);
+ CAMLlocal1 (rv);
+
+ guestfs_h *g = Guestfs_val (gv);
+ if (g == NULL)
+ caml_failwith ("chown: used handle after closing it");
+
+ int owner = Int_val (ownerv);
+ int group = Int_val (groupv);
+ const char *path = String_val (pathv);
+ int r;
+
+ caml_enter_blocking_section ();
+ r = guestfs_chown (g, owner, group, path);
+ caml_leave_blocking_section ();
+ if (r == -1)
+ ocaml_guestfs_raise_error (g, "chown");
+
+ rv = Val_unit;
+ CAMLreturn (rv);
+}
+
+CAMLprim value
+ocaml_guestfs_exists (value gv, value pathv)
+{
+ CAMLparam2 (gv, pathv);
+ CAMLlocal1 (rv);
+
+ guestfs_h *g = Guestfs_val (gv);
+ if (g == NULL)
+ caml_failwith ("exists: used handle after closing it");
+
+ const char *path = String_val (pathv);
+ int r;
+
+ caml_enter_blocking_section ();
+ r = guestfs_exists (g, path);
+ caml_leave_blocking_section ();
+ if (r == -1)
+ ocaml_guestfs_raise_error (g, "exists");
+
+ rv = Val_bool (r);
+ CAMLreturn (rv);
+}
+
+CAMLprim value
+ocaml_guestfs_is_file (value gv, value pathv)
+{
+ CAMLparam2 (gv, pathv);
+ CAMLlocal1 (rv);
+
+ guestfs_h *g = Guestfs_val (gv);
+ if (g == NULL)
+ caml_failwith ("is_file: used handle after closing it");
+
+ const char *path = String_val (pathv);
+ int r;
+
+ caml_enter_blocking_section ();
+ r = guestfs_is_file (g, path);
+ caml_leave_blocking_section ();
+ if (r == -1)
+ ocaml_guestfs_raise_error (g, "is_file");
+
+ rv = Val_bool (r);
+ CAMLreturn (rv);
+}
+
+CAMLprim value
+ocaml_guestfs_is_dir (value gv, value pathv)
+{
+ CAMLparam2 (gv, pathv);
+ CAMLlocal1 (rv);
+
+ guestfs_h *g = Guestfs_val (gv);
+ if (g == NULL)
+ caml_failwith ("is_dir: used handle after closing it");
+
+ const char *path = String_val (pathv);
+ int r;
+
+ caml_enter_blocking_section ();
+ r = guestfs_is_dir (g, path);
+ caml_leave_blocking_section ();
+ if (r == -1)
+ ocaml_guestfs_raise_error (g, "is_dir");
+
+ rv = Val_bool (r);
+ CAMLreturn (rv);
+}
+
+CAMLprim value
+ocaml_guestfs_pvcreate (value gv, value devicev)
+{
+ CAMLparam2 (gv, devicev);
+ CAMLlocal1 (rv);
+
+ guestfs_h *g = Guestfs_val (gv);
+ if (g == NULL)
+ caml_failwith ("pvcreate: used handle after closing it");
+
+ const char *device = String_val (devicev);
+ int r;
+
+ caml_enter_blocking_section ();
+ r = guestfs_pvcreate (g, device);
+ caml_leave_blocking_section ();
+ if (r == -1)
+ ocaml_guestfs_raise_error (g, "pvcreate");
+
+ rv = Val_unit;
+ CAMLreturn (rv);
+}
+
+CAMLprim value
+ocaml_guestfs_vgcreate (value gv, value volgroupv, value physvolsv)
+{
+ CAMLparam3 (gv, volgroupv, physvolsv);
+ CAMLlocal1 (rv);
+
+ guestfs_h *g = Guestfs_val (gv);
+ if (g == NULL)
+ caml_failwith ("vgcreate: used handle after closing it");
+
+ const char *volgroup = String_val (volgroupv);
+ char **physvols = ocaml_guestfs_strings_val (g, physvolsv);
+ int r;
+
+ caml_enter_blocking_section ();
+ r = guestfs_vgcreate (g, volgroup, physvols);
+ caml_leave_blocking_section ();
+ ocaml_guestfs_free_strings (physvols);
+ if (r == -1)
+ ocaml_guestfs_raise_error (g, "vgcreate");
+
+ rv = Val_unit;
+ CAMLreturn (rv);
+}
+
+CAMLprim value
+ocaml_guestfs_lvcreate (value gv, value logvolv, value volgroupv, value mbytesv)
+{
+ CAMLparam4 (gv, logvolv, volgroupv, mbytesv);
+ CAMLlocal1 (rv);
+
+ guestfs_h *g = Guestfs_val (gv);
+ if (g == NULL)
+ caml_failwith ("lvcreate: used handle after closing it");
+
+ const char *logvol = String_val (logvolv);
+ const char *volgroup = String_val (volgroupv);
+ int mbytes = Int_val (mbytesv);
+ int r;
+
+ caml_enter_blocking_section ();
+ r = guestfs_lvcreate (g, logvol, volgroup, mbytes);
+ caml_leave_blocking_section ();
+ if (r == -1)
+ ocaml_guestfs_raise_error (g, "lvcreate");
+
+ rv = Val_unit;
+ CAMLreturn (rv);
+}
+
+CAMLprim value
+ocaml_guestfs_mkfs (value gv, value fstypev, value devicev)
+{
+ CAMLparam3 (gv, fstypev, devicev);
+ CAMLlocal1 (rv);
+
+ guestfs_h *g = Guestfs_val (gv);
+ if (g == NULL)
+ caml_failwith ("mkfs: 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_mkfs (g, fstype, device);
+ caml_leave_blocking_section ();
+ if (r == -1)
+ ocaml_guestfs_raise_error (g, "mkfs");
+
+ rv = Val_unit;
+ CAMLreturn (rv);
+}
+
+CAMLprim value
+ocaml_guestfs_sfdisk (value gv, value devicev, value cylsv, value headsv, value sectorsv, value linesv)
+{
+ CAMLparam5 (gv, devicev, cylsv, headsv, sectorsv);
+ CAMLxparam1 (linesv);
+ CAMLlocal1 (rv);
+
+ guestfs_h *g = Guestfs_val (gv);
+ if (g == NULL)
+ caml_failwith ("sfdisk: used handle after closing it");
+
+ const char *device = String_val (devicev);
+ int cyls = Int_val (cylsv);
+ int heads = Int_val (headsv);
+ int sectors = Int_val (sectorsv);
+ char **lines = ocaml_guestfs_strings_val (g, linesv);
+ int r;
+
+ caml_enter_blocking_section ();
+ r = guestfs_sfdisk (g, device, cyls, heads, sectors, lines);
+ caml_leave_blocking_section ();
+ ocaml_guestfs_free_strings (lines);
+ if (r == -1)
+ ocaml_guestfs_raise_error (g, "sfdisk");
+
+ rv = Val_unit;
+ CAMLreturn (rv);
+}
+
+CAMLprim value
+ocaml_guestfs_sfdisk_byte (value *argv, int argn)
+{
+ return ocaml_guestfs_sfdisk (argv[0], argv[0], argv[1], argv[2], argv[3], argv[4]);
+}
+
+CAMLprim value
+ocaml_guestfs_write_file (value gv, value pathv, value contentv, value sizev)
+{
+ CAMLparam4 (gv, pathv, contentv, sizev);
+ CAMLlocal1 (rv);
+
+ guestfs_h *g = Guestfs_val (gv);
+ if (g == NULL)
+ caml_failwith ("write_file: used handle after closing it");
+
+ const char *path = String_val (pathv);
+ const char *content = String_val (contentv);
+ int size = Int_val (sizev);
+ int r;
+
+ caml_enter_blocking_section ();
+ r = guestfs_write_file (g, path, content, size);
+ caml_leave_blocking_section ();
+ if (r == -1)
+ ocaml_guestfs_raise_error (g, "write_file");
+
+ rv = Val_unit;
+ CAMLreturn (rv);
+}
+
+CAMLprim value
+ocaml_guestfs_umount (value gv, value pathordevicev)
+{
+ CAMLparam2 (gv, pathordevicev);
+ CAMLlocal1 (rv);
+
+ guestfs_h *g = Guestfs_val (gv);
+ if (g == NULL)
+ caml_failwith ("umount: used handle after closing it");
+
+ const char *pathordevice = String_val (pathordevicev);
+ int r;
+
+ caml_enter_blocking_section ();
+ r = guestfs_umount (g, pathordevice);
+ caml_leave_blocking_section ();
+ if (r == -1)
+ ocaml_guestfs_raise_error (g, "umount");
+
+ rv = Val_unit;
+ CAMLreturn (rv);
+}
+
+CAMLprim value
+ocaml_guestfs_mounts (value gv)
+{
+ CAMLparam1 (gv);