zbd: Fix zone report handling
[fio.git] / options.h
1 #ifndef FIO_OPTION_H
2 #define FIO_OPTION_H
3
4 #define FIO_MAX_OPTS            512
5
6 #include <string.h>
7 #include <inttypes.h>
8 #include "parse.h"
9 #include "lib/types.h"
10
11 int add_option(const struct fio_option *);
12 void invalidate_profile_options(const char *);
13 extern char *exec_profile;
14
15 void add_opt_posval(const char *, const char *, const char *);
16 void del_opt_posval(const char *, const char *);
17 struct thread_data;
18 void fio_options_free(struct thread_data *);
19 char *get_next_str(char **ptr);
20 int get_max_str_idx(char *input);
21 char* get_name_by_idx(char *input, int index);
22 int set_name_idx(char *, size_t, char *, int, bool);
23
24 extern char client_sockaddr_str[];  /* used with --client option */
25
26 extern struct fio_option fio_options[FIO_MAX_OPTS];
27
28 extern bool __fio_option_is_set(struct thread_options *, unsigned int off);
29
30 #define fio_option_is_set(__td, name)                                   \
31 ({                                                                      \
32         const unsigned int off = offsetof(struct thread_options, name); \
33         bool __r = __fio_option_is_set((__td), off);                    \
34         __r;                                                            \
35 })
36
37 extern void fio_option_mark_set(struct thread_options *,
38                                 const struct fio_option *);
39
40 static inline bool o_match(const struct fio_option *o, const char *opt)
41 {
42         if (!strcmp(o->name, opt))
43                 return true;
44         else if (o->alias && !strcmp(o->alias, opt))
45                 return true;
46
47         return false;
48 }
49
50 extern struct fio_option *find_option(struct fio_option *, const char *);
51 extern const struct fio_option *
52 find_option_c(const struct fio_option *, const char *);
53 extern struct fio_option *fio_option_find(const char *);
54 extern unsigned int fio_get_kb_base(void *);
55
56 #endif