From 0c2ed80a3590e30a2eebfa89f4d43080bf850abe Mon Sep 17 00:00:00 2001 From: "Darrick J. Wong" Date: Tue, 25 Oct 2016 15:14:33 -0700 Subject: [PATCH] xfs_io: provide long-format help for falloc Provide long-format help for falloc so that users can learn about the command. Note for xfstest writers: If you need to check that a particular fallocate mode works (-c/-i/-p/-u) on a given filesystem, you should call _require_xfs_io_command with the falloc subcommand directly, (i.e. _require_xfs_io_command funshare) because the subcommands are special-cased to actually try the command. Signed-off-by: Darrick J. Wong Reviewed-by: Christoph Hellwig --- io/prealloc.c | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) diff --git a/io/prealloc.c b/io/prealloc.c index 713ea7bcb..7f5c20026 100644 --- a/io/prealloc.c +++ b/io/prealloc.c @@ -164,6 +164,26 @@ zero_f( #if defined (HAVE_FALLOCATE) +static void +falloc_help(void) +{ + printf(_( +"\n" +" modifies space associated with part of a file via fallocate" +"\n" +" Example:\n" +" 'falloc 0 1m' - fills all holes within the first megabyte\n" +"\n" +" falloc uses the fallocate system call to alter space allocations in the\n" +" open file. The following operations are supported:\n" +" All the file offsets are in units of bytes.\n" +" -c -- collapses the given range.\n" +" -i -- inserts a hole into the given range of the file.\n" +" -k -- do not change file size.\n" +" -p -- unmap the given range from the file.\n" +"\n")); +} + static int fallocate_f( int argc, @@ -349,6 +369,7 @@ prealloc_init(void) falloc_cmd.args = _("[-c] [-k] [-p] off len"); falloc_cmd.oneline = _("allocates space associated with part of a file via fallocate"); + falloc_cmd.help = falloc_help; add_command(&falloc_cmd); fpunch_cmd.name = "fpunch"; -- 2.47.2