Commit 0c97be22 authored by Andreas Gruenbacher's avatar Andreas Gruenbacher Committed by Miklos Szeredi

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: default avatarAndreas Gruenbacher <agruenba@redhat.com>
Signed-off-by: default avatarMiklos Szeredi <mszeredi@redhat.com>
parent fe2b7595
...@@ -986,7 +986,8 @@ static unsigned int ovl_split_lowerdirs(char *str) ...@@ -986,7 +986,8 @@ static unsigned int ovl_split_lowerdirs(char *str)
return ctr; return ctr;
} }
static int ovl_posix_acl_xattr_set(const struct xattr_handler *handler, static int __maybe_unused
ovl_posix_acl_xattr_set(const struct xattr_handler *handler,
struct dentry *dentry, struct inode *inode, struct dentry *dentry, struct inode *inode,
const char *name, const void *value, const char *name, const void *value,
size_t size, int flags) size_t size, int flags)
...@@ -1040,13 +1041,15 @@ static int ovl_own_xattr_set(const struct xattr_handler *handler, ...@@ -1040,13 +1041,15 @@ static int ovl_own_xattr_set(const struct xattr_handler *handler,
return -EPERM; return -EPERM;
} }
static const struct xattr_handler ovl_posix_acl_access_xattr_handler = { static const struct xattr_handler __maybe_unused
ovl_posix_acl_access_xattr_handler = {
.name = XATTR_NAME_POSIX_ACL_ACCESS, .name = XATTR_NAME_POSIX_ACL_ACCESS,
.flags = ACL_TYPE_ACCESS, .flags = ACL_TYPE_ACCESS,
.set = ovl_posix_acl_xattr_set, .set = ovl_posix_acl_xattr_set,
}; };
static const struct xattr_handler ovl_posix_acl_default_xattr_handler = { static const struct xattr_handler __maybe_unused
ovl_posix_acl_default_xattr_handler = {
.name = XATTR_NAME_POSIX_ACL_DEFAULT, .name = XATTR_NAME_POSIX_ACL_DEFAULT,
.flags = ACL_TYPE_DEFAULT, .flags = ACL_TYPE_DEFAULT,
.set = ovl_posix_acl_xattr_set, .set = ovl_posix_acl_xattr_set,
...@@ -1063,19 +1066,15 @@ static const struct xattr_handler ovl_other_xattr_handler = { ...@@ -1063,19 +1066,15 @@ static const struct xattr_handler ovl_other_xattr_handler = {
}; };
static const struct xattr_handler *ovl_xattr_handlers[] = { static const struct xattr_handler *ovl_xattr_handlers[] = {
#ifdef CONFIG_FS_POSIX_ACL
&ovl_posix_acl_access_xattr_handler, &ovl_posix_acl_access_xattr_handler,
&ovl_posix_acl_default_xattr_handler, &ovl_posix_acl_default_xattr_handler,
#endif
&ovl_own_xattr_handler, &ovl_own_xattr_handler,
&ovl_other_xattr_handler, &ovl_other_xattr_handler,
NULL NULL
}; };
static const struct xattr_handler *ovl_xattr_noacl_handlers[] = {
&ovl_own_xattr_handler,
&ovl_other_xattr_handler,
NULL,
};
static int ovl_fill_super(struct super_block *sb, void *data, int silent) static int ovl_fill_super(struct super_block *sb, void *data, int silent)
{ {
struct path upperpath = { NULL, NULL }; struct path upperpath = { NULL, NULL };
...@@ -1288,10 +1287,7 @@ static int ovl_fill_super(struct super_block *sb, void *data, int silent) ...@@ -1288,10 +1287,7 @@ static int ovl_fill_super(struct super_block *sb, void *data, int silent)
sb->s_magic = OVERLAYFS_SUPER_MAGIC; sb->s_magic = OVERLAYFS_SUPER_MAGIC;
sb->s_op = &ovl_super_operations; sb->s_op = &ovl_super_operations;
if (IS_ENABLED(CONFIG_FS_POSIX_ACL))
sb->s_xattr = ovl_xattr_handlers; sb->s_xattr = ovl_xattr_handlers;
else
sb->s_xattr = ovl_xattr_noacl_handlers;
sb->s_root = root_dentry; sb->s_root = root_dentry;
sb->s_fs_info = ufs; sb->s_fs_info = ufs;
sb->s_flags |= MS_POSIXACL; sb->s_flags |= MS_POSIXACL;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment