Revamp file open/close handling

Some IO engines need special handling for opening and closing
files, and this has complicated the fio filesetup.c file. Instead
have the io engine provide hooks for file open/close. This also
greatly cleans up the flags (we can get rid of SELFOPEN and MMAPIO)
and moves private knowledge into the engines where it belongs.

This potentially destabilizes fio somewhat, so testing is needed.
The new openfiles option that is introduced with this change isn't
verified working yet, hence it isn't documented.

Signed-off-by: Jens Axboe <jens.axboe@oracle.com>
diff --git a/fio.c b/fio.c
index 48d65e0..43cc6af 100644
--- a/fio.c
+++ b/fio.c
@@ -734,14 +734,11 @@
 
 	if (!td->create_serialize && setup_files(td))
 		goto err;
-	if (open_files(td))
+
+	if (td_io_init(td))
 		goto err;
 
-	/*
-	 * Do this late, as some IO engines would like to have the
-	 * files setup prior to initializing structures.
-	 */
-	if (td_io_init(td))
+	if (open_files(td))
 		goto err;
 
 	if (td->exec_prerun) {