[Libguestfs] [PATCH nbdkit 1/6] filters: Add a function to read full extents from a plugin.

Eric Blake eblake at redhat.com
Wed Feb 3 20:47:23 UTC 2021


On 1/26/21 3:51 PM, Richard W.M. Jones wrote:
> This convenience function makes it a bit simpler to read a full set of
> extents covering a range from a plugin, especially for plugins which
> don't reply with a full set of extents in a single call.
> ---
>  docs/nbdkit-filter.pod  | 22 +++++++++++++++++
>  include/nbdkit-filter.h |  5 ++++
>  server/extents.c        | 54 +++++++++++++++++++++++++++++++++++++++++
>  server/nbdkit.syms      |  1 +
>  4 files changed, 82 insertions(+)
> 

> +++ b/server/extents.c

> +struct nbdkit_extents *
> +nbdkit_extents_full (struct nbdkit_next_ops *next_ops, nbdkit_backend *nxdata,
> +                     uint32_t count, uint64_t offset, uint32_t flags,
> +                     int *err)

> +    /* If the plugin is behaving we must make forward progress. */
> +    assert (offset > old_offset);
> +  }
> +
> +  return ret;
> +
> + error1:
> +  *err = errno;
> + error0:
> +  if (ret) nbdkit_extents_free (ret);

nbdkit_extents_free(NULL) is a no-op, do we need the 'if' here?

> +  return NULL;
> +}


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




More information about the Libguestfs mailing list