[prev in list] [next in list] [prev in thread] [next in thread] 

List:       wine-devel
Subject:    [PATCH 2/3] server: Introduce is_fd_synchronous helper.
From:       Jacek Caban <jacek () codeweavers ! com>
Date:       2018-10-31 15:44:56
Message-ID: bc4257b2-9089-aacb-79bc-7bcfd06f2b02 () codeweavers ! com
[Download RAW message or body]

Signed-off-by: Jacek Caban <jacek@codeweavers.com>
---
 server/fd.c   | 10 ++++++++--
 server/file.c |  7 +------
 server/file.h |  1 +
 3 files changed, 10 insertions(+), 8 deletions(-)



["0002-server-Introduce-is_fd_synchronous-helper.diff" (text/x-patch)]

diff --git a/server/fd.c b/server/fd.c
index 1459ad1277..eba3256e76 100644
--- a/server/fd.c
+++ b/server/fd.c
@@ -1930,6 +1930,12 @@ unsigned int get_fd_options( struct fd *fd )
     return fd->options;
 }
 
+/* check if fd is in overlapped mode */
+int is_fd_overlapped( struct fd *fd )
+{
+    return !(fd->options & (FILE_SYNCHRONOUS_IO_ALERT | \
FILE_SYNCHRONOUS_IO_NONALERT)); +}
+
 /* retrieve the unix fd for an object */
 int get_unix_fd( struct fd *fd )
 {
@@ -2611,7 +2617,7 @@ DECL_HANDLER(set_completion_info)
 
     if (fd)
     {
-        if (!(fd->options & (FILE_SYNCHRONOUS_IO_ALERT | \
FILE_SYNCHRONOUS_IO_NONALERT)) && !fd->completion) +        if (is_fd_overlapped( fd \
) && !fd->completion)  {
             fd->completion = get_completion_obj( current->process, req->chandle, \
IO_COMPLETION_MODIFY_STATE );  fd->comp_key = req->ckey;
@@ -2639,7 +2645,7 @@ DECL_HANDLER(set_fd_completion_mode)
     struct fd *fd = get_handle_fd_obj( current->process, req->handle, 0 );
     if (fd)
     {
-        if (!(fd->options & (FILE_SYNCHRONOUS_IO_ALERT | \
FILE_SYNCHRONOUS_IO_NONALERT))) +        if (is_fd_overlapped( fd ))
         {
             /* removing COMPLETION_SKIP_ON_SUCCESS is not allowed */
             fd->comp_flags |= req->flags & ( FILE_SKIP_COMPLETION_PORT_ON_SUCCESS
diff --git a/server/file.c b/server/file.c
index 37f7afe655..8d39f303bd 100644
--- a/server/file.c
+++ b/server/file.c
@@ -114,11 +114,6 @@ static const struct fd_ops file_fd_ops =
     default_fd_reselect_async     /* reselect_async */
 };
 
-static inline int is_overlapped( const struct file *file )
-{
-    return !(get_fd_options( file->fd ) & (FILE_SYNCHRONOUS_IO_ALERT | \
                FILE_SYNCHRONOUS_IO_NONALERT));
-}
-
 /* create a file from a file descriptor */
 /* if the function fails the fd is closed */
 struct file *create_file_for_fd( int fd, unsigned int access, unsigned int sharing )
@@ -761,7 +756,7 @@ DECL_HANDLER(lock_file)
     if ((file = get_file_obj( current->process, req->handle, 0 )))
     {
         reply->handle = lock_fd( file->fd, req->offset, req->count, req->shared, \
                req->wait );
-        reply->overlapped = is_overlapped( file );
+        reply->overlapped = is_fd_overlapped( file->fd );
         release_object( file );
     }
 }
diff --git a/server/file.h b/server/file.h
index 84cbc29037..a9581a7f6e 100644
--- a/server/file.h
+++ b/server/file.h
@@ -88,6 +88,7 @@ extern struct fd *get_fd_object_for_mapping( struct fd *fd, \
unsigned int access,  extern void *get_fd_user( struct fd *fd );
 extern void set_fd_user( struct fd *fd, const struct fd_ops *ops, struct object \
*user );  extern unsigned int get_fd_options( struct fd *fd );
+extern int is_fd_overlapped( struct fd *fd );
 extern int get_unix_fd( struct fd *fd );
 extern int is_same_file_fd( struct fd *fd1, struct fd *fd2 );
 extern int is_fd_removable( struct fd *fd );


[Attachment #4 (text/plain)]




[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic