Skip to content

Commit

Permalink
erofs: code cleanup by removing ifdef macro surrounding
Browse files Browse the repository at this point in the history
Define erofs_listxattr and erofs_xattr_handlers to NULL when
CONFIG_EROFS_FS_XATTR is not enabled, then we can remove many
ugly ifdef macros in the code.

Signed-off-by: Chengguang Xu <cgxu519@mykernel.net>
Reviewed-by: Gao Xiang <hsiangkao@redhat.com>
Reviewed-by: Chao Yu <yuchao0@huawei.com>
Link: https://lore.kernel.org/r/20200526090343.22794-1-cgxu519@mykernel.net
Signed-off-by: Gao Xiang <hsiangkao@redhat.com>
  • Loading branch information
Chengguang Xu authored and Gao Xiang committed May 27, 2020
1 parent 9cb1fd0 commit e7cda1e
Show file tree
Hide file tree
Showing 4 changed files with 3 additions and 16 deletions.
6 changes: 0 additions & 6 deletions fs/erofs/inode.c
Original file line number Diff line number Diff line change
Expand Up @@ -311,27 +311,21 @@ int erofs_getattr(const struct path *path, struct kstat *stat,

const struct inode_operations erofs_generic_iops = {
.getattr = erofs_getattr,
#ifdef CONFIG_EROFS_FS_XATTR
.listxattr = erofs_listxattr,
#endif
.get_acl = erofs_get_acl,
};

const struct inode_operations erofs_symlink_iops = {
.get_link = page_get_link,
.getattr = erofs_getattr,
#ifdef CONFIG_EROFS_FS_XATTR
.listxattr = erofs_listxattr,
#endif
.get_acl = erofs_get_acl,
};

const struct inode_operations erofs_fast_symlink_iops = {
.get_link = simple_get_link,
.getattr = erofs_getattr,
#ifdef CONFIG_EROFS_FS_XATTR
.listxattr = erofs_listxattr,
#endif
.get_acl = erofs_get_acl,
};

2 changes: 0 additions & 2 deletions fs/erofs/namei.c
Original file line number Diff line number Diff line change
Expand Up @@ -244,9 +244,7 @@ static struct dentry *erofs_lookup(struct inode *dir,
const struct inode_operations erofs_dir_iops = {
.lookup = erofs_lookup,
.getattr = erofs_getattr,
#ifdef CONFIG_EROFS_FS_XATTR
.listxattr = erofs_listxattr,
#endif
.get_acl = erofs_get_acl,
};

4 changes: 1 addition & 3 deletions fs/erofs/super.c
Original file line number Diff line number Diff line change
Expand Up @@ -408,10 +408,8 @@ static int erofs_fill_super(struct super_block *sb, void *data, int silent)
sb->s_time_gran = 1;

sb->s_op = &erofs_sops;

#ifdef CONFIG_EROFS_FS_XATTR
sb->s_xattr = erofs_xattr_handlers;
#endif

/* set erofs default mount options */
erofs_default_options(sbi);

Expand Down
7 changes: 2 additions & 5 deletions fs/erofs/xattr.h
Original file line number Diff line number Diff line change
Expand Up @@ -76,11 +76,8 @@ static inline int erofs_getxattr(struct inode *inode, int index,
return -EOPNOTSUPP;
}

static inline ssize_t erofs_listxattr(struct dentry *dentry,
char *buffer, size_t buffer_size)
{
return -EOPNOTSUPP;
}
#define erofs_listxattr (NULL)
#define erofs_xattr_handlers (NULL)
#endif /* !CONFIG_EROFS_FS_XATTR */

#ifdef CONFIG_EROFS_FS_POSIX_ACL
Expand Down

0 comments on commit e7cda1e

Please sign in to comment.