00001
00002
00003
00004
00005
00006
00007
00008
00009 #include "adio.h"
00010
00011
00012
00013
00014 void ADIO_Set_shared_fp(ADIO_File fd, ADIO_Offset offset, int *error_code)
00015 {
00016 ADIO_Status status;
00017 MPI_Comm dupcommself;
00018
00019 #ifdef NFS
00020 if (fd->file_system == ADIO_NFS) {
00021 ADIOI_NFS_Set_shared_fp(fd, offset, error_code);
00022 return;
00023 }
00024 #endif
00025
00026 if (fd->shared_fp_fd == ADIO_FILE_NULL) {
00027 MPI_Comm_dup(MPI_COMM_SELF, &dupcommself);
00028 fd->shared_fp_fd = ADIO_Open(MPI_COMM_SELF, dupcommself,
00029 fd->shared_fp_fname,
00030 fd->file_system,
00031 ADIO_CREATE | ADIO_RDWR | ADIO_DELETE_ON_CLOSE,
00032 0, MPI_BYTE, MPI_BYTE, M_ASYNC,
00033 MPI_INFO_NULL,
00034 ADIO_PERM_NULL, error_code);
00035 }
00036
00037 if (*error_code != MPI_SUCCESS) return;
00038
00039 ADIOI_WRITE_LOCK(fd->shared_fp_fd, 0, SEEK_SET, sizeof(ADIO_Offset));
00040 ADIO_WriteContig(fd->shared_fp_fd, &offset, sizeof(ADIO_Offset),
00041 MPI_BYTE, ADIO_EXPLICIT_OFFSET, 0, &status, error_code);
00042 ADIOI_UNLOCK(fd->shared_fp_fd, 0, SEEK_SET, sizeof(ADIO_Offset));
00043 }
00044