aboutsummaryrefslogtreecommitdiffstats
path: root/fs
diff options
context:
space:
mode:
authorAndreas Gruenbacher <agruenba@redhat.com>2016-08-22 10:36:49 -0400
committerMiklos Szeredi <mszeredi@redhat.com>2016-09-01 05:11:59 -0400
commit0c97be22f928b85110504c4bbb8574facb4bd0c0 (patch)
tree3be9e72efa0eb6e0f01033acc9d268c1963006b4 /fs
parentfe2b75952347762a21f67d9df1199137ae5988b2 (diff)
ovl: Get rid of ovl_xattr_noacl_handlers array
Use an ordinary #ifdef to conditionally include the POSIX ACL handlers in ovl_xattr_handlers, like the other filesystems do. Flag the code that is now only used conditionally with __maybe_unused. Signed-off-by: Andreas Gruenbacher <agruenba@redhat.com> Signed-off-by: Miklos Szeredi <mszeredi@redhat.com>
Diffstat (limited to 'fs')
-rw-r--r--fs/overlayfs/super.c28
1 files changed, 12 insertions, 16 deletions
diff --git a/fs/overlayfs/super.c b/fs/overlayfs/super.c
index 6aad7d4e2601..c35619195385 100644
--- a/fs/overlayfs/super.c
+++ b/fs/overlayfs/super.c
@@ -986,10 +986,11 @@ static unsigned int ovl_split_lowerdirs(char *str)
986 return ctr; 986 return ctr;
987} 987}
988 988
989static int ovl_posix_acl_xattr_set(const struct xattr_handler *handler, 989static int __maybe_unused
990 struct dentry *dentry, struct inode *inode, 990ovl_posix_acl_xattr_set(const struct xattr_handler *handler,
991 const char *name, const void *value, 991 struct dentry *dentry, struct inode *inode,
992 size_t size, int flags) 992 const char *name, const void *value,
993 size_t size, int flags)
993{ 994{
994 struct dentry *workdir = ovl_workdir(dentry); 995 struct dentry *workdir = ovl_workdir(dentry);
995 struct inode *realinode = ovl_inode_real(inode, NULL); 996 struct inode *realinode = ovl_inode_real(inode, NULL);
@@ -1040,13 +1041,15 @@ static int ovl_own_xattr_set(const struct xattr_handler *handler,
1040 return -EPERM; 1041 return -EPERM;
1041} 1042}
1042 1043
1043static const struct xattr_handler ovl_posix_acl_access_xattr_handler = { 1044static const struct xattr_handler __maybe_unused
1045ovl_posix_acl_access_xattr_handler = {
1044 .name = XATTR_NAME_POSIX_ACL_ACCESS, 1046 .name = XATTR_NAME_POSIX_ACL_ACCESS,
1045 .flags = ACL_TYPE_ACCESS, 1047 .flags = ACL_TYPE_ACCESS,
1046 .set = ovl_posix_acl_xattr_set, 1048 .set = ovl_posix_acl_xattr_set,
1047}; 1049};
1048 1050
1049static const struct xattr_handler ovl_posix_acl_default_xattr_handler = { 1051static const struct xattr_handler __maybe_unused
1052ovl_posix_acl_default_xattr_handler = {
1050 .name = XATTR_NAME_POSIX_ACL_DEFAULT, 1053 .name = XATTR_NAME_POSIX_ACL_DEFAULT,
1051 .flags = ACL_TYPE_DEFAULT, 1054 .flags = ACL_TYPE_DEFAULT,
1052 .set = ovl_posix_acl_xattr_set, 1055 .set = ovl_posix_acl_xattr_set,
@@ -1063,19 +1066,15 @@ static const struct xattr_handler ovl_other_xattr_handler = {
1063}; 1066};
1064 1067
1065static const struct xattr_handler *ovl_xattr_handlers[] = { 1068static const struct xattr_handler *ovl_xattr_handlers[] = {
1069#ifdef CONFIG_FS_POSIX_ACL
1066 &ovl_posix_acl_access_xattr_handler, 1070 &ovl_posix_acl_access_xattr_handler,
1067 &ovl_posix_acl_default_xattr_handler, 1071 &ovl_posix_acl_default_xattr_handler,
1072#endif
1068 &ovl_own_xattr_handler, 1073 &ovl_own_xattr_handler,
1069 &ovl_other_xattr_handler, 1074 &ovl_other_xattr_handler,
1070 NULL 1075 NULL
1071}; 1076};
1072 1077
1073static const struct xattr_handler *ovl_xattr_noacl_handlers[] = {
1074 &ovl_own_xattr_handler,
1075 &ovl_other_xattr_handler,
1076 NULL,
1077};
1078
1079static int ovl_fill_super(struct super_block *sb, void *data, int silent) 1078static int ovl_fill_super(struct super_block *sb, void *data, int silent)
1080{ 1079{
1081 struct path upperpath = { NULL, NULL }; 1080 struct path upperpath = { NULL, NULL };
@@ -1288,10 +1287,7 @@ static int ovl_fill_super(struct super_block *sb, void *data, int silent)
1288 1287
1289 sb->s_magic = OVERLAYFS_SUPER_MAGIC; 1288 sb->s_magic = OVERLAYFS_SUPER_MAGIC;
1290 sb->s_op = &ovl_super_operations; 1289 sb->s_op = &ovl_super_operations;
1291 if (IS_ENABLED(CONFIG_FS_POSIX_ACL)) 1290 sb->s_xattr = ovl_xattr_handlers;
1292 sb->s_xattr = ovl_xattr_handlers;
1293 else
1294 sb->s_xattr = ovl_xattr_noacl_handlers;
1295 sb->s_root = root_dentry; 1291 sb->s_root = root_dentry;
1296 sb->s_fs_info = ufs; 1292 sb->s_fs_info = ufs;
1297 sb->s_flags |= MS_POSIXACL; 1293 sb->s_flags |= MS_POSIXACL;