Commit 1ee382c7 authored by Zebediah Figura's avatar Zebediah Figura Committed by Alexandre Julliard

server: Pass the async result size as part of apc_call_t.

Only really an optimization (plus it makes the code a little conceptually simpler). Signed-off-by: 's avatarZebediah Figura <zfigura@codeweavers.com> Signed-off-by: 's avatarAlexandre Julliard <julliard@winehq.org>
parent 554a4a11
...@@ -4690,7 +4690,6 @@ static NTSTATUS irp_completion( void *user, ULONG_PTR *info, NTSTATUS status ) ...@@ -4690,7 +4690,6 @@ static NTSTATUS irp_completion( void *user, ULONG_PTR *info, NTSTATUS status )
req->user_arg = wine_server_client_ptr( async ); req->user_arg = wine_server_client_ptr( async );
wine_server_set_reply( req, async->buffer, async->size ); wine_server_set_reply( req, async->buffer, async->size );
status = virtual_locked_server_call( req ); status = virtual_locked_server_call( req );
*info = reply->size;
} }
SERVER_END_REQ; SERVER_END_REQ;
} }
......
...@@ -378,7 +378,7 @@ static void invoke_system_apc( const apc_call_t *call, apc_result_t *result, BOO ...@@ -378,7 +378,7 @@ static void invoke_system_apc( const apc_call_t *call, apc_result_t *result, BOO
case APC_ASYNC_IO: case APC_ASYNC_IO:
{ {
struct async_fileio *user = wine_server_get_ptr( call->async_io.user ); struct async_fileio *user = wine_server_get_ptr( call->async_io.user );
ULONG_PTR info = 0; ULONG_PTR info = call->async_io.result;
result->type = call->type; result->type = call->type;
result->async_io.status = user->callback( user, &info, call->async_io.status ); result->async_io.status = user->callback( user, &info, call->async_io.status );
......
...@@ -565,7 +565,6 @@ static NTSTATUS try_recv( int fd, struct async_recv_ioctl *async, ULONG_PTR *siz ...@@ -565,7 +565,6 @@ static NTSTATUS try_recv( int fd, struct async_recv_ioctl *async, ULONG_PTR *siz
static NTSTATUS async_recv_proc( void *user, ULONG_PTR *info, NTSTATUS status ) static NTSTATUS async_recv_proc( void *user, ULONG_PTR *info, NTSTATUS status )
{ {
struct async_recv_ioctl *async = user; struct async_recv_ioctl *async = user;
ULONG_PTR information = 0;
int fd, needs_close; int fd, needs_close;
TRACE( "%#x\n", status ); TRACE( "%#x\n", status );
...@@ -575,19 +574,15 @@ static NTSTATUS async_recv_proc( void *user, ULONG_PTR *info, NTSTATUS status ) ...@@ -575,19 +574,15 @@ static NTSTATUS async_recv_proc( void *user, ULONG_PTR *info, NTSTATUS status )
if ((status = server_get_unix_fd( async->io.handle, 0, &fd, &needs_close, NULL, NULL ))) if ((status = server_get_unix_fd( async->io.handle, 0, &fd, &needs_close, NULL, NULL )))
return status; return status;
status = try_recv( fd, async, &information ); status = try_recv( fd, async, info );
TRACE( "got status %#x, %#lx bytes read\n", status, information ); TRACE( "got status %#x, %#lx bytes read\n", status, *info );
if (status == STATUS_DEVICE_NOT_READY) if (status == STATUS_DEVICE_NOT_READY)
status = STATUS_PENDING; status = STATUS_PENDING;
if (needs_close) close( fd ); if (needs_close) close( fd );
} }
if (status != STATUS_PENDING) if (status != STATUS_PENDING) release_fileio( &async->io );
{
*info = information;
release_fileio( &async->io );
}
return status; return status;
} }
...@@ -704,7 +699,6 @@ static ULONG_PTR fill_poll_output( struct async_poll_ioctl *async, NTSTATUS stat ...@@ -704,7 +699,6 @@ static ULONG_PTR fill_poll_output( struct async_poll_ioctl *async, NTSTATUS stat
static NTSTATUS async_poll_proc( void *user, ULONG_PTR *info, NTSTATUS status ) static NTSTATUS async_poll_proc( void *user, ULONG_PTR *info, NTSTATUS status )
{ {
struct async_poll_ioctl *async = user; struct async_poll_ioctl *async = user;
ULONG_PTR information = 0;
if (status == STATUS_ALERTED) if (status == STATUS_ALERTED)
{ {
...@@ -716,12 +710,11 @@ static NTSTATUS async_poll_proc( void *user, ULONG_PTR *info, NTSTATUS status ) ...@@ -716,12 +710,11 @@ static NTSTATUS async_poll_proc( void *user, ULONG_PTR *info, NTSTATUS status )
} }
SERVER_END_REQ; SERVER_END_REQ;
information = fill_poll_output( async, status ); *info = fill_poll_output( async, status );
} }
if (status != STATUS_PENDING) if (status != STATUS_PENDING)
{ {
*info = information;
free( async->input ); free( async->input );
release_fileio( &async->io ); release_fileio( &async->io );
} }
......
...@@ -492,6 +492,7 @@ typedef union ...@@ -492,6 +492,7 @@ typedef union
unsigned int status; unsigned int status;
client_ptr_t user; client_ptr_t user;
client_ptr_t sb; client_ptr_t sb;
data_size_t result;
} async_io; } async_io;
struct struct
{ {
...@@ -2896,9 +2897,7 @@ struct get_async_result_request ...@@ -2896,9 +2897,7 @@ struct get_async_result_request
struct get_async_result_reply struct get_async_result_reply
{ {
struct reply_header __header; struct reply_header __header;
data_size_t size;
/* VARARG(out_data,bytes); */ /* VARARG(out_data,bytes); */
char __pad_12[4];
}; };
...@@ -6257,7 +6256,7 @@ union generic_reply ...@@ -6257,7 +6256,7 @@ union generic_reply
/* ### protocol_version begin ### */ /* ### protocol_version begin ### */
#define SERVER_PROTOCOL_VERSION 729 #define SERVER_PROTOCOL_VERSION 730
/* ### protocol_version end ### */ /* ### protocol_version end ### */
......
...@@ -185,11 +185,11 @@ void async_terminate( struct async *async, unsigned int status ) ...@@ -185,11 +185,11 @@ void async_terminate( struct async *async, unsigned int status )
data.type = APC_ASYNC_IO; data.type = APC_ASYNC_IO;
data.async_io.user = async->data.user; data.async_io.user = async->data.user;
data.async_io.sb = async->data.iosb; data.async_io.sb = async->data.iosb;
data.async_io.result = iosb ? iosb->result : 0;
/* if the result is nonzero or there is output data, the client needs to /* if there is output data, the client needs to make an extra request
* make an extra request to retrieve them; use STATUS_ALERTED to signal * to retrieve it; use STATUS_ALERTED to signal this case */
* this case */ if (iosb && iosb->out_data)
if (iosb && (iosb->result || iosb->out_data))
data.async_io.status = STATUS_ALERTED; data.async_io.status = STATUS_ALERTED;
else else
data.async_io.status = status; data.async_io.status = status;
...@@ -719,6 +719,5 @@ DECL_HANDLER(get_async_result) ...@@ -719,6 +719,5 @@ DECL_HANDLER(get_async_result)
iosb->out_data = NULL; iosb->out_data = NULL;
} }
} }
reply->size = iosb->result;
set_error( iosb->status ); set_error( iosb->status );
} }
...@@ -508,6 +508,7 @@ typedef union ...@@ -508,6 +508,7 @@ typedef union
unsigned int status; /* I/O status */ unsigned int status; /* I/O status */
client_ptr_t user; /* user pointer */ client_ptr_t user; /* user pointer */
client_ptr_t sb; /* status block */ client_ptr_t sb; /* status block */
data_size_t result; /* result size */
} async_io; } async_io;
struct struct
{ {
...@@ -2156,7 +2157,6 @@ enum message_type ...@@ -2156,7 +2157,6 @@ enum message_type
@REQ(get_async_result) @REQ(get_async_result)
client_ptr_t user_arg; /* user arg used to identify async */ client_ptr_t user_arg; /* user arg used to identify async */
@REPLY @REPLY
data_size_t size; /* result size (input or output depending on the operation) */
VARARG(out_data,bytes); /* iosb output data */ VARARG(out_data,bytes); /* iosb output data */
@END @END
......
...@@ -1396,8 +1396,7 @@ C_ASSERT( FIELD_OFFSET(struct cancel_async_request, only_thread) == 24 ); ...@@ -1396,8 +1396,7 @@ C_ASSERT( FIELD_OFFSET(struct cancel_async_request, only_thread) == 24 );
C_ASSERT( sizeof(struct cancel_async_request) == 32 ); C_ASSERT( sizeof(struct cancel_async_request) == 32 );
C_ASSERT( FIELD_OFFSET(struct get_async_result_request, user_arg) == 16 ); C_ASSERT( FIELD_OFFSET(struct get_async_result_request, user_arg) == 16 );
C_ASSERT( sizeof(struct get_async_result_request) == 24 ); C_ASSERT( sizeof(struct get_async_result_request) == 24 );
C_ASSERT( FIELD_OFFSET(struct get_async_result_reply, size) == 8 ); C_ASSERT( sizeof(struct get_async_result_reply) == 8 );
C_ASSERT( sizeof(struct get_async_result_reply) == 16 );
C_ASSERT( FIELD_OFFSET(struct read_request, async) == 16 ); C_ASSERT( FIELD_OFFSET(struct read_request, async) == 16 );
C_ASSERT( FIELD_OFFSET(struct read_request, pos) == 56 ); C_ASSERT( FIELD_OFFSET(struct read_request, pos) == 56 );
C_ASSERT( sizeof(struct read_request) == 64 ); C_ASSERT( sizeof(struct read_request) == 64 );
......
...@@ -181,7 +181,7 @@ static void dump_apc_call( const char *prefix, const apc_call_t *call ) ...@@ -181,7 +181,7 @@ static void dump_apc_call( const char *prefix, const apc_call_t *call )
case APC_ASYNC_IO: case APC_ASYNC_IO:
dump_uint64( "APC_ASYNC_IO,user=", &call->async_io.user ); dump_uint64( "APC_ASYNC_IO,user=", &call->async_io.user );
dump_uint64( ",sb=", &call->async_io.sb ); dump_uint64( ",sb=", &call->async_io.sb );
fprintf( stderr, ",status=%s", get_status_name(call->async_io.status) ); fprintf( stderr, ",status=%s,result=%u", get_status_name(call->async_io.status), call->async_io.result );
break; break;
case APC_VIRTUAL_ALLOC: case APC_VIRTUAL_ALLOC:
dump_uint64( "APC_VIRTUAL_ALLOC,addr==", &call->virtual_alloc.addr ); dump_uint64( "APC_VIRTUAL_ALLOC,addr==", &call->virtual_alloc.addr );
...@@ -2845,8 +2845,7 @@ static void dump_get_async_result_request( const struct get_async_result_request ...@@ -2845,8 +2845,7 @@ static void dump_get_async_result_request( const struct get_async_result_request
static void dump_get_async_result_reply( const struct get_async_result_reply *req ) static void dump_get_async_result_reply( const struct get_async_result_reply *req )
{ {
fprintf( stderr, " size=%u", req->size ); dump_varargs_bytes( " out_data=", cur_size );
dump_varargs_bytes( ", out_data=", cur_size );
} }
static void dump_read_request( const struct read_request *req ) static void dump_read_request( const struct read_request *req )
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment