X-Git-Url: http://git.annexia.org/?p=libguestfs.git;a=blobdiff_plain;f=ocaml%2Fguestfs_c_actions.c;h=6db7239404c0aa88835a13cdecd6752664b6747f;hp=3eedbda679fed9f49937bb0f0f68e261714ac34d;hb=0884d8bbae6d76a603ec1385ada2938f88981c5c;hpb=da8ddb2745c3d53c36e3ad7f09836a4c27a4d3e6 diff --git a/ocaml/guestfs_c_actions.c b/ocaml/guestfs_c_actions.c index 3eedbda..6db7239 100644 --- a/ocaml/guestfs_c_actions.c +++ b/ocaml/guestfs_c_actions.c @@ -1543,6 +1543,51 @@ ocaml_guestfs_end_busy (value gv) } CAMLprim value +ocaml_guestfs_set_memsize (value gv, value memsizev) +{ + CAMLparam2 (gv, memsizev); + CAMLlocal1 (rv); + + guestfs_h *g = Guestfs_val (gv); + if (g == NULL) + caml_failwith ("set_memsize: used handle after closing it"); + + int memsize = Int_val (memsizev); + int r; + + caml_enter_blocking_section (); + r = guestfs_set_memsize (g, memsize); + caml_leave_blocking_section (); + if (r == -1) + ocaml_guestfs_raise_error (g, "set_memsize"); + + rv = Val_unit; + CAMLreturn (rv); +} + +CAMLprim value +ocaml_guestfs_get_memsize (value gv) +{ + CAMLparam1 (gv); + CAMLlocal1 (rv); + + guestfs_h *g = Guestfs_val (gv); + if (g == NULL) + caml_failwith ("get_memsize: used handle after closing it"); + + int r; + + caml_enter_blocking_section (); + r = guestfs_get_memsize (g); + caml_leave_blocking_section (); + if (r == -1) + ocaml_guestfs_raise_error (g, "get_memsize"); + + rv = Val_int (r); + CAMLreturn (rv); +} + +CAMLprim value ocaml_guestfs_mount (value gv, value devicev, value mountpointv) { CAMLparam3 (gv, devicev, mountpointv); @@ -4732,3 +4777,128 @@ ocaml_guestfs_mkswap_U (value gv, value uuidv, value devicev) CAMLreturn (rv); } +CAMLprim value +ocaml_guestfs_mknod (value gv, value modev, value devmajorv, value devminorv, value pathv) +{ + CAMLparam5 (gv, modev, devmajorv, devminorv, pathv); + CAMLlocal1 (rv); + + guestfs_h *g = Guestfs_val (gv); + if (g == NULL) + caml_failwith ("mknod: used handle after closing it"); + + int mode = Int_val (modev); + int devmajor = Int_val (devmajorv); + int devminor = Int_val (devminorv); + const char *path = String_val (pathv); + int r; + + caml_enter_blocking_section (); + r = guestfs_mknod (g, mode, devmajor, devminor, path); + caml_leave_blocking_section (); + if (r == -1) + ocaml_guestfs_raise_error (g, "mknod"); + + rv = Val_unit; + CAMLreturn (rv); +} + +CAMLprim value +ocaml_guestfs_mkfifo (value gv, value modev, value pathv) +{ + CAMLparam3 (gv, modev, pathv); + CAMLlocal1 (rv); + + guestfs_h *g = Guestfs_val (gv); + if (g == NULL) + caml_failwith ("mkfifo: used handle after closing it"); + + int mode = Int_val (modev); + const char *path = String_val (pathv); + int r; + + caml_enter_blocking_section (); + r = guestfs_mkfifo (g, mode, path); + caml_leave_blocking_section (); + if (r == -1) + ocaml_guestfs_raise_error (g, "mkfifo"); + + rv = Val_unit; + CAMLreturn (rv); +} + +CAMLprim value +ocaml_guestfs_mknod_b (value gv, value modev, value devmajorv, value devminorv, value pathv) +{ + CAMLparam5 (gv, modev, devmajorv, devminorv, pathv); + CAMLlocal1 (rv); + + guestfs_h *g = Guestfs_val (gv); + if (g == NULL) + caml_failwith ("mknod_b: used handle after closing it"); + + int mode = Int_val (modev); + int devmajor = Int_val (devmajorv); + int devminor = Int_val (devminorv); + const char *path = String_val (pathv); + int r; + + caml_enter_blocking_section (); + r = guestfs_mknod_b (g, mode, devmajor, devminor, path); + caml_leave_blocking_section (); + if (r == -1) + ocaml_guestfs_raise_error (g, "mknod_b"); + + rv = Val_unit; + CAMLreturn (rv); +} + +CAMLprim value +ocaml_guestfs_mknod_c (value gv, value modev, value devmajorv, value devminorv, value pathv) +{ + CAMLparam5 (gv, modev, devmajorv, devminorv, pathv); + CAMLlocal1 (rv); + + guestfs_h *g = Guestfs_val (gv); + if (g == NULL) + caml_failwith ("mknod_c: used handle after closing it"); + + int mode = Int_val (modev); + int devmajor = Int_val (devmajorv); + int devminor = Int_val (devminorv); + const char *path = String_val (pathv); + int r; + + caml_enter_blocking_section (); + r = guestfs_mknod_c (g, mode, devmajor, devminor, path); + caml_leave_blocking_section (); + if (r == -1) + ocaml_guestfs_raise_error (g, "mknod_c"); + + rv = Val_unit; + CAMLreturn (rv); +} + +CAMLprim value +ocaml_guestfs_umask (value gv, value maskv) +{ + CAMLparam2 (gv, maskv); + CAMLlocal1 (rv); + + guestfs_h *g = Guestfs_val (gv); + if (g == NULL) + caml_failwith ("umask: used handle after closing it"); + + int mask = Int_val (maskv); + int r; + + caml_enter_blocking_section (); + r = guestfs_umask (g, mask); + caml_leave_blocking_section (); + if (r == -1) + ocaml_guestfs_raise_error (g, "umask"); + + rv = Val_int (r); + CAMLreturn (rv); +} +