X-Git-Url: https://git.kernel.dk/?p=fio.git;a=blobdiff_plain;f=options.c;h=03b24377babde979427c4255cc451acd88b85343;hp=77cfd424ed2b9e2de6506f6961a182d89a1614d4;hb=79d16311c8d0c7188d73df77838fb1b4b6ff58db;hpb=ddf16fe4da558a2778bf1ba06c965080d318cb24 diff --git a/options.c b/options.c index 77cfd424..03b24377 100644 --- a/options.c +++ b/options.c @@ -14,8 +14,9 @@ #include "verify.h" #include "parse.h" #include "lib/fls.h" +#include "options.h" -#define td_var_offset(var) ((size_t) &((struct thread_options *)0)->var) +static FLIST_HEAD(ext_opt_list); /* * Check if mmap/mmaphuge has a :/foo/bar/file at the end. If so, return that. @@ -1081,6 +1082,15 @@ static struct fio_option options[] = { }, .parent = "nrfiles", }, +#ifdef FIO_HAVE_FALLOCATE + { + .name = "fallocate", + .type = FIO_OPT_BOOL, + .off1 = td_var_offset(fallocate), + .help = "Use fallocate() when laying out files", + .def = "1", + }, +#endif { .name = "fadvise_hint", .type = FIO_OPT_BOOL, @@ -1716,23 +1726,10 @@ static struct fio_option options[] = { }, { .name = "profile", - .type = FIO_OPT_STR, + .type = FIO_OPT_STR_STORE, .off1 = td_var_offset(profile), - .posval = { - { .ival = "tiobench", - .oval = PROFILE_TIOBENCH, - .help = "Perform tiobench like test", - }, - }, .help = "Select a specific builtin performance test", }, - { - .name = "cgroup_root", - .type = FIO_OPT_STR_STORE, - .off1 = td_var_offset(cgroup_root), - .help = "Root of mounted blkio cgroup", - .def = "/cgroup", - }, { .name = "cgroup", .type = FIO_OPT_STR_STORE, @@ -1747,6 +1744,18 @@ static struct fio_option options[] = { .minval = 100, .maxval = 1000, }, + { + .name = "uid", + .type = FIO_OPT_INT, + .off1 = td_var_offset(uid), + .help = "Run job with this user ID", + }, + { + .name = "gid", + .type = FIO_OPT_INT, + .off1 = td_var_offset(gid), + .help = "Run job with this group ID", + }, { .name = NULL, }, @@ -1804,16 +1813,15 @@ static struct fio_keyword fio_keywords[] = { void fio_keywords_init(void) { - unsigned long mb_memory; + unsigned long long mb_memory; char buf[128]; long l; sprintf(buf, "%lu", page_size); fio_keywords[0].replace = strdup(buf); - l = sysconf(_SC_PHYS_PAGES); - mb_memory = l * (page_size / 1024UL); - sprintf(buf, "%lu", mb_memory); + mb_memory = os_phys_mem() / page_size; + sprintf(buf, "%llu", mb_memory); fio_keywords[1].replace = strdup(buf); l = sysconf(_SC_NPROCESSORS_ONLN); @@ -1933,7 +1941,7 @@ int fio_options_parse(struct thread_data *td, char **opts, int num_opts) for (ret = 0, i = 0; i < num_opts; i++) { opts[i] = fio_keyword_replace(opts[i]); - ret |= parse_option(opts[i], options, td); + ret |= parse_option(opts[i], options, &ext_opt_list, td); } return ret; @@ -1941,7 +1949,7 @@ int fio_options_parse(struct thread_data *td, char **opts, int num_opts) int fio_cmd_option_parse(struct thread_data *td, const char *opt, char *val) { - return parse_cmd_option(opt, val, options, td); + return parse_cmd_option(opt, val, options, &ext_opt_list, td); } void fio_fill_default_options(struct thread_data *td) @@ -2004,3 +2012,10 @@ unsigned int fio_get_kb_base(void *data) return kb_base; } + +void register_ext_option(struct ext_option *eopt) +{ + dprint(FD_PARSE, "register option '%s'\n", eopt->o.name); + option_init(&eopt->o); + flist_add_tail(&eopt->list, &ext_opt_list); +}