qemu-devel
[Top][All Lists]
Advanced

[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 :|




reply via email to

[Prev in Thread] Current Thread [Next in Thread]