[Libguestfs] [libnbd PATCH v2 4/5] api: Add STRICT_FLAGS to set_strict_mode
Eric Blake
eblake at redhat.com
Thu Sep 17 13:38:02 UTC 2020
On 9/17/20 8:32 AM, Richard W.M. Jones wrote:
> On Fri, Sep 11, 2020 at 04:49:55PM -0500, Eric Blake wrote:
>> The next strict knob: allow the user to pass unknown flags across the
>> wire (this is different than passing a known flag at the wrong time).
>>
>> It is interesting to note that NBD only permits 16 bits of flags, but
>> we have a signature that takes uint32_t; if we wanted, we could pack
>> libnbd-specific flags in the upper bits that the NBD protocol would
>> never see.
>
> This is fine ACK.
>
> About the "guard" change: I probably would have put that change in a
> separate commit. Also you could consider having a default_flags
> parameter to avoid having to set guard = None everywhere, although you
> would still have to make a one-off change to every *_flags. It would
> look like this:
>
> let default_flags = { flag_prefix = ""; guard = None; flags = [] }
> ...
> let handshake_flags = {
> default_flags with
> flag_prefix = "HANDSHAKE_FLAG";
> flags = [ ... ]
> }
>
> (We already do this with "default_call"). Neither of these is a big deal
> though.
Splitting the patch makes sense. Also, I _did_ consider the
'default_flags with' solution before your reply, but only after I had
written the email. In the short term, it is no difference in the amount
of churn (adding one line to every flags definition); but in the long
term, it is nicer if we ever add more items. So from that perspective,
I'll go with that change.
--
Eric Blake, Principal Software Engineer
Red Hat, Inc. +1-919-301-3226
Virtualization: qemu.org | libvirt.org
More information about the Libguestfs
mailing list