00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014 #include "ad_ntfs.h"
00015
00016 void ADIOI_NTFS_ReadContig(ADIO_File fd, void *buf, int count,
00017 MPI_Datatype datatype, int file_ptr_type,
00018 ADIO_Offset offset, ADIO_Status *status, int *error_code)
00019 {
00020
00021 DWORD dwTemp;
00022 DWORD dwNumRead = 0;
00023 int err=-1, datatype_size, len;
00024 #ifndef PRINT_ERR_MSG
00025 static char myname[] = "ADIOI_NTFS_READCONTIG";
00026 #endif
00027
00028 MPI_Type_size(datatype, &datatype_size);
00029 len = datatype_size * count;
00030
00031 if (file_ptr_type == ADIO_EXPLICIT_OFFSET) {
00032 if (fd->fp_sys_posn != offset)
00033 {
00034 dwTemp = DWORDHIGH(offset);
00035 SetFilePointer(fd->fd_sys, DWORDLOW(offset), &dwTemp, FILE_BEGIN);
00036 }
00037 err = ReadFile(fd->fd_sys, buf, len, &dwNumRead, NULL);
00038
00039
00040 fd->fp_sys_posn = offset + (ADIO_Offset)dwNumRead;
00041
00042 }
00043 else {
00044 if (fd->fp_sys_posn != fd->fp_ind)
00045 {
00046 dwTemp = DWORDHIGH(fd->fp_ind);
00047 SetFilePointer(fd->fd_sys, DWORDLOW(fd->fp_ind), &dwTemp, FILE_BEGIN);
00048 }
00049 err = ReadFile(fd->fd_sys, buf, len, &dwNumRead, NULL);
00050
00051
00052 fd->fp_ind = fd->fp_ind + (ADIO_Offset)dwNumRead;
00053 fd->fp_sys_posn = fd->fp_ind;
00054 }
00055
00056 #ifdef HAVE_STATUS_SET_BYTES
00057 if (err != FALSE) MPIR_Status_set_bytes(status, datatype, dwNumRead);
00058 #endif
00059
00060 #ifdef PRINT_ERR_MSG
00061 *error_code = (err == FALSE) ? MPI_ERR_UNKNOWN : MPI_SUCCESS;
00062 #else
00063 if (err == FALSE) {
00064 *error_code = MPIR_Err_setmsg(MPI_ERR_IO, MPIR_ADIO_ERROR,
00065 myname, "I/O Error", "%s", strerror(errno));
00066 ADIOI_Error(fd, *error_code, myname);
00067 }
00068 else *error_code = MPI_SUCCESS;
00069 #endif
00070 }
00071
00072
00073
00074
00075 void ADIOI_NTFS_ReadStrided(ADIO_File fd, void *buf, int count,
00076 MPI_Datatype datatype, int file_ptr_type,
00077 ADIO_Offset offset, ADIO_Status *status, int
00078 *error_code)
00079 {
00080 ADIOI_GEN_ReadStrided(fd, buf, count, datatype, file_ptr_type,
00081 offset, status, error_code);
00082 }