forked from Mirrors/wine-wine
server: Create async objects in read and write request handlers.
async_get_data allows splitting patches, but will be removed later in the series. Signed-off-by: Jacek Caban <jacek@codeweavers.com> Signed-off-by: Alexandre Julliard <julliard@winehq.org>oldstable
parent
91bd81441f
commit
8ef4f9a0c8
|
@ -469,6 +469,16 @@ struct iosb *create_iosb( const void *in_data, data_size_t in_size, data_size_t
|
||||||
return iosb;
|
return iosb;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
struct iosb *async_get_iosb( struct async *async )
|
||||||
|
{
|
||||||
|
return async->iosb ? (struct iosb *)grab_object( async->iosb ) : NULL;
|
||||||
|
}
|
||||||
|
|
||||||
|
const async_data_t *async_get_data( struct async *async )
|
||||||
|
{
|
||||||
|
return &async->data;
|
||||||
|
}
|
||||||
|
|
||||||
/* cancels all async I/O */
|
/* cancels all async I/O */
|
||||||
DECL_HANDLER(cancel_async)
|
DECL_HANDLER(cancel_async)
|
||||||
{
|
{
|
||||||
|
|
|
@ -174,10 +174,8 @@ static struct fd *device_file_get_fd( struct object *obj );
|
||||||
static int device_file_close_handle( struct object *obj, struct process *process, obj_handle_t handle );
|
static int device_file_close_handle( struct object *obj, struct process *process, obj_handle_t handle );
|
||||||
static void device_file_destroy( struct object *obj );
|
static void device_file_destroy( struct object *obj );
|
||||||
static enum server_fd_type device_file_get_fd_type( struct fd *fd );
|
static enum server_fd_type device_file_get_fd_type( struct fd *fd );
|
||||||
static obj_handle_t device_file_read( struct fd *fd, const async_data_t *async_data, int blocking,
|
static obj_handle_t device_file_read( struct fd *fd, struct async *async, int blocking, file_pos_t pos );
|
||||||
file_pos_t pos, struct iosb *iosb );
|
static obj_handle_t device_file_write( struct fd *fd, struct async *async, int blocking, file_pos_t pos );
|
||||||
static obj_handle_t device_file_write( struct fd *fd, const async_data_t *async_data, int blocking,
|
|
||||||
file_pos_t pos, struct iosb *iosb );
|
|
||||||
static obj_handle_t device_file_flush( struct fd *fd, const async_data_t *async_data, int blocking );
|
static obj_handle_t device_file_flush( struct fd *fd, const async_data_t *async_data, int blocking );
|
||||||
static obj_handle_t device_file_ioctl( struct fd *fd, ioctl_code_t code, const async_data_t *async_data,
|
static obj_handle_t device_file_ioctl( struct fd *fd, ioctl_code_t code, const async_data_t *async_data,
|
||||||
int blocking );
|
int blocking );
|
||||||
|
@ -489,13 +487,13 @@ static enum server_fd_type device_file_get_fd_type( struct fd *fd )
|
||||||
return FD_TYPE_DEVICE;
|
return FD_TYPE_DEVICE;
|
||||||
}
|
}
|
||||||
|
|
||||||
static obj_handle_t device_file_read( struct fd *fd, const async_data_t *async_data, int blocking,
|
static obj_handle_t device_file_read( struct fd *fd, struct async *async, int blocking, file_pos_t pos )
|
||||||
file_pos_t pos, struct iosb *iosb )
|
|
||||||
{
|
{
|
||||||
struct device_file *file = get_fd_user( fd );
|
struct device_file *file = get_fd_user( fd );
|
||||||
struct irp_call *irp;
|
struct irp_call *irp;
|
||||||
obj_handle_t handle;
|
obj_handle_t handle;
|
||||||
irp_params_t params;
|
irp_params_t params;
|
||||||
|
struct iosb *iosb;
|
||||||
|
|
||||||
memset( ¶ms, 0, sizeof(params) );
|
memset( ¶ms, 0, sizeof(params) );
|
||||||
params.read.major = IRP_MJ_READ;
|
params.read.major = IRP_MJ_READ;
|
||||||
|
@ -503,21 +501,23 @@ static obj_handle_t device_file_read( struct fd *fd, const async_data_t *async_d
|
||||||
params.read.pos = pos;
|
params.read.pos = pos;
|
||||||
params.read.file = file->user_ptr;
|
params.read.file = file->user_ptr;
|
||||||
|
|
||||||
|
iosb = async_get_iosb( async );
|
||||||
irp = create_irp( file, ¶ms, iosb );
|
irp = create_irp( file, ¶ms, iosb );
|
||||||
|
release_object( iosb );
|
||||||
if (!irp) return 0;
|
if (!irp) return 0;
|
||||||
|
|
||||||
handle = queue_irp( file, irp, async_data, blocking );
|
handle = queue_irp( file, irp, async_get_data( async ), blocking );
|
||||||
release_object( irp );
|
release_object( irp );
|
||||||
return handle;
|
return handle;
|
||||||
}
|
}
|
||||||
|
|
||||||
static obj_handle_t device_file_write( struct fd *fd, const async_data_t *async_data, int blocking,
|
static obj_handle_t device_file_write( struct fd *fd, struct async *async, int blocking, file_pos_t pos )
|
||||||
file_pos_t pos, struct iosb *iosb )
|
|
||||||
{
|
{
|
||||||
struct device_file *file = get_fd_user( fd );
|
struct device_file *file = get_fd_user( fd );
|
||||||
struct irp_call *irp;
|
struct irp_call *irp;
|
||||||
obj_handle_t handle;
|
obj_handle_t handle;
|
||||||
irp_params_t params;
|
irp_params_t params;
|
||||||
|
struct iosb *iosb;
|
||||||
|
|
||||||
memset( ¶ms, 0, sizeof(params) );
|
memset( ¶ms, 0, sizeof(params) );
|
||||||
params.write.major = IRP_MJ_WRITE;
|
params.write.major = IRP_MJ_WRITE;
|
||||||
|
@ -525,10 +525,12 @@ static obj_handle_t device_file_write( struct fd *fd, const async_data_t *async_
|
||||||
params.write.pos = pos;
|
params.write.pos = pos;
|
||||||
params.write.file = file->user_ptr;
|
params.write.file = file->user_ptr;
|
||||||
|
|
||||||
|
iosb = async_get_iosb( async );
|
||||||
irp = create_irp( file, ¶ms, iosb );
|
irp = create_irp( file, ¶ms, iosb );
|
||||||
|
release_object( iosb );
|
||||||
if (!irp) return 0;
|
if (!irp) return 0;
|
||||||
|
|
||||||
handle = queue_irp( file, irp, async_data, blocking );
|
handle = queue_irp( file, irp, async_get_data( async ), blocking );
|
||||||
release_object( irp );
|
release_object( irp );
|
||||||
return handle;
|
return handle;
|
||||||
}
|
}
|
||||||
|
|
21
server/fd.c
21
server/fd.c
|
@ -2167,15 +2167,14 @@ static void unmount_device( struct fd *device_fd )
|
||||||
}
|
}
|
||||||
|
|
||||||
/* default read() routine */
|
/* default read() routine */
|
||||||
obj_handle_t no_fd_read( struct fd *fd, const async_data_t *async, int blocking, file_pos_t pos, struct iosb *iosb )
|
obj_handle_t no_fd_read( struct fd *fd, struct async *async, int blocking, file_pos_t pos )
|
||||||
{
|
{
|
||||||
set_error( STATUS_OBJECT_TYPE_MISMATCH );
|
set_error( STATUS_OBJECT_TYPE_MISMATCH );
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* default write() routine */
|
/* default write() routine */
|
||||||
obj_handle_t no_fd_write( struct fd *fd, const async_data_t *async, int blocking,
|
obj_handle_t no_fd_write( struct fd *fd, struct async *async, int blocking, file_pos_t pos )
|
||||||
file_pos_t pos, struct iosb *iosb )
|
|
||||||
{
|
{
|
||||||
set_error( STATUS_OBJECT_TYPE_MISMATCH );
|
set_error( STATUS_OBJECT_TYPE_MISMATCH );
|
||||||
return 0;
|
return 0;
|
||||||
|
@ -2450,14 +2449,20 @@ DECL_HANDLER(get_handle_fd)
|
||||||
DECL_HANDLER(read)
|
DECL_HANDLER(read)
|
||||||
{
|
{
|
||||||
struct fd *fd = get_handle_fd_obj( current->process, req->async.handle, FILE_READ_DATA );
|
struct fd *fd = get_handle_fd_obj( current->process, req->async.handle, FILE_READ_DATA );
|
||||||
|
struct async *async;
|
||||||
struct iosb *iosb;
|
struct iosb *iosb;
|
||||||
|
|
||||||
if (!fd) return;
|
if (!fd) return;
|
||||||
|
|
||||||
if ((iosb = create_iosb( NULL, 0, get_reply_max_size() )))
|
if ((iosb = create_iosb( NULL, 0, get_reply_max_size() )))
|
||||||
{
|
{
|
||||||
reply->wait = fd->fd_ops->read( fd, &req->async, req->blocking, req->pos, iosb );
|
async = create_async( current, &req->async, iosb );
|
||||||
|
if (async)
|
||||||
|
{
|
||||||
|
reply->wait = fd->fd_ops->read( fd, async, req->blocking, req->pos );
|
||||||
reply->options = fd->options;
|
reply->options = fd->options;
|
||||||
|
release_object( async );
|
||||||
|
}
|
||||||
release_object( iosb );
|
release_object( iosb );
|
||||||
}
|
}
|
||||||
release_object( fd );
|
release_object( fd );
|
||||||
|
@ -2467,14 +2472,20 @@ DECL_HANDLER(read)
|
||||||
DECL_HANDLER(write)
|
DECL_HANDLER(write)
|
||||||
{
|
{
|
||||||
struct fd *fd = get_handle_fd_obj( current->process, req->async.handle, FILE_WRITE_DATA );
|
struct fd *fd = get_handle_fd_obj( current->process, req->async.handle, FILE_WRITE_DATA );
|
||||||
|
struct async *async;
|
||||||
struct iosb *iosb;
|
struct iosb *iosb;
|
||||||
|
|
||||||
if (!fd) return;
|
if (!fd) return;
|
||||||
|
|
||||||
if ((iosb = create_iosb( get_req_data(), get_req_data_size(), 0 )))
|
if ((iosb = create_iosb( get_req_data(), get_req_data_size(), 0 )))
|
||||||
{
|
{
|
||||||
reply->wait = fd->fd_ops->write( fd, &req->async, req->blocking, req->pos, iosb );
|
async = create_async( current, &req->async, iosb );
|
||||||
|
if (async)
|
||||||
|
{
|
||||||
|
reply->wait = fd->fd_ops->write( fd, async, req->blocking, req->pos );
|
||||||
reply->options = fd->options;
|
reply->options = fd->options;
|
||||||
|
release_object( async );
|
||||||
|
}
|
||||||
release_object( iosb );
|
release_object( iosb );
|
||||||
}
|
}
|
||||||
release_object( fd );
|
release_object( fd );
|
||||||
|
|
|
@ -52,9 +52,9 @@ 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 a read on the file */
|
/* perform a read on the file */
|
||||||
obj_handle_t (*read)(struct fd *, const async_data_t *, int, file_pos_t, struct iosb * );
|
obj_handle_t (*read)(struct fd *, struct async *, int, file_pos_t );
|
||||||
/* perform a write on the file */
|
/* perform a write on the file */
|
||||||
obj_handle_t (*write)(struct fd *, const async_data_t *, int, file_pos_t, struct iosb * );
|
obj_handle_t (*write)(struct fd *, struct async *, int, file_pos_t );
|
||||||
/* flush the object buffers */
|
/* flush the object buffers */
|
||||||
obj_handle_t (*flush)(struct fd *, const async_data_t *, int);
|
obj_handle_t (*flush)(struct fd *, const async_data_t *, int);
|
||||||
/* perform an ioctl on the file */
|
/* perform an ioctl on the file */
|
||||||
|
@ -100,10 +100,8 @@ extern void default_poll_event( struct fd *fd, int event );
|
||||||
extern struct async *fd_queue_async( struct fd *fd, const async_data_t *data, struct iosb *iosb, int type );
|
extern struct async *fd_queue_async( struct fd *fd, const async_data_t *data, struct iosb *iosb, 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_read( struct fd *fd, struct async *async, int blocking, file_pos_t pos );
|
||||||
struct iosb *iosb );
|
extern obj_handle_t no_fd_write( struct fd *fd, struct async *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, struct iosb *iosb );
|
|
||||||
extern obj_handle_t no_fd_flush( struct fd *fd, const async_data_t *async, int blocking );
|
extern obj_handle_t no_fd_flush( struct fd *fd, 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 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 );
|
||||||
|
@ -189,6 +187,8 @@ extern void async_wake_up( struct async_queue *queue, unsigned int status );
|
||||||
extern struct completion *fd_get_completion( struct fd *fd, apc_param_t *p_key );
|
extern struct completion *fd_get_completion( struct fd *fd, apc_param_t *p_key );
|
||||||
extern void fd_copy_completion( struct fd *src, struct fd *dst );
|
extern void fd_copy_completion( struct fd *src, struct fd *dst );
|
||||||
extern struct iosb *create_iosb( const void *in_data, data_size_t in_size, data_size_t out_size );
|
extern struct iosb *create_iosb( const void *in_data, data_size_t in_size, data_size_t out_size );
|
||||||
|
extern struct iosb *async_get_iosb( struct async *async );
|
||||||
|
extern const async_data_t *async_get_data( struct async *async );
|
||||||
extern void cancel_process_asyncs( struct process *process );
|
extern void cancel_process_asyncs( struct process *process );
|
||||||
|
|
||||||
/* access rights that require Unix read permission */
|
/* access rights that require Unix read permission */
|
||||||
|
|
Loading…
Reference in New Issue