server: Remove no longer needed pipe_client struct.

Signed-off-by: Jacek Caban <jacek@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
Jacek Caban 2018-11-23 15:13:24 +01:00 committed by Alexandre Julliard
parent 4841b5dc9f
commit f487d50afd
1 changed files with 22 additions and 30 deletions

View File

@ -70,18 +70,12 @@ struct pipe_end
struct pipe_server 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 */ struct list entry; /* entry in named pipe servers list */
unsigned int options; /* pipe options */ unsigned int options; /* pipe options */
struct async_queue listen_q; /* listen queue */ 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 named_pipe
{ {
struct object obj; /* object header */ 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 = static const struct object_ops pipe_client_ops =
{ {
sizeof(struct pipe_client), /* size */ sizeof(struct pipe_end), /* size */
pipe_client_dump, /* dump */ pipe_client_dump, /* dump */
pipe_end_get_type, /* get_type */ pipe_end_get_type, /* get_type */
add_queue, /* add_queue */ 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 ) 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 ); 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) 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 ) 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) switch(code)
{ {
@ -1144,7 +1138,7 @@ static int pipe_client_ioctl( struct fd *fd, ioctl_code_t code, struct async *as
return 0; return 0;
default: 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; return server;
} }
static struct pipe_client *create_pipe_client( unsigned int flags, struct named_pipe *pipe, static struct pipe_end *create_pipe_client( struct named_pipe *pipe, data_size_t buffer_size, unsigned int options )
data_size_t buffer_size, unsigned int options )
{ {
struct pipe_client *client; struct pipe_end *client;
client = alloc_object( &pipe_client_ops ); client = alloc_object( &pipe_client_ops );
if (!client) if (!client)
return NULL; return NULL;
client->flags = flags; init_pipe_end( client, pipe, 0, buffer_size );
init_pipe_end( &client->pipe_end, pipe, 0, buffer_size ); client->state = FILE_PIPE_CONNECTED_STATE;
client->pipe_end.state = FILE_PIPE_CONNECTED_STATE; client->client_pid = get_process_id( current->process );
client->pipe_end.client_pid = get_process_id( current->process );
client->pipe_end.fd = alloc_pseudo_fd( &pipe_client_fd_ops, &client->pipe_end.obj, options ); client->fd = alloc_pseudo_fd( &pipe_client_fd_ops, &client->obj, options );
if (!client->pipe_end.fd) if (!client->fd)
{ {
release_object( client ); release_object( client );
return NULL; return NULL;
} }
allow_fd_caching( client->pipe_end.fd ); allow_fd_caching( client->fd );
set_fd_signaled( client->pipe_end.fd, 1 ); set_fd_signaled( client->fd, 1 );
return client; 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 named_pipe *pipe = (struct named_pipe *)obj;
struct pipe_server *server; struct pipe_server *server;
struct pipe_client *client; struct pipe_end *client;
unsigned int pipe_sharing; unsigned int pipe_sharing;
if (!(server = find_available_server( pipe ))) 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; 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 ); async_wake_up( &server->listen_q, STATUS_SUCCESS );
server->pipe_end.state = FILE_PIPE_CONNECTED_STATE; server->pipe_end.state = FILE_PIPE_CONNECTED_STATE;
server->pipe_end.connection = &client->pipe_end; server->pipe_end.connection = client;
client->pipe_end.connection = &server->pipe_end; client->connection = &server->pipe_end;
server->pipe_end.client_pid = client->pipe_end.client_pid; server->pipe_end.client_pid = client->client_pid;
client->pipe_end.server_pid = server->pipe_end.server_pid; client->server_pid = server->pipe_end.server_pid;
} }
release_object( server ); 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 ) static int named_pipe_device_ioctl( struct fd *fd, ioctl_code_t code, struct async *async )