server: Rename the get_file_info function to get_fd_type and get rid of the flags.

This commit is contained in:
Alexandre Julliard 2007-04-10 22:26:23 +02:00
parent f85437c57f
commit 7a9363a4d4
13 changed files with 42 additions and 65 deletions

View File

@ -179,14 +179,14 @@ static const struct object_ops dir_ops =
};
static int dir_get_poll_events( struct fd *fd );
static enum server_fd_type dir_get_info( struct fd *fd, int *flags );
static enum server_fd_type dir_get_fd_type( struct fd *fd );
static const struct fd_ops dir_fd_ops =
{
dir_get_poll_events, /* get_poll_events */
default_poll_event, /* poll_event */
no_flush, /* flush */
dir_get_info, /* get_file_info */
dir_get_fd_type, /* get_fd_type */
default_fd_queue_async, /* queue_async */
default_fd_reselect_async, /* reselect_async */
default_fd_cancel_async /* cancel_async */
@ -342,9 +342,8 @@ static int dir_get_poll_events( struct fd *fd )
return 0;
}
static enum server_fd_type dir_get_info( struct fd *fd, int *flags )
static enum server_fd_type dir_get_fd_type( struct fd *fd )
{
*flags = 0;
return FD_TYPE_DIR;
}
@ -520,7 +519,7 @@ static const struct fd_ops inotify_fd_ops =
inotify_get_poll_events, /* get_poll_events */
inotify_poll_event, /* poll_event */
no_flush, /* flush */
no_get_file_info, /* get_file_info */
no_get_fd_type, /* get_fd_type */
default_fd_queue_async, /* queue_async */
default_fd_reselect_async, /* reselect_async */
default_fd_cancel_async, /* cancel_async */

View File

@ -1779,10 +1779,9 @@ void no_flush( struct fd *fd, struct event **event )
set_error( STATUS_OBJECT_TYPE_MISMATCH );
}
/* default get_file_info() routine */
enum server_fd_type no_get_file_info( struct fd *fd, int *flags )
/* default get_fd_type() routine */
enum server_fd_type no_get_fd_type( struct fd *fd )
{
*flags = 0;
return FD_TYPE_INVALID;
}
@ -1908,7 +1907,8 @@ DECL_HANDLER(get_handle_fd)
if ((fd = get_handle_fd_obj( current->process, req->handle, req->access )))
{
reply->type = fd->fd_ops->get_file_info( fd, &reply->flags );
reply->flags = 0;
reply->type = fd->fd_ops->get_fd_type( fd );
if (reply->type != FD_TYPE_INVALID)
{
if (!(fd->options & (FILE_SYNCHRONOUS_IO_ALERT | FILE_SYNCHRONOUS_IO_NONALERT)))

View File

@ -69,7 +69,7 @@ static void file_destroy( struct object *obj );
static int file_get_poll_events( struct fd *fd );
static void file_flush( struct fd *fd, struct event **event );
static enum server_fd_type file_get_info( struct fd *fd, int *flags );
static enum server_fd_type file_get_fd_type( struct fd *fd );
static const struct object_ops file_ops =
{
@ -93,7 +93,7 @@ static const struct fd_ops file_fd_ops =
file_get_poll_events, /* get_poll_events */
default_poll_event, /* poll_event */
file_flush, /* flush */
file_get_info, /* get_file_info */
file_get_fd_type, /* get_fd_type */
default_fd_queue_async, /* queue_async */
default_fd_reselect_async, /* reselect_async */
default_fd_cancel_async /* cancel_async */
@ -232,9 +232,8 @@ static void file_flush( struct fd *fd, struct event **event )
if (unix_fd != -1 && fsync( unix_fd ) == -1) file_set_error();
}
static enum server_fd_type file_get_info( struct fd *fd, int *flags )
static enum server_fd_type file_get_fd_type( struct fd *fd )
{
*flags = 0;
return FD_TYPE_FILE;
}

View File

@ -38,7 +38,7 @@ struct fd_ops
/* flush the object buffers */
void (*flush)(struct fd *, struct event **);
/* get file information */
enum server_fd_type (*get_file_info)(struct fd *fd, int *flags);
enum server_fd_type (*get_fd_type)(struct fd *fd);
/* queue an async operation */
void (*queue_async)(struct fd *, const async_data_t *data, int type, int count);
/* selected events for async i/o need an update */
@ -78,7 +78,7 @@ extern void default_fd_queue_async( struct fd *fd, const async_data_t *data, int
extern void default_fd_reselect_async( struct fd *fd, struct async_queue *queue );
extern void default_fd_cancel_async( struct fd *fd );
extern void no_flush( struct fd *fd, struct event **event );
extern enum server_fd_type no_get_file_info( struct fd *fd, int *flags );
extern enum server_fd_type no_get_fd_type( struct fd *fd );
extern void no_queue_async( struct fd *fd, const async_data_t *data, int type, int count);
extern void no_cancel_async( struct fd *fd );
extern void main_loop(void);

View File

@ -87,7 +87,7 @@ static const struct object_ops mailslot_ops =
mailslot_destroy /* destroy */
};
static enum server_fd_type mailslot_get_info( struct fd *fd, int *flags );
static enum server_fd_type mailslot_get_fd_type( struct fd *fd );
static void mailslot_queue_async( struct fd *fd, const async_data_t *data, int type, int count );
static const struct fd_ops mailslot_fd_ops =
@ -95,7 +95,7 @@ static const struct fd_ops mailslot_fd_ops =
default_fd_get_poll_events, /* get_poll_events */
default_poll_event, /* poll_event */
no_flush, /* flush */
mailslot_get_info, /* get_file_info */
mailslot_get_fd_type, /* get_fd_type */
mailslot_queue_async, /* queue_async */
default_fd_reselect_async, /* reselect_async */
default_fd_cancel_async /* cancel_async */
@ -133,14 +133,14 @@ static const struct object_ops mail_writer_ops =
mail_writer_destroy /* destroy */
};
static enum server_fd_type mail_writer_get_info( struct fd *fd, int *flags );
static enum server_fd_type mail_writer_get_fd_type( struct fd *fd );
static const struct fd_ops mail_writer_fd_ops =
{
NULL, /* get_poll_events */
NULL, /* poll_event */
no_flush, /* flush */
mail_writer_get_info, /* get_file_info */
mail_writer_get_fd_type, /* get_fd_type */
no_queue_async, /* queue_async */
NULL /* cancel_async */
};
@ -160,7 +160,7 @@ static struct object *mailslot_device_lookup_name( struct object *obj, struct un
static struct object *mailslot_device_open_file( struct object *obj, unsigned int access,
unsigned int sharing, unsigned int options );
static void mailslot_device_destroy( struct object *obj );
static enum server_fd_type mailslot_device_get_file_info( struct fd *fd, int *flags );
static enum server_fd_type mailslot_device_get_fd_type( struct fd *fd );
static const struct object_ops mailslot_device_ops =
{
@ -184,7 +184,7 @@ static const struct fd_ops mailslot_device_fd_ops =
default_fd_get_poll_events, /* get_poll_events */
default_poll_event, /* poll_event */
no_flush, /* flush */
mailslot_device_get_file_info, /* get_file_info */
mailslot_device_get_fd_type, /* get_fd_type */
default_fd_queue_async, /* queue_async */
default_fd_reselect_async, /* reselect_async */
default_fd_cancel_async /* cancel_async */
@ -211,11 +211,8 @@ static void mailslot_dump( struct object *obj, int verbose )
mailslot->max_msgsize, mailslot->read_timeout );
}
static enum server_fd_type mailslot_get_info( struct fd *fd, int *flags )
static enum server_fd_type mailslot_get_fd_type( struct fd *fd )
{
struct mailslot *mailslot = get_fd_user( fd );
assert( mailslot->obj.ops == &mailslot_ops );
*flags = 0;
return FD_TYPE_MAILSLOT;
}
@ -331,9 +328,8 @@ static void mailslot_device_destroy( struct object *obj )
free( device->mailslots );
}
static enum server_fd_type mailslot_device_get_file_info( struct fd *fd, int *flags )
static enum server_fd_type mailslot_device_get_fd_type( struct fd *fd )
{
*flags = 0;
return FD_TYPE_DEVICE;
}
@ -435,9 +431,8 @@ static void mail_writer_destroy( struct object *obj)
release_object( writer->mailslot );
}
static enum server_fd_type mail_writer_get_info( struct fd *fd, int *flags )
static enum server_fd_type mail_writer_get_fd_type( struct fd *fd )
{
*flags = 0;
return FD_TYPE_MAILSLOT;
}

View File

@ -137,7 +137,7 @@ static void pipe_server_dump( struct object *obj, int verbose );
static struct fd *pipe_server_get_fd( struct object *obj );
static void pipe_server_destroy( struct object *obj);
static void pipe_server_flush( struct fd *fd, struct event **event );
static enum server_fd_type pipe_server_get_info( struct fd *fd, int *flags );
static enum server_fd_type pipe_server_get_fd_type( struct fd *fd );
static const struct object_ops pipe_server_ops =
{
@ -161,7 +161,7 @@ static const struct fd_ops pipe_server_fd_ops =
default_fd_get_poll_events, /* get_poll_events */
default_poll_event, /* poll_event */
pipe_server_flush, /* flush */
pipe_server_get_info, /* get_file_info */
pipe_server_get_fd_type, /* get_fd_type */
default_fd_queue_async, /* queue_async */
default_fd_reselect_async, /* reselect_async */
default_fd_cancel_async, /* cancel_async */
@ -172,7 +172,7 @@ static void pipe_client_dump( struct object *obj, int verbose );
static struct fd *pipe_client_get_fd( struct object *obj );
static void pipe_client_destroy( struct object *obj );
static void pipe_client_flush( struct fd *fd, struct event **event );
static enum server_fd_type pipe_client_get_info( struct fd *fd, int *flags );
static enum server_fd_type pipe_client_get_fd_type( struct fd *fd );
static const struct object_ops pipe_client_ops =
{
@ -196,7 +196,7 @@ static const struct fd_ops pipe_client_fd_ops =
default_fd_get_poll_events, /* get_poll_events */
default_poll_event, /* poll_event */
pipe_client_flush, /* flush */
pipe_client_get_info, /* get_file_info */
pipe_client_get_fd_type, /* get_fd_type */
default_fd_queue_async, /* queue_async */
default_fd_reselect_async, /* reselect_async */
default_fd_cancel_async /* cancel_async */
@ -209,7 +209,7 @@ static struct object *named_pipe_device_lookup_name( struct object *obj,
static struct object *named_pipe_device_open_file( struct object *obj, unsigned int access,
unsigned int sharing, unsigned int options );
static void named_pipe_device_destroy( struct object *obj );
static enum server_fd_type named_pipe_device_get_file_info( struct fd *fd, int *flags );
static enum server_fd_type named_pipe_device_get_fd_type( struct fd *fd );
static const struct object_ops named_pipe_device_ops =
{
@ -233,7 +233,7 @@ static const struct fd_ops named_pipe_device_fd_ops =
default_fd_get_poll_events, /* get_poll_events */
default_poll_event, /* poll_event */
no_flush, /* flush */
named_pipe_device_get_file_info, /* get_file_info */
named_pipe_device_get_fd_type, /* get_fd_type */
default_fd_queue_async, /* queue_async */
default_fd_reselect_async, /* reselect_async */
default_fd_cancel_async /* cancel_async */
@ -456,9 +456,8 @@ static void named_pipe_device_destroy( struct object *obj )
free( device->pipes );
}
static enum server_fd_type named_pipe_device_get_file_info( struct fd *fd, int *flags )
static enum server_fd_type named_pipe_device_get_fd_type( struct fd *fd )
{
*flags = 0;
return FD_TYPE_DEVICE;
}
@ -555,15 +554,13 @@ static inline int is_overlapped( unsigned int options )
return !(options & (FILE_SYNCHRONOUS_IO_ALERT | FILE_SYNCHRONOUS_IO_NONALERT));
}
static enum server_fd_type pipe_server_get_info( struct fd *fd, int *flags )
static enum server_fd_type pipe_server_get_fd_type( struct fd *fd )
{
*flags = 0;
return FD_TYPE_PIPE;
}
static enum server_fd_type pipe_client_get_info( struct fd *fd, int *flags )
static enum server_fd_type pipe_client_get_fd_type( struct fd *fd )
{
*flags = 0;
return FD_TYPE_PIPE;
}

View File

@ -85,7 +85,7 @@ static const struct fd_ops process_fd_ops =
NULL, /* get_poll_events */
process_poll_event, /* poll_event */
no_flush, /* flush */
no_get_file_info, /* get_file_info */
no_get_fd_type, /* get_fd_type */
no_queue_async, /* queue_async */
NULL, /* reselect_async */
no_cancel_async /* cancel async */

View File

@ -167,7 +167,7 @@ static const struct fd_ops msg_queue_fd_ops =
NULL, /* get_poll_events */
msg_queue_poll_event, /* poll_event */
no_flush, /* flush */
no_get_file_info, /* get_file_info */
no_get_fd_type, /* get_fd_type */
no_queue_async, /* queue_async */
NULL, /* reselect_async */
no_cancel_async /* cancel async */

View File

@ -107,7 +107,7 @@ static const struct fd_ops master_socket_fd_ops =
NULL, /* get_poll_events */
master_socket_poll_event, /* poll_event */
no_flush, /* flush */
no_get_file_info, /* get_file_info */
no_get_fd_type, /* get_fd_type */
no_queue_async, /* queue_async */
NULL, /* reselect_async */
no_cancel_async /* cancel_async */

View File

@ -61,7 +61,7 @@ static struct fd *serial_get_fd( struct object *obj );
static unsigned int serial_map_access( struct object *obj, unsigned int access );
static void serial_destroy(struct object *obj);
static enum server_fd_type serial_get_info( struct fd *fd, int *flags );
static enum server_fd_type serial_get_fd_type( struct fd *fd );
static void serial_flush( struct fd *fd, struct event **event );
static void serial_queue_async( struct fd *fd, const async_data_t *data, int type, int count );
@ -106,7 +106,7 @@ static const struct fd_ops serial_fd_ops =
default_fd_get_poll_events, /* get_poll_events */
default_poll_event, /* poll_event */
serial_flush, /* flush */
serial_get_info, /* get_file_info */
serial_get_fd_type, /* get_file_info */
serial_queue_async, /* queue_async */
default_fd_reselect_async, /* reselect_async */
default_fd_cancel_async /* cancel_async */
@ -171,12 +171,8 @@ static struct serial *get_serial_obj( struct process *process, obj_handle_t hand
return (struct serial *)get_handle_obj( process, handle, access, &serial_ops );
}
static enum server_fd_type serial_get_info( struct fd *fd, int *flags )
static enum server_fd_type serial_get_fd_type( struct fd *fd )
{
struct serial *serial = get_fd_user( fd );
assert( serial->obj.ops == &serial_ops );
*flags = 0;
return FD_TYPE_SERIAL;
}

View File

@ -83,7 +83,7 @@ static const struct fd_ops handler_fd_ops =
NULL, /* get_poll_events */
handler_poll_event, /* poll_event */
no_flush, /* flush */
no_get_file_info, /* get_file_info */
no_get_fd_type, /* get_fd_type */
no_queue_async, /* queue_async */
NULL, /* reselect_async */
no_cancel_async /* cancel_async */

View File

@ -95,7 +95,7 @@ static void sock_destroy( struct object *obj );
static int sock_get_poll_events( struct fd *fd );
static void sock_poll_event( struct fd *fd, int event );
static enum server_fd_type sock_get_info( struct fd *fd, int *flags );
static enum server_fd_type sock_get_fd_type( struct fd *fd );
static void sock_queue_async( struct fd *fd, const async_data_t *data, int type, int count );
static void sock_reselect_async( struct fd *fd, struct async_queue *queue );
static void sock_cancel_async( struct fd *fd );
@ -125,7 +125,7 @@ static const struct fd_ops sock_fd_ops =
sock_get_poll_events, /* get_poll_events */
sock_poll_event, /* poll_event */
no_flush, /* flush */
sock_get_info, /* get_file_info */
sock_get_fd_type, /* get_file_info */
sock_queue_async, /* queue_async */
sock_reselect_async, /* reselect_async */
sock_cancel_async /* cancel_async */
@ -491,17 +491,8 @@ static int sock_get_poll_events( struct fd *fd )
return ev;
}
static enum server_fd_type sock_get_info( struct fd *fd, int *flags )
static enum server_fd_type sock_get_fd_type( struct fd *fd )
{
struct sock *sock = get_fd_user( fd );
assert( sock->obj.ops == &sock_ops );
*flags = 0;
if ( sock->type != SOCK_STREAM || sock->state & FD_WINE_CONNECTED )
{
if ( !(sock->state & FD_READ ) ) *flags |= FD_FLAG_RECV_SHUTDOWN;
if ( !(sock->state & FD_WRITE ) ) *flags |= FD_FLAG_SEND_SHUTDOWN;
}
return FD_TYPE_SOCKET;
}

View File

@ -130,7 +130,7 @@ static const struct fd_ops thread_fd_ops =
NULL, /* get_poll_events */
thread_poll_event, /* poll_event */
no_flush, /* flush */
no_get_file_info, /* get_file_info */
no_get_fd_type, /* get_fd_type */
no_queue_async, /* queue_async */
NULL, /* reselect_async */
no_cancel_async /* cancel_async */