Commit | Line | Data |
---|---|---|
9f988e2e JA |
1 | #ifndef FIO_OPTION_H |
2 | #define FIO_OPTION_H | |
3 | ||
07b3232d JA |
4 | #define FIO_MAX_OPTS 512 |
5 | ||
f5b6bb85 | 6 | #include <string.h> |
9f988e2e JA |
7 | #include "parse.h" |
8 | #include "flist.h" | |
9 | ||
10 | #define td_var_offset(var) ((size_t) &((struct thread_options *)0)->var) | |
11 | ||
07b3232d JA |
12 | int add_option(struct fio_option *); |
13 | void invalidate_profile_options(const char *); | |
14 | extern char *exec_profile; | |
9f988e2e | 15 | |
f5b6bb85 JA |
16 | void add_opt_posval(const char *, const char *, const char *); |
17 | void del_opt_posval(const char *, const char *); | |
7e356b2d JA |
18 | struct thread_data; |
19 | void fio_options_free(struct thread_data *); | |
bcbfeefa CE |
20 | char *get_name_idx(char *, int); |
21 | int set_name_idx(char *, char *, int); | |
f5b6bb85 | 22 | |
9af4a244 JA |
23 | extern struct fio_option fio_options[FIO_MAX_OPTS]; |
24 | ||
a8523a6a JA |
25 | extern int __fio_option_is_set(struct thread_options *, unsigned int off); |
26 | ||
27 | #define fio_option_is_set(__td, name) \ | |
28 | __fio_option_is_set((__td), td_var_offset(name)) | |
29 | ||
30 | extern void fio_option_mark_set(struct thread_options *, struct fio_option *); | |
31 | ||
f5b6bb85 JA |
32 | static inline int o_match(struct fio_option *o, const char *opt) |
33 | { | |
34 | if (!strcmp(o->name, opt)) | |
35 | return 1; | |
36 | else if (o->alias && !strcmp(o->alias, opt)) | |
37 | return 1; | |
38 | ||
39 | return 0; | |
40 | } | |
41 | ||
42 | static inline struct fio_option *find_option(struct fio_option *options, | |
43 | const char *opt) | |
44 | { | |
45 | struct fio_option *o; | |
46 | ||
47 | for (o = &options[0]; o->name; o++) | |
48 | if (o_match(o, opt)) | |
49 | return o; | |
50 | ||
51 | return NULL; | |
52 | } | |
53 | ||
9af4a244 JA |
54 | struct opt_group { |
55 | const char *name; | |
56 | unsigned int mask; | |
57 | }; | |
58 | ||
59 | enum opt_category { | |
e8b0e958 JA |
60 | __FIO_OPT_C_GENERAL = 0, |
61 | __FIO_OPT_C_IO, | |
62 | __FIO_OPT_C_FILE, | |
63 | __FIO_OPT_C_STAT, | |
64 | __FIO_OPT_C_LOG, | |
13fca827 | 65 | __FIO_OPT_C_PROFILE, |
e90a0adf | 66 | __FIO_OPT_C_ENGINE, |
e8b0e958 JA |
67 | __FIO_OPT_C_NR, |
68 | ||
69 | FIO_OPT_C_GENERAL = (1U << __FIO_OPT_C_GENERAL), | |
70 | FIO_OPT_C_IO = (1U << __FIO_OPT_C_IO), | |
71 | FIO_OPT_C_FILE = (1U << __FIO_OPT_C_FILE), | |
72 | FIO_OPT_C_STAT = (1U << __FIO_OPT_C_STAT), | |
73 | FIO_OPT_C_LOG = (1U << __FIO_OPT_C_LOG), | |
13fca827 | 74 | FIO_OPT_C_PROFILE = (1U << __FIO_OPT_C_PROFILE), |
e90a0adf | 75 | FIO_OPT_C_ENGINE = (1U << __FIO_OPT_C_ENGINE), |
e8b0e958 JA |
76 | FIO_OPT_C_INVALID = (1U << __FIO_OPT_C_NR), |
77 | }; | |
78 | ||
79 | enum opt_category_group { | |
80 | __FIO_OPT_G_RATE = 0, | |
e231bbe6 | 81 | __FIO_OPT_G_ZONE, |
e8b0e958 JA |
82 | __FIO_OPT_G_RWMIX, |
83 | __FIO_OPT_G_VERIFY, | |
84 | __FIO_OPT_G_TRIM, | |
85 | __FIO_OPT_G_IOLOG, | |
86 | __FIO_OPT_G_IO_DEPTH, | |
87 | __FIO_OPT_G_IO_FLOW, | |
0626037e JA |
88 | __FIO_OPT_G_DESC, |
89 | __FIO_OPT_G_FILENAME, | |
90 | __FIO_OPT_G_IO_BASIC, | |
a1f6afec JA |
91 | __FIO_OPT_G_CGROUP, |
92 | __FIO_OPT_G_RUNTIME, | |
10860056 JA |
93 | __FIO_OPT_G_PROCESS, |
94 | __FIO_OPT_G_CRED, | |
95 | __FIO_OPT_G_CLOCK, | |
3ceb458f JA |
96 | __FIO_OPT_G_IO_TYPE, |
97 | __FIO_OPT_G_THINKTIME, | |
98 | __FIO_OPT_G_RANDOM, | |
99 | __FIO_OPT_G_IO_BUF, | |
13fca827 | 100 | __FIO_OPT_G_TIOBENCH, |
bc3f552f | 101 | __FIO_OPT_G_ERR, |
e90a0adf JA |
102 | __FIO_OPT_G_E4DEFRAG, |
103 | __FIO_OPT_G_NETIO, | |
104 | __FIO_OPT_G_LIBAIO, | |
d4afedfd | 105 | __FIO_OPT_G_ACT, |
3e260a46 | 106 | __FIO_OPT_G_LATPROF, |
fc5c0345 | 107 | __FIO_OPT_G_RBD, |
6e7d7dfb | 108 | __FIO_OPT_G_GFAPI, |
e231bbe6 | 109 | __FIO_OPT_G_NR, |
9af4a244 | 110 | |
e8b0e958 | 111 | FIO_OPT_G_RATE = (1U << __FIO_OPT_G_RATE), |
9af4a244 | 112 | FIO_OPT_G_ZONE = (1U << __FIO_OPT_G_ZONE), |
e8b0e958 JA |
113 | FIO_OPT_G_RWMIX = (1U << __FIO_OPT_G_RWMIX), |
114 | FIO_OPT_G_VERIFY = (1U << __FIO_OPT_G_VERIFY), | |
115 | FIO_OPT_G_TRIM = (1U << __FIO_OPT_G_TRIM), | |
116 | FIO_OPT_G_IOLOG = (1U << __FIO_OPT_G_IOLOG), | |
117 | FIO_OPT_G_IO_DEPTH = (1U << __FIO_OPT_G_IO_DEPTH), | |
118 | FIO_OPT_G_IO_FLOW = (1U << __FIO_OPT_G_IO_FLOW), | |
0626037e JA |
119 | FIO_OPT_G_DESC = (1U << __FIO_OPT_G_DESC), |
120 | FIO_OPT_G_FILENAME = (1U << __FIO_OPT_G_FILENAME), | |
121 | FIO_OPT_G_IO_BASIC = (1U << __FIO_OPT_G_IO_BASIC), | |
a1f6afec JA |
122 | FIO_OPT_G_CGROUP = (1U << __FIO_OPT_G_CGROUP), |
123 | FIO_OPT_G_RUNTIME = (1U << __FIO_OPT_G_RUNTIME), | |
10860056 JA |
124 | FIO_OPT_G_PROCESS = (1U << __FIO_OPT_G_PROCESS), |
125 | FIO_OPT_G_CRED = (1U << __FIO_OPT_G_CRED), | |
126 | FIO_OPT_G_CLOCK = (1U << __FIO_OPT_G_CLOCK), | |
3ceb458f JA |
127 | FIO_OPT_G_IO_TYPE = (1U << __FIO_OPT_G_IO_TYPE), |
128 | FIO_OPT_G_THINKTIME = (1U << __FIO_OPT_G_THINKTIME), | |
129 | FIO_OPT_G_RANDOM = (1U << __FIO_OPT_G_RANDOM), | |
130 | FIO_OPT_G_IO_BUF = (1U << __FIO_OPT_G_IO_BUF), | |
13fca827 | 131 | FIO_OPT_G_TIOBENCH = (1U << __FIO_OPT_G_TIOBENCH), |
bc3f552f | 132 | FIO_OPT_G_ERR = (1U << __FIO_OPT_G_ERR), |
e90a0adf JA |
133 | FIO_OPT_G_E4DEFRAG = (1U << __FIO_OPT_G_E4DEFRAG), |
134 | FIO_OPT_G_NETIO = (1U << __FIO_OPT_G_NETIO), | |
135 | FIO_OPT_G_LIBAIO = (1U << __FIO_OPT_G_LIBAIO), | |
d4afedfd | 136 | FIO_OPT_G_ACT = (1U << __FIO_OPT_G_ACT), |
3e260a46 | 137 | FIO_OPT_G_LATPROF = (1U << __FIO_OPT_G_LATPROF), |
fc5c0345 | 138 | FIO_OPT_G_RBD = (1U << __FIO_OPT_G_RBD), |
6e7d7dfb | 139 | FIO_OPT_G_GFAPI = (1U << __FIO_OPT_G_GFAPI), |
9af4a244 JA |
140 | FIO_OPT_G_INVALID = (1U << __FIO_OPT_G_NR), |
141 | }; | |
142 | ||
143 | extern struct opt_group *opt_group_from_mask(unsigned int *mask); | |
e8b0e958 | 144 | extern struct opt_group *opt_group_cat_from_mask(unsigned int *mask); |
c504ee55 | 145 | extern struct fio_option *fio_option_find(const char *name); |
3c3ed070 | 146 | extern unsigned int fio_get_kb_base(void *); |
9af4a244 | 147 | |
9f988e2e | 148 | #endif |