From 7a9363a4d4f93607e78a488d87fac05865ecc57e Mon Sep 17 00:00:00 2001 From: Alexandre Julliard Date: Tue, 10 Apr 2007 22:26:23 +0200 Subject: [PATCH] server: Rename the get_file_info function to get_fd_type and get rid of the flags. --- server/change.c | 9 ++++----- server/fd.c | 8 ++++---- server/file.c | 7 +++---- server/file.h | 4 ++-- server/mailslot.c | 23 +++++++++-------------- server/named_pipe.c | 21 +++++++++------------ server/process.c | 2 +- server/queue.c | 2 +- server/request.c | 2 +- server/serial.c | 10 +++------- server/signal.c | 2 +- server/sock.c | 15 +++------------ server/thread.c | 2 +- 13 files changed, 42 insertions(+), 65 deletions(-) diff --git a/server/change.c b/server/change.c index 00ffb9437c2..6f4489dd7cf 100644 --- a/server/change.c +++ b/server/change.c @@ -179,14 +179,14 @@ static const struct object_ops dir_ops = }; static int dir_get_poll_events( struct fd *fd ); -static enum server_fd_type dir_get_info( struct fd *fd, int *flags ); +static enum server_fd_type dir_get_fd_type( struct fd *fd ); static const struct fd_ops dir_fd_ops = { dir_get_poll_events, /* get_poll_events */ default_poll_event, /* poll_event */ no_flush, /* flush */ - dir_get_info, /* get_file_info */ + dir_get_fd_type, /* get_fd_type */ default_fd_queue_async, /* queue_async */ default_fd_reselect_async, /* reselect_async */ default_fd_cancel_async /* cancel_async */ @@ -342,9 +342,8 @@ static int dir_get_poll_events( struct fd *fd ) return 0; } -static enum server_fd_type dir_get_info( struct fd *fd, int *flags ) +static enum server_fd_type dir_get_fd_type( struct fd *fd ) { - *flags = 0; return FD_TYPE_DIR; } @@ -520,7 +519,7 @@ static const struct fd_ops inotify_fd_ops = inotify_get_poll_events, /* get_poll_events */ inotify_poll_event, /* poll_event */ no_flush, /* flush */ - no_get_file_info, /* get_file_info */ + no_get_fd_type, /* get_fd_type */ default_fd_queue_async, /* queue_async */ default_fd_reselect_async, /* reselect_async */ default_fd_cancel_async, /* cancel_async */ diff --git a/server/fd.c b/server/fd.c index c7ae7fbfa31..c8688ec3cfd 100644 --- a/server/fd.c +++ b/server/fd.c @@ -1779,10 +1779,9 @@ void no_flush( struct fd *fd, struct event **event ) set_error( STATUS_OBJECT_TYPE_MISMATCH ); } -/* default get_file_info() routine */ -enum server_fd_type no_get_file_info( struct fd *fd, int *flags ) +/* default get_fd_type() routine */ +enum server_fd_type no_get_fd_type( struct fd *fd ) { - *flags = 0; return FD_TYPE_INVALID; } @@ -1908,7 +1907,8 @@ DECL_HANDLER(get_handle_fd) if ((fd = get_handle_fd_obj( current->process, req->handle, req->access ))) { - reply->type = fd->fd_ops->get_file_info( fd, &reply->flags ); + reply->flags = 0; + reply->type = fd->fd_ops->get_fd_type( fd ); if (reply->type != FD_TYPE_INVALID) { if (!(fd->options & (FILE_SYNCHRONOUS_IO_ALERT | FILE_SYNCHRONOUS_IO_NONALERT))) diff --git a/server/file.c b/server/file.c index e6f1c711f09..8e10847550f 100644 --- a/server/file.c +++ b/server/file.c @@ -69,7 +69,7 @@ static void file_destroy( struct object *obj ); static int file_get_poll_events( struct fd *fd ); static void file_flush( struct fd *fd, struct event **event ); -static enum server_fd_type file_get_info( struct fd *fd, int *flags ); +static enum server_fd_type file_get_fd_type( struct fd *fd ); static const struct object_ops file_ops = { @@ -93,7 +93,7 @@ static const struct fd_ops file_fd_ops = file_get_poll_events, /* get_poll_events */ default_poll_event, /* poll_event */ file_flush, /* flush */ - file_get_info, /* get_file_info */ + file_get_fd_type, /* get_fd_type */ default_fd_queue_async, /* queue_async */ default_fd_reselect_async, /* reselect_async */ default_fd_cancel_async /* cancel_async */ @@ -232,9 +232,8 @@ static void file_flush( struct fd *fd, struct event **event ) if (unix_fd != -1 && fsync( unix_fd ) == -1) file_set_error(); } -static enum server_fd_type file_get_info( struct fd *fd, int *flags ) +static enum server_fd_type file_get_fd_type( struct fd *fd ) { - *flags = 0; return FD_TYPE_FILE; } diff --git a/server/file.h b/server/file.h index e3a7cb59c3f..25d74b2b3fd 100644 --- a/server/file.h +++ b/server/file.h @@ -38,7 +38,7 @@ struct fd_ops /* flush the object buffers */ void (*flush)(struct fd *, struct event **); /* get file information */ - enum server_fd_type (*get_file_info)(struct fd *fd, int *flags); + enum server_fd_type (*get_fd_type)(struct fd *fd); /* queue an async operation */ void (*queue_async)(struct fd *, const async_data_t *data, int type, int count); /* selected events for async i/o need an update */ @@ -78,7 +78,7 @@ extern void default_fd_queue_async( struct fd *fd, const async_data_t *data, int extern void default_fd_reselect_async( struct fd *fd, struct async_queue *queue ); extern void default_fd_cancel_async( struct fd *fd ); extern void no_flush( struct fd *fd, struct event **event ); -extern enum server_fd_type no_get_file_info( struct fd *fd, int *flags ); +extern enum server_fd_type no_get_fd_type( struct fd *fd ); extern void no_queue_async( struct fd *fd, const async_data_t *data, int type, int count); extern void no_cancel_async( struct fd *fd ); extern void main_loop(void); diff --git a/server/mailslot.c b/server/mailslot.c index abc634901bd..8e178627897 100644 --- a/server/mailslot.c +++ b/server/mailslot.c @@ -87,7 +87,7 @@ static const struct object_ops mailslot_ops = mailslot_destroy /* destroy */ }; -static enum server_fd_type mailslot_get_info( struct fd *fd, int *flags ); +static enum server_fd_type mailslot_get_fd_type( struct fd *fd ); static void mailslot_queue_async( struct fd *fd, const async_data_t *data, int type, int count ); static const struct fd_ops mailslot_fd_ops = @@ -95,7 +95,7 @@ static const struct fd_ops mailslot_fd_ops = default_fd_get_poll_events, /* get_poll_events */ default_poll_event, /* poll_event */ no_flush, /* flush */ - mailslot_get_info, /* get_file_info */ + mailslot_get_fd_type, /* get_fd_type */ mailslot_queue_async, /* queue_async */ default_fd_reselect_async, /* reselect_async */ default_fd_cancel_async /* cancel_async */ @@ -133,14 +133,14 @@ static const struct object_ops mail_writer_ops = mail_writer_destroy /* destroy */ }; -static enum server_fd_type mail_writer_get_info( struct fd *fd, int *flags ); +static enum server_fd_type mail_writer_get_fd_type( struct fd *fd ); static const struct fd_ops mail_writer_fd_ops = { NULL, /* get_poll_events */ NULL, /* poll_event */ no_flush, /* flush */ - mail_writer_get_info, /* get_file_info */ + mail_writer_get_fd_type, /* get_fd_type */ no_queue_async, /* queue_async */ NULL /* cancel_async */ }; @@ -160,7 +160,7 @@ static struct object *mailslot_device_lookup_name( struct object *obj, struct un static struct object *mailslot_device_open_file( struct object *obj, unsigned int access, unsigned int sharing, unsigned int options ); static void mailslot_device_destroy( struct object *obj ); -static enum server_fd_type mailslot_device_get_file_info( struct fd *fd, int *flags ); +static enum server_fd_type mailslot_device_get_fd_type( struct fd *fd ); static const struct object_ops mailslot_device_ops = { @@ -184,7 +184,7 @@ static const struct fd_ops mailslot_device_fd_ops = default_fd_get_poll_events, /* get_poll_events */ default_poll_event, /* poll_event */ no_flush, /* flush */ - mailslot_device_get_file_info, /* get_file_info */ + mailslot_device_get_fd_type, /* get_fd_type */ default_fd_queue_async, /* queue_async */ default_fd_reselect_async, /* reselect_async */ default_fd_cancel_async /* cancel_async */ @@ -211,11 +211,8 @@ static void mailslot_dump( struct object *obj, int verbose ) mailslot->max_msgsize, mailslot->read_timeout ); } -static enum server_fd_type mailslot_get_info( struct fd *fd, int *flags ) +static enum server_fd_type mailslot_get_fd_type( struct fd *fd ) { - struct mailslot *mailslot = get_fd_user( fd ); - assert( mailslot->obj.ops == &mailslot_ops ); - *flags = 0; return FD_TYPE_MAILSLOT; } @@ -331,9 +328,8 @@ static void mailslot_device_destroy( struct object *obj ) free( device->mailslots ); } -static enum server_fd_type mailslot_device_get_file_info( struct fd *fd, int *flags ) +static enum server_fd_type mailslot_device_get_fd_type( struct fd *fd ) { - *flags = 0; return FD_TYPE_DEVICE; } @@ -435,9 +431,8 @@ static void mail_writer_destroy( struct object *obj) release_object( writer->mailslot ); } -static enum server_fd_type mail_writer_get_info( struct fd *fd, int *flags ) +static enum server_fd_type mail_writer_get_fd_type( struct fd *fd ) { - *flags = 0; return FD_TYPE_MAILSLOT; } diff --git a/server/named_pipe.c b/server/named_pipe.c index 738e3689669..d5b88a2710e 100644 --- a/server/named_pipe.c +++ b/server/named_pipe.c @@ -137,7 +137,7 @@ static void pipe_server_dump( struct object *obj, int verbose ); 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_info( struct fd *fd, int *flags ); +static enum server_fd_type pipe_server_get_fd_type( struct fd *fd ); static const struct object_ops pipe_server_ops = { @@ -161,7 +161,7 @@ static const struct fd_ops pipe_server_fd_ops = default_fd_get_poll_events, /* get_poll_events */ default_poll_event, /* poll_event */ pipe_server_flush, /* flush */ - pipe_server_get_info, /* get_file_info */ + pipe_server_get_fd_type, /* get_fd_type */ default_fd_queue_async, /* queue_async */ default_fd_reselect_async, /* reselect_async */ default_fd_cancel_async, /* cancel_async */ @@ -172,7 +172,7 @@ static void pipe_client_dump( struct object *obj, int verbose ); static struct fd *pipe_client_get_fd( struct object *obj ); static void pipe_client_destroy( struct object *obj ); static void pipe_client_flush( struct fd *fd, struct event **event ); -static enum server_fd_type pipe_client_get_info( struct fd *fd, int *flags ); +static enum server_fd_type pipe_client_get_fd_type( struct fd *fd ); static const struct object_ops pipe_client_ops = { @@ -196,7 +196,7 @@ static const struct fd_ops pipe_client_fd_ops = default_fd_get_poll_events, /* get_poll_events */ default_poll_event, /* poll_event */ pipe_client_flush, /* flush */ - pipe_client_get_info, /* get_file_info */ + pipe_client_get_fd_type, /* get_fd_type */ default_fd_queue_async, /* queue_async */ default_fd_reselect_async, /* reselect_async */ default_fd_cancel_async /* cancel_async */ @@ -209,7 +209,7 @@ static struct object *named_pipe_device_lookup_name( struct object *obj, static struct object *named_pipe_device_open_file( struct object *obj, unsigned int access, unsigned int sharing, unsigned int options ); static void named_pipe_device_destroy( struct object *obj ); -static enum server_fd_type named_pipe_device_get_file_info( struct fd *fd, int *flags ); +static enum server_fd_type named_pipe_device_get_fd_type( struct fd *fd ); static const struct object_ops named_pipe_device_ops = { @@ -233,7 +233,7 @@ static const struct fd_ops named_pipe_device_fd_ops = default_fd_get_poll_events, /* get_poll_events */ default_poll_event, /* poll_event */ no_flush, /* flush */ - named_pipe_device_get_file_info, /* get_file_info */ + named_pipe_device_get_fd_type, /* get_fd_type */ default_fd_queue_async, /* queue_async */ default_fd_reselect_async, /* reselect_async */ default_fd_cancel_async /* cancel_async */ @@ -456,9 +456,8 @@ static void named_pipe_device_destroy( struct object *obj ) free( device->pipes ); } -static enum server_fd_type named_pipe_device_get_file_info( struct fd *fd, int *flags ) +static enum server_fd_type named_pipe_device_get_fd_type( struct fd *fd ) { - *flags = 0; return FD_TYPE_DEVICE; } @@ -555,15 +554,13 @@ static inline int is_overlapped( unsigned int options ) return !(options & (FILE_SYNCHRONOUS_IO_ALERT | FILE_SYNCHRONOUS_IO_NONALERT)); } -static enum server_fd_type pipe_server_get_info( struct fd *fd, int *flags ) +static enum server_fd_type pipe_server_get_fd_type( struct fd *fd ) { - *flags = 0; return FD_TYPE_PIPE; } -static enum server_fd_type pipe_client_get_info( struct fd *fd, int *flags ) +static enum server_fd_type pipe_client_get_fd_type( struct fd *fd ) { - *flags = 0; return FD_TYPE_PIPE; } diff --git a/server/process.c b/server/process.c index ee19aa4d71f..1724a24428c 100644 --- a/server/process.c +++ b/server/process.c @@ -85,7 +85,7 @@ static const struct fd_ops process_fd_ops = NULL, /* get_poll_events */ process_poll_event, /* poll_event */ no_flush, /* flush */ - no_get_file_info, /* get_file_info */ + no_get_fd_type, /* get_fd_type */ no_queue_async, /* queue_async */ NULL, /* reselect_async */ no_cancel_async /* cancel async */ diff --git a/server/queue.c b/server/queue.c index 95fd3c9d535..7335cfc8972 100644 --- a/server/queue.c +++ b/server/queue.c @@ -167,7 +167,7 @@ static const struct fd_ops msg_queue_fd_ops = NULL, /* get_poll_events */ msg_queue_poll_event, /* poll_event */ no_flush, /* flush */ - no_get_file_info, /* get_file_info */ + no_get_fd_type, /* get_fd_type */ no_queue_async, /* queue_async */ NULL, /* reselect_async */ no_cancel_async /* cancel async */ diff --git a/server/request.c b/server/request.c index d9730d4ce96..ec83ef9704b 100644 --- a/server/request.c +++ b/server/request.c @@ -107,7 +107,7 @@ static const struct fd_ops master_socket_fd_ops = NULL, /* get_poll_events */ master_socket_poll_event, /* poll_event */ no_flush, /* flush */ - no_get_file_info, /* get_file_info */ + no_get_fd_type, /* get_fd_type */ no_queue_async, /* queue_async */ NULL, /* reselect_async */ no_cancel_async /* cancel_async */ diff --git a/server/serial.c b/server/serial.c index 63b925d5223..4d1853cd36b 100644 --- a/server/serial.c +++ b/server/serial.c @@ -61,7 +61,7 @@ static struct fd *serial_get_fd( struct object *obj ); static unsigned int serial_map_access( struct object *obj, unsigned int access ); static void serial_destroy(struct object *obj); -static enum server_fd_type serial_get_info( struct fd *fd, int *flags ); +static enum server_fd_type serial_get_fd_type( struct fd *fd ); static void serial_flush( struct fd *fd, struct event **event ); static void serial_queue_async( struct fd *fd, const async_data_t *data, int type, int count ); @@ -106,7 +106,7 @@ static const struct fd_ops serial_fd_ops = default_fd_get_poll_events, /* get_poll_events */ default_poll_event, /* poll_event */ serial_flush, /* flush */ - serial_get_info, /* get_file_info */ + serial_get_fd_type, /* get_file_info */ serial_queue_async, /* queue_async */ default_fd_reselect_async, /* reselect_async */ default_fd_cancel_async /* cancel_async */ @@ -171,12 +171,8 @@ static struct serial *get_serial_obj( struct process *process, obj_handle_t hand return (struct serial *)get_handle_obj( process, handle, access, &serial_ops ); } -static enum server_fd_type serial_get_info( struct fd *fd, int *flags ) +static enum server_fd_type serial_get_fd_type( struct fd *fd ) { - struct serial *serial = get_fd_user( fd ); - assert( serial->obj.ops == &serial_ops ); - - *flags = 0; return FD_TYPE_SERIAL; } diff --git a/server/signal.c b/server/signal.c index 927699f63f1..89fc809ffb1 100644 --- a/server/signal.c +++ b/server/signal.c @@ -83,7 +83,7 @@ static const struct fd_ops handler_fd_ops = NULL, /* get_poll_events */ handler_poll_event, /* poll_event */ no_flush, /* flush */ - no_get_file_info, /* get_file_info */ + no_get_fd_type, /* get_fd_type */ no_queue_async, /* queue_async */ NULL, /* reselect_async */ no_cancel_async /* cancel_async */ diff --git a/server/sock.c b/server/sock.c index 03cb3577d45..817c6bd2c3b 100644 --- a/server/sock.c +++ b/server/sock.c @@ -95,7 +95,7 @@ static void sock_destroy( struct object *obj ); static int sock_get_poll_events( struct fd *fd ); static void sock_poll_event( struct fd *fd, int event ); -static enum server_fd_type sock_get_info( struct fd *fd, int *flags ); +static enum server_fd_type sock_get_fd_type( struct fd *fd ); static void sock_queue_async( struct fd *fd, const async_data_t *data, int type, int count ); static void sock_reselect_async( struct fd *fd, struct async_queue *queue ); static void sock_cancel_async( struct fd *fd ); @@ -125,7 +125,7 @@ static const struct fd_ops sock_fd_ops = sock_get_poll_events, /* get_poll_events */ sock_poll_event, /* poll_event */ no_flush, /* flush */ - sock_get_info, /* get_file_info */ + sock_get_fd_type, /* get_file_info */ sock_queue_async, /* queue_async */ sock_reselect_async, /* reselect_async */ sock_cancel_async /* cancel_async */ @@ -491,17 +491,8 @@ static int sock_get_poll_events( struct fd *fd ) return ev; } -static enum server_fd_type sock_get_info( struct fd *fd, int *flags ) +static enum server_fd_type sock_get_fd_type( struct fd *fd ) { - struct sock *sock = get_fd_user( fd ); - assert( sock->obj.ops == &sock_ops ); - - *flags = 0; - if ( sock->type != SOCK_STREAM || sock->state & FD_WINE_CONNECTED ) - { - if ( !(sock->state & FD_READ ) ) *flags |= FD_FLAG_RECV_SHUTDOWN; - if ( !(sock->state & FD_WRITE ) ) *flags |= FD_FLAG_SEND_SHUTDOWN; - } return FD_TYPE_SOCKET; } diff --git a/server/thread.c b/server/thread.c index 2bac6362916..a4a113da287 100644 --- a/server/thread.c +++ b/server/thread.c @@ -130,7 +130,7 @@ static const struct fd_ops thread_fd_ops = NULL, /* get_poll_events */ thread_poll_event, /* poll_event */ no_flush, /* flush */ - no_get_file_info, /* get_file_info */ + no_get_fd_type, /* get_fd_type */ no_queue_async, /* queue_async */ NULL, /* reselect_async */ no_cancel_async /* cancel_async */