libbtrfsutil: add subvolume iterator helpers
authorOmar Sandoval <osandov@fb.com>
Thu, 18 Jan 2018 22:05:12 +0000 (14:05 -0800)
committerDavid Sterba <dsterba@suse.com>
Tue, 6 Mar 2018 10:28:37 +0000 (11:28 +0100)
commit0b8512b7f5a6106efcab371471c472572a55367e
tree6434c263496a7cd4eb4fdefd219177002d2abdb8
parente0d173c6c44d52287f2e20ec104cb3840e558343
libbtrfsutil: add subvolume iterator helpers

This is how we can implement stuff like `btrfs subvol list`. Rather than
producing the entire list upfront, the iterator approach uses less
memory in the common case where the whole list is not stored (O(max
subvolume path length)). It supports both pre-order traversal (useful
for, e.g, recursive snapshot) and post-order traversal (useful for
recursive delete).

Signed-off-by: Omar Sandoval <osandov@fb.com>
Signed-off-by: David Sterba <dsterba@suse.com>
libbtrfsutil/btrfsutil.h
libbtrfsutil/python/btrfsutilpy.h
libbtrfsutil/python/module.c
libbtrfsutil/python/subvolume.c
libbtrfsutil/python/tests/test_subvolume.py
libbtrfsutil/subvolume.c