25 FIO_OPT_SOFT_DEPRECATED,
26 FIO_OPT_UNSUPPORTED, /* keep this last */
30 * Match a possible value string with the integer option.
33 const char *ival; /* string option */
34 unsigned long long oval;/* output value */
35 const char *help; /* help text for sub option */
36 int orval; /* OR value */
37 void *cb; /* sub-option callback */
40 #define OPT_LEN_MAX 8192
41 #define PARSE_MAX_VP 32
47 const char *name; /* option name */
48 const char *lname; /* long option name */
49 const char *alias; /* possible old allowed name */
50 enum fio_opt_type type; /* option type */
51 unsigned int off1; /* potential parameters */
57 unsigned long long maxval; /* max and min value */
59 double maxfp; /* max and min floating value */
61 unsigned int interval; /* client hint for suitable interval */
62 unsigned int maxlen; /* max length */
63 int neg; /* negate value stored */
65 void *cb; /* callback */
66 const char *help; /* help text for option */
67 const char *def; /* default setting */
68 struct value_pair posval[PARSE_MAX_VP];/* possible values */
69 const char *parent; /* parent option */
70 int hide; /* hide if parent isn't set */
71 int hide_on_set; /* hide on set, not on unset */
72 const char *inverse; /* if set, apply opposite action to this option */
73 struct fio_option *inv_opt; /* cached lookup */
74 int (*verify)(const struct fio_option *, void *);
75 const char *prof_name; /* only valid for specific profile */
77 uint64_t category; /* what type of option */
78 uint64_t group; /* who to group with */
80 int is_seconds; /* time value with seconds base */
81 int is_time; /* time based value */
83 int pow2; /* must be a power-of-2 */
87 extern int parse_option(char *, const char *, const struct fio_option *,
88 const struct fio_option **, void *,
90 extern void sort_options(char **, const struct fio_option *, int);
91 extern int parse_cmd_option(const char *t, const char *l,
92 const struct fio_option *, void *,
94 extern int show_cmd_help(const struct fio_option *, const char *);
95 extern void fill_default_options(void *, const struct fio_option *);
96 extern void options_init(struct fio_option *);
97 extern void options_mem_dupe(const struct fio_option *, void *);
98 extern void options_free(const struct fio_option *, void *);
100 extern void strip_blank_front(char **);
101 extern void strip_blank_end(char *);
102 extern int str_to_decimal(const char *, long long *, int, void *, int, int);
103 extern int check_str_bytes(const char *p, long long *val, void *data);
104 extern int check_str_time(const char *p, long long *val, int);
105 extern int str_to_float(const char *str, double *val, int is_time);
107 extern int string_distance(const char *s1, const char *s2);
108 extern int string_distance_ok(const char *s1, int dist);
111 * Handlers for the options
113 typedef int (fio_opt_str_fn)(void *, const char *);
114 typedef int (fio_opt_str_val_fn)(void *, long long *);
115 typedef int (fio_opt_int_fn)(void *, int *);
117 struct thread_options;
118 static inline void *td_var(void *to, const struct fio_option *o,
128 return (void *) ((uintptr_t) ret + offset);
131 static inline int parse_is_percent(unsigned long long val)
133 return val <= -1ULL && val >= (-1ULL - 100ULL);
136 static inline int parse_is_percent_uncapped(unsigned long long val)
138 return (long long)val <= -1;
141 struct print_option {
142 struct flist_head list;