X-Git-Url: http://git.annexia.org/?p=libguestfs.git;a=blobdiff_plain;f=ocaml%2Fguestfs_c_actions.c;h=3eedbda679fed9f49937bb0f0f68e261714ac34d;hp=04be818009ffa6dcdeb8f98d75d59fdce953439b;hb=da8ddb2745c3d53c36e3ad7f09836a4c27a4d3e6;hpb=b2ed0f4c55c2bd3d07341ba2207f0cb238eb4e18 diff --git a/ocaml/guestfs_c_actions.c b/ocaml/guestfs_c_actions.c index 04be818..3eedbda 100644 --- a/ocaml/guestfs_c_actions.c +++ b/ocaml/guestfs_c_actions.c @@ -4588,3 +4588,147 @@ ocaml_guestfs_df_h (value gv) CAMLreturn (rv); } +CAMLprim value +ocaml_guestfs_du (value gv, value pathv) +{ + CAMLparam2 (gv, pathv); + CAMLlocal1 (rv); + + guestfs_h *g = Guestfs_val (gv); + if (g == NULL) + caml_failwith ("du: used handle after closing it"); + + const char *path = String_val (pathv); + int64_t r; + + caml_enter_blocking_section (); + r = guestfs_du (g, path); + caml_leave_blocking_section (); + if (r == -1) + ocaml_guestfs_raise_error (g, "du"); + + rv = caml_copy_int64 (r); + CAMLreturn (rv); +} + +CAMLprim value +ocaml_guestfs_initrd_list (value gv, value pathv) +{ + CAMLparam2 (gv, pathv); + CAMLlocal1 (rv); + + guestfs_h *g = Guestfs_val (gv); + if (g == NULL) + caml_failwith ("initrd_list: used handle after closing it"); + + const char *path = String_val (pathv); + int i; + char **r; + + caml_enter_blocking_section (); + r = guestfs_initrd_list (g, path); + caml_leave_blocking_section (); + if (r == NULL) + ocaml_guestfs_raise_error (g, "initrd_list"); + + 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_mount_loop (value gv, value filev, value mountpointv) +{ + CAMLparam3 (gv, filev, mountpointv); + CAMLlocal1 (rv); + + guestfs_h *g = Guestfs_val (gv); + if (g == NULL) + caml_failwith ("mount_loop: used handle after closing it"); + + const char *file = String_val (filev); + const char *mountpoint = String_val (mountpointv); + int r; + + caml_enter_blocking_section (); + r = guestfs_mount_loop (g, file, mountpoint); + caml_leave_blocking_section (); + if (r == -1) + ocaml_guestfs_raise_error (g, "mount_loop"); + + rv = Val_unit; + 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); +} +