From: Jacek Caban Subject: [PATCH 08/12] server: Allow async_handoff users to set result themselves. Message-Id: Date: Tue, 13 Jun 2017 16:49:05 +0200 This is how current ioctls are currently implemented and, since it's easier for simple cases, it's a possibility worth preserving. Signed-off-by: Jacek Caban --- server/async.c | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/server/async.c b/server/async.c index c5c09c41a4..0720914e25 100644 --- a/server/async.c +++ b/server/async.c @@ -339,13 +339,23 @@ obj_handle_t async_handoff( struct async *async, int success, struct async_queue if (async->status != STATUS_PENDING) release_object( async ); } - if (async->iosb->status != STATUS_PENDING) + if (get_error() != STATUS_PENDING) + { + /* status and data are already set and returned */ + async_terminate( async, get_error() ); + } + else if (async->iosb->status != STATUS_PENDING) { + /* result is already available in iosb, return it */ if (async->iosb->out_data) { set_reply_data_ptr( async->iosb->out_data, async->iosb->out_size ); async->iosb->out_data = NULL; } + } + + if (async->iosb->status != STATUS_PENDING) + { if (result) *result = async->iosb->result; async->signaled = 1; }