23 FIO_OPT_SOFT_DEPRECATED,
24 FIO_OPT_UNSUPPORTED, /* keep this last */
28 * Match a possible value string with the integer option.
31 const char *ival; /* string option */
32 unsigned int oval; /* output value */
33 const char *help; /* help text for sub option */
34 int orval; /* OR value */
35 void *cb; /* sub-option callback */
38 #define OPT_LEN_MAX 4096
39 #define PARSE_MAX_VP 24
45 const char *name; /* option name */
46 const char *lname; /* long option name */
47 const char *alias; /* possible old allowed name */
48 enum fio_opt_type type; /* option type */
49 unsigned int off1; /* potential parameters */
55 unsigned int maxval; /* max and min value */
57 double maxfp; /* max and min floating value */
59 unsigned int interval; /* client hint for suitable interval */
60 unsigned int maxlen; /* max length */
61 int neg; /* negate value stored */
63 void *cb; /* callback */
64 const char *help; /* help text for option */
65 const char *def; /* default setting */
66 struct value_pair posval[PARSE_MAX_VP];/* possible values */
67 const char *parent; /* parent option */
68 int hide; /* hide if parent isn't set */
69 int hide_on_set; /* hide on set, not on unset */
70 const char *inverse; /* if set, apply opposite action to this option */
71 struct fio_option *inv_opt; /* cached lookup */
72 int (*verify)(const struct fio_option *, void *);
73 const char *prof_name; /* only valid for specific profile */
75 uint64_t category; /* what type of option */
76 uint64_t group; /* who to group with */
78 int is_seconds; /* time value with seconds base */
79 int is_time; /* time based value */
81 int pow2; /* must be a power-of-2 */
85 extern int parse_option(char *, const char *, const struct fio_option *,
86 const struct fio_option **, void *,
88 extern void sort_options(char **, const struct fio_option *, int);
89 extern int parse_cmd_option(const char *t, const char *l,
90 const struct fio_option *, void *,
92 extern int show_cmd_help(const struct fio_option *, const char *);
93 extern void fill_default_options(void *, const struct fio_option *);
94 extern void options_init(struct fio_option *);
95 extern void options_mem_dupe(const struct fio_option *, void *);
96 extern void options_free(const struct fio_option *, void *);
98 extern void strip_blank_front(char **);
99 extern void strip_blank_end(char *);
100 extern int str_to_decimal(const char *, long long *, int, void *, int, int);
101 extern int check_str_bytes(const char *p, long long *val, void *data);
102 extern int check_str_time(const char *p, long long *val, int);
103 extern int str_to_float(const char *str, double *val, int is_time);
105 extern int string_distance(const char *s1, const char *s2);
106 extern int string_distance_ok(const char *s1, int dist);
109 * Handlers for the options
111 typedef int (fio_opt_str_fn)(void *, const char *);
112 typedef int (fio_opt_str_val_fn)(void *, long long *);
113 typedef int (fio_opt_int_fn)(void *, int *);
115 struct thread_options;
116 static inline void *td_var(void *to, const struct fio_option *o,
129 static inline int parse_is_percent(unsigned long long val)
131 return val <= -1ULL && val >= (-1ULL - 100ULL);
134 struct print_option {
135 struct flist_head list;