---
src/ext2.ml | 2 +-
src/ext2fs-c.c | 7 ++++++-
src/ext2fs.ml | 2 +-
src/ext2fs.mli | 2 +-
4 files changed, 9 insertions(+), 4 deletions(-)
diff --git a/src/ext2.ml b/src/ext2.ml
index bccf3a7..d5c26a7 100644
--- a/src/ext2.ml
+++ b/src/ext2.ml
@@ -52,7 +52,7 @@ let build_ext2 debug basedir files modpath kernel_version appliance =
(quote appliance) in
run_command cmd;
- let fs = ext2fs_open appliance in
+ let fs = ext2fs_open ~debug appliance in
ext2fs_read_bitmaps fs;
if debug >= 1 then
diff --git a/src/ext2fs-c.c b/src/ext2fs-c.c
index 8eab24c..c9d3994 100644
--- a/src/ext2fs-c.c
+++ b/src/ext2fs-c.c
@@ -55,6 +55,7 @@
struct ext2_data
{
ext2_filsys fs;
+ int debug;
};
static void initialize (void) __attribute__((constructor));
@@ -84,6 +85,8 @@ ext2_handle_closed (void)
}
#define Ext2fs_val(v) (*((struct ext2_data *)Data_custom_val(v)))
+#define Val_none Val_int(0)
+#define Some_val(v) Field(v,0)
static void
ext2_finalize (value fsv)
@@ -121,7 +124,7 @@ Val_ext2fs (struct ext2_data *data)
}
value
-supermin_ext2fs_open (value filev)
+supermin_ext2fs_open (value filev, value debugv)
{
CAMLparam1 (filev);
CAMLlocal1 (fsv);
@@ -138,6 +141,8 @@ supermin_ext2fs_open (value filev)
if (err != 0)
ext2_error_to_exception ("ext2fs_open", err, String_val (filev));
+ data.debug = debugv == Val_none ? 0 : Int_val (Some_val (debugv));
+
fsv = Val_ext2fs (&data);
CAMLreturn (fsv);
}
diff --git a/src/ext2fs.ml b/src/ext2fs.ml
index cf7c546..9f3580e 100644
--- a/src/ext2fs.ml
+++ b/src/ext2fs.ml
@@ -18,7 +18,7 @@
type t
-external ext2fs_open : string -> t = "supermin_ext2fs_open"
+external ext2fs_open : string -> ?debug:int -> t =
"supermin_ext2fs_open"
external ext2fs_close : t -> unit = "supermin_ext2fs_close"
external ext2fs_read_bitmaps : t -> unit = "supermin_ext2fs_read_bitmaps"
diff --git a/src/ext2fs.mli b/src/ext2fs.mli
index ebcaf1b..2a59b2d 100644
--- a/src/ext2fs.mli
+++ b/src/ext2fs.mli
@@ -25,7 +25,7 @@
type t
-val ext2fs_open : string -> t
+val ext2fs_open : string -> ?debug:int -> t
val ext2fs_close : t -> unit
val ext2fs_read_bitmaps : t -> unit
--
1.9.3
Show replies by date