diff options
author | Richard W.M. Jones <rjones@redhat.com> | 2009-06-30 13:09:44 +0100 |
---|---|---|
committer | Richard W.M. Jones <rjones@redhat.com> | 2009-06-30 13:10:45 +0100 |
commit | 0884d8bbae6d76a603ec1385ada2938f88981c5c (patch) | |
tree | 15c91a3bc58ba3537d4b52c48accf8703f3d8ffb /ocaml | |
parent | f850e1f065fb04df7cc87a921ab3c658741cc393 (diff) | |
download | libguestfs-0884d8bbae6d76a603ec1385ada2938f88981c5c.tar.gz libguestfs-0884d8bbae6d76a603ec1385ada2938f88981c5c.tar.xz libguestfs-0884d8bbae6d76a603ec1385ada2938f88981c5c.zip |
Generated code for mknod, mkfifo, mknod_b, mknod_c, umask.
Diffstat (limited to 'ocaml')
-rw-r--r-- | ocaml/guestfs.ml | 5 | ||||
-rw-r--r-- | ocaml/guestfs.mli | 15 | ||||
-rw-r--r-- | ocaml/guestfs_c_actions.c | 125 |
3 files changed, 145 insertions, 0 deletions
diff --git a/ocaml/guestfs.ml b/ocaml/guestfs.ml index 027f0e9c..0bf458c4 100644 --- a/ocaml/guestfs.ml +++ b/ocaml/guestfs.ml @@ -301,3 +301,8 @@ external mount_loop : t -> string -> string -> unit = "ocaml_guestfs_mount_loop" external mkswap : t -> string -> unit = "ocaml_guestfs_mkswap" external mkswap_L : t -> string -> string -> unit = "ocaml_guestfs_mkswap_L" external mkswap_U : t -> string -> string -> unit = "ocaml_guestfs_mkswap_U" +external mknod : t -> int -> int -> int -> string -> unit = "ocaml_guestfs_mknod" +external mkfifo : t -> int -> string -> unit = "ocaml_guestfs_mkfifo" +external mknod_b : t -> int -> int -> int -> string -> unit = "ocaml_guestfs_mknod_b" +external mknod_c : t -> int -> int -> int -> string -> unit = "ocaml_guestfs_mknod_c" +external umask : t -> int -> int = "ocaml_guestfs_umask" diff --git a/ocaml/guestfs.mli b/ocaml/guestfs.mli index ef6a1423..5cab5887 100644 --- a/ocaml/guestfs.mli +++ b/ocaml/guestfs.mli @@ -682,3 +682,18 @@ val mkswap_L : t -> string -> string -> unit val mkswap_U : t -> string -> string -> unit (** create a swap partition with an explicit UUID *) +val mknod : t -> int -> int -> int -> string -> unit +(** make block, character or FIFO devices *) + +val mkfifo : t -> int -> string -> unit +(** make FIFO (named pipe) *) + +val mknod_b : t -> int -> int -> int -> string -> unit +(** make block device node *) + +val mknod_c : t -> int -> int -> int -> string -> unit +(** make char device node *) + +val umask : t -> int -> int +(** set file mode creation mask (umask) *) + diff --git a/ocaml/guestfs_c_actions.c b/ocaml/guestfs_c_actions.c index 6e937f45..6db72394 100644 --- a/ocaml/guestfs_c_actions.c +++ b/ocaml/guestfs_c_actions.c @@ -4777,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); +} + |