mirror of
git://source.winehq.org/git/wine.git
synced 2024-09-16 04:46:45 +00:00
server: Create async object in flush request handler.
Signed-off-by: Jacek Caban <jacek@codeweavers.com> Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
parent
bede6499ed
commit
a9c51f4e8a
|
@ -176,7 +176,7 @@ 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, struct async *async, int blocking, file_pos_t pos );
|
static obj_handle_t device_file_read( struct fd *fd, struct async *async, int blocking, file_pos_t pos );
|
||||||
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, struct async *async, int blocking, file_pos_t pos );
|
||||||
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, struct async *async, int blocking );
|
||||||
static obj_handle_t device_file_ioctl( struct fd *fd, ioctl_code_t code, struct async *async, int blocking );
|
static obj_handle_t device_file_ioctl( struct fd *fd, ioctl_code_t code, struct async *async, int blocking );
|
||||||
|
|
||||||
static const struct object_ops device_file_ops =
|
static const struct object_ops device_file_ops =
|
||||||
|
@ -465,13 +465,13 @@ static void set_file_user_ptr( struct device_file *file, client_ptr_t ptr )
|
||||||
|
|
||||||
/* queue an irp to the device */
|
/* queue an irp to the device */
|
||||||
static obj_handle_t queue_irp( struct device_file *file, struct irp_call *irp,
|
static obj_handle_t queue_irp( struct device_file *file, struct irp_call *irp,
|
||||||
const async_data_t *async_data, int blocking )
|
struct async *async, int blocking )
|
||||||
{
|
{
|
||||||
obj_handle_t handle = 0;
|
obj_handle_t handle = 0;
|
||||||
|
|
||||||
if (blocking && !(handle = alloc_handle( current->process, irp, SYNCHRONIZE, 0 ))) return 0;
|
if (blocking && !(handle = alloc_handle( current->process, irp, SYNCHRONIZE, 0 ))) return 0;
|
||||||
|
|
||||||
if (!(irp->async = fd_queue_async( file->fd, async_data, irp->iosb, ASYNC_TYPE_WAIT )))
|
if (!(irp->async = fd_queue_async( file->fd, async_get_data( async ), irp->iosb, ASYNC_TYPE_WAIT )))
|
||||||
{
|
{
|
||||||
if (handle) close_handle( current->process, handle );
|
if (handle) close_handle( current->process, handle );
|
||||||
return 0;
|
return 0;
|
||||||
|
@ -505,7 +505,7 @@ static obj_handle_t device_file_read( struct fd *fd, struct async *async, int bl
|
||||||
release_object( iosb );
|
release_object( iosb );
|
||||||
if (!irp) return 0;
|
if (!irp) return 0;
|
||||||
|
|
||||||
handle = queue_irp( file, irp, async_get_data( async ), blocking );
|
handle = queue_irp( file, irp, async, blocking );
|
||||||
release_object( irp );
|
release_object( irp );
|
||||||
return handle;
|
return handle;
|
||||||
}
|
}
|
||||||
|
@ -529,12 +529,12 @@ static obj_handle_t device_file_write( struct fd *fd, struct async *async, int b
|
||||||
release_object( iosb );
|
release_object( iosb );
|
||||||
if (!irp) return 0;
|
if (!irp) return 0;
|
||||||
|
|
||||||
handle = queue_irp( file, irp, async_get_data( async ), blocking );
|
handle = queue_irp( file, irp, async, blocking );
|
||||||
release_object( irp );
|
release_object( irp );
|
||||||
return handle;
|
return handle;
|
||||||
}
|
}
|
||||||
|
|
||||||
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, struct async *async, int blocking )
|
||||||
{
|
{
|
||||||
struct device_file *file = get_fd_user( fd );
|
struct device_file *file = get_fd_user( fd );
|
||||||
struct irp_call *irp;
|
struct irp_call *irp;
|
||||||
|
@ -548,7 +548,7 @@ static obj_handle_t device_file_flush( struct fd *fd, const async_data_t *async_
|
||||||
irp = create_irp( file, ¶ms, NULL );
|
irp = create_irp( file, ¶ms, NULL );
|
||||||
if (!irp) return 0;
|
if (!irp) return 0;
|
||||||
|
|
||||||
handle = queue_irp( file, irp, async_data, blocking );
|
handle = queue_irp( file, irp, async, blocking );
|
||||||
release_object( irp );
|
release_object( irp );
|
||||||
return handle;
|
return handle;
|
||||||
}
|
}
|
||||||
|
@ -573,7 +573,7 @@ static obj_handle_t device_file_ioctl( struct fd *fd, ioctl_code_t code, struct
|
||||||
release_object(iosb);
|
release_object(iosb);
|
||||||
if (!irp) return 0;
|
if (!irp) return 0;
|
||||||
|
|
||||||
handle = queue_irp( file, irp, async_get_data( async ), blocking );
|
handle = queue_irp( file, irp, async, blocking );
|
||||||
release_object( irp );
|
release_object( irp );
|
||||||
return handle;
|
return handle;
|
||||||
}
|
}
|
||||||
|
|
13
server/fd.c
13
server/fd.c
|
@ -2179,7 +2179,7 @@ obj_handle_t no_fd_write( struct fd *fd, struct async *async, int blocking, file
|
||||||
}
|
}
|
||||||
|
|
||||||
/* default flush() routine */
|
/* default flush() routine */
|
||||||
obj_handle_t no_fd_flush( struct fd *fd, const async_data_t *async, int blocking )
|
obj_handle_t no_fd_flush( struct fd *fd, struct async *async, int blocking )
|
||||||
{
|
{
|
||||||
set_error( STATUS_OBJECT_TYPE_MISMATCH );
|
set_error( STATUS_OBJECT_TYPE_MISMATCH );
|
||||||
return 0;
|
return 0;
|
||||||
|
@ -2376,12 +2376,17 @@ void fd_copy_completion( struct fd *src, struct fd *dst )
|
||||||
DECL_HANDLER(flush)
|
DECL_HANDLER(flush)
|
||||||
{
|
{
|
||||||
struct fd *fd = get_handle_fd_obj( current->process, req->async.handle, 0 );
|
struct fd *fd = get_handle_fd_obj( current->process, req->async.handle, 0 );
|
||||||
|
struct async *async;
|
||||||
|
|
||||||
if (fd)
|
if (!fd) return;
|
||||||
|
|
||||||
|
async = create_async( current, &req->async, NULL );
|
||||||
|
if (async)
|
||||||
{
|
{
|
||||||
reply->event = fd->fd_ops->flush( fd, &req->async, req->blocking );
|
reply->event = fd->fd_ops->flush( fd, async, req->blocking );
|
||||||
release_object( fd );
|
release_object( async );
|
||||||
}
|
}
|
||||||
|
release_object( fd );
|
||||||
}
|
}
|
||||||
|
|
||||||
/* open a file object */
|
/* open a file object */
|
||||||
|
|
|
@ -74,7 +74,7 @@ static struct object *file_open_file( struct object *obj, unsigned int access,
|
||||||
static void file_destroy( struct object *obj );
|
static void file_destroy( struct object *obj );
|
||||||
|
|
||||||
static int file_get_poll_events( struct fd *fd );
|
static int file_get_poll_events( struct fd *fd );
|
||||||
static obj_handle_t file_flush( struct fd *fd, const async_data_t *async, int blocking );
|
static obj_handle_t file_flush( struct fd *fd, struct async *async, int blocking );
|
||||||
static enum server_fd_type file_get_fd_type( struct fd *fd );
|
static enum server_fd_type file_get_fd_type( struct fd *fd );
|
||||||
|
|
||||||
static const struct object_ops file_ops =
|
static const struct object_ops file_ops =
|
||||||
|
@ -295,7 +295,7 @@ static int file_get_poll_events( struct fd *fd )
|
||||||
return events;
|
return events;
|
||||||
}
|
}
|
||||||
|
|
||||||
static obj_handle_t file_flush( struct fd *fd, const async_data_t *async, int blocking )
|
static obj_handle_t file_flush( struct fd *fd, struct async *async, int blocking )
|
||||||
{
|
{
|
||||||
int unix_fd = get_unix_fd( fd );
|
int unix_fd = get_unix_fd( fd );
|
||||||
if (unix_fd != -1 && fsync( unix_fd ) == -1) file_set_error();
|
if (unix_fd != -1 && fsync( unix_fd ) == -1) file_set_error();
|
||||||
|
|
|
@ -56,7 +56,7 @@ struct fd_ops
|
||||||
/* perform a write on the file */
|
/* perform a write on the file */
|
||||||
obj_handle_t (*write)(struct fd *, struct async *, int, file_pos_t );
|
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 *, struct async *, int);
|
||||||
/* perform an ioctl on the file */
|
/* perform an ioctl on the file */
|
||||||
obj_handle_t (*ioctl)(struct fd *fd, ioctl_code_t code, struct async *async, int blocking );
|
obj_handle_t (*ioctl)(struct fd *fd, ioctl_code_t code, struct async *async, int blocking );
|
||||||
/* queue an async operation */
|
/* queue an async operation */
|
||||||
|
@ -102,7 +102,7 @@ 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, struct async *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 );
|
||||||
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, struct async *async, int blocking, file_pos_t pos );
|
||||||
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, struct async *async, int blocking );
|
||||||
extern obj_handle_t no_fd_ioctl( struct fd *fd, ioctl_code_t code, struct async *async, int blocking );
|
extern obj_handle_t no_fd_ioctl( struct fd *fd, ioctl_code_t code, struct async *async, int blocking );
|
||||||
extern obj_handle_t default_fd_ioctl( struct fd *fd, ioctl_code_t code, struct async *async, int blocking );
|
extern obj_handle_t default_fd_ioctl( struct fd *fd, ioctl_code_t code, struct async *async, int blocking );
|
||||||
extern void no_fd_queue_async( struct fd *fd, struct async *async, int type, int count );
|
extern void no_fd_queue_async( struct fd *fd, struct async *async, int type, int count );
|
||||||
|
|
|
@ -142,7 +142,7 @@ static const struct object_ops named_pipe_ops =
|
||||||
static void pipe_server_dump( struct object *obj, int verbose );
|
static void pipe_server_dump( struct object *obj, int verbose );
|
||||||
static struct fd *pipe_server_get_fd( struct object *obj );
|
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 obj_handle_t pipe_server_flush( struct fd *fd, const async_data_t *async, int blocking );
|
static obj_handle_t pipe_server_flush( struct fd *fd, struct async *async, int blocking );
|
||||||
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 obj_handle_t pipe_server_ioctl( struct fd *fd, ioctl_code_t code, struct async *async,
|
static obj_handle_t pipe_server_ioctl( struct fd *fd, ioctl_code_t code, struct async *async,
|
||||||
int blocking );
|
int blocking );
|
||||||
|
@ -187,7 +187,7 @@ static void pipe_client_dump( struct object *obj, int verbose );
|
||||||
static int pipe_client_signaled( struct object *obj, struct wait_queue_entry *entry );
|
static int pipe_client_signaled( struct object *obj, struct wait_queue_entry *entry );
|
||||||
static struct fd *pipe_client_get_fd( struct object *obj );
|
static struct fd *pipe_client_get_fd( struct object *obj );
|
||||||
static void pipe_client_destroy( struct object *obj );
|
static void pipe_client_destroy( struct object *obj );
|
||||||
static obj_handle_t pipe_client_flush( struct fd *fd, const async_data_t *async, int blocking );
|
static obj_handle_t pipe_client_flush( struct fd *fd, struct async *async, int blocking );
|
||||||
static enum server_fd_type pipe_client_get_fd_type( struct fd *fd );
|
static enum server_fd_type pipe_client_get_fd_type( struct fd *fd );
|
||||||
|
|
||||||
static const struct object_ops pipe_client_ops =
|
static const struct object_ops pipe_client_ops =
|
||||||
|
@ -545,17 +545,16 @@ static void check_flushed( void *arg )
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static obj_handle_t pipe_server_flush( struct fd *fd, const async_data_t *async_data, int blocking )
|
static obj_handle_t pipe_server_flush( struct fd *fd, struct async *async, int blocking )
|
||||||
{
|
{
|
||||||
struct pipe_server *server = get_fd_user( fd );
|
struct pipe_server *server = get_fd_user( fd );
|
||||||
obj_handle_t handle = 0;
|
obj_handle_t handle = 0;
|
||||||
struct async *async;
|
|
||||||
|
|
||||||
if (!server || server->state != ps_connected_server) return 0;
|
if (!server || server->state != ps_connected_server) return 0;
|
||||||
|
|
||||||
if (!pipe_data_remaining( server )) return 0;
|
if (!pipe_data_remaining( server )) return 0;
|
||||||
|
|
||||||
if ((async = fd_queue_async( server->fd, async_data, NULL, ASYNC_TYPE_WAIT )))
|
if ((async = fd_queue_async( server->fd, async_get_data( async ), NULL, ASYNC_TYPE_WAIT )))
|
||||||
{
|
{
|
||||||
/* there's no unix way to be alerted when a pipe becomes empty, so resort to polling */
|
/* there's no unix way to be alerted when a pipe becomes empty, so resort to polling */
|
||||||
if (!server->flush_poll)
|
if (!server->flush_poll)
|
||||||
|
@ -567,7 +566,7 @@ static obj_handle_t pipe_server_flush( struct fd *fd, const async_data_t *async_
|
||||||
return handle;
|
return handle;
|
||||||
}
|
}
|
||||||
|
|
||||||
static obj_handle_t pipe_client_flush( struct fd *fd, const async_data_t *async, int blocking )
|
static obj_handle_t pipe_client_flush( struct fd *fd, struct async *async, int blocking )
|
||||||
{
|
{
|
||||||
/* FIXME: what do we have to do for this? */
|
/* FIXME: what do we have to do for this? */
|
||||||
return 0;
|
return 0;
|
||||||
|
|
Loading…
Reference in a new issue