[PATCH v2] server: Use queue_irp() also for synchronous IRPs.
Zebediah Figura
z.figura12 at gmail.com
Sat Aug 5 19:26:37 CDT 2017
Signed-off-by: Zebediah Figura <z.figura12 at gmail.com>
---
server/device.c | 46 ++++++++++++++++++++--------------------------
1 file changed, 20 insertions(+), 26 deletions(-)
diff --git a/server/device.c b/server/device.c
index 192395dcc7..8ad3e39587 100644
--- a/server/device.c
+++ b/server/device.c
@@ -336,6 +336,24 @@ static void add_irp_to_queue( struct device_file *file, struct irp_call *irp, st
if (list_head( &manager->requests ) == &irp->mgr_entry) wake_up( &manager->obj, 0 ); /* first one */
}
+/* queue an irp to the device */
+static int queue_irp( struct device_file *file, const irp_params_t *params, struct async *async )
+{
+ struct irp_call *irp = create_irp( file, params, async );
+ if (!irp) return 0;
+
+ if (async)
+ {
+ fd_queue_async( file->fd, async, ASYNC_TYPE_WAIT );
+ irp->async = (struct async *)grab_object( async );
+ }
+ add_irp_to_queue( file, irp, current );
+ release_object( irp );
+ if (async)
+ set_error( STATUS_PENDING );
+ return 1;
+}
+
static struct object *device_open_file( struct object *obj, unsigned int access,
unsigned int sharing, unsigned int options )
{
@@ -368,7 +386,6 @@ static struct object *device_open_file( struct object *obj, unsigned int access,
if (device->manager)
{
- struct irp_call *irp;
irp_params_t params;
memset( ¶ms, 0, sizeof(params) );
@@ -378,11 +395,7 @@ static struct object *device_open_file( struct object *obj, unsigned int access,
params.create.options = options;
params.create.device = file->device->user_ptr;
- if ((irp = create_irp( file, ¶ms, NULL )))
- {
- add_irp_to_queue( file, irp, NULL );
- release_object( irp );
- }
+ queue_irp( file, ¶ms, NULL );
}
return &file->obj;
}
@@ -407,18 +420,13 @@ static int device_file_close_handle( struct object *obj, struct process *process
if (file->device->manager && obj->handle_count == 1) /* last handle */
{
- struct irp_call *irp;
irp_params_t params;
memset( ¶ms, 0, sizeof(params) );
params.close.major = IRP_MJ_CLOSE;
params.close.file = file->user_ptr;
- if ((irp = create_irp( file, ¶ms, NULL )))
- {
- add_irp_to_queue( file, irp, NULL );
- release_object( irp );
- }
+ queue_irp( file, ¶ms, NULL );
}
return 1;
}
@@ -461,20 +469,6 @@ static void set_file_user_ptr( struct device_file *file, client_ptr_t ptr )
}
}
-/* queue an irp to the device */
-static int queue_irp( struct device_file *file, const irp_params_t *params, struct async *async )
-{
- struct irp_call *irp = create_irp( file, params, async );
- if (!irp) return 0;
-
- fd_queue_async( file->fd, async, ASYNC_TYPE_WAIT );
- irp->async = (struct async *)grab_object( async );
- add_irp_to_queue( file, irp, current );
- release_object( irp );
- set_error( STATUS_PENDING );
- return 1;
-}
-
static enum server_fd_type device_file_get_fd_type( struct fd *fd )
{
return FD_TYPE_DEVICE;
--
2.13.3
More information about the wine-patches
mailing list