server: Allow volume information queries to be asynchronous.

Signed-off-by: Erich E. Hoover <erich.e.hoover@gmail.com>
Signed-off-by: Zebediah Figura <z.figura12@gmail.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
Erich E. Hoover 2020-05-23 21:39:41 -06:00 committed by Alexandre Julliard
parent 09c67c4809
commit 61d7629ba4
8 changed files with 32 additions and 16 deletions

View file

@ -1688,13 +1688,16 @@ struct get_volume_info_request
{ {
struct request_header __header; struct request_header __header;
obj_handle_t handle; obj_handle_t handle;
async_data_t async;
unsigned int info_class; unsigned int info_class;
char __pad_20[4]; char __pad_60[4];
}; };
struct get_volume_info_reply struct get_volume_info_reply
{ {
struct reply_header __header; struct reply_header __header;
obj_handle_t wait;
/* VARARG(data,bytes); */ /* VARARG(data,bytes); */
char __pad_12[4];
}; };
@ -6266,7 +6269,7 @@ union generic_reply
/* ### protocol_version begin ### */ /* ### protocol_version begin ### */
#define SERVER_PROTOCOL_VERSION 675 #define SERVER_PROTOCOL_VERSION 676
/* ### protocol_version end ### */ /* ### protocol_version end ### */

View file

@ -99,7 +99,7 @@ static const struct object_ops console_ops =
static enum server_fd_type console_get_fd_type( struct fd *fd ); static enum server_fd_type console_get_fd_type( struct fd *fd );
static void console_get_file_info( struct fd *fd, obj_handle_t handle, unsigned int info_class ); static void console_get_file_info( struct fd *fd, obj_handle_t handle, unsigned int info_class );
static void console_get_volume_info( struct fd *fd, unsigned int info_class ); static int console_get_volume_info( struct fd *fd, struct async *async, unsigned int info_class );
static int console_read( struct fd *fd, struct async *async, file_pos_t pos ); static int console_read( struct fd *fd, struct async *async, file_pos_t pos );
static int console_flush( struct fd *fd, struct async *async ); static int console_flush( struct fd *fd, struct async *async );
static int console_ioctl( struct fd *fd, ioctl_code_t code, struct async *async ); static int console_ioctl( struct fd *fd, ioctl_code_t code, struct async *async );
@ -480,7 +480,7 @@ static void console_get_file_info( struct fd *fd, obj_handle_t handle, unsigned
set_error( STATUS_INVALID_DEVICE_REQUEST ); set_error( STATUS_INVALID_DEVICE_REQUEST );
} }
static void console_get_volume_info( struct fd *fd, unsigned int info_class ) static int console_get_volume_info( struct fd *fd, struct async *async, unsigned int info_class )
{ {
switch (info_class) switch (info_class)
{ {
@ -500,6 +500,7 @@ static void console_get_volume_info( struct fd *fd, unsigned int info_class )
default: default:
set_error( STATUS_NOT_IMPLEMENTED ); set_error( STATUS_NOT_IMPLEMENTED );
} }
return 0;
} }
static struct object *create_console(void) static struct object *create_console(void)

View file

@ -2369,9 +2369,10 @@ void default_fd_get_file_info( struct fd *fd, obj_handle_t handle, unsigned int
} }
/* default get_volume_info() routine */ /* default get_volume_info() routine */
void no_fd_get_volume_info( struct fd *fd, unsigned int info_class ) int no_fd_get_volume_info( struct fd *fd, struct async *async, unsigned int info_class )
{ {
set_error( STATUS_OBJECT_TYPE_MISMATCH ); set_error( STATUS_OBJECT_TYPE_MISMATCH );
return 0;
} }
/* default ioctl() routine */ /* default ioctl() routine */
@ -2666,12 +2667,16 @@ DECL_HANDLER(get_file_info)
DECL_HANDLER(get_volume_info) DECL_HANDLER(get_volume_info)
{ {
struct fd *fd = get_handle_fd_obj( current->process, req->handle, 0 ); struct fd *fd = get_handle_fd_obj( current->process, req->handle, 0 );
struct async *async;
if (fd) if (!fd) return;
if ((async = create_request_async( fd, fd->comp_flags, &req->async )))
{ {
fd->fd_ops->get_volume_info( fd, req->info_class ); reply->wait = async_handoff( async, fd->fd_ops->get_volume_info( fd, async, req->info_class ), NULL, 1 );
release_object( fd ); release_object( async );
} }
release_object( fd );
} }
/* open a file object */ /* open a file object */

View file

@ -65,7 +65,7 @@ struct fd_ops
/* query file info */ /* query file info */
void (*get_file_info)( struct fd *, obj_handle_t, unsigned int ); void (*get_file_info)( struct fd *, obj_handle_t, unsigned int );
/* query volume info */ /* query volume info */
void (*get_volume_info)( struct fd *, unsigned int ); int (*get_volume_info)( struct fd *, struct async *, unsigned int );
/* perform an ioctl on the file */ /* perform an ioctl on the file */
int (*ioctl)(struct fd *fd, ioctl_code_t code, struct async *async ); int (*ioctl)(struct fd *fd, ioctl_code_t code, struct async *async );
/* queue an async operation */ /* queue an async operation */
@ -114,7 +114,7 @@ extern int no_fd_write( struct fd *fd, struct async *async, file_pos_t pos );
extern int no_fd_flush( struct fd *fd, struct async *async ); extern int no_fd_flush( struct fd *fd, struct async *async );
extern void no_fd_get_file_info( struct fd *fd, obj_handle_t handle, unsigned int info_class ); extern void no_fd_get_file_info( struct fd *fd, obj_handle_t handle, unsigned int info_class );
extern void default_fd_get_file_info( struct fd *fd, obj_handle_t handle, unsigned int info_class ); extern void default_fd_get_file_info( struct fd *fd, obj_handle_t handle, unsigned int info_class );
extern void no_fd_get_volume_info( struct fd *fd, unsigned int info_class ); extern int no_fd_get_volume_info( struct fd *fd, struct async *async, unsigned int info_class );
extern int no_fd_ioctl( struct fd *fd, ioctl_code_t code, struct async *async ); extern int no_fd_ioctl( struct fd *fd, ioctl_code_t code, struct async *async );
extern int default_fd_ioctl( struct fd *fd, ioctl_code_t code, struct async *async ); extern int default_fd_ioctl( struct fd *fd, ioctl_code_t code, struct async *async );
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 );

View file

@ -146,7 +146,7 @@ static WCHAR *pipe_end_get_full_name( struct object *obj, data_size_t *len );
static int pipe_end_read( struct fd *fd, struct async *async, file_pos_t pos ); static int pipe_end_read( struct fd *fd, struct async *async, file_pos_t pos );
static int pipe_end_write( struct fd *fd, struct async *async_data, file_pos_t pos ); static int pipe_end_write( struct fd *fd, struct async *async_data, file_pos_t pos );
static int pipe_end_flush( struct fd *fd, struct async *async ); static int pipe_end_flush( struct fd *fd, struct async *async );
static void pipe_end_get_volume_info( struct fd *fd, unsigned int info_class ); static int pipe_end_get_volume_info( struct fd *fd, struct async *async, unsigned int info_class );
static void pipe_end_reselect_async( struct fd *fd, struct async_queue *queue ); static void pipe_end_reselect_async( struct fd *fd, struct async_queue *queue );
static void pipe_end_get_file_info( struct fd *fd, obj_handle_t handle, unsigned int info_class ); static void pipe_end_get_file_info( struct fd *fd, obj_handle_t handle, unsigned int info_class );
@ -742,7 +742,7 @@ static WCHAR *pipe_end_get_full_name( struct object *obj, data_size_t *len )
return pipe_end->pipe->obj.ops->get_full_name( &pipe_end->pipe->obj, len ); return pipe_end->pipe->obj.ops->get_full_name( &pipe_end->pipe->obj, len );
} }
static void pipe_end_get_volume_info( struct fd *fd, unsigned int info_class ) static int pipe_end_get_volume_info( struct fd *fd, struct async *async, unsigned int info_class )
{ {
switch (info_class) switch (info_class)
{ {
@ -762,6 +762,7 @@ static void pipe_end_get_volume_info( struct fd *fd, unsigned int info_class )
default: default:
set_error( STATUS_NOT_IMPLEMENTED ); set_error( STATUS_NOT_IMPLEMENTED );
} }
return 0;
} }
static void message_queue_read( struct pipe_end *pipe_end, struct iosb *iosb ) static void message_queue_read( struct pipe_end *pipe_end, struct iosb *iosb )

View file

@ -1392,8 +1392,10 @@ enum server_fd_type
/* Query volume information */ /* Query volume information */
@REQ(get_volume_info) @REQ(get_volume_info)
obj_handle_t handle; /* handle to the file */ obj_handle_t handle; /* handle to the file */
async_data_t async; /* async I/O parameters */
unsigned int info_class; /* queried information class */ unsigned int info_class; /* queried information class */
@REPLY @REPLY
obj_handle_t wait; /* handle to wait on for blocking read */
VARARG(data,bytes); /* volume info data */ VARARG(data,bytes); /* volume info data */
@END @END

View file

@ -1032,9 +1032,11 @@ C_ASSERT( FIELD_OFFSET(struct get_file_info_request, info_class) == 16 );
C_ASSERT( sizeof(struct get_file_info_request) == 24 ); C_ASSERT( sizeof(struct get_file_info_request) == 24 );
C_ASSERT( sizeof(struct get_file_info_reply) == 8 ); C_ASSERT( sizeof(struct get_file_info_reply) == 8 );
C_ASSERT( FIELD_OFFSET(struct get_volume_info_request, handle) == 12 ); C_ASSERT( FIELD_OFFSET(struct get_volume_info_request, handle) == 12 );
C_ASSERT( FIELD_OFFSET(struct get_volume_info_request, info_class) == 16 ); C_ASSERT( FIELD_OFFSET(struct get_volume_info_request, async) == 16 );
C_ASSERT( sizeof(struct get_volume_info_request) == 24 ); C_ASSERT( FIELD_OFFSET(struct get_volume_info_request, info_class) == 56 );
C_ASSERT( sizeof(struct get_volume_info_reply) == 8 ); C_ASSERT( sizeof(struct get_volume_info_request) == 64 );
C_ASSERT( FIELD_OFFSET(struct get_volume_info_reply, wait) == 8 );
C_ASSERT( sizeof(struct get_volume_info_reply) == 16 );
C_ASSERT( FIELD_OFFSET(struct lock_file_request, handle) == 12 ); C_ASSERT( FIELD_OFFSET(struct lock_file_request, handle) == 12 );
C_ASSERT( FIELD_OFFSET(struct lock_file_request, offset) == 16 ); C_ASSERT( FIELD_OFFSET(struct lock_file_request, offset) == 16 );
C_ASSERT( FIELD_OFFSET(struct lock_file_request, count) == 24 ); C_ASSERT( FIELD_OFFSET(struct lock_file_request, count) == 24 );

View file

@ -1993,12 +1993,14 @@ static void dump_get_file_info_reply( const struct get_file_info_reply *req )
static void dump_get_volume_info_request( const struct get_volume_info_request *req ) static void dump_get_volume_info_request( const struct get_volume_info_request *req )
{ {
fprintf( stderr, " handle=%04x", req->handle ); fprintf( stderr, " handle=%04x", req->handle );
dump_async_data( ", async=", &req->async );
fprintf( stderr, ", info_class=%08x", req->info_class ); fprintf( stderr, ", info_class=%08x", req->info_class );
} }
static void dump_get_volume_info_reply( const struct get_volume_info_reply *req ) static void dump_get_volume_info_reply( const struct get_volume_info_reply *req )
{ {
dump_varargs_bytes( " data=", cur_size ); fprintf( stderr, " wait=%04x", req->wait );
dump_varargs_bytes( ", data=", cur_size );
} }
static void dump_lock_file_request( const struct lock_file_request *req ) static void dump_lock_file_request( const struct lock_file_request *req )