27 * Match a possible value string with the integer option.
30 const char *ival; /* string option */
31 unsigned int oval; /* output value */
32 const char *help; /* help text for sub option */
33 int orval; /* OR value */
34 void *cb; /* sub-option callback */
37 #define OPT_LEN_MAX 4096
38 #define PARSE_MAX_VP 24
44 const char *name; /* option name */
45 const char *lname; /* long option name */
46 const char *alias; /* possible old allowed name */
47 enum fio_opt_type type; /* option type */
48 unsigned int off1; /* potential parameters */
54 unsigned int maxval; /* max and min value */
56 double maxfp; /* max and min floating value */
58 unsigned int interval; /* client hint for suitable interval */
59 unsigned int maxlen; /* max length */
60 int neg; /* negate value stored */
62 void *cb; /* callback */
63 const char *help; /* help text for option */
64 const char *def; /* default setting */
65 struct value_pair posval[PARSE_MAX_VP];/* possible values */
66 const char *parent; /* parent option */
67 int hide; /* hide if parent isn't set */
68 int hide_on_set; /* hide on set, not on unset */
69 const char *inverse; /* if set, apply opposite action to this option */
70 struct fio_option *inv_opt; /* cached lookup */
71 int (*verify)(struct fio_option *, void *);
72 const char *prof_name; /* only valid for specific profile */
74 uint64_t category; /* what type of option */
75 uint64_t group; /* who to group with */
77 int is_seconds; /* time value with seconds base */
78 int is_time; /* time based value */
80 int pow2; /* must be a power-of-2 */
84 extern int parse_option(char *, const char *, struct fio_option *, struct fio_option **, void *, struct flist_head *);
85 extern void sort_options(char **, struct fio_option *, int);
86 extern int parse_cmd_option(const char *t, const char *l, struct fio_option *, void *, struct flist_head *);
87 extern int show_cmd_help(struct fio_option *, const char *);
88 extern void fill_default_options(void *, struct fio_option *);
89 extern void options_init(struct fio_option *);
90 extern void options_mem_dupe(struct fio_option *, void *);
91 extern void options_free(struct fio_option *, void *);
93 extern void strip_blank_front(char **);
94 extern void strip_blank_end(char *);
95 extern int str_to_decimal(const char *, long long *, int, void *, int, int);
96 extern int check_str_bytes(const char *p, long long *val, void *data);
97 extern int check_str_time(const char *p, long long *val, int);
98 extern int str_to_float(const char *str, double *val, int is_time);
100 extern int string_distance(const char *s1, const char *s2);
101 extern int string_distance_ok(const char *s1, int dist);
104 * Handlers for the options
106 typedef int (fio_opt_str_fn)(void *, const char *);
107 typedef int (fio_opt_str_val_fn)(void *, long long *);
108 typedef int (fio_opt_int_fn)(void *, int *);
110 struct thread_options;
111 static inline void *td_var(void *to, struct fio_option *o, unsigned int offset)
120 return (char *) ret + offset;
123 static inline int parse_is_percent(unsigned long long val)
125 return val <= -1ULL && val >= (-1ULL - 100ULL);
128 struct print_option {
129 struct flist_head list;