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~83 X-Git-Url: https://git.kernel.dk/?p=fio.git;a=commitdiff_plain;h=ca718005e5384fd47459f5cbaa0e617b5000c7c7;hp=df07130a05d53b6a40b6783384600e10641d76d2 parse: add posval support to FIO_OPT_INT Signed-off-by: Jens Axboe --- diff --git a/parse.c b/parse.c index 5b8e10f9..dddcb8e5 100644 --- a/parse.c +++ b/parse.c @@ -465,6 +465,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);