00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014 #include "ad_ntfs.h"
00015
00016 void ADIOI_NTFS_IreadContig(ADIO_File fd, void *buf, int count,
00017 MPI_Datatype datatype, int file_ptr_type,
00018 ADIO_Offset offset, ADIO_Request *request, int *error_code)
00019 {
00020 int len, typesize;
00021 int err=FALSE;
00022 #ifndef PRINT_ERR_MSG
00023 static char myname[] = "ADIOI_NTFS_IREADCONTIG";
00024 #endif
00025
00026 (*request) = ADIOI_Malloc_request();
00027 (*request)->optype = ADIOI_READ;
00028 (*request)->fd = fd;
00029 (*request)->datatype = datatype;
00030
00031 MPI_Type_size(datatype, &typesize);
00032 len = count * typesize;
00033
00034 if (file_ptr_type == ADIO_INDIVIDUAL) offset = fd->fp_ind;
00035 err = ADIOI_NTFS_aio(fd, buf, len, offset, 0, &((*request)->handle));
00036 if (file_ptr_type == ADIO_INDIVIDUAL) fd->fp_ind += len;
00037
00038 (*request)->queued = 1;
00039 ADIOI_Add_req_to_list(request);
00040
00041 #ifdef PRINT_ERR_MSG
00042 *error_code = (err == FALSE) ? MPI_ERR_UNKNOWN : MPI_SUCCESS;
00043 #else
00044 if (err == FALSE) {
00045 *error_code = MPIR_Err_setmsg(MPI_ERR_IO, MPIR_ADIO_ERROR,
00046 myname, "I/O Error", "%s", strerror(errno));
00047 ADIOI_Error(fd, *error_code, myname);
00048 }
00049 else *error_code = MPI_SUCCESS;
00050 #endif
00051
00052 fd->fp_sys_posn = -1;
00053 fd->async_count++;
00054 }
00055
00056
00057
00058 void ADIOI_NTFS_IreadStrided(ADIO_File fd, void *buf, int count,
00059 MPI_Datatype datatype, int file_ptr_type,
00060 ADIO_Offset offset, ADIO_Request *request, int
00061 *error_code)
00062 {
00063 ADIO_Status status;
00064 #ifdef HAVE_STATUS_SET_BYTES
00065 int typesize;
00066 #endif
00067
00068 *request = ADIOI_Malloc_request();
00069 (*request)->optype = ADIOI_READ;
00070 (*request)->fd = fd;
00071 (*request)->datatype = datatype;
00072 (*request)->queued = 0;
00073 (*request)->handle = 0;
00074
00075
00076 ADIOI_NTFS_ReadStrided(fd, buf, count, datatype, file_ptr_type,
00077 offset, &status, error_code);
00078
00079 fd->async_count++;
00080
00081 #ifdef HAVE_STATUS_SET_BYTES
00082 if (*error_code == MPI_SUCCESS) {
00083 MPI_Type_size(datatype, &typesize);
00084 (*request)->nbytes = count * typesize;
00085 }
00086 #endif
00087 }