00001
00002
00003
00004
00005
00006
00007
00008 #include "ad_pvfs2.h"
00009 #include "adio_extern.h"
00010 #include "ad_pvfs2_common.h"
00011
00012 void ADIOI_PVFS2_Fcntl(ADIO_File fd, int flag, ADIO_Fcntl_t *fcntl_struct,
00013 int *error_code)
00014 {
00015 int ret;
00016 ADIOI_PVFS2_fs *pvfs_fs;
00017 PVFS_sysresp_getattr resp_getattr;
00018 static char myname[] = "ADIOI_PVFS2_FCNTL";
00019
00020 pvfs_fs = (ADIOI_PVFS2_fs*)fd->fs_ptr;
00021
00022 switch(flag) {
00023 case ADIO_FCNTL_GET_FSIZE:
00024 ret = PVFS_sys_getattr(pvfs_fs->object_ref, PVFS_ATTR_SYS_SIZE,
00025 &(pvfs_fs->credentials), &resp_getattr);
00026 if (ret != 0 ) {
00027
00028 *error_code = MPIO_Err_create_code(MPI_SUCCESS,
00029 MPIR_ERR_RECOVERABLE,
00030 myname, __LINE__,
00031 ADIOI_PVFS2_error_convert(ret),
00032 "Error in PVFS_sys_getattr", 0);
00033
00034 }
00035 else {
00036 *error_code = MPI_SUCCESS;
00037 }
00038 fcntl_struct->fsize = resp_getattr.attr.size;
00039 return;
00040
00041 case ADIO_FCNTL_SET_DISKSPACE:
00042 ADIOI_GEN_Prealloc(fd, fcntl_struct->diskspace, error_code);
00043 break;
00044
00045
00046 case ADIO_FCNTL_SET_ATOMICITY:
00047 default:
00048 *error_code = MPIO_Err_create_code(MPI_SUCCESS,
00049 MPIR_ERR_RECOVERABLE,
00050 myname, __LINE__,
00051 MPI_ERR_ARG,
00052 "**flag", "**flag %d", flag);
00053
00054 }
00055 }
00056
00057
00058
00059