X-Git-Url: http://git.efficios.com/?p=test-ssd.git;a=blobdiff_plain;f=test-ssd-write.c;h=49a4238f28fec84a44c78e08c07854954e874070;hp=2bce0fc8f65b3e68046e3194b008f13d040cd498;hb=8b048fcdf0861c07124be3f56c80cc3f84d8b65a;hpb=e3027339976586284af5f5d437104bf5be217cc4;ds=sidebyside diff --git a/test-ssd-write.c b/test-ssd-write.c index 2bce0fc..49a4238 100644 --- a/test-ssd-write.c +++ b/test-ssd-write.c @@ -71,7 +71,7 @@ #include enum write_mode { - WRITE_RANDOM, + WRITE_RANDOM = 0, WRITE_ZEROES, }; @@ -236,17 +236,6 @@ int main(int argc, char **argv) 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; @@ -255,19 +244,22 @@ int main(int argc, char **argv) } } - if (verify_mode) { - printf("Verification mode activated.\n"); - } - switch (write_mode) { case WRITE_RANDOM: + printf("Generating random data\n"); + break; case WRITE_ZEROES: + printf("Filling with zeroes (compressible pattern)\n"); 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) {