server: Remove the return value of the flush() method, it's not used.
This commit is contained in:
parent
c16eb8efd9
commit
df651875ad
|
@ -1763,10 +1763,9 @@ void default_fd_cancel_async( struct fd *fd )
|
|||
}
|
||||
|
||||
/* default flush() routine */
|
||||
int no_flush( struct fd *fd, struct event **event )
|
||||
void no_flush( struct fd *fd, struct event **event )
|
||||
{
|
||||
set_error( STATUS_OBJECT_TYPE_MISMATCH );
|
||||
return 0;
|
||||
}
|
||||
|
||||
/* default get_file_info() routine */
|
||||
|
|
|
@ -69,7 +69,7 @@ static unsigned int file_map_access( struct object *obj, unsigned int access );
|
|||
static void file_destroy( struct object *obj );
|
||||
|
||||
static int file_get_poll_events( struct fd *fd );
|
||||
static int file_flush( struct fd *fd, struct event **event );
|
||||
static void file_flush( struct fd *fd, struct event **event );
|
||||
static enum server_fd_type file_get_info( struct fd *fd, int *flags );
|
||||
|
||||
static const struct object_ops file_ops =
|
||||
|
@ -227,16 +227,10 @@ static int file_get_poll_events( struct fd *fd )
|
|||
return events;
|
||||
}
|
||||
|
||||
static int file_flush( struct fd *fd, struct event **event )
|
||||
static void file_flush( struct fd *fd, struct event **event )
|
||||
{
|
||||
int ret = 0, unix_fd = get_unix_fd( fd );
|
||||
|
||||
if (unix_fd != -1)
|
||||
{
|
||||
ret = (fsync( unix_fd ) != -1);
|
||||
if (!ret) file_set_error();
|
||||
}
|
||||
return ret;
|
||||
int unix_fd = get_unix_fd( fd );
|
||||
if (unix_fd != -1 && fsync( unix_fd ) == -1) file_set_error();
|
||||
}
|
||||
|
||||
static enum server_fd_type file_get_info( struct fd *fd, int *flags )
|
||||
|
|
|
@ -35,7 +35,7 @@ struct fd_ops
|
|||
/* a poll() event occurred */
|
||||
void (*poll_event)(struct fd *,int event);
|
||||
/* flush the object buffers */
|
||||
int (*flush)(struct fd *, struct event **);
|
||||
void (*flush)(struct fd *, struct event **);
|
||||
/* get file information */
|
||||
enum server_fd_type (*get_file_info)(struct fd *fd, int *flags);
|
||||
/* queue an async operation */
|
||||
|
@ -72,7 +72,7 @@ extern void fd_queue_async_timeout( struct fd *fd, const async_data_t *data, int
|
|||
int count, const struct timeval *timeout );
|
||||
extern void default_fd_queue_async( struct fd *fd, const async_data_t *data, int type, int count );
|
||||
extern void default_fd_cancel_async( struct fd *fd );
|
||||
extern int no_flush( struct fd *fd, struct event **event );
|
||||
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 void no_queue_async( struct fd *fd, const async_data_t *data, int type, int count);
|
||||
extern void no_cancel_async( struct fd *fd );
|
||||
|
|
|
@ -136,7 +136,7 @@ static unsigned int pipe_map_access( struct object *obj, unsigned int access );
|
|||
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 int pipe_server_flush( struct fd *fd, struct event **event );
|
||||
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 const struct object_ops pipe_server_ops =
|
||||
|
@ -170,7 +170,7 @@ static const struct fd_ops pipe_server_fd_ops =
|
|||
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 int pipe_client_flush( struct fd *fd, struct event **event );
|
||||
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 const struct object_ops pipe_client_ops =
|
||||
|
@ -517,20 +517,15 @@ static void check_flushed( void *arg )
|
|||
}
|
||||
}
|
||||
|
||||
static int pipe_server_flush( struct fd *fd, struct event **event )
|
||||
static void pipe_server_flush( struct fd *fd, struct event **event )
|
||||
{
|
||||
struct pipe_server *server = get_fd_user( fd );
|
||||
|
||||
if (!server)
|
||||
return 0;
|
||||
|
||||
if (server->state != ps_connected_server)
|
||||
return 0;
|
||||
if (!server || server->state != ps_connected_server) return;
|
||||
|
||||
/* FIXME: if multiple threads flush the same pipe,
|
||||
maybe should create a list of processes to notify */
|
||||
if (server->flush_poll)
|
||||
return 0;
|
||||
if (server->flush_poll) return;
|
||||
|
||||
if (pipe_data_remaining( server ))
|
||||
{
|
||||
|
@ -539,20 +534,16 @@ static int pipe_server_flush( struct fd *fd, struct event **event )
|
|||
/* this kind of sux -
|
||||
there's no unix way to be alerted when a pipe becomes empty */
|
||||
server->event = create_event( NULL, NULL, 0, 0, 0 );
|
||||
if (!server->event)
|
||||
return 0;
|
||||
if (!server->event) return;
|
||||
add_timeout( &tv, 100 );
|
||||
server->flush_poll = add_timeout_user( &tv, check_flushed, server );
|
||||
*event = server->event;
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int pipe_client_flush( struct fd *fd, struct event **event )
|
||||
static void pipe_client_flush( struct fd *fd, struct event **event )
|
||||
{
|
||||
/* FIXME: what do we have to do for this? */
|
||||
return 0;
|
||||
}
|
||||
|
||||
static inline int is_overlapped( unsigned int options )
|
||||
|
|
|
@ -64,7 +64,7 @@ static void serial_destroy(struct object *obj);
|
|||
static int serial_get_poll_events( struct fd *fd );
|
||||
static void serial_poll_event( struct fd *fd, int event );
|
||||
static enum server_fd_type serial_get_info( struct fd *fd, int *flags );
|
||||
static int serial_flush( struct fd *fd, struct event **event );
|
||||
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 );
|
||||
static void serial_cancel_async( struct fd *fd );
|
||||
|
||||
|
@ -297,14 +297,12 @@ static void serial_cancel_async( struct fd *fd )
|
|||
async_terminate_queue( &serial->wait_q, STATUS_CANCELLED );
|
||||
}
|
||||
|
||||
static int serial_flush( struct fd *fd, struct event **event )
|
||||
static void serial_flush( struct fd *fd, struct event **event )
|
||||
{
|
||||
/* MSDN says: If hFile is a handle to a communications device,
|
||||
* the function only flushes the transmit buffer.
|
||||
*/
|
||||
int ret = (tcflush( get_unix_fd(fd), TCOFLUSH ) != -1);
|
||||
if (!ret) file_set_error();
|
||||
return ret;
|
||||
if (tcflush( get_unix_fd(fd), TCOFLUSH ) == -1) file_set_error();
|
||||
}
|
||||
|
||||
DECL_HANDLER(get_serial_info)
|
||||
|
|
Loading…
Reference in New Issue