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

This commit is contained in:
Alexandre Julliard 2007-04-17 22:06:13 +02:00
parent aaf477f292
commit 737148c57b
7 changed files with 26 additions and 8 deletions

View file

@ -21,6 +21,7 @@ typedef unsigned short atom_t;
typedef unsigned int process_id_t; typedef unsigned int process_id_t;
typedef unsigned int thread_id_t; typedef unsigned int thread_id_t;
typedef unsigned int data_size_t; typedef unsigned int data_size_t;
typedef unsigned int ioctl_code_t;
struct request_header struct request_header
{ {
@ -2668,7 +2669,7 @@ struct ioctl_request
{ {
struct request_header __header; struct request_header __header;
obj_handle_t handle; obj_handle_t handle;
unsigned int code; ioctl_code_t code;
async_data_t async; async_data_t async;
/* VARARG(in_data,bytes); */ /* VARARG(in_data,bytes); */
}; };

View file

@ -1855,7 +1855,7 @@ static void unmount_device( struct fd *device_fd )
} }
/* default ioctl() routine */ /* 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 ) const void *data, data_size_t size )
{ {
switch(code) switch(code)

View file

@ -40,7 +40,7 @@ struct fd_ops
/* get file information */ /* get file information */
enum server_fd_type (*get_fd_type)(struct fd *fd); enum server_fd_type (*get_fd_type)(struct fd *fd);
/* perform an ioctl on the file */ /* 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); const void *data, data_size_t size);
/* queue an async operation */ /* queue an async operation */
void (*queue_async)(struct fd *, const async_data_t *data, int type, int count); 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 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_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 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 ); 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_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 ); extern void default_fd_reselect_async( struct fd *fd, struct async_queue *queue );

View file

@ -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_destroy( struct object *obj);
static void pipe_server_flush( struct fd *fd, struct event **event ); 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 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 ); const void *data, data_size_t size );
static const struct object_ops pipe_server_ops = 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; 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 ) const void *data, data_size_t size )
{ {
struct pipe_server *server = get_fd_user( fd ); struct pipe_server *server = get_fd_user( fd );

View file

@ -37,6 +37,7 @@ typedef unsigned short atom_t;
typedef unsigned int process_id_t; typedef unsigned int process_id_t;
typedef unsigned int thread_id_t; typedef unsigned int thread_id_t;
typedef unsigned int data_size_t; typedef unsigned int data_size_t;
typedef unsigned int ioctl_code_t;
struct request_header struct request_header
{ {
@ -1967,7 +1968,7 @@ enum message_type
/* Perform an ioctl on a file */ /* Perform an ioctl on a file */
@REQ(ioctl) @REQ(ioctl)
obj_handle_t handle; /* handle to the device */ 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 */ async_data_t async; /* async I/O parameters */
VARARG(in_data,bytes); /* ioctl input data */ VARARG(in_data,bytes); /* ioctl input data */
@REPLY @REPLY

View file

@ -36,6 +36,7 @@
#include "winbase.h" #include "winbase.h"
#include "wincon.h" #include "wincon.h"
#include "winternl.h" #include "winternl.h"
#include "winioctl.h"
#include "file.h" #include "file.h"
#include "request.h" #include "request.h"
#include "unicode.h" #include "unicode.h"
@ -82,6 +83,18 @@ static void dump_char_info( const char_info_t *info )
fprintf( stderr, "',%04x}", info->attr ); 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 ) static void dump_apc_call( const apc_call_t *call )
{ {
fputc( '{', stderr ); 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 ) static void dump_ioctl_request( const struct ioctl_request *req )
{ {
fprintf( stderr, " handle=%p,", req->handle ); 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=" ); fprintf( stderr, " async=" );
dump_async_data( &req->async ); dump_async_data( &req->async );
fprintf( stderr, "," ); fprintf( stderr, "," );

View file

@ -46,6 +46,7 @@ my %formats =
"apc_result_t" => "&dump_apc_result", "apc_result_t" => "&dump_apc_result",
"async_data_t" => "&dump_async_data", "async_data_t" => "&dump_async_data",
"luid_t" => "&dump_luid", "luid_t" => "&dump_luid",
"ioctl_code_t" => "&dump_ioctl_code",
); );
my @requests = (); my @requests = ();