Alexandre Julliard : server: Implement flush requests for device files.

Alexandre Julliard julliard at wine.codeweavers.com
Wed May 6 09:29:04 CDT 2015


Module: wine
Branch: master
Commit: 6073e75a6a4b0dbb1a9ff74c01f373d1af80a5e6
URL:    http://source.winehq.org/git/wine.git/?a=commit;h=6073e75a6a4b0dbb1a9ff74c01f373d1af80a5e6

Author: Alexandre Julliard <julliard at winehq.org>
Date:   Wed May  6 17:13:51 2015 +0900

server: Implement flush requests for device files.

---

 server/device.c | 20 +++++++++++++++++++-
 server/trace.c  |  3 +++
 2 files changed, 22 insertions(+), 1 deletion(-)

diff --git a/server/device.c b/server/device.c
index 2707faf..a2fc1cb 100644
--- a/server/device.c
+++ b/server/device.c
@@ -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 )
 {
diff --git a/server/trace.c b/server/trace.c
index e257afb..e4b6af5 100644
--- a/server/trace.c
+++ b/server/trace.c
@@ -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 );




More information about the wine-cvs mailing list