io_u: ensure that we align new start offset properly for time_based
[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>
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
14int add_option(struct fio_option *);
15void invalidate_profile_options(const char *);
16extern char *exec_profile;
9f988e2e 17
f5b6bb85
JA
18void add_opt_posval(const char *, const char *, const char *);
19void del_opt_posval(const char *, const char *);
7e356b2d
JA
20struct thread_data;
21void fio_options_free(struct thread_data *);
bcbfeefa 22char *get_name_idx(char *, int);
e13c3b50 23int set_name_idx(char *, size_t, char *, int);
f5b6bb85 24
e13c3b50 25extern char client_sockaddr_str[]; /* used with --client option */
72a703da 26
9af4a244
JA
27extern struct fio_option fio_options[FIO_MAX_OPTS];
28
72f39748 29extern 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
38extern void fio_option_mark_set(struct thread_options *, struct fio_option *);
39
72f39748 40static 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
50static 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
c504ee55 62extern struct fio_option *fio_option_find(const char *name);
3c3ed070 63extern unsigned int fio_get_kb_base(void *);
9af4a244 64
9f988e2e 65#endif