Start the process of making options more gfio friendly
We either need to eliminate the option callbacks, or ensure that
they don't have side effects outside of touching td->o. We will
need to use &td->o as the data passed in for the callbacks, not
the full td.
Signed-off-by: Jens Axboe <axboe@kernel.dk>
diff --git a/memory.c b/memory.c
index 82a79bd..0135abb 100644
--- a/memory.c
+++ b/memory.c
@@ -121,8 +121,8 @@
td->mmapfd = 1;
- if (td->mmapfile) {
- td->mmapfd = open(td->mmapfile, O_RDWR|O_CREAT, 0644);
+ if (td->o.mmapfile) {
+ td->mmapfd = open(td->o.mmapfile, O_RDWR|O_CREAT, 0644);
if (td->mmapfd < 0) {
td_verror(td, errno, "open mmap file");
@@ -146,7 +146,7 @@
td->orig_buffer = NULL;
if (td->mmapfd) {
close(td->mmapfd);
- unlink(td->mmapfile);
+ unlink(td->o.mmapfile);
}
return 1;
@@ -159,10 +159,10 @@
{
dprint(FD_MEM, "munmap %u %p\n", total_mem, td->orig_buffer);
munmap(td->orig_buffer, td->orig_buffer_size);
- if (td->mmapfile) {
+ if (td->o.mmapfile) {
close(td->mmapfd);
- unlink(td->mmapfile);
- free(td->mmapfile);
+ unlink(td->o.mmapfile);
+ free(td->o.mmapfile);
}
}