Categorize engine and profile options
[fio.git] / options.h
CommitLineData
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
12int add_option(struct fio_option *);
13void invalidate_profile_options(const char *);
14extern char *exec_profile;
9f988e2e 15
f5b6bb85
JA
16void add_opt_posval(const char *, const char *, const char *);
17void del_opt_posval(const char *, const char *);
7e356b2d
JA
18struct thread_data;
19void fio_options_free(struct thread_data *);
f5b6bb85
JA
20
21static 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
31static 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
81c6b6cd
JA
43struct opt_group {
44 const char *name;
45 unsigned int mask;
46};
47
48enum opt_category {
49 __FIO_OPT_C_GENERAL = 0,
50 __FIO_OPT_C_IO,
51 __FIO_OPT_C_FILE,
52 __FIO_OPT_C_STAT,
53 __FIO_OPT_C_LOG,
54 __FIO_OPT_C_PROFILE,
e90a0adf 55 __FIO_OPT_C_ENGINE,
81c6b6cd
JA
56 __FIO_OPT_C_NR,
57
58 FIO_OPT_C_GENERAL = (1U << __FIO_OPT_C_GENERAL),
59 FIO_OPT_C_IO = (1U << __FIO_OPT_C_IO),
60 FIO_OPT_C_FILE = (1U << __FIO_OPT_C_FILE),
61 FIO_OPT_C_STAT = (1U << __FIO_OPT_C_STAT),
62 FIO_OPT_C_LOG = (1U << __FIO_OPT_C_LOG),
63 FIO_OPT_C_PROFILE = (1U << __FIO_OPT_C_PROFILE),
e90a0adf 64 FIO_OPT_C_ENGINE = (1U << __FIO_OPT_C_ENGINE),
81c6b6cd
JA
65 FIO_OPT_C_INVALID = (1U << __FIO_OPT_C_NR),
66};
67
68enum opt_category_group {
69 __FIO_OPT_G_RATE = 0,
70 __FIO_OPT_G_ZONE,
71 __FIO_OPT_G_RWMIX,
72 __FIO_OPT_G_VERIFY,
73 __FIO_OPT_G_TRIM,
74 __FIO_OPT_G_IOLOG,
75 __FIO_OPT_G_IO_DEPTH,
76 __FIO_OPT_G_IO_FLOW,
77 __FIO_OPT_G_DESC,
78 __FIO_OPT_G_FILENAME,
79 __FIO_OPT_G_IO_BASIC,
80 __FIO_OPT_G_CGROUP,
81 __FIO_OPT_G_RUNTIME,
82 __FIO_OPT_G_PROCESS,
83 __FIO_OPT_G_CRED,
84 __FIO_OPT_G_CLOCK,
85 __FIO_OPT_G_IO_TYPE,
86 __FIO_OPT_G_THINKTIME,
87 __FIO_OPT_G_RANDOM,
88 __FIO_OPT_G_IO_BUF,
89 __FIO_OPT_G_TIOBENCH,
90 __FIO_OPT_G_ERR,
e90a0adf
JA
91 __FIO_OPT_G_E4DEFRAG,
92 __FIO_OPT_G_NETIO,
93 __FIO_OPT_G_LIBAIO,
94 __FIO_OPT_G_TIOPROF,
81c6b6cd
JA
95 __FIO_OPT_G_NR,
96
97 FIO_OPT_G_RATE = (1U << __FIO_OPT_G_RATE),
98 FIO_OPT_G_ZONE = (1U << __FIO_OPT_G_ZONE),
99 FIO_OPT_G_RWMIX = (1U << __FIO_OPT_G_RWMIX),
100 FIO_OPT_G_VERIFY = (1U << __FIO_OPT_G_VERIFY),
101 FIO_OPT_G_TRIM = (1U << __FIO_OPT_G_TRIM),
102 FIO_OPT_G_IOLOG = (1U << __FIO_OPT_G_IOLOG),
103 FIO_OPT_G_IO_DEPTH = (1U << __FIO_OPT_G_IO_DEPTH),
104 FIO_OPT_G_IO_FLOW = (1U << __FIO_OPT_G_IO_FLOW),
105 FIO_OPT_G_DESC = (1U << __FIO_OPT_G_DESC),
106 FIO_OPT_G_FILENAME = (1U << __FIO_OPT_G_FILENAME),
107 FIO_OPT_G_IO_BASIC = (1U << __FIO_OPT_G_IO_BASIC),
108 FIO_OPT_G_CGROUP = (1U << __FIO_OPT_G_CGROUP),
109 FIO_OPT_G_RUNTIME = (1U << __FIO_OPT_G_RUNTIME),
110 FIO_OPT_G_PROCESS = (1U << __FIO_OPT_G_PROCESS),
111 FIO_OPT_G_CRED = (1U << __FIO_OPT_G_CRED),
112 FIO_OPT_G_CLOCK = (1U << __FIO_OPT_G_CLOCK),
113 FIO_OPT_G_IO_TYPE = (1U << __FIO_OPT_G_IO_TYPE),
114 FIO_OPT_G_THINKTIME = (1U << __FIO_OPT_G_THINKTIME),
115 FIO_OPT_G_RANDOM = (1U << __FIO_OPT_G_RANDOM),
116 FIO_OPT_G_IO_BUF = (1U << __FIO_OPT_G_IO_BUF),
117 FIO_OPT_G_TIOBENCH = (1U << __FIO_OPT_G_TIOBENCH),
118 FIO_OPT_G_ERR = (1U << __FIO_OPT_G_ERR),
e90a0adf
JA
119 FIO_OPT_G_E4DEFRAG = (1U << __FIO_OPT_G_E4DEFRAG),
120 FIO_OPT_G_NETIO = (1U << __FIO_OPT_G_NETIO),
121 FIO_OPT_G_LIBAIO = (1U << __FIO_OPT_G_LIBAIO),
122 FIO_OPT_G_TIOPROF = (1U << __FIO_OPT_G_TIOPROF),
81c6b6cd
JA
123 FIO_OPT_G_INVALID = (1U << __FIO_OPT_G_NR),
124};
125
9f988e2e 126#endif