blob: be3d24ac43f1634a39a57b77ab84491cf7142b25 [file] [log] [blame]
Jens Axboee1f36502006-10-27 10:54:08 +02001#ifndef FIO_PARSE_H
2#define FIO_PARSE_H
3
4/*
5 * Option types
6 */
7enum fio_opt_type {
8 FIO_OPT_STR = 0,
9 FIO_OPT_STR_VAL,
10 FIO_OPT_STR_VAL_TIME,
11 FIO_OPT_STR_STORE,
12 FIO_OPT_RANGE,
13 FIO_OPT_INT,
14 FIO_OPT_STR_SET,
15};
16
17/*
18 * Option define
19 */
20struct fio_option {
21 char *name;
22 enum fio_opt_type type;
23 unsigned int off1;
24 unsigned int off2;
25 unsigned int max_val;
26 void *cb;
27};
28
29typedef int (str_cb_fn)(void *, char *);
30
31extern int parse_option(const char *, struct fio_option *, void *);
Jens Axboeb4692822006-10-27 13:43:22 +020032extern int parse_cmd_option(const char *t, const char *l, struct fio_option *, void *);
Jens Axboee1f36502006-10-27 10:54:08 +020033
34extern void strip_blank_front(char **);
35extern void strip_blank_end(char *);
36
37/*
38 * Handlers for the options
39 */
Jens Axboeb4692822006-10-27 13:43:22 +020040typedef int (fio_opt_str_fn)(void *, const char *);
Jens Axboee1f36502006-10-27 10:54:08 +020041typedef int (fio_opt_str_val_fn)(void *, unsigned long long *);
42typedef int (fio_opt_int_fn)(void *, unsigned int *);
43typedef int (fio_opt_str_set_fn)(void *);
44
45#define td_var(start, offset) ((void *) start + (offset))
46
47#endif