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