[Libguestfs] [PATCH libnbd 1/3] api: Change nbd_read_only -> nbd_is_read_only.

Richard W.M. Jones rjones at redhat.com
Tue Aug 6 18:57:07 UTC 2019


On Tue, Aug 06, 2019 at 11:00:28AM -0500, Eric Blake wrote:
> On 8/6/19 8:38 AM, Richard W.M. Jones wrote:
> > This makes it consistent with other nbd_is_* and nbd_can_* APIs.
> > 
> > Suggested by Thomas Haller.
> > ---
> >  docs/libnbd.pod                      | 2 +-
> >  examples/batched-read-write.c        | 2 +-
> >  examples/simple-reads-and-writes.c   | 2 +-
> >  examples/threaded-reads-and-writes.c | 2 +-
> >  generator/generator                  | 2 +-
> >  lib/flags.c                          | 2 +-
> >  lib/rw.c                             | 6 +++---
> >  tests/aio-parallel-load.c            | 2 +-
> >  tests/aio-parallel.c                 | 2 +-
> >  tests/read-only-flag.c               | 4 ++--
> >  tests/read-write-flag.c              | 4 ++--
> >  tests/synch-parallel.c               | 2 +-
> >  12 files changed, 16 insertions(+), 16 deletions(-)
> 
> The following patch lets nbdkit compile with any libnbd version >= 0.9.6
> (since this libnbd patch will cause an API bump when we finally release
> 0.9.8...)
> 
> But I won't actually push anything to nbdkit until we actually release
> the next libnbd, in case there's more tweaks to worry about in the
> meantime.  And we may still decide to just bump the minimum required
> version in configure.ac instead of doing this hack to support both versions.
> 
> diff --git i/plugins/nbd/nbd.c w/plugins/nbd/nbd.c
> index f11e54d5..a83ded5e 100644
> --- i/plugins/nbd/nbd.c
> +++ w/plugins/nbd/nbd.c
> @@ -566,11 +566,15 @@ nbdplug_get_size (void *handle)
>    return size;
>  }
> 
> +#ifndef LIBNBD_HAVE_NBD_IS_READ_ONLY
> +# define nbd_is_read_only nbd_read_only
> +#endif
> +
>  static int
>  nbdplug_can_write (void *handle)
>  {
>    struct handle *h = handle;
> -  int i = nbd_read_only (h->nbd);
> +  int i = nbd_is_read_only (h->nbd);
> 
>    if (i == -1) {
>      nbdkit_error ("failure to check readonly flag: %s", nbd_get_error ());

ACK although it may be best not to pile up these changes
and just have it working with the latest version (albeit
the current release is not quite up to date).

Rich.

-- 
Richard Jones, Virtualization Group, Red Hat http://people.redhat.com/~rjones
Read my programming and virtualization blog: http://rwmj.wordpress.com
Fedora Windows cross-compiler. Compile Windows programs, test, and
build Windows installers. Over 100 libraries supported.
http://fedoraproject.org/wiki/MinGW




More information about the Libguestfs mailing list