diff --git a/src/aiori-IME.c b/src/aiori-IME.c index ef7b3cf..b6cef34 100755 --- a/src/aiori-IME.c +++ b/src/aiori-IME.c @@ -54,6 +54,33 @@ static int IME_Stat(const char *, struct stat *, IOR_param_t *); static void IME_Initialize(); static void IME_Finalize(); + +/************************** O P T I O N S *****************************/ +typedef struct{ + int direct_io; +} ime_options_t; + + +option_help * IME_options(void ** init_backend_options, void * init_values){ + ime_options_t * o = malloc(sizeof(ime_options_t)); + + if (init_values != NULL){ + memcpy(o, init_values, sizeof(ime_options_t)); + }else{ + o->direct_io = 0; + } + + *init_backend_options = o; + + option_help h [] = { + {0, "ime.odirect", "Direct I/O Mode", OPTION_FLAG, 'd', & o->direct_io}, + LAST_OPTION + }; + option_help * help = malloc(sizeof(h)); + memcpy(help, h, sizeof(h)); + return help; +} + /************************** D E C L A R A T I O N S ***************************/ extern int rank; @@ -79,6 +106,7 @@ ior_aiori_t ime_aiori = { .stat = IME_Stat, .initialize = IME_Initialize, .finalize = IME_Finalize, + .get_options = IME_options, .enable_mdtest = true, }; @@ -130,8 +158,10 @@ static void *IME_Open(char *testFileName, IOR_param_t *param) if (fd == NULL) ERR("Unable to malloc file descriptor"); - if (param->useO_DIRECT) - set_o_direct_flag(&fd_oflag); + ime_options_t * o = (ime_options_t*) param->backend_options; + if (o->direct_io == TRUE){ + set_o_direct_flag(&fd_oflag); + } if (param->openFlags & IOR_RDONLY) fd_oflag |= O_RDONLY;