X-Git-Url: https://git.kernel.dk/?p=fio.git;a=blobdiff_plain;f=options.c;h=5ee70befced30f6729f6684b725d5493c9ca22ae;hp=57e9af5b4676296f22a1aee8a97fd379826afb53;hb=7b504eddc4b0;hpb=bc6a0a5d5625b13bb9630bcdcf9d4041b1639a94 diff --git a/options.c b/options.c index 57e9af5b..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; @@ -1231,6 +1243,7 @@ struct fio_option fio_options[FIO_MAX_OPTS] = { .parent = "filename", .hide = 0, .def = "none", + .cb = str_lockfile_cb, .category = FIO_OPT_C_FILE, .group = FIO_OPT_G_FILENAME, .posval = { @@ -3773,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; }