#include "blkdev.h"
#include "c.h"
#include "exitcodes.h"
+#include "strutils.h"
#include "closestream.h"
#define XALLOC_EXIT_CODE FSCK_EX_ERROR
static char *outbuffer;
-static size_t blksize;
+static size_t blksize = 0;
#endif /* INCLUDE_FS_TESTS */
fputs(_(" -v, --verbose be more verbose\n"), stream);
fputs(_(" -x, --destination <dir> extract into directory\n"), stream);
fputs(_(" -y for compatibility only, ignored\n"), stream);
+ fputs(_(" -b, --blocksize SIZE use this blocksize, defaults to page size\n"), stream);
fputs(USAGE_SEPARATOR, stream);
fputs(USAGE_HELP, stream);
fputs(USAGE_VERSION, stream);
{"verbose", no_argument, 0, 'v'},
{"version", no_argument, 0, 'V'},
{"help", no_argument, 0, 'h'},
+ {"blocksize", required_argument, 0, 'b'},
{NULL, no_argument, 0, '0'},
};
atexit(close_stdout);
/* command line options */
- while ((c = getopt_long(argc, argv, "ayx:vVh", longopts, NULL)) != EOF)
+ while ((c = getopt_long(argc, argv, "ayx:vVhb:", longopts, NULL)) != EOF)
switch (c) {
case 'a': /* ignore */
case 'y':
case 'v':
opt_verbose++;
break;
+ case 'b':
+#ifdef INCLUDE_FS_TESTS
+ blksize = strtou32_or_err(optarg, _("invalid blocksize argument"));
+#endif
+ break;
default:
usage(FSCK_EX_USAGE);
}
test_super(&start, &length);
test_crc(start);
#ifdef INCLUDE_FS_TESTS
- blksize = getpagesize();
+ if (blksize == 0)
+ blksize = getpagesize();
outbuffer = xmalloc(blksize * 2);
test_fs(start);
#endif