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
39 FIO_OPT_G_DESC = 1UL << 0,
40 FIO_OPT_G_FILE = 1UL << 1,
41 FIO_OPT_G_MISC = 1UL << 2,
42 FIO_OPT_G_IO = 1UL << 3,
43 FIO_OPT_G_IO_DDIR = 1UL << 4,
44 FIO_OPT_G_IO_BUF = 1UL << 5,
45 FIO_OPT_G_RAND = 1UL << 6,
46 FIO_OPT_G_OS = 1UL << 7,
47 FIO_OPT_G_MEM = 1UL << 8,
48 FIO_OPT_G_VERIFY = 1UL << 9,
49 FIO_OPT_G_CPU = 1UL << 10,
50 FIO_OPT_G_LOG = 1UL << 11,
51 FIO_OPT_G_ZONE = 1UL << 12,
52 FIO_OPT_G_CACHE = 1UL << 13,
53 FIO_OPT_G_STAT = 1UL << 14,
54 FIO_OPT_G_ERR = 1UL << 15,
55 FIO_OPT_G_JOB = 1UL << 16,
62 const char *name; /* option name */
63 const char *alias; /* possible old allowed name */
64 enum fio_opt_type type; /* option type */
65 unsigned int off1; /* potential parameters */
69 void *roff1, *roff2, *roff3, *roff4;
70 unsigned int maxval; /* max and min value */
72 double maxfp; /* max and min floating value */
74 unsigned int maxlen; /* max length */
75 int neg; /* negate value stored */
77 void *cb; /* callback */
78 const char *help; /* help text for option */
79 const char *def; /* default setting */
80 struct value_pair posval[PARSE_MAX_VP];/* possible values */
81 const char *parent; /* parent option */
82 int (*verify)(struct fio_option *, void *);
83 const char *prof_name; /* only valid for specific profile */
84 unsigned int category; /* for type grouping */
87 typedef int (str_cb_fn)(void *, char *);
89 extern int parse_option(char *, const char *, struct fio_option *, struct fio_option **, void *);
90 extern void sort_options(char **, struct fio_option *, int);
91 extern int parse_cmd_option(const char *t, const char *l, struct fio_option *, void *);
92 extern int show_cmd_help(struct fio_option *, const char *);
93 extern void fill_default_options(void *, struct fio_option *);
94 extern void option_init(struct fio_option *);
95 extern void options_init(struct fio_option *);
96 extern void options_free(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 *);
103 * Handlers for the options
105 typedef int (fio_opt_str_fn)(void *, const char *);
106 typedef int (fio_opt_str_val_fn)(void *, long long *);
107 typedef int (fio_opt_int_fn)(void *, int *);
108 typedef int (fio_opt_str_set_fn)(void *);
110 #define td_var(start, offset) ((void *) start + (offset))
113 #define min(a, b) ((a) < (b) ? (a) : (b))
116 #define max(a, b) ((a) > (b) ? (a) : (b))
119 static inline int parse_is_percent(unsigned long long val)
121 return val <= -1ULL && val >= (-1ULL - 100ULL);