This source file includes following definitions.
- ADIOI_NFS_Fcntl
1
2
3
4
5
6
7
8 #include "ad_nfs.h"
9 #include "adio_extern.h"
10
11
12
13
14 void ADIOI_NFS_Fcntl(ADIO_File fd, int flag, ADIO_Fcntl_t *fcntl_struct, int *error_code)
15 {
16 static char myname[] = "ADIOI_NFS_FCNTL";
17
18 switch(flag) {
19 case ADIO_FCNTL_GET_FSIZE:
20 ADIOI_READ_LOCK(fd, 0, SEEK_SET, 1);
21 #ifdef ADIOI_MPE_LOGGING
22 MPE_Log_event( ADIOI_MPE_lseek_a, 0, NULL );
23 #endif
24 fcntl_struct->fsize = lseek(fd->fd_sys, 0, SEEK_END);
25 #ifdef ADIOI_MPE_LOGGING
26 MPE_Log_event( ADIOI_MPE_lseek_b, 0, NULL );
27 #endif
28 ADIOI_UNLOCK(fd, 0, SEEK_SET, 1);
29 if (fd->fp_sys_posn != -1) {
30 #ifdef ADIOI_MPE_LOGGING
31 MPE_Log_event( ADIOI_MPE_lseek_a, 0, NULL );
32 #endif
33 lseek(fd->fd_sys, fd->fp_sys_posn, SEEK_SET);
34 #ifdef ADIOI_MPE_LOGGING
35 MPE_Log_event( ADIOI_MPE_lseek_b, 0, NULL );
36 #endif
37 }
38 if (fcntl_struct->fsize == -1) {
39 *error_code = MPIO_Err_create_code(MPI_SUCCESS,
40 MPIR_ERR_RECOVERABLE, myname,
41 __LINE__, MPI_ERR_IO, "**io",
42 "**io %s", strerror(errno));
43 }
44 else *error_code = MPI_SUCCESS;
45 break;
46
47 case ADIO_FCNTL_SET_DISKSPACE:
48 ADIOI_GEN_Prealloc(fd, fcntl_struct->diskspace, error_code);
49 break;
50
51 case ADIO_FCNTL_SET_ATOMICITY:
52 fd->atomicity = (fcntl_struct->atomicity == 0) ? 0 : 1;
53 *error_code = MPI_SUCCESS;
54 break;
55
56 default:
57
58 *error_code = MPIO_Err_create_code(MPI_SUCCESS, MPIR_ERR_RECOVERABLE,
59 myname, __LINE__,
60 MPI_ERR_ARG,
61 "**flag", "**flag %d", flag);
62 return;
63
64 }
65 }