From 837b39b20284a101d103af8e78af37473a83756b Mon Sep 17 00:00:00 2001 From: Alexandre Julliard Date: Tue, 5 May 2015 12:17:45 +0900 Subject: [PATCH] server: Add read and write fd member functions. Also rename no_flush() to no_fd_flush() for consistency. --- server/change.c | 4 +++- server/console.c | 4 +++- server/device.c | 4 +++- server/fd.c | 28 ++++++++++++++++++++++------ server/file.c | 4 +++- server/file.h | 13 ++++++++++--- server/mailslot.c | 12 +++++++++--- server/mapping.c | 4 +++- server/named_pipe.c | 12 +++++++++--- server/serial.c | 4 +++- server/sock.c | 10 +++++++--- 11 files changed, 75 insertions(+), 24 deletions(-) diff --git a/server/change.c b/server/change.c index 3ac70a43729..08cee9b7145 100644 --- a/server/change.c +++ b/server/change.c @@ -177,8 +177,10 @@ 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_fd_type, /* get_fd_type */ + no_fd_read, /* read */ + no_fd_write, /* write */ + no_fd_flush, /* flush */ default_fd_ioctl, /* ioctl */ default_fd_queue_async, /* queue_async */ default_fd_reselect_async, /* reselect_async */ diff --git a/server/console.c b/server/console.c index 4c2d61dda4a..218831b6cac 100644 --- a/server/console.c +++ b/server/console.c @@ -172,8 +172,10 @@ static const struct fd_ops console_fd_ops = { default_fd_get_poll_events, /* get_poll_events */ default_poll_event, /* poll_event */ - no_flush, /* flush */ console_get_fd_type, /* get_fd_type */ + no_fd_read, /* read */ + no_fd_write, /* write */ + no_fd_flush, /* flush */ default_fd_ioctl, /* ioctl */ default_fd_queue_async, /* queue_async */ default_fd_reselect_async, /* reselect_async */ diff --git a/server/device.c b/server/device.c index aabff7950e7..9301f31708f 100644 --- a/server/device.c +++ b/server/device.c @@ -155,8 +155,10 @@ static const struct fd_ops device_fd_ops = { default_fd_get_poll_events, /* get_poll_events */ default_poll_event, /* poll_event */ - no_flush, /* flush */ device_get_fd_type, /* get_fd_type */ + no_fd_read, /* read */ + no_fd_write, /* write */ + no_fd_flush, /* flush */ device_ioctl, /* ioctl */ default_fd_queue_async, /* queue_async */ default_fd_reselect_async, /* reselect_async */ diff --git a/server/fd.c b/server/fd.c index a36df10578a..9b9ce97f490 100644 --- a/server/fd.c +++ b/server/fd.c @@ -2111,12 +2111,6 @@ void default_fd_cancel_async( struct fd *fd, struct process *process, struct thr set_error( STATUS_NOT_FOUND ); } -/* default flush() routine */ -void no_flush( struct fd *fd, struct event **event ) -{ - set_error( STATUS_OBJECT_TYPE_MISMATCH ); -} - static inline int is_valid_mounted_device( struct stat *st ) { #if defined(linux) || defined(__sun__) @@ -2164,6 +2158,28 @@ static void unmount_device( struct fd *device_fd ) release_object( device ); } +/* default read() routine */ +obj_handle_t no_fd_read( struct fd *fd, const async_data_t *async, int blocking, file_pos_t pos ) +{ + set_error( STATUS_OBJECT_TYPE_MISMATCH ); + return 0; +} + +/* default write() routine */ +obj_handle_t no_fd_write( struct fd *fd, const async_data_t *async, int blocking, + file_pos_t pos, data_size_t *written ) +{ + set_error( STATUS_OBJECT_TYPE_MISMATCH ); + return 0; +} + +/* default flush() routine */ +void no_fd_flush( struct fd *fd, struct event **event ) +{ + set_error( STATUS_OBJECT_TYPE_MISMATCH ); +} + +/* default ioctl() routine */ obj_handle_t no_fd_ioctl( struct fd *fd, ioctl_code_t code, const async_data_t *async, int blocking ) { set_error( STATUS_OBJECT_TYPE_MISMATCH ); diff --git a/server/file.c b/server/file.c index aa5ff011135..902125efde6 100644 --- a/server/file.c +++ b/server/file.c @@ -97,8 +97,10 @@ 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_fd_type, /* get_fd_type */ + no_fd_read, /* read */ + no_fd_write, /* write */ + file_flush, /* flush */ default_fd_ioctl, /* ioctl */ default_fd_queue_async, /* queue_async */ default_fd_reselect_async, /* reselect_async */ diff --git a/server/file.h b/server/file.h index a4663545f97..d30bb8451d7 100644 --- a/server/file.h +++ b/server/file.h @@ -37,10 +37,14 @@ struct fd_ops int (*get_poll_events)(struct fd *); /* a poll() event occurred */ void (*poll_event)(struct fd *,int event); - /* flush the object buffers */ - void (*flush)(struct fd *, struct event **); /* get file information */ enum server_fd_type (*get_fd_type)(struct fd *fd); + /* perform a read on the file */ + obj_handle_t (*read)(struct fd *, const async_data_t *, int, file_pos_t ); + /* perform a write on the file */ + obj_handle_t (*write)(struct fd *, const async_data_t *, int, file_pos_t, data_size_t * ); + /* flush the object buffers */ + void (*flush)(struct fd *, struct event **); /* perform an ioctl on the file */ obj_handle_t (*ioctl)(struct fd *fd, ioctl_code_t code, const async_data_t *async, int blocking ); /* queue an async operation */ @@ -85,13 +89,16 @@ 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 ); 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 obj_handle_t no_fd_read( struct fd *fd, const async_data_t *async, int blocking, file_pos_t pos ); +extern obj_handle_t no_fd_write( struct fd *fd, const async_data_t *async, int blocking, + file_pos_t pos, data_size_t *written ); +extern void no_fd_flush( struct fd *fd, struct event **event ); extern obj_handle_t no_fd_ioctl( struct fd *fd, ioctl_code_t code, const async_data_t *async, int blocking ); extern obj_handle_t default_fd_ioctl( struct fd *fd, ioctl_code_t code, const async_data_t *async, int blocking ); extern void no_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_cancel_async( struct fd *fd, struct process *process, struct thread *thread, client_ptr_t iosb ); -extern void no_flush( struct fd *fd, struct event **event ); extern void main_loop(void); extern void remove_process_locks( struct process *process ); diff --git a/server/mailslot.c b/server/mailslot.c index 051f0adb48f..97ea3f64f8d 100644 --- a/server/mailslot.c +++ b/server/mailslot.c @@ -97,8 +97,10 @@ 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_fd_type, /* get_fd_type */ + no_fd_read, /* read */ + no_fd_write, /* write */ + no_fd_flush, /* flush */ default_fd_ioctl, /* ioctl */ mailslot_queue_async, /* queue_async */ default_fd_reselect_async, /* reselect_async */ @@ -147,8 +149,10 @@ static const struct fd_ops mail_writer_fd_ops = { default_fd_get_poll_events, /* get_poll_events */ default_poll_event, /* poll_event */ - no_flush, /* flush */ mail_writer_get_fd_type, /* get_fd_type */ + no_fd_read, /* read */ + no_fd_write, /* write */ + no_fd_flush, /* flush */ default_fd_ioctl, /* ioctl */ default_fd_queue_async, /* queue_async */ default_fd_reselect_async, /* reselect_async */ @@ -197,8 +201,10 @@ 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_fd_type, /* get_fd_type */ + no_fd_read, /* read */ + no_fd_write, /* write */ + no_fd_flush, /* flush */ default_fd_ioctl, /* ioctl */ default_fd_queue_async, /* queue_async */ default_fd_reselect_async, /* reselect_async */ diff --git a/server/mapping.c b/server/mapping.c index 64b3003b7c9..16e7c1cb15a 100644 --- a/server/mapping.c +++ b/server/mapping.c @@ -100,8 +100,10 @@ static const struct fd_ops mapping_fd_ops = { default_fd_get_poll_events, /* get_poll_events */ default_poll_event, /* poll_event */ - no_flush, /* flush */ mapping_get_fd_type, /* get_fd_type */ + no_fd_read, /* read */ + no_fd_write, /* write */ + no_fd_flush, /* flush */ no_fd_ioctl, /* ioctl */ no_fd_queue_async, /* queue_async */ default_fd_reselect_async, /* reselect_async */ diff --git a/server/named_pipe.c b/server/named_pipe.c index 6d5fc5e15ed..d47524c2ebe 100644 --- a/server/named_pipe.c +++ b/server/named_pipe.c @@ -170,8 +170,10 @@ 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_fd_type, /* get_fd_type */ + no_fd_read, /* read */ + no_fd_write, /* write */ + pipe_server_flush, /* flush */ pipe_server_ioctl, /* ioctl */ default_fd_queue_async, /* queue_async */ default_fd_reselect_async, /* reselect_async */ @@ -210,8 +212,10 @@ 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_fd_type, /* get_fd_type */ + no_fd_read, /* read */ + no_fd_write, /* write */ + pipe_client_flush, /* flush */ default_fd_ioctl, /* ioctl */ default_fd_queue_async, /* queue_async */ default_fd_reselect_async, /* reselect_async */ @@ -254,8 +258,10 @@ 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_fd_type, /* get_fd_type */ + no_fd_read, /* read */ + no_fd_write, /* write */ + no_fd_flush, /* flush */ named_pipe_device_ioctl, /* ioctl */ default_fd_queue_async, /* queue_async */ default_fd_reselect_async, /* reselect_async */ diff --git a/server/serial.c b/server/serial.c index 880f5e34ab2..164a4b1fe71 100644 --- a/server/serial.c +++ b/server/serial.c @@ -109,8 +109,10 @@ static const struct fd_ops serial_fd_ops = { default_fd_get_poll_events, /* get_poll_events */ default_poll_event, /* poll_event */ - no_flush, /* flush */ serial_get_fd_type, /* get_fd_type */ + no_fd_read, /* read */ + no_fd_write, /* write */ + no_fd_flush, /* flush */ default_fd_ioctl, /* ioctl */ serial_queue_async, /* queue_async */ default_fd_reselect_async, /* reselect_async */ diff --git a/server/sock.c b/server/sock.c index ad0ec714dfe..337006f7d9d 100644 --- a/server/sock.c +++ b/server/sock.c @@ -163,8 +163,10 @@ 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_fd_type, /* get_fd_type */ + no_fd_read, /* read */ + no_fd_write, /* write */ + no_fd_flush, /* flush */ sock_ioctl, /* ioctl */ sock_queue_async, /* queue_async */ sock_reselect_async, /* reselect_async */ @@ -1026,9 +1028,11 @@ static const struct fd_ops ifchange_fd_ops = { ifchange_get_poll_events, /* get_poll_events */ ifchange_poll_event, /* poll_event */ - NULL, /* flush */ NULL, /* get_fd_type */ - NULL, /* ioctl */ + no_fd_read, /* read */ + no_fd_write, /* write */ + no_fd_flush, /* flush */ + no_fd_ioctl, /* ioctl */ NULL, /* queue_async */ ifchange_reselect_async, /* reselect_async */ NULL /* cancel_async */ -- 2.11.4.GIT