00001
00002
00003
00004
00005
00006
00007
00008 #include "ad_pfs.h"
00009
00010 void ADIOI_PFS_IreadContig(ADIO_File fd, void *buf, int count,
00011 MPI_Datatype datatype, int file_ptr_type,
00012 ADIO_Offset offset, ADIO_Request *request,
00013 int *error_code)
00014 {
00015 long *id_sys;
00016 int len, typesize, err=-1;
00017 ADIO_Offset off;
00018 static char myname[] = "ADIOI_PFS_IREADCONTIG";
00019
00020 *request = ADIOI_Malloc_request();
00021 (*request)->optype = ADIOI_READ;
00022 (*request)->fd = fd;
00023 (*request)->datatype = datatype;
00024
00025 MPI_Type_size(datatype, &typesize);
00026 len = count * typesize;
00027
00028 id_sys = (long *) ADIOI_Malloc(sizeof(long));
00029 (*request)->handle = (void *) id_sys;
00030
00031 off = (file_ptr_type == ADIO_INDIVIDUAL) ? fd->fp_ind : offset;
00032
00033 lseek(fd->fd_sys, off, SEEK_SET);
00034 *id_sys = _iread(fd->fd_sys, buf, len);
00035
00036 if ((*id_sys == -1) && (errno == EQNOMID)) {
00037
00038
00039
00040
00041
00042
00043 if (*error_code != MPI_SUCCESS) return;
00044
00045
00046 *id_sys = _iread(fd->fd_sys, buf, len);
00047
00048 if ((*id_sys == -1) && (errno == EQNOMID)) {
00049 *error_code = MPIO_Err_create_code(MPI_SUCCESS,
00050 MPIR_ERR_RECOVERABLE, myname,
00051 __LINE__, MPI_ERR_IO, "**io",
00052 "**io %s", strerror(errno));
00053 return;
00054 }
00055 }
00056 else if (*id_sys == -1) {
00057 *error_code = MPIO_Err_create_code(MPI_SUCCESS, MPIR_ERR_RECOVERABLE,
00058 myname, __LINE__, MPI_ERR_IO,
00059 "**io",
00060 "**io %s", strerror(errno));
00061 return;
00062 }
00063
00064 if (file_ptr_type == ADIO_INDIVIDUAL) fd->fp_ind += len;
00065
00066 (*request)->queued = 1;
00067 (*request)->nbytes = len;
00068 ADIOI_Add_req_to_list(request);
00069 fd->async_count++;
00070
00071 fd->fp_sys_posn = -1;
00072
00073 if (*id_sys == -1) {
00074 *error_code = MPIO_Err_create_code(MPI_SUCCESS, MPIR_ERR_RECOVERABLE,
00075 myname, __LINE__, MPI_ERR_IO,
00076 "**io",
00077 "**io %s", strerror(errno));
00078 }
00079 else *error_code = MPI_SUCCESS;
00080 }