server: Implement flush requests for device files.

This commit is contained in:
Alexandre Julliard 2015-05-06 17:13:51 +09:00
parent 481517178f
commit 6073e75a6a
2 changed files with 22 additions and 1 deletions

View File

@ -131,6 +131,7 @@ static obj_handle_t device_read( struct fd *fd, const async_data_t *async_data,
file_pos_t pos );
static obj_handle_t device_write( struct fd *fd, const async_data_t *async_data, int blocking,
file_pos_t pos, data_size_t *written );
static obj_handle_t device_flush( struct fd *fd, const async_data_t *async_data, int blocking );
static obj_handle_t device_ioctl( struct fd *fd, ioctl_code_t code, const async_data_t *async_data,
int blocking );
@ -161,7 +162,7 @@ static const struct fd_ops device_fd_ops =
device_get_fd_type, /* get_fd_type */
device_read, /* read */
device_write, /* write */
no_fd_flush, /* flush */
device_flush, /* flush */
device_ioctl, /* ioctl */
default_fd_queue_async, /* queue_async */
default_fd_reselect_async, /* reselect_async */
@ -388,6 +389,23 @@ static obj_handle_t device_write( struct fd *fd, const async_data_t *async_data,
return handle;
}
static obj_handle_t device_flush( struct fd *fd, const async_data_t *async_data, int blocking )
{
struct device *device = get_fd_user( fd );
struct irp_call *irp;
obj_handle_t handle;
irp_params_t params;
params.major = IRP_MJ_FLUSH_BUFFERS;
irp = create_irp( device, &params, NULL, 0, 0 );
if (!irp) return 0;
handle = queue_irp( device, irp, async_data, blocking );
release_object( irp );
return handle;
}
static obj_handle_t device_ioctl( struct fd *fd, ioctl_code_t code, const async_data_t *async_data,
int blocking )
{

View File

@ -326,6 +326,9 @@ static void dump_irp_params( const char *prefix, const irp_params_t *data )
dump_uint64( ",pos=", &data->write.pos );
fputc( '}', stderr );
break;
case IRP_MJ_FLUSH_BUFFERS:
fprintf( stderr, "%s{major=FLUSH_BUFFERS}", prefix );
break;
case IRP_MJ_DEVICE_CONTROL:
fprintf( stderr, "%s{major=DEVICE_CONTROL", prefix );
dump_ioctl_code( ",code=", &data->ioctl.code );