Commit 64dc8f5c authored by Jacek Caban's avatar Jacek Caban Committed by Alexandre Julliard

server: Store iosb in async object.

parent d2b3c6c3
......@@ -47,6 +47,7 @@ struct async
int signaled;
struct event *event;
async_data_t data; /* data for async I/O call */
struct iosb *iosb; /* I/O status block */
};
static void async_dump( struct object *obj, int verbose );
......@@ -141,6 +142,7 @@ static void async_destroy( struct object *obj )
if (async->timeout) remove_timeout_user( async->timeout );
if (async->event) release_object( async->event );
if (async->iosb) release_object( async->iosb );
release_object( async->queue );
release_object( async->thread );
}
......@@ -172,6 +174,7 @@ void async_terminate( struct async *async, unsigned int status )
}
async->status = status;
if (async->iosb && async->iosb->status == STATUS_PENDING) async->iosb->status = status;
if (async->data.callback)
{
......@@ -225,7 +228,8 @@ void free_async_queue( struct async_queue *queue )
}
/* create an async on a given queue of a fd */
struct async *create_async( struct thread *thread, struct async_queue *queue, const async_data_t *data )
struct async *create_async( struct thread *thread, struct async_queue *queue, const async_data_t *data,
struct iosb *iosb )
{
struct event *event = NULL;
struct async *async;
......@@ -247,6 +251,9 @@ struct async *create_async( struct thread *thread, struct async_queue *queue, co
async->queue = (struct async_queue *)grab_object( queue );
async->signaled = 0;
if (iosb) async->iosb = (struct iosb *)grab_object( iosb );
else async->iosb = NULL;
list_add_tail( &queue->queue, &async->queue_entry );
list_add_tail( &thread->process->asyncs, &async->process_entry );
grab_object( async );
......
......@@ -1246,7 +1246,7 @@ DECL_HANDLER(read_directory_changes)
return;
/* requests don't timeout */
if (!(async = fd_queue_async( dir->fd, &req->async, ASYNC_TYPE_WAIT ))) goto end;
if (!(async = fd_queue_async( dir->fd, &req->async, NULL, ASYNC_TYPE_WAIT ))) goto end;
/* assign it once */
if (!dir->filter)
......
......@@ -488,7 +488,7 @@ static obj_handle_t queue_irp( struct device_file *file, struct irp_call *irp,
if (blocking && !(handle = alloc_handle( current->process, irp, SYNCHRONIZE, 0 ))) return 0;
if (!(irp->async = fd_queue_async( file->fd, async_data, ASYNC_TYPE_WAIT )))
if (!(irp->async = fd_queue_async( file->fd, async_data, irp->iosb, ASYNC_TYPE_WAIT )))
{
if (handle) close_handle( current->process, handle );
return 0;
......
......@@ -2030,7 +2030,7 @@ void default_poll_event( struct fd *fd, int event )
else if (!fd->inode) set_fd_events( fd, fd->fd_ops->get_poll_events( fd ) );
}
struct async *fd_queue_async( struct fd *fd, const async_data_t *data, int type )
struct async *fd_queue_async( struct fd *fd, const async_data_t *data, struct iosb *iosb, int type )
{
struct async_queue *queue;
struct async *async;
......@@ -2054,7 +2054,7 @@ struct async *fd_queue_async( struct fd *fd, const async_data_t *data, int type
assert(0);
}
if ((async = create_async( current, queue, data )) && type != ASYNC_TYPE_WAIT)
if ((async = create_async( current, queue, data, iosb )) && type != ASYNC_TYPE_WAIT)
{
if (!fd->inode)
set_fd_events( fd, fd->fd_ops->get_poll_events( fd ) );
......@@ -2096,7 +2096,7 @@ void default_fd_queue_async( struct fd *fd, const async_data_t *data, int type,
{
struct async *async;
if ((async = fd_queue_async( fd, data, type )))
if ((async = fd_queue_async( fd, data, NULL, type )))
{
release_object( async );
set_error( STATUS_PENDING );
......
......@@ -97,7 +97,7 @@ extern int default_fd_signaled( struct object *obj, struct wait_queue_entry *ent
extern unsigned int default_fd_map_access( struct object *obj, unsigned int access );
extern int default_fd_get_poll_events( struct fd *fd );
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, struct iosb *iosb, 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 );
......@@ -177,7 +177,7 @@ extern struct object *create_serial( struct fd *fd );
extern struct async_queue *create_async_queue( struct fd *fd );
extern void free_async_queue( struct async_queue *queue );
extern struct async *create_async( struct thread *thread, struct async_queue *queue,
const async_data_t *data );
const async_data_t *data, struct iosb *iosb );
extern void async_set_timeout( struct async *async, timeout_t timeout, unsigned int status );
extern void async_set_result( struct object *obj, unsigned int status,
apc_param_t total, client_ptr_t apc, client_ptr_t apc_arg );
......
......@@ -332,7 +332,7 @@ static void mailslot_queue_async( struct fd *fd, const async_data_t *data, int t
assert(mailslot->obj.ops == &mailslot_ops);
if ((async = fd_queue_async( fd, data, type )))
if ((async = fd_queue_async( fd, data, NULL, type )))
{
async_set_timeout( async, mailslot->read_timeout ? mailslot->read_timeout : -1,
STATUS_IO_TIMEOUT );
......
......@@ -555,7 +555,7 @@ static obj_handle_t pipe_server_flush( struct fd *fd, const async_data_t *async_
if (!pipe_data_remaining( server )) return 0;
if ((async = fd_queue_async( server->fd, async_data, ASYNC_TYPE_WAIT )))
if ((async = fd_queue_async( server->fd, async_data, NULL, ASYNC_TYPE_WAIT )))
{
/* there's no unix way to be alerted when a pipe becomes empty, so resort to polling */
if (!server->flush_poll)
......@@ -602,7 +602,7 @@ static obj_handle_t pipe_server_ioctl( struct fd *fd, ioctl_code_t code, const a
{
case ps_idle_server:
case ps_wait_connect:
if ((async = fd_queue_async( server->ioctl_fd, async_data, ASYNC_TYPE_WAIT )))
if ((async = fd_queue_async( server->ioctl_fd, async_data, NULL, ASYNC_TYPE_WAIT )))
{
if (blocking) wait_handle = alloc_handle( current->process, async, SYNCHRONIZE, 0 );
set_server_state( server, ps_wait_open );
......@@ -855,7 +855,7 @@ static obj_handle_t named_pipe_device_ioctl( struct fd *fd, ioctl_code_t code,
if (!pipe->waiters && !(pipe->waiters = create_async_queue( NULL ))) goto done;
if ((async = create_async( current, pipe->waiters, async_data )))
if ((async = create_async( current, pipe->waiters, async_data, NULL )))
{
timeout_t when = buffer->TimeoutSpecified ? buffer->Timeout.QuadPart : pipe->timeout;
async_set_timeout( async, when, STATUS_IO_TIMEOUT );
......
......@@ -201,7 +201,7 @@ static void serial_queue_async( struct fd *fd, const async_data_t *data, int typ
break;
}
if ((async = fd_queue_async( fd, data, type )))
if ((async = fd_queue_async( fd, data, NULL, type )))
{
if (timeout) async_set_timeout( async, timeout * -10000, STATUS_TIMEOUT );
release_object( async );
......
......@@ -552,7 +552,7 @@ obj_handle_t sock_ioctl( struct fd *fd, ioctl_code_t code, const async_data_t *a
return 0;
}
if (!(ifchange_q = sock_get_ifchange_q( sock ))) return 0;
if (!(async = create_async( current, ifchange_q, async_data ))) return 0;
if (!(async = create_async( current, ifchange_q, async_data, NULL ))) return 0;
if (blocking) wait_handle = alloc_handle( current->process, async, SYNCHRONIZE, 0 );
release_object( async );
set_error( STATUS_PENDING );
......@@ -593,7 +593,7 @@ static void sock_queue_async( struct fd *fd, const async_data_t *data, int type,
return;
}
if (!(async = create_async( current, queue, data ))) return;
if (!(async = create_async( current, queue, data, NULL ))) return;
release_object( async );
sock_reselect( sock );
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment