From: "Zebediah Figura (she/her)" Subject: Re: [RFC PATCH v2 02/11] server: Add a helper function to trigger synchronous completion of I/O via APC_ASYNC_IO. Message-Id: Date: Tue, 25 Jan 2022 12:19:45 -0600 In-Reply-To: References: <1e0d520b-0f60-1323-3305-4f884fb121a1@gmail.com> On 1/22/22 08:36, Jinoh Kang wrote: > diff --git a/server/async.c b/server/async.c > index aa6d50cde75..5d0857f3eec 100644 > --- a/server/async.c > +++ b/server/async.c > @@ -383,6 +383,23 @@ obj_handle_t async_handoff( struct async *async, data_size_t *result, int force_ > return async->wait_handle; > } > > +/* Set up synchronous completion of I/O via the APC_ASYNC_IO system APC. > + * This function is intended to be called immediately before async_handoff(), > + * and expects the last error status to be STATUS_ALERTED. > + * > + * The information argument can be used to pass extra information to the client > + * (e.g. whether the socket is in non-blocking mode). > + */ > +void async_start_sync_io_request( struct async *async, data_size_t information ) > +{ > + assert( get_error() == STATUS_ALERTED ); > + assert( async->thread == current ); > + assert( !async->pending ); > + > + async->direct_result = 0; /* force APC to fire off */ > + async->iosb->result = information; > +} > + > /* complete a request-based async with a pre-allocated buffer */ > void async_request_complete( struct async *async, unsigned int status, data_size_t result, > data_size_t out_size, void *out_data ) Please add helpers only in the patches where they're used; it makes things very difficult to review otherwise.