00001
00002
00003
00004
00005
00006
00007
00008 #include "ad_pfs.h"
00009
00010 void ADIOI_PFS_ReadContig(ADIO_File fd, void *buf, int count,
00011 MPI_Datatype datatype, int file_ptr_type,
00012 ADIO_Offset offset, ADIO_Status *status, int *error_code)
00013 {
00014 int err=-1, datatype_size, len;
00015 static char myname[] = "ADIOI_PFS_READCONTIG";
00016
00017 MPI_Type_size(datatype, &datatype_size);
00018 len = datatype_size * count;
00019
00020 if (file_ptr_type == ADIO_EXPLICIT_OFFSET) {
00021 if (fd->fp_sys_posn != offset) {
00022 lseek(fd->fd_sys, offset, SEEK_SET);
00023 }
00024 err = _cread(fd->fd_sys, buf, len);
00025 fd->fp_sys_posn = offset + err;
00026
00027 }
00028 else {
00029 if (fd->fp_sys_posn != fd->fp_ind) {
00030 lseek(fd->fd_sys, fd->fp_ind, SEEK_SET);
00031 }
00032 err = _cread(fd->fd_sys, buf, len);
00033 fd->fp_ind += err;
00034 fd->fp_sys_posn = fd->fp_ind;
00035 }
00036
00037 #ifdef HAVE_STATUS_SET_BYTES
00038 if (err != -1) MPIR_Status_set_bytes(status, datatype, err);
00039 #endif
00040
00041 if (err == -1) {
00042 *error_code = MPIO_Err_create_code(MPI_SUCCESS, MPIR_ERR_RECOVERABLE,
00043 myname, __LINE__, MPI_ERR_IO,
00044 "**io",
00045 "**io %s", strerror(errno));
00046 }
00047 else *error_code = MPI_SUCCESS;
00048 }