00001
00002
00003
00004
00005
00006
00007
00008 #include "ad_pvfs.h"
00009 #include "adio_extern.h"
00010
00011 void ADIOI_PVFS_Fcntl(ADIO_File fd, int flag, ADIO_Fcntl_t *fcntl_struct,
00012 int *error_code)
00013 {
00014 static char myname[] = "ADIOI_PVFS_FCNTL";
00015
00016 switch(flag) {
00017 case ADIO_FCNTL_GET_FSIZE:
00018 #ifdef ADIOI_MPE_LOGGING
00019 MPE_Log_event( ADIOI_MPE_lseek_a, 0, NULL );
00020 #endif
00021 fcntl_struct->fsize = pvfs_lseek64(fd->fd_sys, 0, SEEK_END);
00022 #ifdef ADIOI_MPE_LOGGING
00023 MPE_Log_event( ADIOI_MPE_lseek_b, 0, NULL );
00024 #endif
00025 if (fd->fp_sys_posn != -1) {
00026 #ifdef ADIOI_MPE_LOGGING
00027 MPE_Log_event( ADIOI_MPE_lseek_a, 0, NULL );
00028 #endif
00029 pvfs_lseek64(fd->fd_sys, fd->fp_sys_posn, SEEK_SET);
00030 #ifdef ADIOI_MPE_LOGGING
00031 MPE_Log_event( ADIOI_MPE_lseek_b, 0, NULL );
00032 #endif
00033 }
00034 if (fcntl_struct->fsize == -1) {
00035 *error_code = MPIO_Err_create_code(MPI_SUCCESS,
00036 MPIR_ERR_RECOVERABLE, myname,
00037 __LINE__, MPI_ERR_IO, "**io",
00038 "**io %s", strerror(errno));
00039 }
00040 else *error_code = MPI_SUCCESS;
00041 break;
00042
00043 case ADIO_FCNTL_SET_DISKSPACE:
00044 ADIOI_GEN_Prealloc(fd, fcntl_struct->diskspace, error_code);
00045 break;
00046
00047 case ADIO_FCNTL_SET_ATOMICITY:
00048 fd->atomicity = 0;
00049
00050 if (fcntl_struct->atomicity != 0) {
00051 *error_code = MPIO_Err_create_code(MPI_SUCCESS,
00052 MPIR_ERR_RECOVERABLE,
00053 myname, __LINE__,
00054 MPI_ERR_UNSUPPORTED_OPERATION,
00055 "PVFS does not support atomic mode",
00056 0);
00057 return;
00058 }
00059
00060 break;
00061
00062 default:
00063
00064 *error_code = MPIO_Err_create_code(MPI_SUCCESS,
00065 MPIR_ERR_RECOVERABLE,
00066 myname, __LINE__,
00067 MPI_ERR_ARG,
00068 "**flag", "**flag %d", flag);
00069 return;
00070
00071 }
00072 }