11.06.2021 16:22, Eric Blake wrote:
> On Thu, Jun 10, 2021 at 01:07:35PM +0300, Vladimir Sementsov-Ogievskiy wrote:
>> Add function that transforms named fd inside SocketAddress structure
>> into number representation. This way it may be then used in a context
>> where current monitor is not available.
>>
>> Signed-off-by: Vladimir Sementsov-Ogievskiy <vsementsov@virtuozzo.com>
>> ---
>> include/qemu/sockets.h | 14 ++++++++++++++
>> util/qemu-sockets.c | 19 +++++++++++++++++++
>> 2 files changed, 33 insertions(+)
>>
>> diff --git a/include/qemu/sockets.h b/include/qemu/sockets.h
>> index 7d1f813576..1f4f18a44a 100644
>> --- a/include/qemu/sockets.h
>> +++ b/include/qemu/sockets.h
>> @@ -111,4 +111,18 @@ SocketAddress *socket_remote_address(int fd, Error **errp);
>> */
>> SocketAddress *socket_address_flatten(SocketAddressLegacy *addr);
>>
>> +/**
>> + * socket_address_parse_named_fd:
>> + *
>> + * Modify @addr, replacing named fd by corresponding number.
>> + *
>> + * Parsing named fd (by sockget_get_fd) is not possible in context where
>> + * current monitor is not available. So, SocketAddress user may first call
>> + * socket_parse_named_fd() to parse named fd in advance, and then pass @addr to
>> + * the context where monitor is not available.
>
> 2 different wrong function names, and reads awkwardly. How about this
> shorter variant:
>
> Modify @addr, replacing a named fd by its corresponding number.
> Needed for callers that plan to pass @addr to a context where the
> current monitor is not available.
A lot better, thanks!
>
>> + *
>> + * Return 0 on success.
>> + */
>> +int socket_address_parse_named_fd(SocketAddress *addr, Error **errp);
>> +
>> #endif /* QEMU_SOCKETS_H */
>> diff --git a/util/qemu-sockets.c b/util/qemu-sockets.c
>
> But the code looks good.
Somehow, C is simpler for me than English )
>
> Reviewed-by: Eric Blake <eblake@redhat.com>
>
--
Best regards,
Vladimir