[PATCH 1/6] server: Pass the async result size as part of apc_call_t.
Zebediah Figura
zfigura at codeweavers.com
Tue Sep 14 01:02:43 CDT 2021
Only really an optimization (plus it makes the code a little conceptually simpler).
Signed-off-by: Zebediah Figura <zfigura at codeweavers.com>
---
dlls/ntdll/unix/file.c | 1 -
dlls/ntdll/unix/server.c | 2 +-
dlls/ntdll/unix/socket.c | 15 ++++-----------
server/async.c | 9 ++++-----
server/protocol.def | 2 +-
server/trace.c | 2 +-
6 files changed, 11 insertions(+), 20 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/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/trace.c b/server/trace.c
index da8c74cea2b..b11e51e6d81 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 );
--
2.33.0
More information about the wine-devel
mailing list