]> git.ipfire.org Git - thirdparty/xfsprogs-dev.git/commitdiff
xfs_io: provide long-format help for falloc
authorDarrick J. Wong <darrick.wong@oracle.com>
Tue, 25 Oct 2016 22:14:33 +0000 (15:14 -0700)
committerDarrick J. Wong <darrick.wong@oracle.com>
Wed, 26 Oct 2016 19:43:53 +0000 (12:43 -0700)
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 <darrick.wong@oracle.com>
Reviewed-by: Christoph Hellwig <hch@lst.de>
io/prealloc.c

index 713ea7bcb6885a8b2f7e1ed24a2a914713af6c1c..7f5c200261ab949d0df605789003056dfd8a570e 100644 (file)
@@ -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";