From: Nikita A Menkovich Date: Fri, 14 Jan 2011 13:39:38 +0000 (+0000) Subject: New API: resize2fs-M to resize ext2/3/4 to minimum size. X-Git-Tag: 1.9.4~4 X-Git-Url: http://git.annexia.org/?p=libguestfs.git;a=commitdiff_plain;h=4ffa2d6798f7a2bf0baec8e1084659cf6358bc31 New API: resize2fs-M to resize ext2/3/4 to minimum size. --- diff --git a/daemon/ext2.c b/daemon/ext2.c index 725352e..85ce316 100644 --- a/daemon/ext2.c +++ b/daemon/ext2.c @@ -266,6 +266,27 @@ do_resize2fs_size (const char *device, int64_t size) } int +do_resize2fs_M (const char *device) +{ + char *err; + int r; + + char prog[] = "resize2fs"; + if (e2prog (prog) == -1) + return -1; + + r = command (NULL, &err, prog, "-M" , device, NULL); + if (r == -1) { + reply_with_error ("%s", err); + free (err); + return -1; + } + + free (err); + return 0; +} + +int do_e2fsck_f (const char *device) { char *err; diff --git a/generator/generator_actions.ml b/generator/generator_actions.ml index ccaf10a..50c33a8 100644 --- a/generator/generator_actions.ml +++ b/generator/generator_actions.ml @@ -5675,6 +5675,19 @@ is no extended attribute named C, this returns an error. See also: C, C, L."); + ("resize2fs_M", (RErr, [Device "device"], []), 281, [], + [], + "resize an ext2, ext3 or ext4 filesystem to the minimum size", + "\ +This command is the same as C, but the filesystem +is resized to its minimum size. This works like the C<-M> option +to the C command. + +To get the resulting size of the filesystem you should call +C and read the C and C +values. These two numbers, multiplied together, give the +resulting size of the minimal filesystem in bytes."); + ] let all_functions = non_daemon_functions @ daemon_functions diff --git a/src/MAX_PROC_NR b/src/MAX_PROC_NR index 1b1c131..1473a88 100644 --- a/src/MAX_PROC_NR +++ b/src/MAX_PROC_NR @@ -1 +1 @@ -280 +281