Alexandre Julliard : server: Move the server part of device unmounting to the ioctl processing.

Alexandre Julliard julliard at wine.codeweavers.com
Tue Apr 17 08:12:11 CDT 2007


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

Author: Alexandre Julliard <julliard at winehq.org>
Date:   Mon Apr 16 14:54:52 2007 +0200

server: Move the server part of device unmounting to the ioctl processing.

---

 dlls/ntdll/directory.c         |    8 --------
 dlls/ntdll/file.c              |    4 +++-
 include/wine/server_protocol.h |   17 +----------------
 server/fd.c                    |   35 ++++++++++++++++-------------------
 server/protocol.def            |    6 ------
 server/request.h               |    2 --
 server/trace.c                 |    8 --------
 7 files changed, 20 insertions(+), 60 deletions(-)

diff --git a/dlls/ntdll/directory.c b/dlls/ntdll/directory.c
index 6af4129..7045716 100644
--- a/dlls/ntdll/directory.c
+++ b/dlls/ntdll/directory.c
@@ -2034,14 +2034,6 @@ NTSTATUS DIR_unmount_device( HANDLE handle )
     NTSTATUS status;
     int unix_fd, needs_close;
 
-    SERVER_START_REQ( unmount_device )
-    {
-        req->handle = handle;
-        status = wine_server_call( req );
-    }
-    SERVER_END_REQ;
-    if (status) return status;
-
     if (!(status = server_get_unix_fd( handle, 0, &unix_fd, &needs_close, NULL, NULL )))
     {
         struct stat st;
diff --git a/dlls/ntdll/file.c b/dlls/ntdll/file.c
index 9e46548..cb895ab 100644
--- a/dlls/ntdll/file.c
+++ b/dlls/ntdll/file.c
@@ -1064,7 +1064,9 @@ NTSTATUS WINAPI NtFsControlFile(HANDLE handle, HANDLE event, PIO_APC_ROUTINE apc
     switch(code)
     {
     case FSCTL_DISMOUNT_VOLUME:
-        status = DIR_unmount_device( handle );
+        status = server_ioctl_file( handle, event, apc, apc_context, io, code,
+                                    in_buffer, in_size, out_buffer, out_size );
+        if (!status) status = DIR_unmount_device( handle );
         break;
 
     case FSCTL_PIPE_LISTEN:
diff --git a/include/wine/server_protocol.h b/include/wine/server_protocol.h
index b134513..c686113 100644
--- a/include/wine/server_protocol.h
+++ b/include/wine/server_protocol.h
@@ -1140,18 +1140,6 @@ struct unlock_file_reply
 
 
 
-struct unmount_device_request
-{
-    struct request_header __header;
-    obj_handle_t handle;
-};
-struct unmount_device_reply
-{
-    struct reply_header __header;
-};
-
-
-
 struct create_socket_request
 {
     struct request_header __header;
@@ -4052,7 +4040,6 @@ enum request
     REQ_flush_file,
     REQ_lock_file,
     REQ_unlock_file,
-    REQ_unmount_device,
     REQ_create_socket,
     REQ_accept_socket,
     REQ_set_socket_event,
@@ -4276,7 +4263,6 @@ union generic_request
     struct flush_file_request flush_file_request;
     struct lock_file_request lock_file_request;
     struct unlock_file_request unlock_file_request;
-    struct unmount_device_request unmount_device_request;
     struct create_socket_request create_socket_request;
     struct accept_socket_request accept_socket_request;
     struct set_socket_event_request set_socket_event_request;
@@ -4498,7 +4484,6 @@ union generic_reply
     struct flush_file_reply flush_file_reply;
     struct lock_file_reply lock_file_reply;
     struct unlock_file_reply unlock_file_reply;
-    struct unmount_device_reply unmount_device_reply;
     struct create_socket_reply create_socket_reply;
     struct accept_socket_reply accept_socket_reply;
     struct set_socket_event_reply set_socket_event_reply;
@@ -4675,6 +4660,6 @@ union generic_reply
     struct allocate_locally_unique_id_reply allocate_locally_unique_id_reply;
 };
 
-#define SERVER_PROTOCOL_VERSION 294
+#define SERVER_PROTOCOL_VERSION 295
 
 #endif /* __WINE_WINE_SERVER_PROTOCOL_H */
diff --git a/server/fd.c b/server/fd.c
index 37ddefb..adcaa20 100644
--- a/server/fd.c
+++ b/server/fd.c
@@ -77,6 +77,7 @@
 #include "request.h"
 
 #include "winternl.h"
+#include "winioctl.h"
 
 #if defined(HAVE_SYS_EPOLL_H) && defined(HAVE_EPOLL_CREATE)
 # include <sys/epoll.h>
@@ -1686,13 +1687,6 @@ void default_poll_event( struct fd *fd, int event )
     else if (!fd->inode) set_fd_events( fd, fd->fd_ops->get_poll_events( fd ) );
 }
 
-/* default ioctl() routine */
-void default_fd_ioctl( struct fd *fd, unsigned int code, const async_data_t *async,
-                       const void *data, data_size_t size )
-{
-    set_error( STATUS_NOT_SUPPORTED );
-}
-
 struct async *fd_queue_async( struct fd *fd, const async_data_t *data, int type, int count )
 {
     struct async_queue *queue;
@@ -1833,6 +1827,21 @@ static void unmount_device( struct fd *device_fd )
     release_object( device );
 }
 
+/* default ioctl() routine */
+void default_fd_ioctl( struct fd *fd, unsigned int code, const async_data_t *async,
+                       const void *data, data_size_t size )
+{
+    switch(code)
+    {
+    case FSCTL_DISMOUNT_VOLUME:
+        unmount_device( fd );
+        break;
+    default:
+        set_error( STATUS_NOT_SUPPORTED );
+        break;
+    }
+}
+
 /* same as get_handle_obj but retrieve the struct fd associated to the object */
 static struct fd *get_handle_fd_obj( struct process *process, obj_handle_t handle,
                                      unsigned int access )
@@ -1913,18 +1922,6 @@ DECL_HANDLER(get_handle_fd)
     }
 }
 
-/* get ready to unmount a Unix device */
-DECL_HANDLER(unmount_device)
-{
-    struct fd *fd;
-
-    if ((fd = get_handle_fd_obj( current->process, req->handle, 0 )))
-    {
-        unmount_device( fd );
-        release_object( fd );
-    }
-}
-
 /* perform an ioctl on a file */
 DECL_HANDLER(ioctl)
 {
diff --git a/server/protocol.def b/server/protocol.def
index 8cc44fc..629c82b 100644
--- a/server/protocol.def
+++ b/server/protocol.def
@@ -936,12 +936,6 @@ enum server_fd_type
 @END
 
 
-/* Get ready to unmount a Unix device */
- at REQ(unmount_device)
-    obj_handle_t handle;        /* handle to a file on the device */
- at END
-
-
 /* Create a socket */
 @REQ(create_socket)
     unsigned int access;        /* wanted access rights */
diff --git a/server/request.h b/server/request.h
index fe0e87d..63a7ee4 100644
--- a/server/request.h
+++ b/server/request.h
@@ -152,7 +152,6 @@ DECL_HANDLER(get_handle_fd);
 DECL_HANDLER(flush_file);
 DECL_HANDLER(lock_file);
 DECL_HANDLER(unlock_file);
-DECL_HANDLER(unmount_device);
 DECL_HANDLER(create_socket);
 DECL_HANDLER(accept_socket);
 DECL_HANDLER(set_socket_event);
@@ -375,7 +374,6 @@ static const req_handler req_handlers[REQ_NB_REQUESTS] =
     (req_handler)req_flush_file,
     (req_handler)req_lock_file,
     (req_handler)req_unlock_file,
-    (req_handler)req_unmount_device,
     (req_handler)req_create_socket,
     (req_handler)req_accept_socket,
     (req_handler)req_set_socket_event,
diff --git a/server/trace.c b/server/trace.c
index de24553..171b836 100644
--- a/server/trace.c
+++ b/server/trace.c
@@ -1321,11 +1321,6 @@ static void dump_unlock_file_request( const struct unlock_file_request *req )
     fprintf( stderr, " count_high=%08x", req->count_high );
 }
 
-static void dump_unmount_device_request( const struct unmount_device_request *req )
-{
-    fprintf( stderr, " handle=%p", req->handle );
-}
-
 static void dump_create_socket_request( const struct create_socket_request *req )
 {
     fprintf( stderr, " access=%08x,", req->access );
@@ -3509,7 +3504,6 @@ static const dump_func req_dumpers[REQ_NB_REQUESTS] = {
     (dump_func)dump_flush_file_request,
     (dump_func)dump_lock_file_request,
     (dump_func)dump_unlock_file_request,
-    (dump_func)dump_unmount_device_request,
     (dump_func)dump_create_socket_request,
     (dump_func)dump_accept_socket_request,
     (dump_func)dump_set_socket_event_request,
@@ -3729,7 +3723,6 @@ static const dump_func reply_dumpers[REQ_NB_REQUESTS] = {
     (dump_func)dump_flush_file_reply,
     (dump_func)dump_lock_file_reply,
     (dump_func)0,
-    (dump_func)0,
     (dump_func)dump_create_socket_reply,
     (dump_func)dump_accept_socket_reply,
     (dump_func)0,
@@ -3949,7 +3942,6 @@ static const char * const req_names[REQ_NB_REQUESTS] = {
     "flush_file",
     "lock_file",
     "unlock_file",
-    "unmount_device",
     "create_socket",
     "accept_socket",
     "set_socket_event",




More information about the wine-cvs mailing list