Alexandre Julliard : server: Add a specific data type for ioctl codes so they can be printed as symbols .

Alexandre Julliard julliard at wine.codeweavers.com
Wed Apr 18 06:58:45 CDT 2007


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

Author: Alexandre Julliard <julliard at winehq.org>
Date:   Tue Apr 17 22:06:13 2007 +0200

server: Add a specific data type for ioctl codes so they can be printed as symbols.

---

 include/wine/server_protocol.h |    3 ++-
 server/fd.c                    |    2 +-
 server/file.h                  |    4 ++--
 server/named_pipe.c            |    4 ++--
 server/protocol.def            |    3 ++-
 server/trace.c                 |   17 ++++++++++++++++-
 tools/make_requests            |    1 +
 7 files changed, 26 insertions(+), 8 deletions(-)

diff --git a/include/wine/server_protocol.h b/include/wine/server_protocol.h
index e45c7ad..df2eeaa 100644
--- a/include/wine/server_protocol.h
+++ b/include/wine/server_protocol.h
@@ -21,6 +21,7 @@ typedef unsigned short atom_t;
 typedef unsigned int process_id_t;
 typedef unsigned int thread_id_t;
 typedef unsigned int data_size_t;
+typedef unsigned int ioctl_code_t;
 
 struct request_header
 {
@@ -2668,7 +2669,7 @@ struct ioctl_request
 {
     struct request_header __header;
     obj_handle_t   handle;
-    unsigned int   code;
+    ioctl_code_t   code;
     async_data_t   async;
     /* VARARG(in_data,bytes); */
 };
diff --git a/server/fd.c b/server/fd.c
index 7f6c31c..d24eedc 100644
--- a/server/fd.c
+++ b/server/fd.c
@@ -1855,7 +1855,7 @@ static void unmount_device( struct fd *device_fd )
 }
 
 /* default ioctl() routine */
-void default_fd_ioctl( struct fd *fd, unsigned int code, const async_data_t *async,
+void default_fd_ioctl( struct fd *fd, ioctl_code_t code, const async_data_t *async,
                        const void *data, data_size_t size )
 {
     switch(code)
diff --git a/server/file.h b/server/file.h
index 7109e75..262a011 100644
--- a/server/file.h
+++ b/server/file.h
@@ -40,7 +40,7 @@ struct fd_ops
     /* get file information */
     enum server_fd_type (*get_fd_type)(struct fd *fd);
     /* perform an ioctl on the file */
-    void (*ioctl)(struct fd *fd, unsigned int code, const async_data_t *async,
+    void (*ioctl)(struct fd *fd, ioctl_code_t code, const async_data_t *async,
                   const void *data, data_size_t size);
     /* queue an async operation */
     void (*queue_async)(struct fd *, const async_data_t *data, int type, int count);
@@ -77,7 +77,7 @@ extern void default_poll_event( struct fd *fd, int event );
 extern struct async *fd_queue_async( struct fd *fd, const async_data_t *data, int type, int count );
 extern void fd_async_wake_up( struct fd *fd, int type, unsigned int status );
 extern void fd_reselect_async( struct fd *fd, struct async_queue *queue );
-extern void default_fd_ioctl( struct fd *fd, unsigned int code, const async_data_t *async,
+extern void default_fd_ioctl( struct fd *fd, ioctl_code_t code, const async_data_t *async,
                               const void *data, data_size_t size );
 extern void default_fd_queue_async( struct fd *fd, const async_data_t *data, int type, int count );
 extern void default_fd_reselect_async( struct fd *fd, struct async_queue *queue );
diff --git a/server/named_pipe.c b/server/named_pipe.c
index aebbdd3..a6871b7 100644
--- a/server/named_pipe.c
+++ b/server/named_pipe.c
@@ -139,7 +139,7 @@ static struct fd *pipe_server_get_fd( struct object *obj );
 static void pipe_server_destroy( struct object *obj);
 static void pipe_server_flush( struct fd *fd, struct event **event );
 static enum server_fd_type pipe_server_get_fd_type( struct fd *fd );
-static void pipe_server_ioctl( struct fd *fd, unsigned int code, const async_data_t *async,
+static void pipe_server_ioctl( struct fd *fd, ioctl_code_t code, const async_data_t *async,
                                const void *data, data_size_t size );
 
 static const struct object_ops pipe_server_ops =
@@ -565,7 +565,7 @@ static enum server_fd_type pipe_client_get_fd_type( struct fd *fd )
     return FD_TYPE_PIPE;
 }
 
-static void pipe_server_ioctl( struct fd *fd, unsigned int code, const async_data_t *async,
+static void pipe_server_ioctl( struct fd *fd, ioctl_code_t code, const async_data_t *async,
                                const void *data, data_size_t size )
 {
     struct pipe_server *server = get_fd_user( fd );
diff --git a/server/protocol.def b/server/protocol.def
index e9e3c1e..9aff9e6 100644
--- a/server/protocol.def
+++ b/server/protocol.def
@@ -37,6 +37,7 @@ typedef unsigned short atom_t;
 typedef unsigned int process_id_t;
 typedef unsigned int thread_id_t;
 typedef unsigned int data_size_t;
+typedef unsigned int ioctl_code_t;
 
 struct request_header
 {
@@ -1967,7 +1968,7 @@ enum message_type
 /* Perform an ioctl on a file */
 @REQ(ioctl)
     obj_handle_t   handle;        /* handle to the device */
-    unsigned int   code;          /* ioctl code */
+    ioctl_code_t   code;          /* ioctl code */
     async_data_t   async;         /* async I/O parameters */
     VARARG(in_data,bytes);        /* ioctl input data */
 @REPLY
diff --git a/server/trace.c b/server/trace.c
index 44cf32e..59cdf1d 100644
--- a/server/trace.c
+++ b/server/trace.c
@@ -36,6 +36,7 @@
 #include "winbase.h"
 #include "wincon.h"
 #include "winternl.h"
+#include "winioctl.h"
 #include "file.h"
 #include "request.h"
 #include "unicode.h"
@@ -82,6 +83,18 @@ static void dump_char_info( const char_info_t *info )
     fprintf( stderr, "',%04x}", info->attr );
 }
 
+static void dump_ioctl_code( const ioctl_code_t *code )
+{
+    switch(*code)
+    {
+#define CASE(c) case c: fputs( #c, stderr ); break
+        CASE(FSCTL_DISMOUNT_VOLUME);
+        CASE(FSCTL_PIPE_DISCONNECT);
+        default: fprintf( stderr, "%08x", *code ); break;
+#undef CASE
+    }
+}
+
 static void dump_apc_call( const apc_call_t *call )
 {
     fputc( '{', stderr );
@@ -2391,7 +2404,9 @@ static void dump_cancel_async_request( const struct cancel_async_request *req )
 static void dump_ioctl_request( const struct ioctl_request *req )
 {
     fprintf( stderr, " handle=%p,", req->handle );
-    fprintf( stderr, " code=%08x,", req->code );
+    fprintf( stderr, " code=" );
+    dump_ioctl_code( &req->code );
+    fprintf( stderr, "," );
     fprintf( stderr, " async=" );
     dump_async_data( &req->async );
     fprintf( stderr, "," );
diff --git a/tools/make_requests b/tools/make_requests
index d0bb0a5..e735de6 100755
--- a/tools/make_requests
+++ b/tools/make_requests
@@ -46,6 +46,7 @@ my %formats =
     "apc_result_t"  => "&dump_apc_result",
     "async_data_t"  => "&dump_async_data",
     "luid_t"        => "&dump_luid",
+    "ioctl_code_t"  => "&dump_ioctl_code",
 );
 
 my @requests = ();




More information about the wine-cvs mailing list