blob: c6c2086e0a76286a87f44bbb469307ccdddc09e4 [file] [log] [blame]
Jens Axboe9f988e22010-03-04 10:42:38 +01001#ifndef FIO_OPTION_H
2#define FIO_OPTION_H
3
Jens Axboe07b32322010-03-05 09:48:44 +01004#define FIO_MAX_OPTS 512
5
Jens Axboef5b6bb82010-03-05 10:09:59 +01006#include <string.h>
Jens Axboe9f988e22010-03-04 10:42:38 +01007#include "parse.h"
8#include "flist.h"
9
10#define td_var_offset(var) ((size_t) &((struct thread_options *)0)->var)
11
Jens Axboe07b32322010-03-05 09:48:44 +010012int add_option(struct fio_option *);
13void invalidate_profile_options(const char *);
14extern char *exec_profile;
Jens Axboe9f988e22010-03-04 10:42:38 +010015
Jens Axboef5b6bb82010-03-05 10:09:59 +010016void add_opt_posval(const char *, const char *, const char *);
17void del_opt_posval(const char *, const char *);
18
19static inline int o_match(struct fio_option *o, const char *opt)
20{
21 if (!strcmp(o->name, opt))
22 return 1;
23 else if (o->alias && !strcmp(o->alias, opt))
24 return 1;
25
26 return 0;
27}
28
29static inline struct fio_option *find_option(struct fio_option *options,
30 const char *opt)
31{
32 struct fio_option *o;
33
34 for (o = &options[0]; o->name; o++)
35 if (o_match(o, opt))
36 return o;
37
38 return NULL;
39}
40
Jens Axboe9f988e22010-03-04 10:42:38 +010041#endif