diff options
Diffstat (limited to 'ocaml')
-rw-r--r-- | ocaml/guestfs.ml | 3 | ||||
-rw-r--r-- | ocaml/guestfs.mli | 11 | ||||
-rw-r--r-- | ocaml/guestfs_c_actions.c | 69 |
3 files changed, 82 insertions, 1 deletions
diff --git a/ocaml/guestfs.ml b/ocaml/guestfs.ml index c3305e45..d020df8c 100644 --- a/ocaml/guestfs.ml +++ b/ocaml/guestfs.ml @@ -212,3 +212,6 @@ external mount_ro : t -> string -> string -> unit = "ocaml_guestfs_mount_ro" external mount_options : t -> string -> string -> string -> unit = "ocaml_guestfs_mount_options" external mount_vfs : t -> string -> string -> string -> string -> unit = "ocaml_guestfs_mount_vfs" external debug : t -> string -> string array -> string = "ocaml_guestfs_debug" +external lvremove : t -> string -> unit = "ocaml_guestfs_lvremove" +external vgremove : t -> string -> unit = "ocaml_guestfs_vgremove" +external pvremove : t -> string -> unit = "ocaml_guestfs_pvremove" diff --git a/ocaml/guestfs.mli b/ocaml/guestfs.mli index 846332ca..f38fa48a 100644 --- a/ocaml/guestfs.mli +++ b/ocaml/guestfs.mli @@ -350,7 +350,7 @@ val statvfs : t -> string -> statvfs (** get file system statistics *) val tune2fs_l : t -> string -> (string * string) list -(** get ext2/ext3 superblock details *) +(** get ext2/ext3/ext4 superblock details *) val blockdev_setro : t -> string -> unit (** set block device to read-only *) @@ -415,3 +415,12 @@ val mount_vfs : t -> string -> string -> string -> string -> unit val debug : t -> string -> string array -> string (** debugging and internals *) +val lvremove : t -> string -> unit +(** remove an LVM logical volume *) + +val vgremove : t -> string -> unit +(** remove an LVM volume group *) + +val pvremove : t -> string -> unit +(** remove an LVM physical volume *) + diff --git a/ocaml/guestfs_c_actions.c b/ocaml/guestfs_c_actions.c index c396a8a8..73515cfc 100644 --- a/ocaml/guestfs_c_actions.c +++ b/ocaml/guestfs_c_actions.c @@ -2634,3 +2634,72 @@ ocaml_guestfs_debug (value gv, value subcmdv, value extraargsv) CAMLreturn (rv); } +CAMLprim value +ocaml_guestfs_lvremove (value gv, value devicev) +{ + CAMLparam2 (gv, devicev); + CAMLlocal1 (rv); + + guestfs_h *g = Guestfs_val (gv); + if (g == NULL) + caml_failwith ("lvremove: used handle after closing it"); + + const char *device = String_val (devicev); + int r; + + caml_enter_blocking_section (); + r = guestfs_lvremove (g, device); + caml_leave_blocking_section (); + if (r == -1) + ocaml_guestfs_raise_error (g, "lvremove"); + + rv = Val_unit; + CAMLreturn (rv); +} + +CAMLprim value +ocaml_guestfs_vgremove (value gv, value vgnamev) +{ + CAMLparam2 (gv, vgnamev); + CAMLlocal1 (rv); + + guestfs_h *g = Guestfs_val (gv); + if (g == NULL) + caml_failwith ("vgremove: used handle after closing it"); + + const char *vgname = String_val (vgnamev); + int r; + + caml_enter_blocking_section (); + r = guestfs_vgremove (g, vgname); + caml_leave_blocking_section (); + if (r == -1) + ocaml_guestfs_raise_error (g, "vgremove"); + + rv = Val_unit; + CAMLreturn (rv); +} + +CAMLprim value +ocaml_guestfs_pvremove (value gv, value devicev) +{ + CAMLparam2 (gv, devicev); + CAMLlocal1 (rv); + + guestfs_h *g = Guestfs_val (gv); + if (g == NULL) + caml_failwith ("pvremove: used handle after closing it"); + + const char *device = String_val (devicev); + int r; + + caml_enter_blocking_section (); + r = guestfs_pvremove (g, device); + caml_leave_blocking_section (); + if (r == -1) + ocaml_guestfs_raise_error (g, "pvremove"); + + rv = Val_unit; + CAMLreturn (rv); +} + |