From: Jens Axboe Date: Tue, 9 Apr 2013 19:02:15 +0000 (+0200) Subject: parse: add posval support to FIO_OPT_INT X-Git-Tag: fio-2.1~57^2~8 X-Git-Url: https://git.kernel.dk/?p=fio.git;a=commitdiff_plain;h=d926d535c7e1a12ff1a57a718ed8e84f617b0172 parse: add posval support to FIO_OPT_INT Signed-off-by: Jens Axboe --- diff --git a/parse.c b/parse.c index a701a5bb..8885f594 100644 --- a/parse.c +++ b/parse.c @@ -464,6 +464,24 @@ static int __handle_option(struct fio_option *o, const char *ptr, void *data, " (%u min)\n", ull, o->minval); return 1; } + if (o->posval[0].ival) { + posval_sort(o, posval); + + ret = 1; + for (i = 0; i < PARSE_MAX_VP; i++) { + vp = &posval[i]; + if (!vp->ival || vp->ival[0] == '\0') + continue; + if (vp->oval == ull) { + ret = 0; + break; + } + } + if (ret) { + log_err("value %d not in allowed range\n",ull); + return 1; + } + } if (fn) ret = fn(data, &ull);