server: make client connections fork off
[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 20
9af4a244
JA
21extern struct fio_option fio_options[FIO_MAX_OPTS];
22
f5b6bb85
JA
23static inline int o_match(struct fio_option *o, const char *opt)
24{
25 if (!strcmp(o->name, opt))
26 return 1;
27 else if (o->alias && !strcmp(o->alias, opt))
28 return 1;
29
30 return 0;
31}
32
33static inline struct fio_option *find_option(struct fio_option *options,
34 const char *opt)
35{
36 struct fio_option *o;
37
38 for (o = &options[0]; o->name; o++)
39 if (o_match(o, opt))
40 return o;
41
42 return NULL;
43}
44
9af4a244
JA
45struct opt_group {
46 const char *name;
47 unsigned int mask;
48};
49
50enum opt_category {
51 __FIO_OPT_G_DESC = 0,
e231bbe6
JA
52 __FIO_OPT_G_FILE,
53 __FIO_OPT_G_IO,
54 __FIO_OPT_G_IO_DDIR,
55 __FIO_OPT_G_IO_BUF,
56 __FIO_OPT_G_IO_ENG,
57 __FIO_OPT_G_CACHE,
58 __FIO_OPT_G_VERIFY,
59 __FIO_OPT_G_ZONE,
60 __FIO_OPT_G_MEM,
61 __FIO_OPT_G_LOG,
62 __FIO_OPT_G_ERR,
63 __FIO_OPT_G_STAT,
64 __FIO_OPT_G_CPU,
65 __FIO_OPT_G_OS,
66 __FIO_OPT_G_MISC,
67 __FIO_OPT_G_RAND,
68 __FIO_OPT_G_JOB,
69 __FIO_OPT_G_NR,
9af4a244
JA
70
71 FIO_OPT_G_DESC = (1U << __FIO_OPT_G_DESC),
72 FIO_OPT_G_FILE = (1U << __FIO_OPT_G_FILE),
73 FIO_OPT_G_MISC = (1U << __FIO_OPT_G_MISC),
74 FIO_OPT_G_IO = (1U << __FIO_OPT_G_IO),
75 FIO_OPT_G_IO_DDIR = (1U << __FIO_OPT_G_IO_DDIR),
76 FIO_OPT_G_IO_BUF = (1U << __FIO_OPT_G_IO_BUF),
e231bbe6 77 FIO_OPT_G_IO_ENG = (1U << __FIO_OPT_G_IO_ENG),
9af4a244
JA
78 FIO_OPT_G_RAND = (1U << __FIO_OPT_G_RAND),
79 FIO_OPT_G_OS = (1U << __FIO_OPT_G_OS),
80 FIO_OPT_G_MEM = (1U << __FIO_OPT_G_MEM),
81 FIO_OPT_G_VERIFY = (1U << __FIO_OPT_G_VERIFY),
82 FIO_OPT_G_CPU = (1U << __FIO_OPT_G_CPU),
83 FIO_OPT_G_LOG = (1U << __FIO_OPT_G_LOG),
84 FIO_OPT_G_ZONE = (1U << __FIO_OPT_G_ZONE),
85 FIO_OPT_G_CACHE = (1U << __FIO_OPT_G_CACHE),
86 FIO_OPT_G_STAT = (1U << __FIO_OPT_G_STAT),
87 FIO_OPT_G_ERR = (1U << __FIO_OPT_G_ERR),
88 FIO_OPT_G_JOB = (1U << __FIO_OPT_G_JOB),
89 FIO_OPT_G_INVALID = (1U << __FIO_OPT_G_NR),
90};
91
92extern struct opt_group *opt_group_from_mask(unsigned int *mask);
93
9f988e2e 94#endif