mirror of
https://github.com/torvalds/linux.git
synced 2026-05-24 07:03:03 +02:00
btrfs: sysfs: show if ACL support has been compiled in
ACL support depends on the compile-time configuration option
CONFIG_BTRFS_FS_POSIX_ACL. Prior to mounting a btrfs filesystem, it is not
possible to determine whether ACL support has been compiled in. To address
this, add a sysfs interface, /sys/fs/btrfs/features/acl, and check for ACL
support in the system's btrfs.
To determine ACL support:
Return 0 indicates ACL is not supported:
$ cat /sys/fs/btrfs/features/acl
0
Return 1 indicates ACL is supported:
$ cat /sys/fs/btrfs/features/acl
1
IMO, this is a better approach, so that we also know if kernel is older.
On an older kernel
$ ls /sys/fs/btrfs/features/acl
ls: cannot access '/sys/fs/btrfs/features/acl': No such file or directory
mount a btrfs filesystem
$ cat /proc/self/mounts | grep btrfs | grep -q noacl
$ echo $?
0
Signed-off-by: Anand Jain <anand.jain@oracle.com>
Reviewed-by: David Sterba <dsterba@suse.com>
Signed-off-by: David Sterba <dsterba@suse.com>
This commit is contained in:
parent
3a3c7a7f65
commit
070bb0011c
|
|
@ -414,6 +414,12 @@ static ssize_t supported_sectorsizes_show(struct kobject *kobj,
|
|||
BTRFS_ATTR(static_feature, supported_sectorsizes,
|
||||
supported_sectorsizes_show);
|
||||
|
||||
static ssize_t acl_show(struct kobject *kobj, struct kobj_attribute *a, char *buf)
|
||||
{
|
||||
return sysfs_emit(buf, "%d\n", !!IS_ENABLED(CONFIG_BTRFS_FS_POSIX_ACL));
|
||||
}
|
||||
BTRFS_ATTR(static_feature, acl, acl_show);
|
||||
|
||||
/*
|
||||
* Features which only depend on kernel version.
|
||||
*
|
||||
|
|
@ -421,6 +427,7 @@ BTRFS_ATTR(static_feature, supported_sectorsizes,
|
|||
* btrfs_supported_feature_attrs.
|
||||
*/
|
||||
static struct attribute *btrfs_supported_static_feature_attrs[] = {
|
||||
BTRFS_ATTR_PTR(static_feature, acl),
|
||||
BTRFS_ATTR_PTR(static_feature, rmdir_subvol),
|
||||
BTRFS_ATTR_PTR(static_feature, supported_checksums),
|
||||
BTRFS_ATTR_PTR(static_feature, send_stream_version),
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user