Jens Axboe | 9f988e2 | 2010-03-04 10:42:38 +0100 | [diff] [blame] | 1 | #ifndef FIO_OPTION_H |
| 2 | #define FIO_OPTION_H |
| 3 | |
Jens Axboe | 07b3232 | 2010-03-05 09:48:44 +0100 | [diff] [blame] | 4 | #define FIO_MAX_OPTS 512 |
| 5 | |
Jens Axboe | f5b6bb8 | 2010-03-05 10:09:59 +0100 | [diff] [blame] | 6 | #include <string.h> |
Jens Axboe | 9f988e2 | 2010-03-04 10:42:38 +0100 | [diff] [blame] | 7 | #include "parse.h" |
| 8 | #include "flist.h" |
| 9 | |
| 10 | #define td_var_offset(var) ((size_t) &((struct thread_options *)0)->var) |
| 11 | |
Jens Axboe | 07b3232 | 2010-03-05 09:48:44 +0100 | [diff] [blame] | 12 | int add_option(struct fio_option *); |
| 13 | void invalidate_profile_options(const char *); |
| 14 | extern char *exec_profile; |
Jens Axboe | 9f988e2 | 2010-03-04 10:42:38 +0100 | [diff] [blame] | 15 | |
Jens Axboe | f5b6bb8 | 2010-03-05 10:09:59 +0100 | [diff] [blame] | 16 | void add_opt_posval(const char *, const char *, const char *); |
| 17 | void del_opt_posval(const char *, const char *); |
Jens Axboe | 7e356b2 | 2011-10-14 10:55:16 +0200 | [diff] [blame] | 18 | struct thread_data; |
| 19 | void fio_options_free(struct thread_data *); |
Jens Axboe | f5b6bb8 | 2010-03-05 10:09:59 +0100 | [diff] [blame] | 20 | |
| 21 | static inline int o_match(struct fio_option *o, const char *opt) |
| 22 | { |
| 23 | if (!strcmp(o->name, opt)) |
| 24 | return 1; |
| 25 | else if (o->alias && !strcmp(o->alias, opt)) |
| 26 | return 1; |
| 27 | |
| 28 | return 0; |
| 29 | } |
| 30 | |
| 31 | static inline struct fio_option *find_option(struct fio_option *options, |
| 32 | const char *opt) |
| 33 | { |
| 34 | struct fio_option *o; |
| 35 | |
| 36 | for (o = &options[0]; o->name; o++) |
| 37 | if (o_match(o, opt)) |
| 38 | return o; |
| 39 | |
| 40 | return NULL; |
| 41 | } |
| 42 | |
Jens Axboe | 9f988e2 | 2010-03-04 10:42:38 +0100 | [diff] [blame] | 43 | #endif |