On Thu, Feb 22, 2018 at 10:55:48AM +0900, Misono, Tomohiro wrote: > On 2018/02/16 4:04, Omar Sandoval wrote: > > From: Omar Sandoval <osan...@fb.com> > > > > set_default_subvolume() is a trivial ioctl(), but there's no ioctl() for > > get_default_subvolume(), so we need to search the root tree. > > > > Signed-off-by: Omar Sandoval <osan...@fb.com> > > --- > > libbtrfsutil/btrfsutil.h | 41 ++++++++++ > > libbtrfsutil/python/btrfsutilpy.h | 2 + > > libbtrfsutil/python/module.c | 14 ++++ > > libbtrfsutil/python/subvolume.c | 50 ++++++++++++ > > libbtrfsutil/python/tests/test_subvolume.py | 14 ++++ > > libbtrfsutil/subvolume.c | 113 > > ++++++++++++++++++++++++++++ > > 6 files changed, 234 insertions(+) > > > > diff --git a/libbtrfsutil/btrfsutil.h b/libbtrfsutil/btrfsutil.h > > index 8bd2b847..54777f1d 100644 > > --- a/libbtrfsutil/btrfsutil.h > > +++ b/libbtrfsutil/btrfsutil.h > > @@ -256,6 +256,8 @@ enum btrfs_util_error > > btrfs_util_get_subvolume_read_only_fd(int fd, bool *ret); > > * @path: Subvolume path. > > * @read_only: New value of read-only flag. > > * > > + * This requires appropriate privilege (CAP_SYS_ADMIN). > > + * > > * Return: %BTRFS_UTIL_OK on success, non-zero error code on failure. > > */ > > enum btrfs_util_error btrfs_util_set_subvolume_read_only(const char *path, > > @@ -268,6 +270,45 @@ enum btrfs_util_error > > btrfs_util_set_subvolume_read_only(const char *path, > > enum btrfs_util_error btrfs_util_set_subvolume_read_only_fd(int fd, > > bool read_only); > > > > +/** > > + * btrfs_util_get_default_subvolume() - Get the default subvolume for a > > + * filesystem. > > + * @path: Path on a Btrfs filesystem. > > + * @id_ret: Returned subvolume ID. > > + * > > + * This requires appropriate privilege (CAP_SYS_ADMIN). > > + * > > + * Return: %BTRFS_UTIL_OK on success, non-zero error code on failure. > > + */ > > +enum btrfs_util_error btrfs_util_get_default_subvolume(const char *path, > > + uint64_t *id_ret); > > + > > +/** > > + * btrfs_util_get_default_subvolume_fd() - See > > + * btrfs_util_get_default_subvolume(). > > + */ > > +enum btrfs_util_error btrfs_util_get_default_subvolume_fd(int fd, > > + uint64_t *id_ret); > > + > > +/** > > + * btrfs_util_set_default_subvolume() - Set the default subvolume for a > > + * filesystem. > > + * @path: Path in a Btrfs filesystem. This may be any path in the > > filesystem; it > > + * does not have to refer to a subvolume unless @id is zero. > > + * @id: ID of subvolume to set as the default. If zero is given, the > > subvolume > > + * ID of @path is used. > > The line "This requires appropriate privilege (CAP_SYS_ADMIN)." is missing > here.
Good catch, thanks, fixed. -- To unsubscribe from this list: send the line "unsubscribe linux-btrfs" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html