[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [PATCH V2 18/22] chardev: cpr for sockets
From: |
Daniel P . Berrangé |
Subject: |
Re: [PATCH V2 18/22] chardev: cpr for sockets |
Date: |
Tue, 5 Jan 2021 16:22:43 +0000 |
User-agent: |
Mutt/1.14.6 (2020-07-11) |
On Tue, Jan 05, 2021 at 07:42:06AM -0800, Steve Sistare wrote:
> Define qio_channel_socket_reuse to initialize a channel based on an existing
> socket fd. Save accepted socket fds in the environment before cprsave, and
> look for fds in the environment after cprload. Reject cprsave if a socket
> enables the TLS or websocket option.
>
> Signed-off-by: Mark Kanda <mark.kanda@oracle.com>
> Signed-off-by: Steve Sistare <steven.sistare@oracle.com>
> ---
> chardev/char-socket.c | 30 ++++++++++++++++++++++++++++++
> include/io/channel-socket.h | 12 ++++++++++++
> io/channel-socket.c | 9 +++++++++
> stubs/Makefile.objs | 1 +
> stubs/cpr.c | 3 +++
> 5 files changed, 55 insertions(+)
> create mode 100644 stubs/cpr.c
>
> diff --git a/include/io/channel-socket.h b/include/io/channel-socket.h
> index 777ff59..e425a01 100644
> --- a/include/io/channel-socket.h
> +++ b/include/io/channel-socket.h
> @@ -260,5 +260,17 @@ QIOChannelSocket *
> qio_channel_socket_accept(QIOChannelSocket *ioc,
> Error **errp);
>
> +/**
> + * qio_channel_socket_reuse:
> + * @fd: existing client socket descriptor
> + * @errp: pointer to a NULL-initialized error object
> + *
> + * Construct a client channel using @fd.
> + *
> + * Returns: the new client channel, or NULL on error
> + */
> +QIOChannelSocket *
> +qio_channel_socket_reuse(int fd,
> + Error **errp);
>
> #endif /* QIO_CHANNEL_SOCKET_H */
> diff --git a/io/channel-socket.c b/io/channel-socket.c
> index de49880..07981be 100644
> --- a/io/channel-socket.c
> +++ b/io/channel-socket.c
> @@ -400,6 +400,15 @@ qio_channel_socket_accept(QIOChannelSocket *ioc,
> return NULL;
> }
>
> +QIOChannelSocket *
> +qio_channel_socket_reuse(int fd,
> + Error **errp)
> +{
> + QIOChannelSocket *cioc = qio_channel_socket_new();
> + cioc->fd = fd;
> + return qio_channel_socket_post_accept(cioc, errp) ? 0 : cioc;
> +}
Why do we need to add this new API when we already have
qio_channel_socket_new_fd(int fd, Error **errp)
which accepts a pre-opened socket FD ?
Regards,
Daniel
--
|: https://berrange.com -o- https://www.flickr.com/photos/dberrange :|
|: https://libvirt.org -o- https://fstop138.berrange.com :|
|: https://entangle-photo.org -o- https://www.instagram.com/dberrange :|
- [PATCH V2 10/22] pci: export functions for cpr, (continued)
[PATCH V2 12/22] vfio-pci: cpr, Steve Sistare, 2021/01/05
[PATCH V2 16/22] chardev: cpr for pty, Steve Sistare, 2021/01/05
[PATCH V2 18/22] chardev: cpr for sockets, Steve Sistare, 2021/01/05
- Re: [PATCH V2 18/22] chardev: cpr for sockets,
Daniel P . Berrangé <=
[PATCH V2 19/22] monitor: cpr support, Steve Sistare, 2021/01/05
[PATCH V2 17/22] chardev: socket accept subroutine, Steve Sistare, 2021/01/05
[PATCH V2 20/22] cpr: only-cpr-capable option, Steve Sistare, 2021/01/05
[PATCH V2 22/22] simplify savevm, Steve Sistare, 2021/01/05
[PATCH V2 14/22] chardev: cpr framework, Steve Sistare, 2021/01/05
[PATCH V2 21/22] cpr: maintainers, Steve Sistare, 2021/01/05
[PATCH V2 02/22] qemu_ram_volatile, Steve Sistare, 2021/01/05
[PATCH V2 13/22] vhost: reset vhost devices upon cprsave, Steve Sistare, 2021/01/05
[PATCH V2 01/22] as_flat_walk, Steve Sistare, 2021/01/05