[Libguestfs] [PATCH nbdkit v5 FINAL 12/19] truncate: Implement extents for beyond end of truncated region.
Eric Blake
eblake at redhat.com
Fri Mar 29 02:39:23 UTC 2019
On 3/28/19 11:18 AM, Richard W.M. Jones wrote:
> ---
> filters/truncate/truncate.c | 55 +++++++++++++++++++++++++++++++++++++
> 1 file changed, 55 insertions(+)
>
> + extents2 = nbdkit_extents_new (0, real_size_copy);
> + if (offset + count <= real_size_copy)
> + n = count;
> + else
> + n = real_size_copy - offset;
> + if (next_ops->extents (nxdata, n, offset, flags, extents2, err) == -1) {
> + nbdkit_extents_free (extents2);
> + return -1;
> + }
> +
> + for (i = 0; i < nbdkit_extents_count (extents2); ++i) {
> + struct nbdkit_extent e = nbdkit_get_extent (extents2, i);
> +
> + if (nbdkit_add_extent (extents, e.offset, e.length, e.type) == -1) {
> + nbdkit_extents_free (extents2);
> + return -1;
> + }
> + }
> + nbdkit_extents_free (extents2);
> +
Should we be using the CLEANUP_EXTENTS_FREE macro here and in other 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/20190328/e2cdaca2/attachment.sig>
More information about the Libguestfs
mailing list