Add crc32c checksum
[fio.git] / options.c
index b8df1da1f90756f68cd5fd15b50500b646ba55b3..5b4e3938d5765711a36c2845e1b6f7eb8bc14c70 100644 (file)
--- a/options.c
+++ b/options.c
@@ -6,10 +6,13 @@
 #include <getopt.h>
 #include <assert.h>
 #include <libgen.h>
+#include <fcntl.h>
+#include <sys/types.h>
+#include <sys/stat.h>
 
 #include "fio.h"
 #include "parse.h"
-#include "fls.h"
+#include "lib/fls.h"
 
 #define td_var_offset(var)     ((size_t) &((struct thread_options *)0)->var)
 
@@ -403,7 +406,7 @@ static int str_verify_pattern_cb(void *data, unsigned int *off)
        struct thread_data *td = data;
        unsigned int msb;
 
-       msb = fls(*off);
+       msb = __fls(*off);
        if (msb <= 8)
                td->o.verify_pattern_bytes = 1;
        else if (msb <= 16)
@@ -460,6 +463,7 @@ static struct fio_option options[] = {
                .type   = FIO_OPT_STR_STORE,
                .off1   = td_var_offset(filename),
                .cb     = str_filename_cb,
+               .prio   = 1, /* must come before "directory" */
                .help   = "File(s) to use for the workload",
        },
        {
@@ -553,6 +557,11 @@ static struct fio_option options[] = {
                          { .ival = "posixaio",
                            .help = "POSIX asynchronous IO",
                          },
+#endif
+#ifdef FIO_HAVE_SOLARISAIO
+                         { .ival = "solarisaio",
+                           .help = "Solaris native asynchronous IO",
+                         },
 #endif
                          { .ival = "mmap",
                            .help = "Memory mapped IO",
@@ -604,6 +613,7 @@ static struct fio_option options[] = {
        },
        {
                .name   = "iodepth_batch",
+               .alias  = "iodepth_batch_submit",
                .type   = FIO_OPT_INT,
                .off1   = td_var_offset(iodepth_batch),
                .help   = "Number of IO to submit in one go",
@@ -611,6 +621,15 @@ static struct fio_option options[] = {
                .minval = 1,
                .def    = "1",
        },
+       {
+               .name   = "iodepth_batch_complete",
+               .type   = FIO_OPT_INT,
+               .off1   = td_var_offset(iodepth_batch_complete),
+               .help   = "Number of IO to retrieve in one go",
+               .parent = "iodepth",
+               .minval = 0,
+               .def    = "1",
+       },
        {
                .name   = "iodepth_low",
                .type   = FIO_OPT_INT,
@@ -705,7 +724,7 @@ static struct fio_option options[] = {
                .name   = "softrandommap",
                .type   = FIO_OPT_BOOL,
                .off1   = td_var_offset(softrandommap),
-               .help   = "Allow randommap to fail and continue witout",
+               .help   = "Set norandommap if randommap allocation fails",
                .parent = "norandommap",
                .def    = "0",
        },
@@ -870,6 +889,10 @@ static struct fio_option options[] = {
                            .oval = VERIFY_CRC32,
                            .help = "Use crc32 checksums for verification",
                          },
+                         { .ival = "crc32c",
+                           .oval = VERIFY_CRC32C,
+                           .help = "Use crc32c checksums for verification",
+                         },
                          { .ival = "crc16",
                            .oval = VERIFY_CRC16,
                            .help = "Use crc16 checksums for verification",
@@ -1253,7 +1276,7 @@ static struct fio_option options[] = {
                .name   = "disk_util",
                .type   = FIO_OPT_BOOL,
                .off1   = td_var_offset(do_disk_util),
-               .help   = "Log disk utilization stats",
+               .help   = "Log disk utilization statistics",
                .def    = "1",
        },
 #endif
@@ -1275,7 +1298,7 @@ void fio_options_dup_and_init(struct option *long_options)
 
        o = &options[0];
        while (o->name) {
-               long_options[i].name = o->name;
+               long_options[i].name = (char *) o->name;
                long_options[i].val = FIO_GETOPT_JOB;
                if (o->type == FIO_OPT_STR_SET)
                        long_options[i].has_arg = no_argument;
@@ -1288,9 +1311,16 @@ void fio_options_dup_and_init(struct option *long_options)
        }
 }
 
-int fio_option_parse(struct thread_data *td, const char *opt)
+int fio_options_parse(struct thread_data *td, char **opts, int num_opts)
 {
-       return parse_option(opt, options, td);
+       int i, ret;
+
+       sort_options(opts, options, num_opts);
+
+       for (ret = 0, i = 0; i < num_opts; i++)
+               ret |= parse_option(opts[i], options, td);
+
+       return ret;
 }
 
 int fio_cmd_option_parse(struct thread_data *td, const char *opt, char *val)