From f487d50afde586980238160d763d8770d66b9c66 Mon Sep 17 00:00:00 2001 From: Jacek Caban Date: Fri, 23 Nov 2018 15:13:24 +0100 Subject: [PATCH] server: Remove no longer needed pipe_client struct. Signed-off-by: Jacek Caban Signed-off-by: Alexandre Julliard --- server/named_pipe.c | 52 +++++++++++++++++++-------------------------- 1 file changed, 22 insertions(+), 30 deletions(-) diff --git a/server/named_pipe.c b/server/named_pipe.c index b17f417e945..fcb33a94554 100644 --- a/server/named_pipe.c +++ b/server/named_pipe.c @@ -70,18 +70,12 @@ struct pipe_end struct pipe_server { - struct pipe_end pipe_end; /* common header for pipe_client and pipe_server */ + struct pipe_end pipe_end; /* common header for both pipe ends */ struct list entry; /* entry in named pipe servers list */ unsigned int options; /* pipe options */ struct async_queue listen_q; /* listen queue */ }; -struct pipe_client -{ - struct pipe_end pipe_end; /* common header for pipe_client and pipe_server */ - unsigned int flags; /* file flags */ -}; - struct named_pipe { struct object obj; /* object header */ @@ -201,7 +195,7 @@ static int pipe_client_ioctl( struct fd *fd, ioctl_code_t code, struct async *as static const struct object_ops pipe_client_ops = { - sizeof(struct pipe_client), /* size */ + sizeof(struct pipe_end), /* size */ pipe_client_dump, /* dump */ pipe_end_get_type, /* get_type */ add_queue, /* add_queue */ @@ -333,9 +327,9 @@ static void pipe_server_dump( struct object *obj, int verbose ) static void pipe_client_dump( struct object *obj, int verbose ) { - struct pipe_client *client = (struct pipe_client *) obj; + struct pipe_end *client = (struct pipe_end *) obj; assert( obj->ops == &pipe_client_ops ); - fprintf( stderr, "Named pipe client server=%p\n", client->pipe_end.connection ); + fprintf( stderr, "Named pipe client server=%p\n", client->connection ); } static void named_pipe_destroy( struct object *obj) @@ -1135,7 +1129,7 @@ static int pipe_server_ioctl( struct fd *fd, ioctl_code_t code, struct async *as static int pipe_client_ioctl( struct fd *fd, ioctl_code_t code, struct async *async ) { - struct pipe_client *client = get_fd_user( fd ); + struct pipe_end *client = get_fd_user( fd ); switch(code) { @@ -1144,7 +1138,7 @@ static int pipe_client_ioctl( struct fd *fd, ioctl_code_t code, struct async *as return 0; default: - return pipe_end_ioctl( &client->pipe_end, code, async ); + return pipe_end_ioctl( client, code, async ); } } @@ -1187,28 +1181,26 @@ static struct pipe_server *create_pipe_server( struct named_pipe *pipe, unsigned return server; } -static struct pipe_client *create_pipe_client( unsigned int flags, struct named_pipe *pipe, - data_size_t buffer_size, unsigned int options ) +static struct pipe_end *create_pipe_client( struct named_pipe *pipe, data_size_t buffer_size, unsigned int options ) { - struct pipe_client *client; + struct pipe_end *client; client = alloc_object( &pipe_client_ops ); if (!client) return NULL; - client->flags = flags; - init_pipe_end( &client->pipe_end, pipe, 0, buffer_size ); - client->pipe_end.state = FILE_PIPE_CONNECTED_STATE; - client->pipe_end.client_pid = get_process_id( current->process ); + init_pipe_end( client, pipe, 0, buffer_size ); + client->state = FILE_PIPE_CONNECTED_STATE; + client->client_pid = get_process_id( current->process ); - client->pipe_end.fd = alloc_pseudo_fd( &pipe_client_fd_ops, &client->pipe_end.obj, options ); - if (!client->pipe_end.fd) + client->fd = alloc_pseudo_fd( &pipe_client_fd_ops, &client->obj, options ); + if (!client->fd) { release_object( client ); return NULL; } - allow_fd_caching( client->pipe_end.fd ); - set_fd_signaled( client->pipe_end.fd, 1 ); + allow_fd_caching( client->fd ); + set_fd_signaled( client->fd, 1 ); return client; } @@ -1253,7 +1245,7 @@ static struct object *named_pipe_open_file( struct object *obj, unsigned int acc { struct named_pipe *pipe = (struct named_pipe *)obj; struct pipe_server *server; - struct pipe_client *client; + struct pipe_end *client; unsigned int pipe_sharing; if (!(server = find_available_server( pipe ))) @@ -1271,17 +1263,17 @@ static struct object *named_pipe_open_file( struct object *obj, unsigned int acc return NULL; } - if ((client = create_pipe_client( options, pipe, pipe->outsize, options ))) + if ((client = create_pipe_client( pipe, pipe->outsize, options ))) { async_wake_up( &server->listen_q, STATUS_SUCCESS ); server->pipe_end.state = FILE_PIPE_CONNECTED_STATE; - server->pipe_end.connection = &client->pipe_end; - client->pipe_end.connection = &server->pipe_end; - server->pipe_end.client_pid = client->pipe_end.client_pid; - client->pipe_end.server_pid = server->pipe_end.server_pid; + server->pipe_end.connection = client; + client->connection = &server->pipe_end; + server->pipe_end.client_pid = client->client_pid; + client->server_pid = server->pipe_end.server_pid; } release_object( server ); - return &client->pipe_end.obj; + return &client->obj; } static int named_pipe_device_ioctl( struct fd *fd, ioctl_code_t code, struct async *async )