genfio: Splitting gen_template in 2 parts

gen_template can be split in to two parts:
- the static headers
- the dynamic ones linked to the arguments from cmdline

The static ones are now in gen_template() call before parsing the
cmdline.

The dynamic ones are now call in finish_template() after parsing the
cmdline.

That also open the ability of feeding the fio header during the parsing
removing the need of specific variables to remember the values.
diff --git a/tools/genfio b/tools/genfio
index 6d3220d..3f9ab28 100755
--- a/tools/genfio
+++ b/tools/genfio
@@ -89,13 +89,9 @@
 EOF
 }
 
-gen_template() {
-cat >$TEMPLATE << EOF
-[global]
-ioengine=libaio
+finish_template() {
+cat >>$TEMPLATE <<EOF
 iodepth=$IODEPTH
-invalidate=1
-ramp_time=5
 EOF
 
 if [ "$RUNTIME" != "0" ]; then
@@ -110,7 +106,15 @@
 direct=1
 EOF
 fi
+}
 
+gen_template() {
+cat >$TEMPLATE << EOF
+[global]
+ioengine=libaio
+invalidate=1
+ramp_time=5
+EOF
 }
 
 gen_seq_suite() {
@@ -303,9 +307,10 @@
 
 
 ########## MAIN
-parse_cmdline $@
-check_mode_order
 gen_template
+parse_cmdline $@
+finish_template
+check_mode_order
 
 echo "Generating $OUTFILE"
 cp -f $TEMPLATE $OUTFILE