parse: get rid of raw option offsets
[fio.git] / options.c
index b1b6c8e969381cc44cdde496fbcb4ad174c84a84..5ee70befced30f6729f6684b725d5493c9ca22ae 100644 (file)
--- a/options.c
+++ b/options.c
@@ -821,6 +821,18 @@ static int str_directory_cb(void *data, const char fio_unused *str)
        return 0;
 }
 
+static int str_lockfile_cb(void *data, const char fio_unused *str)
+{
+       struct thread_data *td = data;
+
+       if (td->files_index) {
+               log_err("fio: lockfile= option must precede filename=\n");
+               return 1;
+       }
+
+       return 0;
+}
+
 static int str_opendir_cb(void *data, const char fio_unused *str)
 {
        struct thread_data *td = data;
@@ -1227,9 +1239,11 @@ struct fio_option fio_options[FIO_MAX_OPTS] = {
                .type   = FIO_OPT_STR,
                .off1   = td_var_offset(file_lock_mode),
                .help   = "Lock file when doing IO to it",
+               .prio   = 1,
                .parent = "filename",
                .hide   = 0,
                .def    = "none",
+               .cb     = str_lockfile_cb,
                .category = FIO_OPT_C_FILE,
                .group  = FIO_OPT_G_FILENAME,
                .posval = {
@@ -1656,7 +1670,7 @@ struct fio_option fio_options[FIO_MAX_OPTS] = {
        {
                .name   = "randseed",
                .lname  = "The random generator seed",
-               .type   = FIO_OPT_INT,
+               .type   = FIO_OPT_STR_VAL,
                .off1   = td_var_offset(rand_seed),
                .help   = "Set the random generator seed value",
                .parent = "rw",
@@ -2017,6 +2031,15 @@ struct fio_option fio_options[FIO_MAX_OPTS] = {
                .category = FIO_OPT_C_GENERAL,
                .group  = FIO_OPT_G_RUNTIME,
        },
+       {
+               .name   = "verify_only",
+               .lname  = "Verify only",
+               .type   = FIO_OPT_STR_SET,
+               .off1   = td_var_offset(verify_only),
+               .help   = "Verifies previously written data is still valid",
+               .category = FIO_OPT_C_GENERAL,
+               .group  = FIO_OPT_G_RUNTIME,
+       },
        {
                .name   = "ramp_time",
                .lname  = "Ramp time",
@@ -3763,7 +3786,13 @@ int add_option(struct fio_option *o)
                __o++;
        }
 
+       if (opt_index + 1 == FIO_MAX_OPTS) {
+               log_err("fio: FIO_MAX_OPTS is too small\n");
+               return 1;
+       }
+
        memcpy(&fio_options[opt_index], o, sizeof(*o));
+       fio_options[opt_index + 1].name = NULL;
        return 0;
 }