Commit f7f9bf98 authored by Jacek Caban's avatar Jacek Caban Committed by Alexandre Julliard

server: Introduce is_fd_overlapped() helper.

parent 36693cfb
......@@ -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
......
......@@ -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 );
}
}
......
......@@ -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 );
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment