This source file includes following definitions.
- ADIO_Set_shared_fp
1
2
3
4
5
6
7 #include "adio.h"
8
9
10
11
12 void ADIOI_NFS_Set_shared_fp(ADIO_File fd, ADIO_Offset offset, int *error_code);
13
14 void ADIO_Set_shared_fp(ADIO_File fd, ADIO_Offset offset, int *error_code)
15 {
16 ADIO_Status status;
17 MPI_Comm dupcommself;
18
19 #ifdef ROMIO_NFS
20 if (fd->file_system == ADIO_NFS) {
21 ADIOI_NFS_Set_shared_fp(fd, offset, error_code);
22 return;
23 }
24 #endif
25
26 if (fd->shared_fp_fd == ADIO_FILE_NULL) {
27 MPI_Comm_dup(MPI_COMM_SELF, &dupcommself);
28 fd->shared_fp_fd = ADIO_Open(MPI_COMM_SELF, dupcommself,
29 fd->shared_fp_fname,
30 fd->file_system,
31 fd->fns,
32 ADIO_CREATE | ADIO_RDWR | ADIO_DELETE_ON_CLOSE,
33 0, MPI_BYTE, MPI_BYTE,
34 MPI_INFO_NULL,
35 ADIO_PERM_NULL, error_code);
36 }
37
38 if (*error_code != MPI_SUCCESS) return;
39
40 ADIOI_WRITE_LOCK(fd->shared_fp_fd, 0, SEEK_SET, sizeof(ADIO_Offset));
41 ADIO_WriteContig(fd->shared_fp_fd, &offset, sizeof(ADIO_Offset),
42 MPI_BYTE, ADIO_EXPLICIT_OFFSET, 0, &status, error_code);
43 ADIOI_UNLOCK(fd->shared_fp_fd, 0, SEEK_SET, sizeof(ADIO_Offset));
44 }
45