server: Implement flush requests for device files.
This commit is contained in:
parent
481517178f
commit
6073e75a6a
|
@ -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, ¶ms, 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 )
|
||||
{
|
||||
|
|
|
@ -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 );
|
||||
|
|
Loading…
Reference in New Issue