X-Git-Url: http://git.annexia.org/?a=blobdiff_plain;f=ocaml%2Fguestfs_c_actions.c;h=6db7239404c0aa88835a13cdecd6752664b6747f;hb=896079e29b4d49c6c18ac3316a94bfbe2f307648;hp=6385e806cd81fd85ab231aff5f72d145cf64487b;hpb=c6d6f5ae1b76ec9aa5c540906aeed73d25d13eb9;p=libguestfs.git diff --git a/ocaml/guestfs_c_actions.c b/ocaml/guestfs_c_actions.c index 6385e80..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); @@ -4637,3 +4682,223 @@ ocaml_guestfs_initrd_list (value gv, value pathv) 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); +} + +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); +} +