+static int fio_mmapio_open_file(struct thread_data *td, struct fio_file *f)
+{
+ struct fio_mmap_data *fmd;
+ int ret;
+
+ ret = generic_open_file(td, f);
+ if (ret)
+ return ret;
+
+ fmd = calloc(1, sizeof(*fmd));
+ if (!fmd) {
+ int fio_unused __ret;
+ __ret = generic_close_file(td, f);
+ return 1;
+ }
+
+ FILE_SET_ENG_DATA(f, fmd);
+ return 0;
+}
+
+static int fio_mmapio_close_file(struct thread_data *td, struct fio_file *f)
+{
+ struct fio_mmap_data *fmd = FILE_ENG_DATA(f);
+
+ FILE_SET_ENG_DATA(f, NULL);
+ free(fmd);
+ fio_file_clear_partial_mmap(f);
+
+ return generic_close_file(td, f);
+}
+