summaryrefslogtreecommitdiff
path: root/libbtrfsutil/python/module.c
diff options
context:
space:
mode:
authorOmar Sandoval <osandov@fb.com>2018-02-14 22:16:33 -0800
committerDavid Sterba <dsterba@suse.com>2018-03-06 11:28:36 +0100
commit8b87811f945bec2a0681334030ed51af1e4828f6 (patch)
tree217417d7eeddb7eb5704908ae8991c4b5158187d /libbtrfsutil/python/module.c
parentf676a8ad118ecba7fbf4edc77b91f788c6fa7e7c (diff)
libbtrfsutil: add btrfs_util_subvolume_path()
We can just walk up root backrefs with BTRFS_IOC_TREE_SEARCH and inode paths with BTRFS_IOC_INO_LOOKUP. Signed-off-by: Omar Sandoval <osandov@fb.com> Signed-off-by: David Sterba <dsterba@suse.com>
Diffstat (limited to 'libbtrfsutil/python/module.c')
-rw-r--r--libbtrfsutil/python/module.c8
1 files changed, 8 insertions, 0 deletions
diff --git a/libbtrfsutil/python/module.c b/libbtrfsutil/python/module.c
index deb26875..455e909a 100644
--- a/libbtrfsutil/python/module.c
+++ b/libbtrfsutil/python/module.c
@@ -165,6 +165,14 @@ static PyMethodDef btrfsutil_methods[] = {
"Get the ID of the subvolume containing a file.\n\n"
"Arguments:\n"
"path -- string, bytes, path-like object, or open file descriptor"},
+ {"subvolume_path", (PyCFunction)subvolume_path,
+ METH_VARARGS | METH_KEYWORDS,
+ "subvolume_path(path, id=0) -> int\n\n"
+ "Get the path of a subvolume relative to the filesystem root.\n\n"
+ "Arguments:\n"
+ "path -- string, bytes, path-like object, or open file descriptor\n"
+ "id -- if not zero, instead of returning the subvolume path of the\n"
+ "given path, return the path of the subvolume with this ID"},
{"create_subvolume", (PyCFunction)create_subvolume,
METH_VARARGS | METH_KEYWORDS,
"create_subvolume(path, async=False)\n\n"