This source file includes following definitions.
- ADIOI_PIOFS_ReadContig
1
2
3
4
5
6
7
8 #include "ad_piofs.h"
9
10 void ADIOI_PIOFS_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 #ifndef PRINT_ERR_MSG
16 static char myname[] = "ADIOI_PIOFS_READCONTIG";
17 #endif
18
19 MPI_Type_size_x(datatype, &datatype_size);
20 len = datatype_size * count;
21
22 if (file_ptr_type == ADIO_EXPLICIT_OFFSET) {
23 if (fd->fp_sys_posn != offset) {
24 llseek(fd->fd_sys, offset, SEEK_SET);
25 }
26 err = read(fd->fd_sys, buf, len);
27 fd->fp_sys_posn = offset + err;
28
29 }
30 else {
31 if (fd->fp_sys_posn != fd->fp_ind) {
32 llseek(fd->fd_sys, fd->fp_ind, SEEK_SET);
33 }
34 err = read(fd->fd_sys, buf, len);
35 fd->fp_ind += err;
36 fd->fp_sys_posn = fd->fp_ind;
37 }
38
39 #ifdef HAVE_STATUS_SET_BYTES
40 if (err != -1) MPIR_Status_set_bytes(status, datatype, err);
41 #endif
42
43 if (err == -1) {
44 #ifdef MPICH
45 *error_code = MPIR_Err_create_code(MPI_SUCCESS, MPIR_ERR_RECOVERABLE, myname, __LINE__, MPI_ERR_IO, "**io",
46 "**io %s", strerror(errno));
47 #elif defined(PRINT_ERR_MSG)
48 *error_code = MPI_ERR_UNKNOWN;
49 #else
50 *error_code = MPIR_Err_setmsg(MPI_ERR_IO, MPIR_ADIO_ERROR,
51 myname, "I/O Error", "%s", strerror(errno));
52 ADIOI_Error(fd, *error_code, myname);
53 #endif
54 }
55 else *error_code = MPI_SUCCESS;
56 }