[PATCH] fsx example
[fio.git] / parse.h
1 #ifndef FIO_PARSE_H
2 #define FIO_PARSE_H
3
4 /*
5  * Option types
6  */
7 enum 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  */
20 struct 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
29 typedef int (str_cb_fn)(void *, char *);
30
31 extern int parse_option(const char *, struct fio_option *, void *);
32 extern int parse_cmd_option(const char *t, const char *l, struct fio_option *, void *);
33
34 extern void strip_blank_front(char **);
35 extern void strip_blank_end(char *);
36
37 /*
38  * Handlers for the options
39  */
40 typedef int (fio_opt_str_fn)(void *, const char *);
41 typedef int (fio_opt_str_val_fn)(void *, unsigned long long *);
42 typedef int (fio_opt_int_fn)(void *, unsigned int *);
43 typedef int (fio_opt_str_set_fn)(void *);
44
45 #define td_var(start, offset)   ((void *) start + (offset))
46
47 #endif