xfs
[Top] [All Lists]

[PATCH 03/11] xfstests: randholes: document options a bit more

To: xfs@xxxxxxxxxxx
Subject: [PATCH 03/11] xfstests: randholes: document options a bit more
From: Alex Elder <aelder@xxxxxxx>
Date: Thu, 14 Oct 2010 09:50:00 -0500
Reply-to: aelder@xxxxxxx
Reformat the usage message and provide a little more
information about default values and units for options
for the "randholes" command.

Signed-off-by: Alex Elder <aelder@xxxxxxx>

---
 src/randholes.c |   28 +++++++++++++++++++++-------
 1 file changed, 21 insertions(+), 7 deletions(-)

Index: b/src/randholes.c
===================================================================
--- a/src/randholes.c
+++ b/src/randholes.c
@@ -16,6 +16,8 @@
  * Inc.,  51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
  */
  
+#include <inttypes.h>
+
 #include "global.h"
 
 unsigned char  *valid; /* Bit-vector array showing which blocks have been 
written */
@@ -23,7 +25,11 @@ int          nvalid; /* number of bytes in valid
 #define        SETBIT(ARRAY, N)        ((ARRAY)[(N)/8] |= (1 << ((N)%8)))
 #define        BITVAL(ARRAY, N)        ((ARRAY)[(N)/8] & (1 << ((N)%8)))
 
+#define        DEFAULT_FILESIZE        ((__uint64_t) (256 * 1024 * 1024))
+#define        DEFAULT_BLOCKSIZE       512
+
 __uint64_t filesize;
+
 unsigned int blocksize;
 int count;
 int verbose;
@@ -31,7 +37,7 @@ int wsync;
 int direct;
 int alloconly;
 int rt;
-int extsize;
+int extsize;   /* used only for real-time */
 int preserve;
 int test;
 __uint64_t fileoffset;
@@ -50,10 +56,18 @@ void
 usage(char *progname)
 {
        fprintf(stderr,
-               "usage: %s [-l filesize] [-b blocksize] [-c count]"
-               " [-o write offset] [-s seed] [-x extentsize]"
-               " [-w] [-v] [-d] [-r] [-a] [-p] filename\n",
+               "usage: %s [-l filesize] [-b blocksize] [-c count]\n"
+               "\t\t[-o write_offset] [-s seed] [-r [-x extentsize]]\n"
+               "\t\t[-w] [-v] [-d] [-a] [-p] [-t] filename\n\n",
                progname);
+       fprintf(stderr, "\tdefault filesize is %" PRIu64 " bytes\n",
+               DEFAULT_FILESIZE);
+       fprintf(stderr, "\tdefault blocksize is %u bytes\n",
+               DEFAULT_BLOCKSIZE);
+       fprintf(stderr, "\tdefault count is %d block-sized writes\n",
+               (int) (DEFAULT_FILESIZE / DEFAULT_BLOCKSIZE));
+       fprintf(stderr, "\tdefault write_offset is %" PRIu64 " bytes\n",
+               (__uint64_t) 0);
        exit(1);
 }
 
@@ -64,9 +78,9 @@ main(int argc, char *argv[])
        char *filename = NULL;
         int r;
 
-       filesize = ((__uint64_t)256)*1024*1024;
-       blocksize = 512;
-       count = filesize/blocksize;
+       filesize = DEFAULT_FILESIZE;
+       blocksize = DEFAULT_BLOCKSIZE;
+       count = (int) filesize / blocksize;
        verbose = 0;
        wsync = 0;
        seed = time(NULL);


<Prev in Thread] Current Thread [Next in Thread>
  • [PATCH 03/11] xfstests: randholes: document options a bit more, Alex Elder <=