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 or; /* OR value */
32 void *cb; /* sub-option callback */
35 #define OPT_LEN_MAX 4096
36 #define PARSE_MAX_VP 16
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 */
50 void *roff1, *roff2, *roff3, *roff4;
51 unsigned int maxval; /* max and min value */
53 double maxfp; /* max and min floating value */
55 unsigned int interval; /* client hint for suitable interval */
56 unsigned int maxlen; /* max length */
57 int neg; /* negate value stored */
59 void *cb; /* callback */
60 const char *help; /* help text for option */
61 const char *def; /* default setting */
62 struct value_pair posval[PARSE_MAX_VP];/* possible values */
63 const char *parent; /* parent option */
64 int hide; /* hide if parent isn't set */
65 const char *inverse; /* if set, apply opposite action to this option */
66 struct fio_option *inv_opt; /* cached lookup */
67 int (*verify)(struct fio_option *, void *);
68 const char *prof_name; /* only valid for specific profile */
69 unsigned int category; /* what type of option */
70 unsigned int group; /* who to group with */
74 typedef int (str_cb_fn)(void *, char *);
76 extern int parse_option(char *, const char *, struct fio_option *, struct fio_option **, void *);
77 extern void sort_options(char **, struct fio_option *, int);
78 extern int parse_cmd_option(const char *t, const char *l, struct fio_option *, void *);
79 extern int show_cmd_help(struct fio_option *, const char *);
80 extern void fill_default_options(void *, struct fio_option *);
81 extern void option_init(struct fio_option *);
82 extern void options_init(struct fio_option *);
83 extern void options_free(struct fio_option *, void *);
85 extern void strip_blank_front(char **);
86 extern void strip_blank_end(char *);
87 extern int str_to_decimal(const char *, long long *, int, void *);
88 extern int check_str_bytes(const char *p, long long *val, void *data);
91 * Handlers for the options
93 typedef int (fio_opt_str_fn)(void *, const char *);
94 typedef int (fio_opt_str_val_fn)(void *, long long *);
95 typedef int (fio_opt_int_fn)(void *, int *);
96 typedef int (fio_opt_str_set_fn)(void *);
98 #define td_var(start, offset) ((void *) start + (offset))
101 #define min(a, b) ((a) < (b) ? (a) : (b))
104 #define max(a, b) ((a) > (b) ? (a) : (b))
107 static inline int parse_is_percent(unsigned long long val)
109 return val <= -1ULL && val >= (-1ULL - 100ULL);