New API: resize2fs-M to resize ext2/3/4 to minimum size.

This commit is contained in:
Nikita A Menkovich
2011-01-14 13:39:38 +00:00
committed by Richard W.M. Jones
parent 69f2f62900
commit 4ffa2d6798
3 changed files with 35 additions and 1 deletions

View File

@@ -265,6 +265,27 @@ do_resize2fs_size (const char *device, int64_t size)
return 0;
}
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)
{

View File

@@ -5675,6 +5675,19 @@ is no extended attribute named C<name>, this returns an error.
See also: C<guestfs_lgetxattrs>, C<guestfs_getxattr>, L<attr(5)>.");
("resize2fs_M", (RErr, [Device "device"], []), 281, [],
[],
"resize an ext2, ext3 or ext4 filesystem to the minimum size",
"\
This command is the same as C<guestfs_resize2fs>, but the filesystem
is resized to its minimum size. This works like the C<-M> option
to the C<resize2fs> command.
To get the resulting size of the filesystem you should call
C<guestfs_tune2fs_l> and read the C<Block size> and C<Block count>
values. These two numbers, multiplied together, give the
resulting size of the minimal filesystem in bytes.");
]
let all_functions = non_daemon_functions @ daemon_functions

View File

@@ -1 +1 @@
280
281