summaryrefslogtreecommitdiffstats
path: root/resize
diff options
context:
space:
mode:
authorRichard W.M. Jones <rjones@redhat.com>2012-10-11 13:23:24 +0000
committerRichard W.M. Jones <rjones@redhat.com>2012-10-11 13:37:35 +0000
commit91b2238fc8e462c02f697f0c053043a55f43c13d (patch)
treef8542392c42103dc234d31ef2a40d0c38d4b229b /resize
parentf4a2aecd5ff4904994d75ad92b50a834d40eef17 (diff)
downloadlibguestfs-91b2238fc8e462c02f697f0c053043a55f43c13d.tar.gz
libguestfs-91b2238fc8e462c02f697f0c053043a55f43c13d.tar.xz
libguestfs-91b2238fc8e462c02f697f0c053043a55f43c13d.zip
sparsify: Re-use progress bar wrapper code from virt-resize.
The code was identical -- just copied with s/resize/sparsify/. Instead of duplicating identical code, cause the Makefile.am to use the code from the ../resize/ directory. Unfortunately because there are two Utils modules (which are different), this means we had to rename those modules to Resize_utils and Sparsify_utils respectively. So this is a rather larger change than intended. However it's just code motion.
Diffstat (limited to 'resize')
-rw-r--r--resize/Makefile.am12
-rw-r--r--resize/progress.ml2
-rw-r--r--resize/resize.ml2
-rw-r--r--resize/resize_utils.ml (renamed from resize/utils.ml)0
-rw-r--r--resize/resize_utils_tests.ml (renamed from resize/utils_tests.ml)10
5 files changed, 12 insertions, 14 deletions
diff --git a/resize/Makefile.am b/resize/Makefile.am
index fc69aa78..31fd71b7 100644
--- a/resize/Makefile.am
+++ b/resize/Makefile.am
@@ -37,8 +37,8 @@ SOURCES = \
progress.ml \
resize.ml \
resize_gettext.ml \
- utils.ml \
- utils_tests.ml
+ resize_utils.ml \
+ resize_utils_tests.ml
if HAVE_OCAML
@@ -47,7 +47,7 @@ OBJECTS = \
$(top_builddir)/fish/guestfish-progress.o \
progress-c.o \
resize_gettext.cmx \
- utils.cmx \
+ resize_utils.cmx \
progress.cmx \
resize.cmx
@@ -103,15 +103,15 @@ CLEANFILES += stamp-virt-resize.pod
# Tests.
-check_SCRIPTS = utils_tests
+check_SCRIPTS = resize_utils_tests
-utils_tests: resize_gettext.cmx utils.cmx utils_tests.cmx
+resize_utils_tests: resize_gettext.cmx resize_utils.cmx resize_utils_tests.cmx
$(OCAMLFIND) ocamlopt $(OCAMLOPTFLAGS) \
mlguestfs.cmxa -linkpkg $^ -cclib -lncurses -o $@
TESTS_ENVIRONMENT = $(top_builddir)/run --test
-TESTS = utils_tests
+TESTS = resize_utils_tests
if ENABLE_APPLIANCE
TESTS += test-virt-resize.sh
endif
diff --git a/resize/progress.ml b/resize/progress.ml
index e4fd47e0..993a0b7d 100644
--- a/resize/progress.ml
+++ b/resize/progress.ml
@@ -18,8 +18,6 @@
open Printf
-open Utils
-
module G = Guestfs
type progress_bar
diff --git a/resize/resize.ml b/resize/resize.ml
index c1aef1bf..d94273ab 100644
--- a/resize/resize.ml
+++ b/resize/resize.ml
@@ -22,7 +22,7 @@ open Resize_gettext.Gettext
module G = Guestfs
-open Utils
+open Resize_utils
(* Minimum surplus before we create an extra partition. *)
let min_extra_partition = 10L *^ 1024L *^ 1024L
diff --git a/resize/utils.ml b/resize/resize_utils.ml
index 82d45a3e..82d45a3e 100644
--- a/resize/utils.ml
+++ b/resize/resize_utils.ml
diff --git a/resize/utils_tests.ml b/resize/resize_utils_tests.ml
index cc00061e..061bb076 100644
--- a/resize/utils_tests.ml
+++ b/resize/resize_utils_tests.ml
@@ -16,16 +16,16 @@
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
*)
-(* This file tests the Utils module. *)
+(* This file tests the Resize_utils module. *)
-open Utils
+open Resize_utils
-(* Test Utils.int_of_le32 and Utils.le32_of_int. *)
+(* Test Resize_utils.int_of_le32 and Resize_utils.le32_of_int. *)
let () =
assert (int_of_le32 "\x80\x60\x40\x20" = 0x20406080L);
assert (le32_of_int 0x20406080L = "\x80\x60\x40\x20")
-(* Test Utils.parse_size. *)
+(* Test Resize_utils.parse_size. *)
let () =
(* For absolute sizes, oldsize is ignored. *)
assert (parse_size 100_L "100b" = 100_L);
@@ -64,7 +64,7 @@ let () =
assert (parse_size 100000_L "+1.1%" = 101100_L);
assert (parse_size 100000_L "+1.12%" = 101100_L)
-(* Test Utils.human_size. *)
+(* Test Resize_utils.human_size. *)
let () =
assert (human_size 100_L = "100");
assert (human_size (-100_L) = "-100");