1 /* -*- Mode: C; c-basic-offset:4 ; -*- */
5 * Copyright (C) 1997 University of Chicago.
6 * See COPYRIGHT notice in top-level directory.
11 int ADIOI_XFS_ReadDone(ADIO_Request
*request
, ADIO_Status
*status
, int *error_code
)
15 static char myname
[] = "ADIOI_XFS_READDONE";
18 if (*request
== ADIO_REQUEST_NULL
) {
19 *error_code
= MPI_SUCCESS
;
23 if ((*request
)->queued
) {
24 errno
= aio_error64((const aiocb64_t
*) (*request
)->handle
);
25 if (errno
== EINPROGRESS
) {
27 *error_code
= MPI_SUCCESS
;
30 err
= aio_return64((aiocb64_t
*) (*request
)->handle
);
31 (*request
)->nbytes
= err
;
32 errno
= aio_error64((const aiocb64_t
*) (*request
)->handle
);
36 *error_code
= (err
== -1) ? MPI_ERR_UNKNOWN
: MPI_SUCCESS
;
39 *error_code
= MPIR_Err_setmsg(MPI_ERR_IO
, MPIR_ADIO_ERROR
,
40 myname
, "I/O Error", "%s", strerror(errno
));
41 ADIOI_Error((*request
)->fd
, *error_code
, myname
);
43 else *error_code
= MPI_SUCCESS
;
49 *error_code
= MPI_SUCCESS
;
51 #ifdef HAVE_STATUS_SET_BYTES
52 if (done
&& ((*request
)->nbytes
!= -1))
53 MPIR_Status_set_bytes(status
, (*request
)->datatype
, (*request
)->nbytes
);
57 /* if request is still queued in the system, it is also there
58 on ADIOI_Async_list. Delete it from there. */
59 if ((*request
)->queued
) ADIOI_Del_req_from_list(request
);
61 (*request
)->fd
->async_count
--;
62 if ((*request
)->handle
) ADIOI_Free((*request
)->handle
);
63 ADIOI_Free_request((ADIOI_Req_node
*) (*request
));
64 *request
= ADIO_REQUEST_NULL
;
65 /* status to be filled */
71 int ADIOI_XFS_WriteDone(ADIO_Request
*request
, ADIO_Status
*status
, int *error_code
)
73 return ADIOI_XFS_ReadDone(request
, status
, error_code
);