[Libguestfs] [PATCH nbdkit v5 FINAL 10/19] offset: Implement mapping of extents.

Eric Blake eblake at redhat.com
Tue Apr 23 17:36:05 UTC 2019


On 3/28/19 11:18 AM, Richard W.M. Jones wrote:
> Allows you to safely use nbdkit-offset-filter on top of a plugin
> supporting extents.
> ---
>  filters/offset/offset.c | 36 ++++++++++++++++++++++++++++++++++++
>  1 file changed, 36 insertions(+)
> 

> +
> +  extents2 = nbdkit_extents_new (offs + offset, real_size - offset);
> +  if (extents2 == NULL) {
> +    *err = errno;
> +    return -1;
> +  }

Here, we are careful to set *err.

> +  if (next_ops->extents (nxdata, count, offs + offset,
> +                         flags, extents2, err) == -1)
> +    goto error;

And here.

> +
> +  for (i = 0; i < nbdkit_extents_count (extents2); ++i) {
> +    e = nbdkit_get_extent (extents2, i);
> +    e.offset -= offset;
> +    if (nbdkit_add_extent (extents, e.offset, e.length, e.type) == -1)
> +      goto error;

But here, *err remains unchanged. Is this a problem? Should
nbdkit_add_extent() guarantee that errno is sane on failure (right now,
it does not)?

Affects several filters.

-- 
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/20190423/484eb41b/attachment.sig>


More information about the Libguestfs mailing list