o++;
}
}
+
+void add_opt_posval(const char *optname, const char *ival, const char *help)
+{
+ struct fio_option *o;
+ unsigned int i;
+
+ o = find_option(options, optname);
+ if (!o)
+ return;
+
+ for (i = 0; i < PARSE_MAX_VP; i++) {
+ if (o->posval[i].ival)
+ continue;
+
+ o->posval[i].ival = ival;
+ o->posval[i].help = help;
+ break;
+ }
+}
+
+void del_opt_posval(const char *optname, const char *ival)
+{
+ struct fio_option *o;
+ unsigned int i;
+
+ o = find_option(options, optname);
+ if (!o)
+ return;
+
+ for (i = 0; i < PARSE_MAX_VP; i++) {
+ if (!o->posval[i].ival)
+ continue;
+ if (strcmp(o->posval[i].ival, ival))
+ continue;
+
+ o->posval[i].ival = NULL;
+ o->posval[i].help = NULL;
+ }
+}
#define FIO_MAX_OPTS 512
+#include <string.h>
#include "parse.h"
#include "flist.h"
void invalidate_profile_options(const char *);
extern char *exec_profile;
+void add_opt_posval(const char *, const char *, const char *);
+void del_opt_posval(const char *, const char *);
+
+static inline int o_match(struct fio_option *o, const char *opt)
+{
+ if (!strcmp(o->name, opt))
+ return 1;
+ else if (o->alias && !strcmp(o->alias, opt))
+ return 1;
+
+ return 0;
+}
+
+static inline struct fio_option *find_option(struct fio_option *options,
+ const char *opt)
+{
+ struct fio_option *o;
+
+ for (o = &options[0]; o->name; o++)
+ if (o_match(o, opt))
+ return o;
+
+ return NULL;
+}
+
#endif
return 1;
}
-static inline int o_match(struct fio_option *o, const char *opt)
-{
- if (!strcmp(o->name, opt))
- return 1;
- else if (o->alias && !strcmp(o->alias, opt))
- return 1;
-
- return 0;
-}
-
-static struct fio_option *find_option(struct fio_option *options,
- const char *opt)
-{
- struct fio_option *o;
-
- for (o = &options[0]; o->name; o++)
- if (o_match(o, opt))
- return o;
-
- return NULL;
-}
-
#define val_store(ptr, val, off, data) \
do { \
ptr = td_var((data), (off)); \
void *cb; /* callback */
const char *help; /* help text for option */
const char *def; /* default setting */
- const struct value_pair posval[PARSE_MAX_VP];/* possible values */
+ struct value_pair posval[PARSE_MAX_VP];/* possible values */
const char *parent; /* parent option */
int (*verify)(struct fio_option *, void *);
const char *prof_name; /* only valid for specific profile */
int ret;
dprint(FD_PROFILE, "register profile '%s'\n", ops->name);
- flist_add_tail(&ops->list, &profile_list);
+
ret = add_profile_options(ops);
- if (ret)
- invalidate_profile_options(ops->name);
+ if (!ret) {
+ flist_add_tail(&ops->list, &profile_list);
+ add_opt_posval("profile", ops->name, ops->desc);
+ return 0;
+ }
+ invalidate_profile_options(ops->name);
return ret;
}
dprint(FD_PROFILE, "unregister profile '%s'\n", ops->name);
flist_del(&ops->list);
invalidate_profile_options(ops->name);
+ del_opt_posval("profile", ops->name);
}
static struct profile_ops tiobench_profile = {
.name = "tiobench",
- .desc = "Emulate behaviour of the tiotest/tiobench benchmark",
+ .desc = "tiotest/tiobench benchmark",
.options = options,
.prep_cmd = tb_prep_cmdline,
.cmdline = tb_opts,