Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

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

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
Loading
Loading
Loading
Loading
+12 −16
Original line number Diff line number Diff line
@@ -986,7 +986,8 @@ static unsigned int ovl_split_lowerdirs(char *str)
	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,
			const char *name, const void *value,
			size_t size, int flags)
@@ -1040,13 +1041,15 @@ static int ovl_own_xattr_set(const struct xattr_handler *handler,
	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,
	.flags = ACL_TYPE_ACCESS,
	.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,
	.flags = ACL_TYPE_DEFAULT,
	.set = ovl_posix_acl_xattr_set,
@@ -1063,19 +1066,15 @@ static const struct xattr_handler ovl_other_xattr_handler = {
};

static const struct xattr_handler *ovl_xattr_handlers[] = {
#ifdef CONFIG_FS_POSIX_ACL
	&ovl_posix_acl_access_xattr_handler,
	&ovl_posix_acl_default_xattr_handler,
#endif
	&ovl_own_xattr_handler,
	&ovl_other_xattr_handler,
	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)
{
	struct path upperpath = { NULL, NULL };
@@ -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_op = &ovl_super_operations;
	if (IS_ENABLED(CONFIG_FS_POSIX_ACL))
	sb->s_xattr = ovl_xattr_handlers;
	else
		sb->s_xattr = ovl_xattr_noacl_handlers;
	sb->s_root = root_dentry;
	sb->s_fs_info = ufs;
	sb->s_flags |= MS_POSIXACL;