[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [PATCH V2 18/22] chardev: cpr for sockets
From: |
Steven Sistare |
Subject: |
Re: [PATCH V2 18/22] chardev: cpr for sockets |
Date: |
Tue, 5 Jan 2021 11:35:10 -0500 |
User-agent: |
Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:78.0) Gecko/20100101 Thunderbird/78.6.0 |
On 1/5/2021 11:22 AM, Daniel P. Berrangé wrote:
> 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 ?
That was fast!
Good call, thanks. I missed that qio_channel_socket_new_fd calls
qio_channel_socket_set_fd and
the latter performs the necessary post-accept actions. I will also delete
patch 17.
- Steve
- [PATCH V2 07/22] 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
[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
[PATCH V2 11/22] vfio-pci: refactor for cpr, Steve Sistare, 2021/01/05