From: Jens Axboe Date: Wed, 1 Jul 2009 07:24:05 +0000 (+0200) Subject: Add verify hook to options X-Git-Tag: fio-1.29-rc1~5 X-Git-Url: https://git.kernel.dk/?p=fio.git;a=commitdiff_plain;h=70a4c0c8417bba7c2e1e9a384b9acf226f5b9782 Add verify hook to options This allows us to individually verify options, instead of having a big function that attempts to fix things up. Signed-off-by: Jens Axboe --- diff --git a/parse.c b/parse.c index 1b38db5c..50433744 100644 --- a/parse.c +++ b/parse.c @@ -428,6 +428,12 @@ static int __handle_option(struct fio_option *o, const char *ptr, void *data, ret = 1; } + if (ret) + return ret; + + if (o->verify) + ret = o->verify(o, data); + return ret; } diff --git a/parse.h b/parse.h index 0cdc0894..677b62b9 100644 --- a/parse.h +++ b/parse.h @@ -48,6 +48,7 @@ struct fio_option { const char *def; /* default setting */ const struct value_pair posval[PARSE_MAX_VP];/* possible values */ const char *parent; /* parent option */ + int (*verify)(struct fio_option *, void *); }; typedef int (str_cb_fn)(void *, char *);