This source file includes following definitions.
- ADIOI_PFS_ReadContig
1
2
3
4
5
6
7
8 #include "ad_pfs.h"
9
10 void ADIOI_PFS_ReadContig(ADIO_File fd, void *buf, int count,
11 MPI_Datatype datatype, int file_ptr_type,
12 ADIO_Offset offset, ADIO_Status *status, int *error_code)
13 {
14 MPI_Count err=-1, datatype_size, len;
15 static char myname[] = "ADIOI_PFS_READCONTIG";
16
17 MPI_Type_size_x(datatype, &datatype_size);
18 len = datatype_size * count;
19
20 if (file_ptr_type == ADIO_EXPLICIT_OFFSET) {
21 if (fd->fp_sys_posn != offset) {
22 lseek(fd->fd_sys, offset, SEEK_SET);
23 }
24 err = _cread(fd->fd_sys, buf, len);
25 fd->fp_sys_posn = offset + err;
26
27 }
28 else {
29 if (fd->fp_sys_posn != fd->fp_ind) {
30 lseek(fd->fd_sys, fd->fp_ind, SEEK_SET);
31 }
32 err = _cread(fd->fd_sys, buf, len);
33 fd->fp_ind += err;
34 fd->fp_sys_posn = fd->fp_ind;
35 }
36
37 #ifdef HAVE_STATUS_SET_BYTES
38 if (err != -1) MPIR_Status_set_bytes(status, datatype, err);
39 #endif
40
41 if (err == -1) {
42 *error_code = MPIO_Err_create_code(MPI_SUCCESS, MPIR_ERR_RECOVERABLE,
43 myname, __LINE__, MPI_ERR_IO,
44 "**io",
45 "**io %s", strerror(errno));
46 }
47 else *error_code = MPI_SUCCESS;
48 }