25 * Match a possible value string with the integer option.
28 const char *ival; /* string option */
29 unsigned int oval; /* output value */
30 const char *help; /* help text for sub option */
31 int orval; /* OR value */
32 void *cb; /* sub-option callback */
35 #define OPT_LEN_MAX 4096
36 #define PARSE_MAX_VP 24
42 const char *name; /* option name */
43 const char *lname; /* long option name */
44 const char *alias; /* possible old allowed name */
45 enum fio_opt_type type; /* option type */
46 unsigned int off1; /* potential parameters */
52 unsigned int maxval; /* max and min value */
54 double maxfp; /* max and min floating value */
56 unsigned int interval; /* client hint for suitable interval */
57 unsigned int maxlen; /* max length */
58 int neg; /* negate value stored */
60 void *cb; /* callback */
61 const char *help; /* help text for option */
62 const char *def; /* default setting */
63 struct value_pair posval[PARSE_MAX_VP];/* possible values */
64 const char *parent; /* parent option */
65 int hide; /* hide if parent isn't set */
66 int hide_on_set; /* hide on set, not on unset */
67 const char *inverse; /* if set, apply opposite action to this option */
68 struct fio_option *inv_opt; /* cached lookup */
69 int (*verify)(struct fio_option *, void *);
70 const char *prof_name; /* only valid for specific profile */
72 unsigned int category; /* what type of option */
73 unsigned int group; /* who to group with */
75 int is_seconds; /* time value with seconds base */
76 int is_time; /* time based value */
78 int pow2; /* must be a power-of-2 */
81 typedef int (str_cb_fn)(void *, char *);
83 extern int parse_option(char *, const char *, struct fio_option *, struct fio_option **, void *, int);
84 extern void sort_options(char **, struct fio_option *, int);
85 extern int parse_cmd_option(const char *t, const char *l, struct fio_option *, void *);
86 extern int show_cmd_help(struct fio_option *, const char *);
87 extern void fill_default_options(void *, struct fio_option *);
88 extern void option_init(struct fio_option *);
89 extern void options_init(struct fio_option *);
90 extern void options_free(struct fio_option *, void *);
92 extern void strip_blank_front(char **);
93 extern void strip_blank_end(char *);
94 extern int str_to_decimal(const char *, long long *, int, void *, int, int);
95 extern int check_str_bytes(const char *p, long long *val, void *data);
96 extern int check_str_time(const char *p, long long *val, int);
97 extern int str_to_float(const char *str, double *val, int is_time);
99 extern int string_distance(const char *s1, const char *s2);
100 extern int string_distance_ok(const char *s1, int dist);
103 * Handlers for the options
105 typedef int (fio_opt_str_fn)(void *, const char *);
106 typedef int (fio_opt_str_val_fn)(void *, long long *);
107 typedef int (fio_opt_int_fn)(void *, int *);
108 typedef int (fio_opt_str_set_fn)(void *);
110 #define __td_var(start, offset) ((char *) start + (offset))
112 struct thread_options;
113 static inline void *td_var(struct thread_options *to, struct fio_option *o,
117 return __td_var(o->prof_opts, offset);
119 return __td_var(to, offset);
122 static inline int parse_is_percent(unsigned long long val)
124 return val <= -1ULL && val >= (-1ULL - 100ULL);