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

Eric Blake eblake at redhat.com
Tue Aug 6 16:00:28 UTC 2019


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 ());


-- 
Eric Blake, Principal Software Engineer
Red Hat, Inc.           +1-919-301-3226
Virtualization:  qemu.org | libvirt.org

-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 488 bytes
Desc: OpenPGP digital signature
URL: <http://listman.redhat.com/archives/libguestfs/attachments/20190806/76e5bbe9/attachment.sig>


More information about the Libguestfs mailing list