Jacek Caban : server: Introduce is_fd_overlapped() helper.
Alexandre Julliard
julliard at winehq.org
Wed Oct 31 15:58:33 CDT 2018
Module: wine
Branch: master
Commit: f7f9bf982335053bc7f6f1aaa5b556ea52c5a77d
URL: https://source.winehq.org/git/wine.git/?a=commit;h=f7f9bf982335053bc7f6f1aaa5b556ea52c5a77d
Author: Jacek Caban <jacek at codeweavers.com>
Date: Wed Oct 31 16:44:56 2018 +0100
server: Introduce is_fd_overlapped() helper.
Signed-off-by: Jacek Caban <jacek at codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard at winehq.org>
---
server/fd.c | 10 ++++++++--
server/file.c | 7 +------
server/file.h | 1 +
3 files changed, 10 insertions(+), 8 deletions(-)
diff --git a/server/fd.c b/server/fd.c
index 1459ad1..eba3256 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 37f7afe..8d39f30 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 84cbc29..a9581a7 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 );
More information about the wine-cvs
mailing list