Jacek Caban : ntdll: Remove no longer needed APC handling from APC_ASYNC_IO callbacks.

Alexandre Julliard julliard at winehq.org
Tue Apr 11 15:31:04 CDT 2017


Module: wine
Branch: master
Commit: e2469b2c3d385b2c3e5fcfdafe301d1248a94655
URL:    http://source.winehq.org/git/wine.git/?a=commit;h=e2469b2c3d385b2c3e5fcfdafe301d1248a94655

Author: Jacek Caban <jacek at codeweavers.com>
Date:   Mon Apr 10 13:41:29 2017 +0200

ntdll: Remove no longer needed APC handling from APC_ASYNC_IO callbacks.

Signed-off-by: Jacek Caban <jacek at codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard at winehq.org>

---

 dlls/ntdll/file.c    | 21 +++++----------------
 dlls/ntdll/server.c  |  5 ++---
 dlls/ws2_32/socket.c | 37 ++++++++++---------------------------
 3 files changed, 17 insertions(+), 46 deletions(-)

diff --git a/dlls/ntdll/file.c b/dlls/ntdll/file.c
index cf4edb7..42979d5 100644
--- a/dlls/ntdll/file.c
+++ b/dlls/ntdll/file.c
@@ -346,7 +346,7 @@ NTSTATUS WINAPI NtCreateFile( PHANDLE handle, ACCESS_MASK access, POBJECT_ATTRIB
  *                  Asynchronous file I/O                              *
  */
 
-typedef NTSTATUS async_callback_t( void *user, IO_STATUS_BLOCK *io, NTSTATUS status, void **apc, void **arg );
+typedef NTSTATUS async_callback_t( void *user, IO_STATUS_BLOCK *io, NTSTATUS status );
 
 struct async_fileio
 {
@@ -432,7 +432,7 @@ static async_data_t server_async( HANDLE handle, struct async_fileio *user, HAND
 }
 
 /* callback for irp async I/O completion */
-static NTSTATUS irp_completion( void *user, IO_STATUS_BLOCK *io, NTSTATUS status, void **apc, void **arg )
+static NTSTATUS irp_completion( void *user, IO_STATUS_BLOCK *io, NTSTATUS status )
 {
     struct async_irp *async = user;
     ULONG information = 0;
@@ -452,8 +452,6 @@ static NTSTATUS irp_completion( void *user, IO_STATUS_BLOCK *io, NTSTATUS status
     {
         io->u.Status = status;
         io->Information = information;
-        *apc = async->io.apc;
-        *arg = async->io.apc_arg;
         release_fileio( &async->io );
     }
     return status;
@@ -511,8 +509,7 @@ NTSTATUS FILE_GetNtStatus(void)
 /***********************************************************************
  *             FILE_AsyncReadService      (INTERNAL)
  */
-static NTSTATUS FILE_AsyncReadService( void *user, IO_STATUS_BLOCK *iosb,
-                                       NTSTATUS status, void **apc, void **arg )
+static NTSTATUS FILE_AsyncReadService( void *user, IO_STATUS_BLOCK *iosb, NTSTATUS status )
 {
     struct async_fileio_read *fileio = user;
     int fd, needs_close, result;
@@ -558,8 +555,6 @@ static NTSTATUS FILE_AsyncReadService( void *user, IO_STATUS_BLOCK *iosb,
     {
         iosb->u.Status = status;
         iosb->Information = fileio->already;
-        *apc = fileio->io.apc;
-        *arg = fileio->io.apc_arg;
         release_fileio( &fileio->io );
     }
     return status;
@@ -1118,8 +1113,7 @@ NTSTATUS WINAPI NtReadFileScatter( HANDLE file, HANDLE event, PIO_APC_ROUTINE ap
 /***********************************************************************
  *             FILE_AsyncWriteService      (INTERNAL)
  */
-static NTSTATUS FILE_AsyncWriteService( void *user, IO_STATUS_BLOCK *iosb,
-                                        NTSTATUS status, void **apc, void **arg )
+static NTSTATUS FILE_AsyncWriteService( void *user, IO_STATUS_BLOCK *iosb, NTSTATUS status )
 {
     struct async_fileio_write *fileio = user;
     int result, fd, needs_close;
@@ -1161,8 +1155,6 @@ static NTSTATUS FILE_AsyncWriteService( void *user, IO_STATUS_BLOCK *iosb,
     {
         iosb->u.Status = status;
         iosb->Information = fileio->already;
-        *apc = fileio->io.apc;
-        *arg = fileio->io.apc_arg;
         release_fileio( &fileio->io );
     }
     return status;
@@ -1843,8 +1835,7 @@ struct read_changes_fileio
     char                data[1];
 };
 
-static NTSTATUS read_changes_apc( void *user, IO_STATUS_BLOCK *iosb,
-                                  NTSTATUS status, void **apc, void **arg )
+static NTSTATUS read_changes_apc( void *user, IO_STATUS_BLOCK *iosb, NTSTATUS status )
 {
     struct read_changes_fileio *fileio = user;
     int size = 0;
@@ -1914,8 +1905,6 @@ static NTSTATUS read_changes_apc( void *user, IO_STATUS_BLOCK *iosb,
     {
         iosb->u.Status = status;
         iosb->Information = size;
-        *apc = fileio->io.apc;
-        *arg = fileio->io.apc_arg;
         release_fileio( &fileio->io );
     }
     return status;
diff --git a/dlls/ntdll/server.c b/dlls/ntdll/server.c
index e906898..c02a12a 100644
--- a/dlls/ntdll/server.c
+++ b/dlls/ntdll/server.c
@@ -404,11 +404,10 @@ static BOOL invoke_apc( const apc_call_t *call, apc_result_t *result )
     }
     case APC_ASYNC_IO:
     {
-        void *apc = NULL, *arg = NULL;
         IO_STATUS_BLOCK *iosb = wine_server_get_ptr( call->async_io.sb );
-        NTSTATUS (**user)(void *, IO_STATUS_BLOCK *, NTSTATUS, void **, void **) = wine_server_get_ptr( call->async_io.user );
+        NTSTATUS (**user)(void *, IO_STATUS_BLOCK *, NTSTATUS) = wine_server_get_ptr( call->async_io.user );
         result->type = call->type;
-        result->async_io.status = (*user)( user, iosb, call->async_io.status, &apc, &arg );
+        result->async_io.status = (*user)( user, iosb, call->async_io.status );
         if (result->async_io.status != STATUS_PENDING)
             result->async_io.total = iosb->Information;
         break;
diff --git a/dlls/ws2_32/socket.c b/dlls/ws2_32/socket.c
index 5bf0482..9d27fab 100644
--- a/dlls/ws2_32/socket.c
+++ b/dlls/ws2_32/socket.c
@@ -470,7 +470,7 @@ static inline const char *debugstr_optval(const char *optval, int optlenval)
  * Async IO declarations
  ****************************************************************/
 
-typedef NTSTATUS async_callback_t( void *user, IO_STATUS_BLOCK *io, NTSTATUS status, void **apc, void **arg );
+typedef NTSTATUS async_callback_t( void *user, IO_STATUS_BLOCK *io, NTSTATUS status );
 
 struct ws2_async_io
 {
@@ -2399,8 +2399,7 @@ static int WS2_recv( int fd, struct ws2_async *wsa, int flags )
  *
  * Handler for overlapped recv() operations.
  */
-static NTSTATUS WS2_async_recv( void *user, IO_STATUS_BLOCK *iosb,
-                                NTSTATUS status, void **apc, void **arg )
+static NTSTATUS WS2_async_recv( void *user, IO_STATUS_BLOCK *iosb, NTSTATUS status )
 {
     struct ws2_async *wsa = user;
     int result = 0, fd;
@@ -2437,12 +2436,7 @@ static NTSTATUS WS2_async_recv( void *user, IO_STATUS_BLOCK *iosb,
     {
         iosb->u.Status = status;
         iosb->Information = result;
-        if (wsa->completion_func)
-        {
-            *apc = ws2_async_apc;
-            *arg = wsa;
-        }
-        else
+        if (!wsa->completion_func)
             release_async_io( &wsa->io );
     }
     return status;
@@ -2454,13 +2448,11 @@ static NTSTATUS WS2_async_recv( void *user, IO_STATUS_BLOCK *iosb,
  * This function is used to finish the read part of an accept request. It is
  * needed to place the completion on the correct socket (listener).
  */
-static NTSTATUS WS2_async_accept_recv( void *user, IO_STATUS_BLOCK *iosb,
-                                       NTSTATUS status, void **apc, void **arg )
+static NTSTATUS WS2_async_accept_recv( void *user, IO_STATUS_BLOCK *iosb, NTSTATUS status )
 {
-    void *junk;
     struct ws2_accept_async *wsa = user;
 
-    status = WS2_async_recv( wsa->read, iosb, status, &junk, &junk );
+    status = WS2_async_recv( wsa->read, iosb, status );
     if (status == STATUS_PENDING)
         return status;
 
@@ -2476,8 +2468,7 @@ static NTSTATUS WS2_async_accept_recv( void *user, IO_STATUS_BLOCK *iosb,
  *
  * This is the function called to satisfy the AcceptEx callback
  */
-static NTSTATUS WS2_async_accept( void *user, IO_STATUS_BLOCK *iosb,
-                                  NTSTATUS status, void **apc, void **arg )
+static NTSTATUS WS2_async_accept( void *user, IO_STATUS_BLOCK *iosb, NTSTATUS status )
 {
     struct ws2_accept_async *wsa = user;
     int len;
@@ -2621,8 +2612,7 @@ static int WS2_send( int fd, struct ws2_async *wsa, int flags )
  *
  * Handler for overlapped send() operations.
  */
-static NTSTATUS WS2_async_send( void *user, IO_STATUS_BLOCK *iosb,
-                                NTSTATUS status, void **apc, void **arg )
+static NTSTATUS WS2_async_send( void *user, IO_STATUS_BLOCK *iosb, NTSTATUS status )
 {
     struct ws2_async *wsa = user;
     int result = 0, fd;
@@ -2665,12 +2655,7 @@ static NTSTATUS WS2_async_send( void *user, IO_STATUS_BLOCK *iosb,
     if (status != STATUS_PENDING)
     {
         iosb->u.Status = status;
-        if (wsa->completion_func)
-        {
-            *apc = ws2_async_apc;
-            *arg = wsa;
-        }
-        else
+        if (!wsa->completion_func)
             release_async_io( &wsa->io );
     }
     return status;
@@ -2681,8 +2666,7 @@ static NTSTATUS WS2_async_send( void *user, IO_STATUS_BLOCK *iosb,
  *
  * Handler for shutdown() operations on overlapped sockets.
  */
-static NTSTATUS WS2_async_shutdown( void *user, IO_STATUS_BLOCK *iosb,
-                                    NTSTATUS status, void **apc, void **arg )
+static NTSTATUS WS2_async_shutdown( void *user, IO_STATUS_BLOCK *iosb, NTSTATUS status )
 {
     struct ws2_async_shutdown *wsa = user;
     int fd, err = 1;
@@ -3040,8 +3024,7 @@ static NTSTATUS WS2_transmitfile_base( int fd, struct ws2_transmitfile_async *ws
  *
  * Asynchronous callback for overlapped TransmitFile operations.
  */
-static NTSTATUS WS2_async_transmitfile( void *user, IO_STATUS_BLOCK *iosb,
-                                        NTSTATUS status, void **apc, void **arg )
+static NTSTATUS WS2_async_transmitfile( void *user, IO_STATUS_BLOCK *iosb, NTSTATUS status )
 {
     struct ws2_transmitfile_async *wsa = user;
     int fd;




More information about the wine-cvs mailing list