server: Add read and write fd member functions.
Also rename no_flush() to no_fd_flush() for consistency.
This commit is contained in:
parent
fc4a94c0e2
commit
837b39b202
|
@ -177,8 +177,10 @@ static const struct fd_ops dir_fd_ops =
|
||||||
{
|
{
|
||||||
dir_get_poll_events, /* get_poll_events */
|
dir_get_poll_events, /* get_poll_events */
|
||||||
default_poll_event, /* poll_event */
|
default_poll_event, /* poll_event */
|
||||||
no_flush, /* flush */
|
|
||||||
dir_get_fd_type, /* get_fd_type */
|
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_ioctl, /* ioctl */
|
||||||
default_fd_queue_async, /* queue_async */
|
default_fd_queue_async, /* queue_async */
|
||||||
default_fd_reselect_async, /* reselect_async */
|
default_fd_reselect_async, /* reselect_async */
|
||||||
|
|
|
@ -172,8 +172,10 @@ static const struct fd_ops console_fd_ops =
|
||||||
{
|
{
|
||||||
default_fd_get_poll_events, /* get_poll_events */
|
default_fd_get_poll_events, /* get_poll_events */
|
||||||
default_poll_event, /* poll_event */
|
default_poll_event, /* poll_event */
|
||||||
no_flush, /* flush */
|
|
||||||
console_get_fd_type, /* get_fd_type */
|
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_ioctl, /* ioctl */
|
||||||
default_fd_queue_async, /* queue_async */
|
default_fd_queue_async, /* queue_async */
|
||||||
default_fd_reselect_async, /* reselect_async */
|
default_fd_reselect_async, /* reselect_async */
|
||||||
|
|
|
@ -155,8 +155,10 @@ static const struct fd_ops device_fd_ops =
|
||||||
{
|
{
|
||||||
default_fd_get_poll_events, /* get_poll_events */
|
default_fd_get_poll_events, /* get_poll_events */
|
||||||
default_poll_event, /* poll_event */
|
default_poll_event, /* poll_event */
|
||||||
no_flush, /* flush */
|
|
||||||
device_get_fd_type, /* get_fd_type */
|
device_get_fd_type, /* get_fd_type */
|
||||||
|
no_fd_read, /* read */
|
||||||
|
no_fd_write, /* write */
|
||||||
|
no_fd_flush, /* flush */
|
||||||
device_ioctl, /* ioctl */
|
device_ioctl, /* ioctl */
|
||||||
default_fd_queue_async, /* queue_async */
|
default_fd_queue_async, /* queue_async */
|
||||||
default_fd_reselect_async, /* reselect_async */
|
default_fd_reselect_async, /* reselect_async */
|
||||||
|
|
28
server/fd.c
28
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 );
|
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 )
|
static inline int is_valid_mounted_device( struct stat *st )
|
||||||
{
|
{
|
||||||
#if defined(linux) || defined(__sun__)
|
#if defined(linux) || defined(__sun__)
|
||||||
|
@ -2164,6 +2158,28 @@ static void unmount_device( struct fd *device_fd )
|
||||||
release_object( device );
|
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 )
|
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 );
|
set_error( STATUS_OBJECT_TYPE_MISMATCH );
|
||||||
|
|
|
@ -97,8 +97,10 @@ static const struct fd_ops file_fd_ops =
|
||||||
{
|
{
|
||||||
file_get_poll_events, /* get_poll_events */
|
file_get_poll_events, /* get_poll_events */
|
||||||
default_poll_event, /* poll_event */
|
default_poll_event, /* poll_event */
|
||||||
file_flush, /* flush */
|
|
||||||
file_get_fd_type, /* get_fd_type */
|
file_get_fd_type, /* get_fd_type */
|
||||||
|
no_fd_read, /* read */
|
||||||
|
no_fd_write, /* write */
|
||||||
|
file_flush, /* flush */
|
||||||
default_fd_ioctl, /* ioctl */
|
default_fd_ioctl, /* ioctl */
|
||||||
default_fd_queue_async, /* queue_async */
|
default_fd_queue_async, /* queue_async */
|
||||||
default_fd_reselect_async, /* reselect_async */
|
default_fd_reselect_async, /* reselect_async */
|
||||||
|
|
|
@ -37,10 +37,14 @@ struct fd_ops
|
||||||
int (*get_poll_events)(struct fd *);
|
int (*get_poll_events)(struct fd *);
|
||||||
/* a poll() event occurred */
|
/* a poll() event occurred */
|
||||||
void (*poll_event)(struct fd *,int event);
|
void (*poll_event)(struct fd *,int event);
|
||||||
/* flush the object buffers */
|
|
||||||
void (*flush)(struct fd *, struct event **);
|
|
||||||
/* 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 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 */
|
/* perform an ioctl on the file */
|
||||||
obj_handle_t (*ioctl)(struct fd *fd, ioctl_code_t code, const async_data_t *async, int blocking );
|
obj_handle_t (*ioctl)(struct fd *fd, ioctl_code_t code, const async_data_t *async, int blocking );
|
||||||
/* queue an async operation */
|
/* 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 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_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 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 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 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 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_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 );
|
||||||
extern void default_fd_cancel_async( struct fd *fd, struct process *process, struct thread *thread, client_ptr_t iosb );
|
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 main_loop(void);
|
||||||
extern void remove_process_locks( struct process *process );
|
extern void remove_process_locks( struct process *process );
|
||||||
|
|
||||||
|
|
|
@ -97,8 +97,10 @@ static const struct fd_ops mailslot_fd_ops =
|
||||||
{
|
{
|
||||||
default_fd_get_poll_events, /* get_poll_events */
|
default_fd_get_poll_events, /* get_poll_events */
|
||||||
default_poll_event, /* poll_event */
|
default_poll_event, /* poll_event */
|
||||||
no_flush, /* flush */
|
|
||||||
mailslot_get_fd_type, /* get_fd_type */
|
mailslot_get_fd_type, /* get_fd_type */
|
||||||
|
no_fd_read, /* read */
|
||||||
|
no_fd_write, /* write */
|
||||||
|
no_fd_flush, /* flush */
|
||||||
default_fd_ioctl, /* ioctl */
|
default_fd_ioctl, /* ioctl */
|
||||||
mailslot_queue_async, /* queue_async */
|
mailslot_queue_async, /* queue_async */
|
||||||
default_fd_reselect_async, /* reselect_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_fd_get_poll_events, /* get_poll_events */
|
||||||
default_poll_event, /* poll_event */
|
default_poll_event, /* poll_event */
|
||||||
no_flush, /* flush */
|
|
||||||
mail_writer_get_fd_type, /* get_fd_type */
|
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_ioctl, /* ioctl */
|
||||||
default_fd_queue_async, /* queue_async */
|
default_fd_queue_async, /* queue_async */
|
||||||
default_fd_reselect_async, /* reselect_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_fd_get_poll_events, /* get_poll_events */
|
||||||
default_poll_event, /* poll_event */
|
default_poll_event, /* poll_event */
|
||||||
no_flush, /* flush */
|
|
||||||
mailslot_device_get_fd_type, /* get_fd_type */
|
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_ioctl, /* ioctl */
|
||||||
default_fd_queue_async, /* queue_async */
|
default_fd_queue_async, /* queue_async */
|
||||||
default_fd_reselect_async, /* reselect_async */
|
default_fd_reselect_async, /* reselect_async */
|
||||||
|
|
|
@ -100,8 +100,10 @@ static const struct fd_ops mapping_fd_ops =
|
||||||
{
|
{
|
||||||
default_fd_get_poll_events, /* get_poll_events */
|
default_fd_get_poll_events, /* get_poll_events */
|
||||||
default_poll_event, /* poll_event */
|
default_poll_event, /* poll_event */
|
||||||
no_flush, /* flush */
|
|
||||||
mapping_get_fd_type, /* get_fd_type */
|
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_ioctl, /* ioctl */
|
||||||
no_fd_queue_async, /* queue_async */
|
no_fd_queue_async, /* queue_async */
|
||||||
default_fd_reselect_async, /* reselect_async */
|
default_fd_reselect_async, /* reselect_async */
|
||||||
|
|
|
@ -170,8 +170,10 @@ static const struct fd_ops pipe_server_fd_ops =
|
||||||
{
|
{
|
||||||
default_fd_get_poll_events, /* get_poll_events */
|
default_fd_get_poll_events, /* get_poll_events */
|
||||||
default_poll_event, /* poll_event */
|
default_poll_event, /* poll_event */
|
||||||
pipe_server_flush, /* flush */
|
|
||||||
pipe_server_get_fd_type, /* get_fd_type */
|
pipe_server_get_fd_type, /* get_fd_type */
|
||||||
|
no_fd_read, /* read */
|
||||||
|
no_fd_write, /* write */
|
||||||
|
pipe_server_flush, /* flush */
|
||||||
pipe_server_ioctl, /* ioctl */
|
pipe_server_ioctl, /* ioctl */
|
||||||
default_fd_queue_async, /* queue_async */
|
default_fd_queue_async, /* queue_async */
|
||||||
default_fd_reselect_async, /* reselect_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_fd_get_poll_events, /* get_poll_events */
|
||||||
default_poll_event, /* poll_event */
|
default_poll_event, /* poll_event */
|
||||||
pipe_client_flush, /* flush */
|
|
||||||
pipe_client_get_fd_type, /* get_fd_type */
|
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_ioctl, /* ioctl */
|
||||||
default_fd_queue_async, /* queue_async */
|
default_fd_queue_async, /* queue_async */
|
||||||
default_fd_reselect_async, /* reselect_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_fd_get_poll_events, /* get_poll_events */
|
||||||
default_poll_event, /* poll_event */
|
default_poll_event, /* poll_event */
|
||||||
no_flush, /* flush */
|
|
||||||
named_pipe_device_get_fd_type, /* get_fd_type */
|
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 */
|
named_pipe_device_ioctl, /* ioctl */
|
||||||
default_fd_queue_async, /* queue_async */
|
default_fd_queue_async, /* queue_async */
|
||||||
default_fd_reselect_async, /* reselect_async */
|
default_fd_reselect_async, /* reselect_async */
|
||||||
|
|
|
@ -109,8 +109,10 @@ static const struct fd_ops serial_fd_ops =
|
||||||
{
|
{
|
||||||
default_fd_get_poll_events, /* get_poll_events */
|
default_fd_get_poll_events, /* get_poll_events */
|
||||||
default_poll_event, /* poll_event */
|
default_poll_event, /* poll_event */
|
||||||
no_flush, /* flush */
|
|
||||||
serial_get_fd_type, /* get_fd_type */
|
serial_get_fd_type, /* get_fd_type */
|
||||||
|
no_fd_read, /* read */
|
||||||
|
no_fd_write, /* write */
|
||||||
|
no_fd_flush, /* flush */
|
||||||
default_fd_ioctl, /* ioctl */
|
default_fd_ioctl, /* ioctl */
|
||||||
serial_queue_async, /* queue_async */
|
serial_queue_async, /* queue_async */
|
||||||
default_fd_reselect_async, /* reselect_async */
|
default_fd_reselect_async, /* reselect_async */
|
||||||
|
|
|
@ -163,8 +163,10 @@ static const struct fd_ops sock_fd_ops =
|
||||||
{
|
{
|
||||||
sock_get_poll_events, /* get_poll_events */
|
sock_get_poll_events, /* get_poll_events */
|
||||||
sock_poll_event, /* poll_event */
|
sock_poll_event, /* poll_event */
|
||||||
no_flush, /* flush */
|
|
||||||
sock_get_fd_type, /* get_fd_type */
|
sock_get_fd_type, /* get_fd_type */
|
||||||
|
no_fd_read, /* read */
|
||||||
|
no_fd_write, /* write */
|
||||||
|
no_fd_flush, /* flush */
|
||||||
sock_ioctl, /* ioctl */
|
sock_ioctl, /* ioctl */
|
||||||
sock_queue_async, /* queue_async */
|
sock_queue_async, /* queue_async */
|
||||||
sock_reselect_async, /* reselect_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_get_poll_events, /* get_poll_events */
|
||||||
ifchange_poll_event, /* poll_event */
|
ifchange_poll_event, /* poll_event */
|
||||||
NULL, /* flush */
|
|
||||||
NULL, /* get_fd_type */
|
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 */
|
NULL, /* queue_async */
|
||||||
ifchange_reselect_async, /* reselect_async */
|
ifchange_reselect_async, /* reselect_async */
|
||||||
NULL /* cancel_async */
|
NULL /* cancel_async */
|
||||||
|
|
Loading…
Reference in New Issue