projects
/
fio.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Make parse.h C++ safe by avoiding "or" keyword
[fio.git]
/
options.c
diff --git
a/options.c
b/options.c
index 57e9af5b4676296f22a1aee8a97fd379826afb53..4dcefba05511879ad658efce073f699591351e3d 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;
}
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;
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",
.parent = "filename",
.hide = 0,
.def = "none",
+ .cb = str_lockfile_cb,
.category = FIO_OPT_C_FILE,
.group = FIO_OPT_G_FILENAME,
.posval = {
.category = FIO_OPT_C_FILE,
.group = FIO_OPT_G_FILENAME,
.posval = {
@@
-1901,18
+1914,18
@@
struct fio_option fio_options[FIO_MAX_OPTS] = {
{ .ival = "wait_before",
.oval = SYNC_FILE_RANGE_WAIT_BEFORE,
.help = "SYNC_FILE_RANGE_WAIT_BEFORE",
{ .ival = "wait_before",
.oval = SYNC_FILE_RANGE_WAIT_BEFORE,
.help = "SYNC_FILE_RANGE_WAIT_BEFORE",
- .or
= 1,
+ .or
val
= 1,
},
{ .ival = "write",
.oval = SYNC_FILE_RANGE_WRITE,
.help = "SYNC_FILE_RANGE_WRITE",
},
{ .ival = "write",
.oval = SYNC_FILE_RANGE_WRITE,
.help = "SYNC_FILE_RANGE_WRITE",
- .or
= 1,
+ .or
val
= 1,
},
{
.ival = "wait_after",
.oval = SYNC_FILE_RANGE_WAIT_AFTER,
.help = "SYNC_FILE_RANGE_WAIT_AFTER",
},
{
.ival = "wait_after",
.oval = SYNC_FILE_RANGE_WAIT_AFTER,
.help = "SYNC_FILE_RANGE_WAIT_AFTER",
- .or
= 1,
+ .or
val
= 1,
},
},
.type = FIO_OPT_STR_MULTI,
},
},
.type = FIO_OPT_STR_MULTI,
@@
-3727,7
+3740,7
@@
void options_mem_dupe(void *data, struct fio_option *options)
if (o->type != FIO_OPT_STR_STORE)
continue;
if (o->type != FIO_OPT_STR_STORE)
continue;
- ptr = td_var(data, o->off1);
+ ptr = td_var(data, o
, o
->off1);
if (*ptr)
*ptr = strdup(*ptr);
}
if (*ptr)
*ptr = strdup(*ptr);
}
@@
-3773,7
+3786,13
@@
int add_option(struct fio_option *o)
__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));
memcpy(&fio_options[opt_index], o, sizeof(*o));
+ fio_options[opt_index + 1].name = NULL;
return 0;
}
return 0;
}