summaryrefslogtreecommitdiff
path: root/libbtrfsutil/python/module.c
diff options
context:
space:
mode:
authorOmar Sandoval <osandov@fb.com>2018-01-18 14:23:23 -0800
committerDavid Sterba <dsterba@suse.com>2018-03-06 11:28:37 +0100
commitcfa89b30821fedb48ca163a9c1128c4db596c911 (patch)
treebf04b519f0b9df71f542ec2ee8d9cbc2f4869dff /libbtrfsutil/python/module.c
parent0b8512b7f5a6106efcab371471c472572a55367e (diff)
libbtrfsutil: add btrfs_util_create_snapshot()
Thanks to subvolume iterators, we can also implement recursive snapshot fairly easily. 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.c11
1 files changed, 11 insertions, 0 deletions
diff --git a/libbtrfsutil/python/module.c b/libbtrfsutil/python/module.c
index 9a237142..3f0f6170 100644
--- a/libbtrfsutil/python/module.c
+++ b/libbtrfsutil/python/module.c
@@ -216,6 +216,17 @@ static PyMethodDef btrfsutil_methods[] = {
"path -- string, bytes, or path-like object\n"
"async -- create the subvolume without waiting for it to commit to\n"
"disk and return the transaction ID"},
+ {"create_snapshot", (PyCFunction)create_snapshot,
+ METH_VARARGS | METH_KEYWORDS,
+ "create_snapshot(source, path, recursive=False, read_only=False, async=False)\n\n"
+ "Create a new snapshot.\n\n"
+ "Arguments:\n"
+ "source -- string, bytes, path-like object, or open file descriptor\n"
+ "path -- string, bytes, or path-like object\n"
+ "recursive -- also snapshot child subvolumes\n"
+ "read_only -- create a read-only snapshot\n"
+ "async -- create the subvolume without waiting for it to commit to\n"
+ "disk and return the transaction ID"},
{},
};