Richard W.M. Jones
2020-Feb-10 22:24 UTC
Re: [Libguestfs] [libnbd PATCH 1/1] generator: Add support for NBD_INFO_INIT_STATE extension
The idea and patch is fine, but I wonder if it would be more useful to callers if it was exposed as two separate APIs. Callers would then not need to deal with masking out unknown flags, and it works more like the other is_* / can_* ("flag calls") we already have. Rich. -- Richard Jones, Virtualization Group, Red Hat http://people.redhat.com/~rjones Read my programming and virtualization blog: http://rwmj.wordpress.com virt-p2v converts physical machines to virtual machines. Boot with a live CD or over the network (PXE) and turn machines into KVM guests. http://libguestfs.org/virt-v2v
Eric Blake
2020-Feb-10 22:31 UTC
Re: [Libguestfs] [libnbd PATCH 1/1] generator: Add support for NBD_INFO_INIT_STATE extension
On 2/10/20 4:24 PM, Richard W.M. Jones wrote:> > The idea and patch is fine, but I wonder if it would be more useful to > callers if it was exposed as two separate APIs. Callers would then > not need to deal with masking out unknown flags, and it works more > like the other is_* / can_* ("flag calls") we already have.Fair point, especially since I exposed it in nbdkit as two callbacks for setting the bits. Naming suggestions? Maybe nbd_is_init_sparse and nbd_is_init_zero ? -- Eric Blake, Principal Software Engineer Red Hat, Inc. +1-919-301-3226 Virtualization: qemu.org | libvirt.org
Richard W.M. Jones
2020-Feb-10 22:54 UTC
Re: [Libguestfs] [libnbd PATCH 1/1] generator: Add support for NBD_INFO_INIT_STATE extension
On Mon, Feb 10, 2020 at 04:31:26PM -0600, Eric Blake wrote:> On 2/10/20 4:24 PM, Richard W.M. Jones wrote: > > > >The idea and patch is fine, but I wonder if it would be more useful to > >callers if it was exposed as two separate APIs. Callers would then > >not need to deal with masking out unknown flags, and it works more > >like the other is_* / can_* ("flag calls") we already have. > > Fair point, especially since I exposed it in nbdkit as two callbacks > for setting the bits. Naming suggestions? Maybe nbd_is_init_sparse > and nbd_is_init_zero ?Those make sense. As long as the name begins with "is_" or "can_" the generator will automatically pick it up as a "flag call" in the documentation: https://github.com/libguestfs/libnbd/blob/312701fa5210d79ca437cb263c706c2fe6f683d5/generator/generator#L4850 Rich. -- Richard Jones, Virtualization Group, Red Hat http://people.redhat.com/~rjones Read my programming and virtualization blog: http://rwmj.wordpress.com libguestfs lets you edit virtual machines. Supports shell scripting, bindings from many languages. http://libguestfs.org
Seemingly Similar Threads
- Re: [libnbd PATCH 1/1] generator: Add support for NBD_INFO_INIT_STATE extension
- [libnbd PATCH 1/1] generator: Add support for NBD_INFO_INIT_STATE extension
- Re: Cross-project NBD extension proposal: NBD_INFO_INIT_STATE
- Re: Cross-project NBD extension proposal: NBD_INFO_INIT_STATE
- Re: Cross-project NBD extension proposal: NBD_INFO_INIT_STATE