00001
00002
00003
00004
00005
00006
00007
00008 #include "ad_pfs.h"
00009
00010 int ADIOI_PFS_ReadDone(ADIO_Request *request, ADIO_Status *status,
00011 int *error_code)
00012 {
00013 int done=0;
00014 static char myname[] = "ADIOI_PFS_READDONE";
00015
00016 if (*request == ADIO_REQUEST_NULL) {
00017 *error_code = MPI_SUCCESS;
00018 return 1;
00019 }
00020
00021 if ((*request)->queued)
00022 done = _iodone(*((long *) (*request)->handle));
00023 else done = 1;
00024
00025
00026 #ifdef HAVE_STATUS_SET_BYTES
00027 if ((done >= 0) && ((*request)->nbytes != -1))
00028 MPIR_Status_set_bytes(status, (*request)->datatype, (*request)->nbytes);
00029 #endif
00030
00031 if (done >= 0) {
00032
00033
00034 if ((*request)->queued) ADIOI_Del_req_from_list(request);
00035
00036 (*request)->fd->async_count--;
00037 if ((*request)->handle) ADIOI_Free((*request)->handle);
00038 ADIOI_Free_request((ADIOI_Req_node *) (*request));
00039 *request = ADIO_REQUEST_NULL;
00040 }
00041
00042 if (done == -1 && errno != 0) {
00043 *error_code = MPIO_Err_create_code(MPI_SUCCESS, MPIR_ERR_RECOVERABLE,
00044 myname, __LINE__, MPI_ERR_IO,
00045 "**io",
00046 "**io %s", strerror(errno));
00047 }
00048 else *error_code = MPI_SUCCESS;
00049 return done;
00050 }
00051
00052
00053 int ADIOI_PFS_WriteDone(ADIO_Request *request, ADIO_Status *status,
00054 int *error_code)
00055 {
00056 return ADIOI_PFS_ReadDone(request, status, error_code);
00057 }