Zebediah Figura : server: Pass the async result size as part of apc_call_t.
Alexandre Julliard
julliard at winehq.org
Tue Sep 14 16:00:13 CDT 2021
Module: wine
Branch: master
Commit: 1ee382c706bed683e7263c867fd6599dd6920103
URL: https://source.winehq.org/git/wine.git/?a=commit;h=1ee382c706bed683e7263c867fd6599dd6920103
Author: Zebediah Figura <zfigura at codeweavers.com>
Date: Tue Sep 14 01:02:43 2021 -0500
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: Zebediah Figura <zfigura at codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard at winehq.org>
---
dlls/ntdll/unix/file.c | 1 -
dlls/ntdll/unix/server.c | 2 +-
dlls/ntdll/unix/socket.c | 15 ++++-----------
include/wine/server_protocol.h | 5 ++---
server/async.c | 9 ++++-----
server/protocol.def | 2 +-
server/request.h | 3 +--
server/trace.c | 5 ++---
8 files changed, 15 insertions(+), 27 deletions(-)
diff --git a/dlls/ntdll/unix/file.c b/dlls/ntdll/unix/file.c
index 712f94ec43f..5da9ca560f6 100644
--- a/dlls/ntdll/unix/file.c
+++ b/dlls/ntdll/unix/file.c
@@ -4690,7 +4690,6 @@ static NTSTATUS irp_completion( void *user, ULONG_PTR *info, NTSTATUS status )
req->user_arg = wine_server_client_ptr( async );
wine_server_set_reply( req, async->buffer, async->size );
status = virtual_locked_server_call( req );
- *info = reply->size;
}
SERVER_END_REQ;
}
diff --git a/dlls/ntdll/unix/server.c b/dlls/ntdll/unix/server.c
index 986eb6c3250..d0cfd4cd46c 100644
--- a/dlls/ntdll/unix/server.c
+++ b/dlls/ntdll/unix/server.c
@@ -378,7 +378,7 @@ static void invoke_system_apc( const apc_call_t *call, apc_result_t *result, BOO
case APC_ASYNC_IO:
{
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->async_io.status = user->callback( user, &info, call->async_io.status );
diff --git a/dlls/ntdll/unix/socket.c b/dlls/ntdll/unix/socket.c
index 8469def786a..db58d2e5b12 100644
--- a/dlls/ntdll/unix/socket.c
+++ b/dlls/ntdll/unix/socket.c
@@ -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 )
{
struct async_recv_ioctl *async = user;
- ULONG_PTR information = 0;
int fd, needs_close;
TRACE( "%#x\n", 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 )))
return status;
- status = try_recv( fd, async, &information );
- TRACE( "got status %#x, %#lx bytes read\n", status, information );
+ status = try_recv( fd, async, info );
+ TRACE( "got status %#x, %#lx bytes read\n", status, *info );
if (status == STATUS_DEVICE_NOT_READY)
status = STATUS_PENDING;
if (needs_close) close( fd );
}
- if (status != STATUS_PENDING)
- {
- *info = information;
- release_fileio( &async->io );
- }
+ if (status != STATUS_PENDING) release_fileio( &async->io );
return status;
}
@@ -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 )
{
struct async_poll_ioctl *async = user;
- ULONG_PTR information = 0;
if (status == STATUS_ALERTED)
{
@@ -716,12 +710,11 @@ static NTSTATUS async_poll_proc( void *user, ULONG_PTR *info, NTSTATUS status )
}
SERVER_END_REQ;
- information = fill_poll_output( async, status );
+ *info = fill_poll_output( async, status );
}
if (status != STATUS_PENDING)
{
- *info = information;
free( async->input );
release_fileio( &async->io );
}
diff --git a/include/wine/server_protocol.h b/include/wine/server_protocol.h
index e22da223894..e5437576193 100644
--- a/include/wine/server_protocol.h
+++ b/include/wine/server_protocol.h
@@ -492,6 +492,7 @@ typedef union
unsigned int status;
client_ptr_t user;
client_ptr_t sb;
+ data_size_t result;
} async_io;
struct
{
@@ -2896,9 +2897,7 @@ struct get_async_result_request
struct get_async_result_reply
{
struct reply_header __header;
- data_size_t size;
/* VARARG(out_data,bytes); */
- char __pad_12[4];
};
@@ -6257,7 +6256,7 @@ union generic_reply
/* ### protocol_version begin ### */
-#define SERVER_PROTOCOL_VERSION 729
+#define SERVER_PROTOCOL_VERSION 730
/* ### protocol_version end ### */
diff --git a/server/async.c b/server/async.c
index 7cffd24a18b..bdc7620e9a1 100644
--- a/server/async.c
+++ b/server/async.c
@@ -185,11 +185,11 @@ void async_terminate( struct async *async, unsigned int status )
data.type = APC_ASYNC_IO;
data.async_io.user = async->data.user;
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
- * make an extra request to retrieve them; use STATUS_ALERTED to signal
- * this case */
- if (iosb && (iosb->result || iosb->out_data))
+ /* if there is output data, the client needs to make an extra request
+ * to retrieve it; use STATUS_ALERTED to signal this case */
+ if (iosb && iosb->out_data)
data.async_io.status = STATUS_ALERTED;
else
data.async_io.status = status;
@@ -719,6 +719,5 @@ DECL_HANDLER(get_async_result)
iosb->out_data = NULL;
}
}
- reply->size = iosb->result;
set_error( iosb->status );
}
diff --git a/server/protocol.def b/server/protocol.def
index 02c1f269be7..cc1887dae2d 100644
--- a/server/protocol.def
+++ b/server/protocol.def
@@ -508,6 +508,7 @@ typedef union
unsigned int status; /* I/O status */
client_ptr_t user; /* user pointer */
client_ptr_t sb; /* status block */
+ data_size_t result; /* result size */
} async_io;
struct
{
@@ -2156,7 +2157,6 @@ enum message_type
@REQ(get_async_result)
client_ptr_t user_arg; /* user arg used to identify async */
@REPLY
- data_size_t size; /* result size (input or output depending on the operation) */
VARARG(out_data,bytes); /* iosb output data */
@END
diff --git a/server/request.h b/server/request.h
index f3567cd967f..6fe708e065f 100644
--- a/server/request.h
+++ b/server/request.h
@@ -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( FIELD_OFFSET(struct get_async_result_request, user_arg) == 16 );
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) == 16 );
+C_ASSERT( sizeof(struct get_async_result_reply) == 8 );
C_ASSERT( FIELD_OFFSET(struct read_request, async) == 16 );
C_ASSERT( FIELD_OFFSET(struct read_request, pos) == 56 );
C_ASSERT( sizeof(struct read_request) == 64 );
diff --git a/server/trace.c b/server/trace.c
index da8c74cea2b..cfa6eefc36c 100644
--- a/server/trace.c
+++ b/server/trace.c
@@ -181,7 +181,7 @@ static void dump_apc_call( const char *prefix, const apc_call_t *call )
case APC_ASYNC_IO:
dump_uint64( "APC_ASYNC_IO,user=", &call->async_io.user );
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;
case APC_VIRTUAL_ALLOC:
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
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 )
More information about the wine-cvs
mailing list