This source file includes following definitions.
- ADIOI_NFS_Open
1
2
3
4
5
6
7
8 #include "ad_nfs.h"
9
10 void ADIOI_NFS_Open(ADIO_File fd, int *error_code)
11 {
12 int perm, amode;
13 mode_t old_mask;
14 static char myname[] = "ADIOI_NFS_OPEN";
15
16 if (fd->perm == ADIO_PERM_NULL) {
17 old_mask = umask(022);
18 umask(old_mask);
19 perm = old_mask ^ 0666;
20 }
21 else perm = fd->perm;
22
23 amode = 0;
24 if (fd->access_mode & ADIO_CREATE)
25 amode = amode | O_CREAT;
26 if (fd->access_mode & ADIO_RDONLY)
27 amode = amode | O_RDONLY;
28 if (fd->access_mode & ADIO_WRONLY)
29 amode = amode | O_WRONLY;
30 if (fd->access_mode & ADIO_RDWR)
31 amode = amode | O_RDWR;
32 if (fd->access_mode & ADIO_EXCL)
33 amode = amode | O_EXCL;
34
35 #ifdef ADIOI_MPE_LOGGING
36 MPE_Log_event( ADIOI_MPE_open_a, 0, NULL );
37 #endif
38 fd->fd_sys = open(fd->filename, amode, perm);
39 #ifdef ADIOI_MPE_LOGGING
40 MPE_Log_event( ADIOI_MPE_open_b, 0, NULL );
41 #endif
42 fd->fd_direct = -1;
43
44 if ((fd->fd_sys != -1) && (fd->access_mode & ADIO_APPEND)) {
45 #ifdef ADIOI_MPE_LOGGING
46 MPE_Log_event( ADIOI_MPE_lseek_a, 0, NULL );
47 #endif
48 fd->fp_ind = fd->fp_sys_posn = lseek(fd->fd_sys, 0, SEEK_END);
49 #ifdef ADIOI_MPE_LOGGING
50 MPE_Log_event( ADIOI_MPE_lseek_b, 0, NULL );
51 #endif
52 }
53
54 if (fd->fd_sys == -1) {
55 *error_code = ADIOI_Err_create_code(myname, fd->filename, errno);
56 }
57 else *error_code = MPI_SUCCESS;
58 }