[PATCH] parse cleanups
[fio.git] / parse.h
CommitLineData
e1f36503
JA
1#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 *);
32
33extern void strip_blank_front(char **);
34extern void strip_blank_end(char *);
35
36/*
37 * Handlers for the options
38 */
39typedef int (fio_opt_str_fn)(void *, char *);
40typedef int (fio_opt_str_val_fn)(void *, unsigned long long *);
41typedef int (fio_opt_int_fn)(void *, unsigned int *);
42typedef int (fio_opt_str_set_fn)(void *);
43
44#define td_var(start, offset) ((void *) start + (offset))
45
46#endif