doc: remove '--runtime' command line option
[fio.git] / parse.h
CommitLineData
e1f36503
JA
1#ifndef FIO_PARSE_H
2#define FIO_PARSE_H
3
b5f4ef37 4#include <inttypes.h>
9f988e2e
JA
5#include "flist.h"
6
e1f36503
JA
7/*
8 * Option types
9 */
10enum fio_opt_type {
07b3232d
JA
11 FIO_OPT_INVALID = 0,
12 FIO_OPT_STR,
5f6ddf1e 13 FIO_OPT_STR_MULTI,
e1f36503
JA
14 FIO_OPT_STR_VAL,
15 FIO_OPT_STR_VAL_TIME,
16 FIO_OPT_STR_STORE,
17 FIO_OPT_RANGE,
18 FIO_OPT_INT,
13335ddb 19 FIO_OPT_BOOL,
83349190 20 FIO_OPT_FLOAT_LIST,
e1f36503 21 FIO_OPT_STR_SET,
15ca150e 22 FIO_OPT_DEPRECATED,
75e6bcba 23 FIO_OPT_UNSUPPORTED,
e1f36503
JA
24};
25
b1ec1da6
JA
26/*
27 * Match a possible value string with the integer option.
28 */
29struct value_pair {
30 const char *ival; /* string option */
31 unsigned int oval; /* output value */
7837213b 32 const char *help; /* help text for sub option */
ebadc0ce 33 int orval; /* OR value */
c44b1ff5 34 void *cb; /* sub-option callback */
b1ec1da6
JA
35};
36
c06c78c0 37#define OPT_LEN_MAX 4096
3ae4f4af 38#define PARSE_MAX_VP 24
b1ec1da6 39
e1f36503
JA
40/*
41 * Option define
42 */
43struct fio_option {
ee738499 44 const char *name; /* option name */
e8b0e958 45 const char *lname; /* long option name */
03b74b3e 46 const char *alias; /* possible old allowed name */
ee738499
JA
47 enum fio_opt_type type; /* option type */
48 unsigned int off1; /* potential parameters */
e1f36503 49 unsigned int off2;
f90eff5a
JA
50 unsigned int off3;
51 unsigned int off4;
6eaf09d6
SL
52 unsigned int off5;
53 unsigned int off6;
ee738499 54 unsigned int maxval; /* max and min value */
63f29372 55 int minval;
83349190
YH
56 double maxfp; /* max and min floating value */
57 double minfp;
20eb06bd 58 unsigned int interval; /* client hint for suitable interval */
83349190 59 unsigned int maxlen; /* max length */
76a43db4 60 int neg; /* negate value stored */
3b8b7135 61 int prio;
ee738499
JA
62 void *cb; /* callback */
63 const char *help; /* help text for option */
64 const char *def; /* default setting */
f5b6bb85 65 struct value_pair posval[PARSE_MAX_VP];/* possible values */
afdf9352 66 const char *parent; /* parent option */
d71c154c 67 int hide; /* hide if parent isn't set */
a4ed77fe 68 int hide_on_set; /* hide on set, not on unset */
90265353
JA
69 const char *inverse; /* if set, apply opposite action to this option */
70 struct fio_option *inv_opt; /* cached lookup */
70a4c0c8 71 int (*verify)(struct fio_option *, void *);
07b3232d 72 const char *prof_name; /* only valid for specific profile */
7b504edd 73 void *prof_opts;
b5f4ef37
JA
74 uint64_t category; /* what type of option */
75 uint64_t group; /* who to group with */
90265353 76 void *gui_data;
0de5b26f 77 int is_seconds; /* time value with seconds base */
88038bc7 78 int is_time; /* time based value */
c8931876 79 int no_warn_def;
0f38bbef 80 int pow2; /* must be a power-of-2 */
43f466e6 81 int no_free;
e1f36503
JA
82};
83
c2292325 84extern int parse_option(char *, const char *, struct fio_option *, struct fio_option **, void *, struct flist_head *);
3b8b7135 85extern void sort_options(char **, struct fio_option *, int);
d8b4f395 86extern int parse_cmd_option(const char *t, const char *l, struct fio_option *, void *, struct flist_head *);
07b3232d 87extern int show_cmd_help(struct fio_option *, const char *);
ee738499 88extern void fill_default_options(void *, struct fio_option *);
13335ddb 89extern void options_init(struct fio_option *);
53b5693d 90extern void options_mem_dupe(struct fio_option *, void *);
7e356b2d 91extern void options_free(struct fio_option *, void *);
e1f36503
JA
92
93extern void strip_blank_front(char **);
94extern void strip_blank_end(char *);
88038bc7 95extern int str_to_decimal(const char *, long long *, int, void *, int, int);
9af4a244 96extern int check_str_bytes(const char *p, long long *val, void *data);
0de5b26f 97extern int check_str_time(const char *p, long long *val, int);
88038bc7 98extern int str_to_float(const char *str, double *val, int is_time);
e1f36503 99
a893c261 100extern int string_distance(const char *s1, const char *s2);
3701636d 101extern int string_distance_ok(const char *s1, int dist);
a893c261 102
e1f36503
JA
103/*
104 * Handlers for the options
105 */
b4692828 106typedef int (fio_opt_str_fn)(void *, const char *);
63f29372
JA
107typedef int (fio_opt_str_val_fn)(void *, long long *);
108typedef int (fio_opt_int_fn)(void *, int *);
e1f36503 109
f0fdbcaf 110struct thread_options;
d4dbd376 111static inline void *td_var(void *to, struct fio_option *o, unsigned int offset)
f0fdbcaf 112{
041c462d
JA
113 void *ret;
114
f0fdbcaf 115 if (o->prof_opts)
041c462d
JA
116 ret = o->prof_opts;
117 else
118 ret = to;
f0fdbcaf 119
c3b4dd80 120 return (char *) ret + offset;
f0fdbcaf 121}
e1f36503 122
7bb59102
JA
123static inline int parse_is_percent(unsigned long long val)
124{
125 return val <= -1ULL && val >= (-1ULL - 100ULL);
126}
127
c2292325
JA
128struct print_option {
129 struct flist_head list;
130 char *name;
131 char *value;
132};
133
e1f36503 134#endif