00001
00002
00003
00004
00005
00006
00007
00008
00009 #include "ad_pfs.h"
00010
00011 void ADIOI_PFS_ReadComplete(ADIO_Request *request, ADIO_Status *status, int *error_code)
00012 {
00013 int err=0;
00014 #ifndef PRINT_ERR_MSG
00015 static char myname[] = "ADIOI_PFS_READCOMPLETE";
00016 #endif
00017
00018 if (*request == ADIO_REQUEST_NULL) {
00019 *error_code = MPI_SUCCESS;
00020 return;
00021 }
00022
00023 if ((*request)->queued) {
00024 err = _iowait(*((long *) (*request)->handle));
00025 #ifdef PRINT_ERR_MSG
00026 *error_code = (err == -1) ? MPI_ERR_UNKNOWN : MPI_SUCCESS;
00027 #else
00028 if (err == -1) {
00029 *error_code = MPIR_Err_setmsg(MPI_ERR_IO, MPIR_ADIO_ERROR,
00030 myname, "I/O Error", "%s", strerror(errno));
00031 ADIOI_Error((*request)->fd, *error_code, myname);
00032 }
00033 else *error_code = MPI_SUCCESS;
00034 #endif
00035 }
00036 else *error_code = MPI_SUCCESS;
00037 #ifdef HAVE_STATUS_SET_BYTES
00038 if ((*request)->nbytes != -1)
00039 MPIR_Status_set_bytes(status, (*request)->datatype, (*request)->nbytes);
00040 #endif
00041
00042 if ((*request)->queued != -1) {
00043
00044
00045
00046
00047
00048
00049
00050
00051
00052
00053
00054 if ((*request)->queued) ADIOI_Del_req_from_list(request);
00055
00056 (*request)->fd->async_count--;
00057 if ((*request)->handle) ADIOI_Free((*request)->handle);
00058 ADIOI_Free_request((ADIOI_Req_node *) (*request));
00059 *request = ADIO_REQUEST_NULL;
00060 }
00061 }
00062
00063
00064 void ADIOI_PFS_WriteComplete(ADIO_Request *request, ADIO_Status *status, int *error_code)
00065 {
00066 ADIOI_PFS_ReadComplete(request, status, error_code);
00067 }