Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
#include <string.h>
enum write_mode {
#include <string.h>
enum write_mode {
printf("Creating file %s of length %zu, random seed %u\n", argv[1], len,
seed);
printf("Creating file %s of length %zu, random seed %u\n", argv[1], len,
seed);
- if (strcmp(argv[4], "-r") == 0) {
- printf("Generating random data\n");
- write_mode = WRITE_RANDOM;
- } else if (strcmp(argv[4], "-z") == 0) {
- printf("Filling with zeroes (compressible pattern)\n");
- write_mode = WRITE_ZEROES;
- } else {
- printf("Invalid argument %s\n", argv[4]);
- exit(EXIT_FAILURE);
- }
-
for (i = 4; i < argc; i++) {
if (strcmp(argv[i], "-z") == 0) {
write_mode = WRITE_ZEROES;
for (i = 4; i < argc; i++) {
if (strcmp(argv[i], "-z") == 0) {
write_mode = WRITE_ZEROES;
- if (verify_mode) {
- printf("Verification mode activated.\n");
- }
-
switch (write_mode) {
case WRITE_RANDOM:
switch (write_mode) {
case WRITE_RANDOM:
+ printf("Generating random data\n");
+ break;
+ printf("Filling with zeroes (compressible pattern)\n");
break;
default:
printf("Unsupported write-mode\n");
exit(EXIT_FAILURE);
}
break;
default:
printf("Unsupported write-mode\n");
exit(EXIT_FAILURE);
}
+ if (verify_mode) {
+ printf("Verification mode activated.\n");
+ }
+
/* Grow file */
pos = lseek(fd, len - 1, SEEK_SET);
if (pos < 0) {
/* Grow file */
pos = lseek(fd, len - 1, SEEK_SET);
if (pos < 0) {