parse.h revision 63f29372bc1bd69b66816c96d88b9c0bd8f3d8b9
1e1f365035a952233463d85d659bd960ba78f012eJens Axboe#ifndef FIO_PARSE_H 2e1f365035a952233463d85d659bd960ba78f012eJens Axboe#define FIO_PARSE_H 3e1f365035a952233463d85d659bd960ba78f012eJens Axboe 4e1f365035a952233463d85d659bd960ba78f012eJens Axboe/* 5e1f365035a952233463d85d659bd960ba78f012eJens Axboe * Option types 6e1f365035a952233463d85d659bd960ba78f012eJens Axboe */ 7e1f365035a952233463d85d659bd960ba78f012eJens Axboeenum fio_opt_type { 8e1f365035a952233463d85d659bd960ba78f012eJens Axboe FIO_OPT_STR = 0, 9e1f365035a952233463d85d659bd960ba78f012eJens Axboe FIO_OPT_STR_VAL, 1075e6f36fae06978f29296fce76a7f00ca0df7b56Jens Axboe FIO_OPT_STR_VAL_INT, 11e1f365035a952233463d85d659bd960ba78f012eJens Axboe FIO_OPT_STR_VAL_TIME, 12e1f365035a952233463d85d659bd960ba78f012eJens Axboe FIO_OPT_STR_STORE, 13e1f365035a952233463d85d659bd960ba78f012eJens Axboe FIO_OPT_RANGE, 14e1f365035a952233463d85d659bd960ba78f012eJens Axboe FIO_OPT_INT, 1513335ddb0e304efa0fc96593dd1fd995ec6f68d7Jens Axboe FIO_OPT_BOOL, 16e1f365035a952233463d85d659bd960ba78f012eJens Axboe FIO_OPT_STR_SET, 17e1f365035a952233463d85d659bd960ba78f012eJens Axboe}; 18e1f365035a952233463d85d659bd960ba78f012eJens Axboe 19e1f365035a952233463d85d659bd960ba78f012eJens Axboe/* 20e1f365035a952233463d85d659bd960ba78f012eJens Axboe * Option define 21e1f365035a952233463d85d659bd960ba78f012eJens Axboe */ 22e1f365035a952233463d85d659bd960ba78f012eJens Axboestruct fio_option { 23ee738499877bb1ee913e839cb4a8d4edad2d52adJens Axboe const char *name; /* option name */ 24ee738499877bb1ee913e839cb4a8d4edad2d52adJens Axboe enum fio_opt_type type; /* option type */ 25ee738499877bb1ee913e839cb4a8d4edad2d52adJens Axboe unsigned int off1; /* potential parameters */ 26e1f365035a952233463d85d659bd960ba78f012eJens Axboe unsigned int off2; 27f90eff5a414f6e8c16a51c3a7d9b5e077ab49aacJens Axboe unsigned int off3; 28f90eff5a414f6e8c16a51c3a7d9b5e077ab49aacJens Axboe unsigned int off4; 29ee738499877bb1ee913e839cb4a8d4edad2d52adJens Axboe unsigned int maxval; /* max and min value */ 3063f29372bc1bd69b66816c96d88b9c0bd8f3d8b9Jens Axboe int minval; 31ee738499877bb1ee913e839cb4a8d4edad2d52adJens Axboe void *cb; /* callback */ 32ee738499877bb1ee913e839cb4a8d4edad2d52adJens Axboe const char *help; /* help text for option */ 33ee738499877bb1ee913e839cb4a8d4edad2d52adJens Axboe const char *def; /* default setting */ 3415f7918ff432d5da2b2abc84a50c685bde5e72efJens Axboe const char *posval[16]; /* possible values */ 35e1f365035a952233463d85d659bd960ba78f012eJens Axboe}; 36e1f365035a952233463d85d659bd960ba78f012eJens Axboe 37e1f365035a952233463d85d659bd960ba78f012eJens Axboetypedef int (str_cb_fn)(void *, char *); 38e1f365035a952233463d85d659bd960ba78f012eJens Axboe 39e1f365035a952233463d85d659bd960ba78f012eJens Axboeextern int parse_option(const char *, struct fio_option *, void *); 40b46928282e0a890f49250e79b81af773a2b7108fJens Axboeextern int parse_cmd_option(const char *t, const char *l, struct fio_option *, void *); 41fd28ca4948aa67b76585c6c23d7f70a2cdc7a0d5Jens Axboeextern int show_cmd_help(struct fio_option *, const char *); 42ee738499877bb1ee913e839cb4a8d4edad2d52adJens Axboeextern void fill_default_options(void *, struct fio_option *); 4313335ddb0e304efa0fc96593dd1fd995ec6f68d7Jens Axboeextern void options_init(struct fio_option *); 44e1f365035a952233463d85d659bd960ba78f012eJens Axboe 45e1f365035a952233463d85d659bd960ba78f012eJens Axboeextern void strip_blank_front(char **); 46e1f365035a952233463d85d659bd960ba78f012eJens Axboeextern void strip_blank_end(char *); 47e1f365035a952233463d85d659bd960ba78f012eJens Axboe 48e1f365035a952233463d85d659bd960ba78f012eJens Axboe/* 49e1f365035a952233463d85d659bd960ba78f012eJens Axboe * Handlers for the options 50e1f365035a952233463d85d659bd960ba78f012eJens Axboe */ 51b46928282e0a890f49250e79b81af773a2b7108fJens Axboetypedef int (fio_opt_str_fn)(void *, const char *); 5263f29372bc1bd69b66816c96d88b9c0bd8f3d8b9Jens Axboetypedef int (fio_opt_str_val_fn)(void *, long long *); 5363f29372bc1bd69b66816c96d88b9c0bd8f3d8b9Jens Axboetypedef int (fio_opt_int_fn)(void *, int *); 54e1f365035a952233463d85d659bd960ba78f012eJens Axboetypedef int (fio_opt_str_set_fn)(void *); 55e1f365035a952233463d85d659bd960ba78f012eJens Axboe 56e1f365035a952233463d85d659bd960ba78f012eJens Axboe#define td_var(start, offset) ((void *) start + (offset)) 57e1f365035a952233463d85d659bd960ba78f012eJens Axboe 58e1f365035a952233463d85d659bd960ba78f012eJens Axboe#endif 59