X-Git-Url: https://git.kernel.dk/?a=blobdiff_plain;ds=sidebyside;f=options.c;h=5ee70befced30f6729f6684b725d5493c9ca22ae;hb=f4faa0fd822c1915a031d1d5ce24dff68a420c1e;hp=82870112b06df1532e0b5607f444259942bbb892;hpb=363cffa71a96eb4c7595bb8c325a09eb01f766a5;p=fio.git diff --git a/options.c b/options.c index 82870112..5ee70bef 100644 --- 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 = { @@ -3772,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; }