All of lore.kernel.org
 help / color / mirror / Atom feed
From: Markus Armbruster <armbru@redhat.com>
To: Eric Blake <eblake@redhat.com>
Cc: qemu-devel@nongnu.org, pbonzini@redhat.com, kraxel@redhat.com,
	qemu-block@nongnu.org
Subject: Re: [Qemu-devel] [PATCH 6/7] sockets: Limit SocketAddressLegacy except to external interfaces
Date: Thu, 27 Apr 2017 09:33:58 +0200	[thread overview]
Message-ID: <8760hqi9sp.fsf@dusky.pond.sub.org> (raw)
In-Reply-To: <87d1byjoq1.fsf@dusky.pond.sub.org> (Markus Armbruster's message of "Thu, 27 Apr 2017 09:26:14 +0200")

Markus Armbruster <armbru@redhat.com> writes:

> Eric Blake <eblake@redhat.com> writes:
>
>> On 04/26/2017 02:36 AM, Markus Armbruster wrote:
>>
>> I think it reads fine if you shorten the subject via s/except //
>
> It doesn't unless.  Will fix, thanks!
>
>>> SocketAddressLegacy is a simple union, and simple unions are awkward:
>>> they have their variant members wrapped in a "data" object on the
>>> wire, and require additional indirections in C.  SocketAddress is the
>>> equivalent flat union.  Convert all users of SocketAddressLegacy to
>>> SocketAddress, except for existing external interfaces.
>>> 
>>> See also commit fce5d53..9445673 and 85a82e8..c5f1ae3.
>>> 
>>> Signed-off-by: Markus Armbruster <armbru@redhat.com>
>>> ---
>>
>>> +++ b/blockdev-nbd.c
>>> @@ -99,9 +99,8 @@ static QCryptoTLSCreds *nbd_get_tls_creds(const char *id, Error **errp)
>>>  }
>>>  
>>>  
>>> -void qmp_nbd_server_start(SocketAddressLegacy *addr,
>>> -                          bool has_tls_creds, const char *tls_creds,
>>> -                          Error **errp)
>>> +void nbd_server_start(SocketAddress *addr, const char *tls_creds,
>>> +                      Error **errp)
>>>  {
>> ...
>>> @@ -145,6 +144,16 @@ void qmp_nbd_server_start(SocketAddressLegacy *addr,
>>>      nbd_server = NULL;
>>>  }
>>>  
>>> +void qmp_nbd_server_start(SocketAddressLegacy *addr,
>>> +                          bool has_tls_creds, const char *tls_creds,
>>> +                          Error **errp)
>>> +{
>>> +    SocketAddress *addr_flat = socket_address_flatten(addr);
>>> +
>>> +    nbd_server_start(addr_flat, tls_creds, errp);
>>
>> We didn't always guarantee that tls_creds was initialized when
>> has_tls_creds was false, but it's been quite some time that we fixed
>> that.  So what you have works, and I'm not sure if it's worth using the
>> longer:
>> has_tls_creds ? tls_creds : NULL

Forgot to fill in the blank here: the conditional operator adds neither
readability nor robustness.  All it adds is noise.

I still hope to get rid of the has_ flag for pointers.

  reply	other threads:[~2017-04-27  7:34 UTC|newest]

Thread overview: 19+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-04-26  7:36 [Qemu-devel] [PATCH 0/7] sockets: Flatten SocketAddress except in external interfaces Markus Armbruster
2017-04-26  7:36 ` [Qemu-devel] [PATCH 1/7] sockets: Prepare vsock_parse() for flattened SocketAddress Markus Armbruster
2017-04-26 15:14   ` Eric Blake
2017-04-26  7:36 ` [Qemu-devel] [PATCH 2/7] sockets: Prepare inet_parse() " Markus Armbruster
2017-04-26 15:28   ` Eric Blake
2017-04-26  7:36 ` [Qemu-devel] [PATCH 3/7] qapi: New QAPI_CLONE_MEMBERS() Markus Armbruster
2017-04-26 17:56   ` Eric Blake
2017-04-26  7:36 ` [Qemu-devel] [PATCH 4/7] sockets: Rename SocketAddress to SocketAddressLegacy Markus Armbruster
2017-04-26 19:08   ` Eric Blake
2017-04-26  7:36 ` [Qemu-devel] [PATCH 5/7] sockets: Rename SocketAddressFlat to SocketAddress Markus Armbruster
2017-04-26 19:15   ` Eric Blake
2017-04-27  5:53   ` Prasanna Kalever
2017-04-26  7:36 ` [Qemu-devel] [PATCH 6/7] sockets: Limit SocketAddressLegacy except to external interfaces Markus Armbruster
2017-04-26 19:45   ` Eric Blake
2017-04-27  7:26     ` Markus Armbruster
2017-04-27  7:33       ` Markus Armbruster [this message]
2017-04-26  7:36 ` [Qemu-devel] [PATCH 7/7] socket: Delete unused helper socket_address_crumple() Markus Armbruster
2017-04-26 19:45   ` Eric Blake
2017-04-28  8:15 ` [Qemu-devel] [PATCH 0/7] sockets: Flatten SocketAddress except in external interfaces Markus Armbruster

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=8760hqi9sp.fsf@dusky.pond.sub.org \
    --to=armbru@redhat.com \
    --cc=eblake@redhat.com \
    --cc=kraxel@redhat.com \
    --cc=pbonzini@redhat.com \
    --cc=qemu-block@nongnu.org \
    --cc=qemu-devel@nongnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.