26 FIO_OPT_SOFT_DEPRECATED,
27 FIO_OPT_UNSUPPORTED, /* keep this last */
31 * Match a possible value string with the integer option.
34 const char *ival; /* string option */
35 unsigned long long oval; /* output value */
36 const char *help; /* help text for sub option */
37 int orval; /* OR value */
38 void *cb; /* sub-option callback */
41 #define OPT_LEN_MAX 8192
42 #define PARSE_MAX_VP 32
48 const char *name; /* option name */
49 const char *lname; /* long option name */
50 const char *alias; /* possible old allowed name */
51 enum fio_opt_type type; /* option type */
52 unsigned int off1; /* potential parameters */
58 unsigned long long maxval; /* max and min value */
60 double maxfp; /* max and min floating value */
62 unsigned int interval; /* client hint for suitable interval */
63 unsigned int maxlen; /* max length */
64 int neg; /* negate value stored */
66 void *cb; /* callback */
67 const char *help; /* help text for option */
68 const char *def; /* default setting */
69 struct value_pair posval[PARSE_MAX_VP];/* possible values */
70 const char *parent; /* parent option */
71 int hide; /* hide if parent isn't set */
72 int hide_on_set; /* hide on set, not on unset */
73 const char *inverse; /* if set, apply opposite action to this option */
74 struct fio_option *inv_opt; /* cached lookup */
75 int (*verify)(const struct fio_option *, void *);
76 const char *prof_name; /* only valid for specific profile */
78 uint64_t category; /* what type of option */
79 uint64_t group; /* who to group with */
81 int is_seconds; /* time value with seconds base */
82 int is_time; /* time based value */
84 int pow2; /* must be a power-of-2 */
88 extern int parse_option(char *, const char *, const struct fio_option *,
89 const struct fio_option **, void *,
91 extern void sort_options(char **, const struct fio_option *, int);
92 extern int parse_cmd_option(const char *t, const char *l,
93 const struct fio_option *, void *,
95 extern int show_cmd_help(const struct fio_option *, const char *);
96 extern void fill_default_options(void *, const struct fio_option *);
97 extern void options_init(struct fio_option *);
98 extern void options_mem_dupe(const struct fio_option *, void *);
99 extern void options_free(const struct fio_option *, void *);
101 extern void strip_blank_front(char **);
102 extern void strip_blank_end(char *);
103 extern int str_to_decimal(const char *, long long *, int, void *, int, int);
104 extern int check_str_bytes(const char *p, long long *val, void *data);
105 extern int check_str_time(const char *p, long long *val, int);
106 extern int str_to_float(const char *str, double *val, int is_time);
108 extern int string_distance(const char *s1, const char *s2);
109 extern int string_distance_ok(const char *s1, int dist);
112 * Handlers for the options
114 typedef int (fio_opt_str_fn)(void *, const char *);
115 typedef int (fio_opt_str_val_fn)(void *, long long *);
116 typedef int (fio_opt_int_fn)(void *, int *);
118 struct thread_options;
119 static inline void *td_var(void *to, const struct fio_option *o,
129 return (void *) ((uintptr_t) ret + offset);
132 static inline int parse_is_percent(unsigned long long val)
134 return val >= -101ULL;
137 #define ZONE_BASE_VAL ((-1ULL >> 1) + 1)
138 static inline int parse_is_percent_uncapped(unsigned long long val)
140 return ZONE_BASE_VAL + -1U < val;
143 static inline int parse_is_zone(unsigned long long val)
145 return (val - ZONE_BASE_VAL) <= -1U;
148 struct print_option {
149 struct flist_head list;