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 | ||
f5b6bb85 JA |
25 | static inline int o_match(struct fio_option *o, const char *opt) |
26 | { | |
27 | if (!strcmp(o->name, opt)) | |
28 | return 1; | |
29 | else if (o->alias && !strcmp(o->alias, opt)) | |
30 | return 1; | |
31 | ||
32 | return 0; | |
33 | } | |
34 | ||
35 | static inline struct fio_option *find_option(struct fio_option *options, | |
36 | const char *opt) | |
37 | { | |
38 | struct fio_option *o; | |
39 | ||
40 | for (o = &options[0]; o->name; o++) | |
41 | if (o_match(o, opt)) | |
42 | return o; | |
43 | ||
44 | return NULL; | |
45 | } | |
46 | ||
9af4a244 JA |
47 | struct opt_group { |
48 | const char *name; | |
49 | unsigned int mask; | |
50 | }; | |
51 | ||
52 | enum opt_category { | |
e8b0e958 JA |
53 | __FIO_OPT_C_GENERAL = 0, |
54 | __FIO_OPT_C_IO, | |
55 | __FIO_OPT_C_FILE, | |
56 | __FIO_OPT_C_STAT, | |
57 | __FIO_OPT_C_LOG, | |
13fca827 | 58 | __FIO_OPT_C_PROFILE, |
e90a0adf | 59 | __FIO_OPT_C_ENGINE, |
e8b0e958 JA |
60 | __FIO_OPT_C_NR, |
61 | ||
62 | FIO_OPT_C_GENERAL = (1U << __FIO_OPT_C_GENERAL), | |
63 | FIO_OPT_C_IO = (1U << __FIO_OPT_C_IO), | |
64 | FIO_OPT_C_FILE = (1U << __FIO_OPT_C_FILE), | |
65 | FIO_OPT_C_STAT = (1U << __FIO_OPT_C_STAT), | |
66 | FIO_OPT_C_LOG = (1U << __FIO_OPT_C_LOG), | |
13fca827 | 67 | FIO_OPT_C_PROFILE = (1U << __FIO_OPT_C_PROFILE), |
e90a0adf | 68 | FIO_OPT_C_ENGINE = (1U << __FIO_OPT_C_ENGINE), |
e8b0e958 JA |
69 | FIO_OPT_C_INVALID = (1U << __FIO_OPT_C_NR), |
70 | }; | |
71 | ||
72 | enum opt_category_group { | |
73 | __FIO_OPT_G_RATE = 0, | |
e231bbe6 | 74 | __FIO_OPT_G_ZONE, |
e8b0e958 JA |
75 | __FIO_OPT_G_RWMIX, |
76 | __FIO_OPT_G_VERIFY, | |
77 | __FIO_OPT_G_TRIM, | |
78 | __FIO_OPT_G_IOLOG, | |
79 | __FIO_OPT_G_IO_DEPTH, | |
80 | __FIO_OPT_G_IO_FLOW, | |
0626037e JA |
81 | __FIO_OPT_G_DESC, |
82 | __FIO_OPT_G_FILENAME, | |
83 | __FIO_OPT_G_IO_BASIC, | |
a1f6afec JA |
84 | __FIO_OPT_G_CGROUP, |
85 | __FIO_OPT_G_RUNTIME, | |
10860056 JA |
86 | __FIO_OPT_G_PROCESS, |
87 | __FIO_OPT_G_CRED, | |
88 | __FIO_OPT_G_CLOCK, | |
3ceb458f JA |
89 | __FIO_OPT_G_IO_TYPE, |
90 | __FIO_OPT_G_THINKTIME, | |
91 | __FIO_OPT_G_RANDOM, | |
92 | __FIO_OPT_G_IO_BUF, | |
13fca827 | 93 | __FIO_OPT_G_TIOBENCH, |
bc3f552f | 94 | __FIO_OPT_G_ERR, |
e90a0adf JA |
95 | __FIO_OPT_G_E4DEFRAG, |
96 | __FIO_OPT_G_NETIO, | |
97 | __FIO_OPT_G_LIBAIO, | |
d4afedfd | 98 | __FIO_OPT_G_ACT, |
3e260a46 | 99 | __FIO_OPT_G_LATPROF, |
fc5c0345 | 100 | __FIO_OPT_G_RBD, |
e231bbe6 | 101 | __FIO_OPT_G_NR, |
9af4a244 | 102 | |
e8b0e958 | 103 | FIO_OPT_G_RATE = (1U << __FIO_OPT_G_RATE), |
9af4a244 | 104 | FIO_OPT_G_ZONE = (1U << __FIO_OPT_G_ZONE), |
e8b0e958 JA |
105 | FIO_OPT_G_RWMIX = (1U << __FIO_OPT_G_RWMIX), |
106 | FIO_OPT_G_VERIFY = (1U << __FIO_OPT_G_VERIFY), | |
107 | FIO_OPT_G_TRIM = (1U << __FIO_OPT_G_TRIM), | |
108 | FIO_OPT_G_IOLOG = (1U << __FIO_OPT_G_IOLOG), | |
109 | FIO_OPT_G_IO_DEPTH = (1U << __FIO_OPT_G_IO_DEPTH), | |
110 | FIO_OPT_G_IO_FLOW = (1U << __FIO_OPT_G_IO_FLOW), | |
0626037e JA |
111 | FIO_OPT_G_DESC = (1U << __FIO_OPT_G_DESC), |
112 | FIO_OPT_G_FILENAME = (1U << __FIO_OPT_G_FILENAME), | |
113 | FIO_OPT_G_IO_BASIC = (1U << __FIO_OPT_G_IO_BASIC), | |
a1f6afec JA |
114 | FIO_OPT_G_CGROUP = (1U << __FIO_OPT_G_CGROUP), |
115 | FIO_OPT_G_RUNTIME = (1U << __FIO_OPT_G_RUNTIME), | |
10860056 JA |
116 | FIO_OPT_G_PROCESS = (1U << __FIO_OPT_G_PROCESS), |
117 | FIO_OPT_G_CRED = (1U << __FIO_OPT_G_CRED), | |
118 | FIO_OPT_G_CLOCK = (1U << __FIO_OPT_G_CLOCK), | |
3ceb458f JA |
119 | FIO_OPT_G_IO_TYPE = (1U << __FIO_OPT_G_IO_TYPE), |
120 | FIO_OPT_G_THINKTIME = (1U << __FIO_OPT_G_THINKTIME), | |
121 | FIO_OPT_G_RANDOM = (1U << __FIO_OPT_G_RANDOM), | |
122 | FIO_OPT_G_IO_BUF = (1U << __FIO_OPT_G_IO_BUF), | |
13fca827 | 123 | FIO_OPT_G_TIOBENCH = (1U << __FIO_OPT_G_TIOBENCH), |
bc3f552f | 124 | FIO_OPT_G_ERR = (1U << __FIO_OPT_G_ERR), |
e90a0adf JA |
125 | FIO_OPT_G_E4DEFRAG = (1U << __FIO_OPT_G_E4DEFRAG), |
126 | FIO_OPT_G_NETIO = (1U << __FIO_OPT_G_NETIO), | |
127 | FIO_OPT_G_LIBAIO = (1U << __FIO_OPT_G_LIBAIO), | |
d4afedfd | 128 | FIO_OPT_G_ACT = (1U << __FIO_OPT_G_ACT), |
3e260a46 | 129 | FIO_OPT_G_LATPROF = (1U << __FIO_OPT_G_LATPROF), |
fc5c0345 | 130 | FIO_OPT_G_RBD = (1U << __FIO_OPT_G_RBD), |
9af4a244 JA |
131 | FIO_OPT_G_INVALID = (1U << __FIO_OPT_G_NR), |
132 | }; | |
133 | ||
134 | extern struct opt_group *opt_group_from_mask(unsigned int *mask); | |
e8b0e958 | 135 | extern struct opt_group *opt_group_cat_from_mask(unsigned int *mask); |
c504ee55 | 136 | extern struct fio_option *fio_option_find(const char *name); |
3c3ed070 | 137 | extern unsigned int fio_get_kb_base(void *); |
9af4a244 | 138 | |
9f988e2e | 139 | #endif |