Add verify hook to options
authorJens Axboe <jens.axboe@oracle.com>
Wed, 1 Jul 2009 07:24:05 +0000 (09:24 +0200)
committerJens Axboe <jens.axboe@oracle.com>
Wed, 1 Jul 2009 07:24:05 +0000 (09:24 +0200)
This allows us to individually verify options, instead of having
a big function that attempts to fix things up.

Signed-off-by: Jens Axboe <jens.axboe@oracle.com>
parse.c
parse.h

diff --git a/parse.c b/parse.c
index 1b38db5c2d789d9cbce07658b325aa066f616e37..5043374405d8a1e262687a5a1bdcac90f18990cf 100644 (file)
--- 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 0cdc0894ae207be6f674c8ca963462c7af423b7f..677b62b969850582c8e6419d838ec549b6b5dc5f 100644 (file)
--- 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 *);