Make sure profile options get added to long_options[]
authorJens Axboe <jens.axboe@oracle.com>
Thu, 4 Mar 2010 13:38:10 +0000 (14:38 +0100)
committerJens Axboe <jens.axboe@oracle.com>
Thu, 4 Mar 2010 13:38:10 +0000 (14:38 +0100)
Still the restriction that profile load must come after the
private options, which is a bit odd. Still shaking out the
oddities....

Signed-off-by: Jens Axboe <jens.axboe@oracle.com>
fio.h
options.c

diff --git a/fio.h b/fio.h
index 7eb02ad42dbbb9b66f7569ff6f82f34a6f2cf17d..91a28b4b6b3736f767ddd41ab1fe7ce686a31868 100644 (file)
--- a/fio.h
+++ b/fio.h
@@ -539,7 +539,7 @@ extern void options_mem_free(struct thread_data *);
 extern void td_fill_rand_seeds(struct thread_data *);
 extern void add_job_opts(const char **);
 #define FIO_GETOPT_JOB         0x89988998
-#define FIO_NR_OPTIONS         128
+#define FIO_NR_OPTIONS         512
 
 /*
  * ETA/status stuff
index 2f38b4ae75edddd208d16b2624dac3cf40b4203a..6cfd80d14fac4c8abeff89bd49eab731fdfd1b8f 100644 (file)
--- a/options.c
+++ b/options.c
@@ -1761,9 +1761,21 @@ static struct fio_option options[] = {
        },
 };
 
+static void add_to_lopt(struct option *lopt, struct fio_option *o)
+{
+       lopt->name = (char *) o->name;
+       lopt->val = FIO_GETOPT_JOB;
+       if (o->type == FIO_OPT_STR_SET)
+               lopt->has_arg = no_argument;
+       else
+               lopt->has_arg = required_argument;
+}
+
 void fio_options_dup_and_init(struct option *long_options)
 {
        struct fio_option *o;
+       struct ext_option *eo;
+       struct flist_head *n;
        unsigned int i;
 
        options_init(options);
@@ -1774,17 +1786,19 @@ void fio_options_dup_and_init(struct option *long_options)
 
        o = &options[0];
        while (o->name) {
-               long_options[i].name = (char *) o->name;
-               long_options[i].val = FIO_GETOPT_JOB;
-               if (o->type == FIO_OPT_STR_SET)
-                       long_options[i].has_arg = no_argument;
-               else
-                       long_options[i].has_arg = required_argument;
+               add_to_lopt(&long_options[i], o);
 
                i++;
                o++;
                assert(i < FIO_NR_OPTIONS);
        }
+
+       flist_for_each(n, &ext_opt_list) {
+               eo = flist_entry(n, struct ext_option, list);
+               add_to_lopt(&long_options[i], &eo->o);
+               i++;
+               assert(i < FIO_NR_OPTIONS);
+       }
 }
 
 struct fio_keyword {