X-Git-Url: https://git.kernel.dk/?p=fio.git;a=blobdiff_plain;f=parse.c;h=545c3de56bd9600b3e228f3c392125faf627102c;hp=cdd9ac7e3cf0cb9e81a25d2fd43aba205c90ce88;hb=481c242ba127069bed993fc7cc79a0889830ab6b;hpb=e476994eed3bee246ca166ea6ad6018911408e9b diff --git a/parse.c b/parse.c index cdd9ac7e..545c3de5 100644 --- a/parse.c +++ b/parse.c @@ -15,7 +15,7 @@ #include "debug.h" #include "options.h" -static struct fio_option *fio_options; +static struct fio_option *__fio_options; extern unsigned int fio_get_kb_base(void *); static int vp_cmp(const void *p1, const void *p2) @@ -260,7 +260,7 @@ int str_to_decimal(const char *str, long long *val, int kilo, void *data) return 0; } -static int check_str_bytes(const char *p, long long *val, void *data) +int check_str_bytes(const char *p, long long *val, void *data) { return str_to_decimal(p, val, 1, data); } @@ -770,14 +770,14 @@ static int opt_cmp(const void *p1, const void *p2) if (*(char **)p1) { s = strdup(*((char **) p1)); - o = get_option(s, fio_options, &foo); + o = get_option(s, __fio_options, &foo); if (o) prio1 = o->prio; free(s); } if (*(char **)p2) { s = strdup(*((char **) p2)); - o = get_option(s, fio_options, &foo); + o = get_option(s, __fio_options, &foo); if (o) prio2 = o->prio; free(s); @@ -788,9 +788,9 @@ static int opt_cmp(const void *p1, const void *p2) void sort_options(char **opts, struct fio_option *options, int num_opts) { - fio_options = options; + __fio_options = options; qsort(opts, num_opts, sizeof(char *), opt_cmp); - fio_options = NULL; + __fio_options = NULL; } int parse_cmd_option(const char *opt, const char *val, @@ -833,9 +833,8 @@ int parse_option(char *opt, const char *input, return 1; } - if (!handle_option(*o, post, data)) { + if (!handle_option(*o, post, data)) return 0; - } log_err("fio: failed parsing %s\n", input); return 1; @@ -1047,6 +1046,10 @@ void option_init(struct fio_option *o) (o->roff1 || o->roff2 || o->roff3 || o->roff4))) { log_err("Option %s: both cb and offset given\n", o->name); } + if (!o->category) { + log_info("Options %s: no category defined. Setting to misc\n", o->name); + o->category = FIO_OPT_C_GENERAL; + } } /* @@ -1059,8 +1062,11 @@ void options_init(struct fio_option *options) dprint(FD_PARSE, "init options\n"); - for (o = &options[0]; o->name; o++) + for (o = &options[0]; o->name; o++) { option_init(o); + if (o->inverse) + o->inv_opt = find_option(options, o->inverse); + } } void options_free(struct fio_option *options, void *data)