Commit 28c33903 authored by Jacek Caban's avatar Jacek Caban Committed by Alexandre Julliard

server: Pass APC in async_data_t.

Also don't pass callback pointer that's not used anymore. Signed-off-by: 's avatarJacek Caban <jacek@codeweavers.com> Signed-off-by: 's avatarAlexandre Julliard <julliard@winehq.org>
parent d92bb525
...@@ -422,12 +422,12 @@ static async_data_t server_async( HANDLE handle, struct async_fileio *user, HAND ...@@ -422,12 +422,12 @@ static async_data_t server_async( HANDLE handle, struct async_fileio *user, HAND
PIO_APC_ROUTINE apc, void *apc_context, IO_STATUS_BLOCK *io ) PIO_APC_ROUTINE apc, void *apc_context, IO_STATUS_BLOCK *io )
{ {
async_data_t async; async_data_t async;
async.handle = wine_server_obj_handle( handle ); async.handle = wine_server_obj_handle( handle );
async.callback = wine_server_client_ptr( user ? user->callback : 0 ); async.user = wine_server_client_ptr( user );
async.arg = wine_server_client_ptr( user ); async.iosb = wine_server_client_ptr( io );
async.iosb = wine_server_client_ptr( io ); async.event = wine_server_obj_handle( event );
async.event = wine_server_obj_handle( event ); async.apc = wine_server_client_ptr( apc );
async.cvalue = wine_server_client_ptr( apc ? 0 : apc_context ); async.apc_context = wine_server_client_ptr( apc_context );
return async; return async;
} }
......
...@@ -572,13 +572,13 @@ static NTSTATUS register_async( int type, HANDLE handle, struct ws2_async_io *as ...@@ -572,13 +572,13 @@ static NTSTATUS register_async( int type, HANDLE handle, struct ws2_async_io *as
SERVER_START_REQ( register_async ) SERVER_START_REQ( register_async )
{ {
req->type = type; req->type = type;
req->async.handle = wine_server_obj_handle( handle ); req->async.handle = wine_server_obj_handle( handle );
req->async.callback = wine_server_client_ptr( async->callback ); req->async.user = wine_server_client_ptr( async );
req->async.arg = wine_server_client_ptr( async ); req->async.iosb = wine_server_client_ptr( io );
req->async.iosb = wine_server_client_ptr( io ); req->async.event = wine_server_obj_handle( event );
req->async.event = wine_server_obj_handle( event ); req->async.apc = wine_server_client_ptr( apc );
req->async.cvalue = wine_server_client_ptr( apc ? 0 : apc_context ); req->async.apc_context = wine_server_client_ptr( apc_context );
status = wine_server_call( req ); status = wine_server_call( req );
} }
SERVER_END_REQ; SERVER_END_REQ;
......
...@@ -252,10 +252,10 @@ typedef struct ...@@ -252,10 +252,10 @@ typedef struct
{ {
obj_handle_t handle; obj_handle_t handle;
obj_handle_t event; obj_handle_t event;
client_ptr_t callback;
client_ptr_t iosb; client_ptr_t iosb;
client_ptr_t arg; client_ptr_t user;
apc_param_t cvalue; client_ptr_t apc;
apc_param_t apc_context;
} async_data_t; } async_data_t;
...@@ -463,7 +463,6 @@ typedef union ...@@ -463,7 +463,6 @@ typedef union
{ {
enum apc_type type; enum apc_type type;
unsigned int status; unsigned int status;
client_ptr_t func;
client_ptr_t user; client_ptr_t user;
client_ptr_t sb; client_ptr_t sb;
} async_io; } async_io;
...@@ -6412,6 +6411,6 @@ union generic_reply ...@@ -6412,6 +6411,6 @@ union generic_reply
struct terminate_job_reply terminate_job_reply; struct terminate_job_reply terminate_job_reply;
}; };
#define SERVER_PROTOCOL_VERSION 524 #define SERVER_PROTOCOL_VERSION 525
#endif /* __WINE_WINE_SERVER_PROTOCOL_H */ #endif /* __WINE_WINE_SERVER_PROTOCOL_H */
...@@ -180,14 +180,13 @@ void async_terminate( struct async *async, unsigned int status ) ...@@ -180,14 +180,13 @@ void async_terminate( struct async *async, unsigned int status )
async->status = status; async->status = status;
if (async->iosb && async->iosb->status == STATUS_PENDING) async->iosb->status = status; if (async->iosb && async->iosb->status == STATUS_PENDING) async->iosb->status = status;
if (async->data.callback) if (async->data.user)
{ {
apc_call_t data; apc_call_t data;
memset( &data, 0, sizeof(data) ); memset( &data, 0, sizeof(data) );
data.type = APC_ASYNC_IO; data.type = APC_ASYNC_IO;
data.async_io.func = async->data.callback; data.async_io.user = async->data.user;
data.async_io.user = async->data.arg;
data.async_io.sb = async->data.iosb; data.async_io.sb = async->data.iosb;
data.async_io.status = status; data.async_io.status = status;
thread_queue_apc( async->thread, &async->obj, &data ); thread_queue_apc( async->thread, &async->obj, &data );
...@@ -328,8 +327,8 @@ void async_set_result( struct object *obj, unsigned int status, apc_param_t tota ...@@ -328,8 +327,8 @@ void async_set_result( struct object *obj, unsigned int status, apc_param_t tota
async->status = status; async->status = status;
if (status == STATUS_MORE_PROCESSING_REQUIRED) return; /* don't report the completion */ if (status == STATUS_MORE_PROCESSING_REQUIRED) return; /* don't report the completion */
if (async->queue && async->data.cvalue) if (async->queue && !async->data.apc && async->data.apc_context)
add_async_completion( async->queue, async->data.cvalue, status, total ); add_async_completion( async->queue, async->data.apc_context, status, total );
if (apc) if (apc)
{ {
apc_call_t data; apc_call_t data;
...@@ -504,7 +503,7 @@ DECL_HANDLER(get_async_result) ...@@ -504,7 +503,7 @@ DECL_HANDLER(get_async_result)
struct async *async; struct async *async;
LIST_FOR_EACH_ENTRY( async, &current->process->asyncs, struct async, process_entry ) LIST_FOR_EACH_ENTRY( async, &current->process->asyncs, struct async, process_entry )
if (async->data.arg == req->user_arg) if (async->data.user == req->user_arg)
{ {
iosb = async->iosb; iosb = async->iosb;
break; break;
......
...@@ -268,10 +268,10 @@ typedef struct ...@@ -268,10 +268,10 @@ typedef struct
{ {
obj_handle_t handle; /* object to perform I/O on */ obj_handle_t handle; /* object to perform I/O on */
obj_handle_t event; /* event to signal when done */ obj_handle_t event; /* event to signal when done */
client_ptr_t callback; /* client-side callback to call upon end of async */
client_ptr_t iosb; /* I/O status block in client addr space */ client_ptr_t iosb; /* I/O status block in client addr space */
client_ptr_t arg; /* opaque user data to pass to callback */ client_ptr_t user; /* opaque user data containing callback pointer and async-specific data */
apc_param_t cvalue; /* completion value to use for completion events */ client_ptr_t apc; /* user APC to call */
apc_param_t apc_context; /* user APC context or completion value */
} async_data_t; } async_data_t;
/* structures for extra message data */ /* structures for extra message data */
...@@ -479,7 +479,6 @@ typedef union ...@@ -479,7 +479,6 @@ typedef union
{ {
enum apc_type type; /* APC_ASYNC_IO */ enum apc_type type; /* APC_ASYNC_IO */
unsigned int status; /* I/O status */ unsigned int status; /* I/O status */
client_ptr_t func; /* unsigned int (*func)(void*, void*, unsigned int, void**, void**); */
client_ptr_t user; /* user pointer */ client_ptr_t user; /* user pointer */
client_ptr_t sb; /* status block */ client_ptr_t sb; /* status block */
} async_io; } async_io;
......
...@@ -158,8 +158,7 @@ static void dump_apc_call( const char *prefix, const apc_call_t *call ) ...@@ -158,8 +158,7 @@ static void dump_apc_call( const char *prefix, const apc_call_t *call )
dump_uint64( ",arg=", &call->timer.arg ); dump_uint64( ",arg=", &call->timer.arg );
break; break;
case APC_ASYNC_IO: case APC_ASYNC_IO:
dump_uint64( "APC_ASYNC_IO,func=", &call->async_io.func ); dump_uint64( "APC_ASYNC_IO,user=", &call->async_io.user );
dump_uint64( ",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", get_status_name(call->async_io.status) );
break; break;
...@@ -305,10 +304,10 @@ static void dump_apc_result( const char *prefix, const apc_result_t *result ) ...@@ -305,10 +304,10 @@ static void dump_apc_result( const char *prefix, const apc_result_t *result )
static void dump_async_data( const char *prefix, const async_data_t *data ) static void dump_async_data( const char *prefix, const async_data_t *data )
{ {
fprintf( stderr, "%s{handle=%04x,event=%04x", prefix, data->handle, data->event ); fprintf( stderr, "%s{handle=%04x,event=%04x", prefix, data->handle, data->event );
dump_uint64( ",callback=", &data->callback );
dump_uint64( ",iosb=", &data->iosb ); dump_uint64( ",iosb=", &data->iosb );
dump_uint64( ",arg=", &data->arg ); dump_uint64( ",user=", &data->user );
dump_uint64( ",cvalue=", &data->cvalue ); dump_uint64( ",apc=", &data->apc );
dump_uint64( ",apc_context=", &data->apc_context );
fputc( '}', stderr ); fputc( '}', stderr );
} }
...@@ -5367,6 +5366,7 @@ static const struct ...@@ -5367,6 +5366,7 @@ static const struct
{ "HANDLE_NOT_CLOSABLE", STATUS_HANDLE_NOT_CLOSABLE }, { "HANDLE_NOT_CLOSABLE", STATUS_HANDLE_NOT_CLOSABLE },
{ "HOST_UNREACHABLE", STATUS_HOST_UNREACHABLE }, { "HOST_UNREACHABLE", STATUS_HOST_UNREACHABLE },
{ "ILLEGAL_FUNCTION", STATUS_ILLEGAL_FUNCTION }, { "ILLEGAL_FUNCTION", STATUS_ILLEGAL_FUNCTION },
{ "INFO_LENGTH_MISMATCH", STATUS_INFO_LENGTH_MISMATCH },
{ "INSTANCE_NOT_AVAILABLE", STATUS_INSTANCE_NOT_AVAILABLE }, { "INSTANCE_NOT_AVAILABLE", STATUS_INSTANCE_NOT_AVAILABLE },
{ "INSUFFICIENT_RESOURCES", STATUS_INSUFFICIENT_RESOURCES }, { "INSUFFICIENT_RESOURCES", STATUS_INSUFFICIENT_RESOURCES },
{ "INVALID_CID", STATUS_INVALID_CID }, { "INVALID_CID", STATUS_INVALID_CID },
...@@ -5413,6 +5413,7 @@ static const struct ...@@ -5413,6 +5413,7 @@ static const struct
{ "OBJECT_PATH_SYNTAX_BAD", STATUS_OBJECT_PATH_SYNTAX_BAD }, { "OBJECT_PATH_SYNTAX_BAD", STATUS_OBJECT_PATH_SYNTAX_BAD },
{ "OBJECT_TYPE_MISMATCH", STATUS_OBJECT_TYPE_MISMATCH }, { "OBJECT_TYPE_MISMATCH", STATUS_OBJECT_TYPE_MISMATCH },
{ "PENDING", STATUS_PENDING }, { "PENDING", STATUS_PENDING },
{ "PIPE_BROKEN", STATUS_PIPE_BROKEN },
{ "PIPE_CONNECTED", STATUS_PIPE_CONNECTED }, { "PIPE_CONNECTED", STATUS_PIPE_CONNECTED },
{ "PIPE_DISCONNECTED", STATUS_PIPE_DISCONNECTED }, { "PIPE_DISCONNECTED", STATUS_PIPE_DISCONNECTED },
{ "PIPE_LISTENING", STATUS_PIPE_LISTENING }, { "PIPE_LISTENING", STATUS_PIPE_LISTENING },
......
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