From ca49c50e06834bbc68e21630a5552c57494f2b53 Mon Sep 17 00:00:00 2001 From: Richard Jones Date: Mon, 18 May 2009 20:22:53 +0100 Subject: Generated code for lvresize, resize2fs. --- ocaml/guestfs.ml | 2 ++ ocaml/guestfs.mli | 6 ++++++ ocaml/guestfs_c_actions.c | 47 +++++++++++++++++++++++++++++++++++++++++++++++ 3 files changed, 55 insertions(+) (limited to 'ocaml') diff --git a/ocaml/guestfs.ml b/ocaml/guestfs.ml index fa60a7bb..561b93c3 100644 --- a/ocaml/guestfs.ml +++ b/ocaml/guestfs.ml @@ -243,3 +243,5 @@ external sfdisk_kernel_geometry : t -> string -> string = "ocaml_guestfs_sfdisk_ external sfdisk_disk_geometry : t -> string -> string = "ocaml_guestfs_sfdisk_disk_geometry" external vg_activate_all : t -> bool -> unit = "ocaml_guestfs_vg_activate_all" external vg_activate : t -> bool -> string array -> unit = "ocaml_guestfs_vg_activate" +external lvresize : t -> string -> int -> unit = "ocaml_guestfs_lvresize" +external resize2fs : t -> string -> unit = "ocaml_guestfs_resize2fs" diff --git a/ocaml/guestfs.mli b/ocaml/guestfs.mli index 5ce91220..d9ce4af5 100644 --- a/ocaml/guestfs.mli +++ b/ocaml/guestfs.mli @@ -508,3 +508,9 @@ val vg_activate_all : t -> bool -> unit val vg_activate : t -> bool -> string array -> unit (** activate or deactivate some volume groups *) +val lvresize : t -> string -> int -> unit +(** resize an LVM logical volume *) + +val resize2fs : t -> string -> unit +(** resize an ext2/ext3 filesystem *) + diff --git a/ocaml/guestfs_c_actions.c b/ocaml/guestfs_c_actions.c index f0aa7e23..c64bcf09 100644 --- a/ocaml/guestfs_c_actions.c +++ b/ocaml/guestfs_c_actions.c @@ -3379,3 +3379,50 @@ ocaml_guestfs_vg_activate (value gv, value activatev, value volgroupsv) CAMLreturn (rv); } +CAMLprim value +ocaml_guestfs_lvresize (value gv, value devicev, value mbytesv) +{ + CAMLparam3 (gv, devicev, mbytesv); + CAMLlocal1 (rv); + + guestfs_h *g = Guestfs_val (gv); + if (g == NULL) + caml_failwith ("lvresize: used handle after closing it"); + + const char *device = String_val (devicev); + int mbytes = Int_val (mbytesv); + int r; + + caml_enter_blocking_section (); + r = guestfs_lvresize (g, device, mbytes); + caml_leave_blocking_section (); + if (r == -1) + ocaml_guestfs_raise_error (g, "lvresize"); + + rv = Val_unit; + CAMLreturn (rv); +} + +CAMLprim value +ocaml_guestfs_resize2fs (value gv, value devicev) +{ + CAMLparam2 (gv, devicev); + CAMLlocal1 (rv); + + guestfs_h *g = Guestfs_val (gv); + if (g == NULL) + caml_failwith ("resize2fs: used handle after closing it"); + + const char *device = String_val (devicev); + int r; + + caml_enter_blocking_section (); + r = guestfs_resize2fs (g, device); + caml_leave_blocking_section (); + if (r == -1) + ocaml_guestfs_raise_error (g, "resize2fs"); + + rv = Val_unit; + CAMLreturn (rv); +} + -- cgit