server: Cancel asyncs through fd_ops.

Signed-off-by: Zebediah Figura <zfigura@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
Zebediah Figura 2021-09-03 23:11:38 -05:00 committed by Alexandre Julliard
parent d23f1007d2
commit 4f1c7ba5f9
12 changed files with 34 additions and 1 deletions

View File

@ -502,7 +502,7 @@ restart:
(!thread || async->thread == thread) &&
(!iosb || async->data.iosb == iosb))
{
async_terminate( async, STATUS_CANCELLED );
fd_cancel_async( async->fd, async );
woken++;
goto restart;
}

View File

@ -144,6 +144,7 @@ static const struct fd_ops dir_fd_ops =
default_fd_get_file_info, /* get_file_info */
no_fd_get_volume_info, /* get_volume_info */
default_fd_ioctl, /* ioctl */
default_fd_cancel_async, /* cancel_async */
default_fd_queue_async, /* queue_async */
default_fd_reselect_async /* reselect_async */
};

View File

@ -115,6 +115,7 @@ static const struct fd_ops console_fd_ops =
console_get_file_info, /* get_file_info */
console_get_volume_info, /* get_volume_info */
console_ioctl, /* ioctl */
default_fd_cancel_async, /* cancel_async */
default_fd_queue_async, /* queue_async */
default_fd_reselect_async /* reselect_async */
};
@ -185,6 +186,7 @@ static const struct fd_ops console_server_fd_ops =
no_fd_get_file_info, /* get_file_info */
no_fd_get_volume_info, /* get_volume_info */
console_server_ioctl, /* ioctl */
default_fd_cancel_async, /* cancel_async */
default_fd_queue_async, /* queue_async */
default_fd_reselect_async /* reselect_async */
};
@ -254,6 +256,7 @@ static const struct fd_ops screen_buffer_fd_ops =
console_get_file_info, /* get_file_info */
console_get_volume_info, /* get_volume_info */
screen_buffer_ioctl, /* ioctl */
default_fd_cancel_async, /* cancel_async */
default_fd_queue_async, /* queue_async */
default_fd_reselect_async /* reselect_async */
};
@ -340,6 +343,7 @@ static const struct fd_ops console_input_fd_ops =
console_get_file_info, /* get_file_info */
console_get_volume_info, /* get_volume_info */
console_input_ioctl, /* ioctl */
default_fd_cancel_async, /* cancel_async */
default_fd_queue_async, /* queue_async */
default_fd_reselect_async /* reselect_async */
};
@ -395,6 +399,7 @@ static const struct fd_ops console_output_fd_ops =
console_get_file_info, /* get_file_info */
console_get_volume_info, /* get_volume_info */
console_output_ioctl, /* ioctl */
default_fd_cancel_async, /* cancel_async */
default_fd_queue_async, /* queue_async */
default_fd_reselect_async /* reselect_async */
};
@ -451,6 +456,7 @@ static const struct fd_ops console_connection_fd_ops =
no_fd_get_file_info, /* get_file_info */
no_fd_get_volume_info, /* get_volume_info */
console_connection_ioctl, /* ioctl */
default_fd_cancel_async, /* cancel_async */
default_fd_queue_async, /* queue_async */
default_fd_reselect_async /* reselect_async */
};

View File

@ -243,6 +243,7 @@ static const struct fd_ops device_file_fd_ops =
default_fd_get_file_info, /* get_file_info */
device_file_get_volume_info, /* get_volume_info */
device_file_ioctl, /* ioctl */
default_fd_cancel_async, /* cancel_async */
default_fd_queue_async, /* queue_async */
device_file_reselect_async /* reselect_async */
};

View File

@ -2239,6 +2239,11 @@ void fd_async_wake_up( struct fd *fd, int type, unsigned int status )
}
}
void fd_cancel_async( struct fd *fd, struct async *async )
{
fd->fd_ops->cancel_async( fd, async );
}
void fd_reselect_async( struct fd *fd, struct async_queue *queue )
{
fd->fd_ops->reselect_async( fd, queue );
@ -2249,6 +2254,11 @@ void no_fd_queue_async( struct fd *fd, struct async *async, int type, int count
set_error( STATUS_OBJECT_TYPE_MISMATCH );
}
void default_fd_cancel_async( struct fd *fd, struct async *async )
{
async_terminate( async, STATUS_CANCELLED );
}
void default_fd_queue_async( struct fd *fd, struct async *async, int type, int count )
{
fd_queue_async( fd, async, type );

View File

@ -124,6 +124,7 @@ static const struct fd_ops file_fd_ops =
default_fd_get_file_info, /* get_file_info */
no_fd_get_volume_info, /* get_volume_info */
default_fd_ioctl, /* ioctl */
default_fd_cancel_async, /* cancel_async */
default_fd_queue_async, /* queue_async */
default_fd_reselect_async /* reselect_async */
};

View File

@ -68,6 +68,8 @@ struct fd_ops
void (*get_volume_info)( struct fd *, struct async *, unsigned int );
/* perform an ioctl on the file */
void (*ioctl)(struct fd *fd, ioctl_code_t code, struct async *async );
/* cancel an async operation */
void (*cancel_async)(struct fd *fd, struct async *async);
/* queue an async operation */
void (*queue_async)(struct fd *, struct async *async, int type, int count);
/* selected events for async i/o need an update */
@ -106,6 +108,7 @@ extern void get_nt_name( struct fd *fd, struct unicode_str *name );
extern int default_fd_signaled( struct object *obj, struct wait_queue_entry *entry );
extern int default_fd_get_poll_events( struct fd *fd );
extern void default_poll_event( struct fd *fd, int event );
extern void fd_cancel_async( struct fd *fd, struct async *async );
extern void fd_queue_async( struct fd *fd, struct async *async, 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 );
@ -117,6 +120,7 @@ extern void default_fd_get_file_info( struct fd *fd, obj_handle_t handle, unsign
extern void no_fd_get_volume_info( struct fd *fd, struct async *async, unsigned int info_class );
extern void no_fd_ioctl( struct fd *fd, ioctl_code_t code, struct async *async );
extern void default_fd_ioctl( struct fd *fd, ioctl_code_t code, struct async *async );
extern void default_fd_cancel_async( struct fd *fd, struct async *async );
extern void no_fd_queue_async( struct fd *fd, struct async *async, int type, int count );
extern void default_fd_queue_async( struct fd *fd, struct async *async, int type, int count );
extern void default_fd_reselect_async( struct fd *fd, struct async_queue *queue );

View File

@ -108,6 +108,7 @@ static const struct fd_ops mailslot_fd_ops =
default_fd_get_file_info, /* get_file_info */
no_fd_get_volume_info, /* get_volume_info */
default_fd_ioctl, /* ioctl */
default_fd_cancel_async, /* cancel_async */
mailslot_queue_async, /* queue_async */
default_fd_reselect_async /* reselect_async */
};
@ -165,6 +166,7 @@ static const struct fd_ops mail_writer_fd_ops =
default_fd_get_file_info, /* get_file_info */
no_fd_get_volume_info, /* get_volume_info */
default_fd_ioctl, /* ioctl */
default_fd_cancel_async, /* cancel_async */
default_fd_queue_async, /* queue_async */
default_fd_reselect_async /* reselect_async */
};
@ -255,6 +257,7 @@ static const struct fd_ops mailslot_device_fd_ops =
default_fd_get_file_info, /* get_file_info */
no_fd_get_volume_info, /* get_volume_info */
default_fd_ioctl, /* ioctl */
default_fd_cancel_async, /* cancel_async */
default_fd_queue_async, /* queue_async */
default_fd_reselect_async /* reselect_async */
};

View File

@ -204,6 +204,7 @@ static const struct fd_ops mapping_fd_ops =
no_fd_get_file_info, /* get_file_info */
no_fd_get_volume_info, /* get_volume_info */
no_fd_ioctl, /* ioctl */
default_fd_cancel_async, /* cancel_async */
no_fd_queue_async, /* queue_async */
default_fd_reselect_async /* reselect_async */
};

View File

@ -194,6 +194,7 @@ static const struct fd_ops pipe_server_fd_ops =
pipe_end_get_file_info, /* get_file_info */
pipe_end_get_volume_info, /* get_volume_info */
pipe_server_ioctl, /* ioctl */
default_fd_cancel_async, /* cancel_async */
no_fd_queue_async, /* queue_async */
pipe_end_reselect_async /* reselect_async */
};
@ -237,6 +238,7 @@ static const struct fd_ops pipe_client_fd_ops =
pipe_end_get_file_info, /* get_file_info */
pipe_end_get_volume_info, /* get_volume_info */
pipe_client_ioctl, /* ioctl */
default_fd_cancel_async, /* cancel_async */
no_fd_queue_async, /* queue_async */
pipe_end_reselect_async /* reselect_async */
};
@ -314,6 +316,7 @@ static const struct fd_ops named_pipe_device_fd_ops =
default_fd_get_file_info, /* get_file_info */
no_fd_get_volume_info, /* get_volume_info */
named_pipe_device_ioctl, /* ioctl */
default_fd_cancel_async, /* cancel_async */
default_fd_queue_async, /* queue_async */
default_fd_reselect_async /* reselect_async */
};

View File

@ -119,6 +119,7 @@ static const struct fd_ops serial_fd_ops =
default_fd_get_file_info, /* get_file_info */
no_fd_get_volume_info, /* get_volume_info */
serial_ioctl, /* ioctl */
default_fd_cancel_async, /* cancel_async */
serial_queue_async, /* queue_async */
serial_reselect_async /* reselect_async */
};

View File

@ -274,6 +274,7 @@ static const struct fd_ops sock_fd_ops =
default_fd_get_file_info, /* get_file_info */
no_fd_get_volume_info, /* get_volume_info */
sock_ioctl, /* ioctl */
default_fd_cancel_async, /* cancel_async */
sock_queue_async, /* queue_async */
sock_reselect_async /* reselect_async */
};
@ -2973,6 +2974,7 @@ static const struct fd_ops ifchange_fd_ops =
no_fd_get_file_info, /* get_file_info */
no_fd_get_volume_info, /* get_volume_info */
no_fd_ioctl, /* ioctl */
NULL, /* cancel_async */
NULL, /* queue_async */
NULL /* reselect_async */
};