Make sure profile options get added to long_options[]

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>
diff --git a/fio.h b/fio.h
index 7eb02ad..91a28b4 100644
--- a/fio.h
+++ b/fio.h
@@ -539,7 +539,7 @@
 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
diff --git a/options.c b/options.c
index 2f38b4a..6cfd80d 100644
--- a/options.c
+++ b/options.c
@@ -1761,9 +1761,21 @@
 	},
 };
 
+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 @@
 
 	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 {