expose generic aiori_ calls for access, etc.

master
Shane Snyder 2018-04-25 17:21:48 -05:00
parent 7a371cfeda
commit d7fc07163e
2 changed files with 33 additions and 10 deletions

View File

@ -61,7 +61,7 @@ ior_aiori_t *available_aiori[] = {
* This function provides a AIORI statfs for POSIX-compliant filesystems. It * This function provides a AIORI statfs for POSIX-compliant filesystems. It
* uses statvfs is available and falls back on statfs. * uses statvfs is available and falls back on statfs.
*/ */
static int aiori_statfs (const char *path, ior_aiori_statfs_t *stat_buf, IOR_param_t * param) int aiori_posix_statfs (const char *path, ior_aiori_statfs_t *stat_buf, IOR_param_t * param)
{ {
int ret; int ret;
#if defined(HAVE_STATVFS) #if defined(HAVE_STATVFS)
@ -86,44 +86,60 @@ static int aiori_statfs (const char *path, ior_aiori_statfs_t *stat_buf, IOR_par
return 0; return 0;
} }
static int aiori_mkdir (const char *path, mode_t mode, IOR_param_t * param) int aiori_posix_mkdir (const char *path, mode_t mode, IOR_param_t * param)
{ {
return mkdir (path, mode); return mkdir (path, mode);
} }
static int aiori_rmdir (const char *path, IOR_param_t * param) int aiori_posix_rmdir (const char *path, IOR_param_t * param)
{ {
return rmdir (path); return rmdir (path);
} }
static int aiori_access (const char *path, int mode, IOR_param_t * param) int aiori_posix_access (const char *path, int mode, IOR_param_t * param)
{ {
return access (path, mode); return access (path, mode);
} }
static int aiori_stat (const char *path, struct stat *buf, IOR_param_t * param) int aiori_posix_stat (const char *path, struct stat *buf, IOR_param_t * param)
{ {
return stat (path, buf); return stat (path, buf);
} }
const ior_aiori_t *aiori_select (const char *api) const ior_aiori_t *aiori_select (const char *api)
{ {
char warn_str[256] = {0};
for (ior_aiori_t **tmp = available_aiori ; *tmp != NULL; ++tmp) { for (ior_aiori_t **tmp = available_aiori ; *tmp != NULL; ++tmp) {
if (NULL == api || strcasecmp(api, (*tmp)->name) == 0) { if (NULL == api || strcasecmp(api, (*tmp)->name) == 0) {
if (NULL == (*tmp)->statfs) { if (NULL == (*tmp)->statfs) {
(*tmp)->statfs = aiori_statfs; (*tmp)->statfs = aiori_posix_statfs;
snprintf(warn_str, 256, "assuming POSIX-based backend for"
" %s statfs call", api);
WARN(warn_str);
} }
if (NULL == (*tmp)->mkdir) { if (NULL == (*tmp)->mkdir) {
(*tmp)->mkdir = aiori_mkdir; (*tmp)->mkdir = aiori_posix_mkdir;
snprintf(warn_str, 256, "assuming POSIX-based backend for"
" %s mkdir call", api);
WARN(warn_str);
} }
if (NULL == (*tmp)->rmdir) { if (NULL == (*tmp)->rmdir) {
(*tmp)->rmdir = aiori_rmdir; (*tmp)->rmdir = aiori_posix_rmdir;
snprintf(warn_str, 256, "assuming POSIX-based backend for"
" %s rmdir call", api);
WARN(warn_str);
} }
if (NULL == (*tmp)->access) { if (NULL == (*tmp)->access) {
(*tmp)->access = aiori_access; (*tmp)->access = aiori_posix_access;
snprintf(warn_str, 256, "assuming POSIX-based backend for"
" %s access call", api);
WARN(warn_str);
} }
if (NULL == (*tmp)->stat) { if (NULL == (*tmp)->stat) {
(*tmp)->stat = aiori_stat; (*tmp)->stat = aiori_posix_stat;
snprintf(warn_str, 256, "assuming POSIX-based backend for"
" %s stat call", api);
WARN(warn_str);
} }
return *tmp; return *tmp;
} }

View File

@ -92,6 +92,13 @@ const ior_aiori_t *aiori_select (const char *api);
int aiori_count (void); int aiori_count (void);
const char *aiori_default (void); const char *aiori_default (void);
/* some generic POSIX-based backend calls */
int aiori_posix_statfs (const char *path, ior_aiori_statfs_t *stat_buf, IOR_param_t * param);
int aiori_posix_mkdir (const char *path, mode_t mode, IOR_param_t * param);
int aiori_posix_rmdir (const char *path, IOR_param_t * param);
int aiori_posix_access (const char *path, int mode, IOR_param_t * param);
int aiori_posix_stat (const char *path, struct stat *buf, IOR_param_t * param);
IOR_offset_t MPIIO_GetFileSize(IOR_param_t * test, MPI_Comm testComm, IOR_offset_t MPIIO_GetFileSize(IOR_param_t * test, MPI_Comm testComm,
char *testFileName); char *testFileName);