Commit e7cda1ee authored by Chengguang Xu's avatar Chengguang Xu Committed by Gao Xiang

erofs: code cleanup by removing ifdef macro surrounding

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: default avatarChengguang Xu <cgxu519@mykernel.net>
Reviewed-by: default avatarGao Xiang <hsiangkao@redhat.com>
Reviewed-by: default avatarChao Yu <yuchao0@huawei.com>
Link: https://lore.kernel.org/r/20200526090343.22794-1-cgxu519@mykernel.netSigned-off-by: default avatarGao Xiang <hsiangkao@redhat.com>
parent 9cb1fd0e
...@@ -311,27 +311,21 @@ int erofs_getattr(const struct path *path, struct kstat *stat, ...@@ -311,27 +311,21 @@ int erofs_getattr(const struct path *path, struct kstat *stat,
const struct inode_operations erofs_generic_iops = { const struct inode_operations erofs_generic_iops = {
.getattr = erofs_getattr, .getattr = erofs_getattr,
#ifdef CONFIG_EROFS_FS_XATTR
.listxattr = erofs_listxattr, .listxattr = erofs_listxattr,
#endif
.get_acl = erofs_get_acl, .get_acl = erofs_get_acl,
}; };
const struct inode_operations erofs_symlink_iops = { const struct inode_operations erofs_symlink_iops = {
.get_link = page_get_link, .get_link = page_get_link,
.getattr = erofs_getattr, .getattr = erofs_getattr,
#ifdef CONFIG_EROFS_FS_XATTR
.listxattr = erofs_listxattr, .listxattr = erofs_listxattr,
#endif
.get_acl = erofs_get_acl, .get_acl = erofs_get_acl,
}; };
const struct inode_operations erofs_fast_symlink_iops = { const struct inode_operations erofs_fast_symlink_iops = {
.get_link = simple_get_link, .get_link = simple_get_link,
.getattr = erofs_getattr, .getattr = erofs_getattr,
#ifdef CONFIG_EROFS_FS_XATTR
.listxattr = erofs_listxattr, .listxattr = erofs_listxattr,
#endif
.get_acl = erofs_get_acl, .get_acl = erofs_get_acl,
}; };
...@@ -244,9 +244,7 @@ static struct dentry *erofs_lookup(struct inode *dir, ...@@ -244,9 +244,7 @@ static struct dentry *erofs_lookup(struct inode *dir,
const struct inode_operations erofs_dir_iops = { const struct inode_operations erofs_dir_iops = {
.lookup = erofs_lookup, .lookup = erofs_lookup,
.getattr = erofs_getattr, .getattr = erofs_getattr,
#ifdef CONFIG_EROFS_FS_XATTR
.listxattr = erofs_listxattr, .listxattr = erofs_listxattr,
#endif
.get_acl = erofs_get_acl, .get_acl = erofs_get_acl,
}; };
...@@ -408,10 +408,8 @@ static int erofs_fill_super(struct super_block *sb, void *data, int silent) ...@@ -408,10 +408,8 @@ static int erofs_fill_super(struct super_block *sb, void *data, int silent)
sb->s_time_gran = 1; sb->s_time_gran = 1;
sb->s_op = &erofs_sops; sb->s_op = &erofs_sops;
#ifdef CONFIG_EROFS_FS_XATTR
sb->s_xattr = erofs_xattr_handlers; sb->s_xattr = erofs_xattr_handlers;
#endif
/* set erofs default mount options */ /* set erofs default mount options */
erofs_default_options(sbi); erofs_default_options(sbi);
......
...@@ -76,11 +76,8 @@ static inline int erofs_getxattr(struct inode *inode, int index, ...@@ -76,11 +76,8 @@ static inline int erofs_getxattr(struct inode *inode, int index,
return -EOPNOTSUPP; return -EOPNOTSUPP;
} }
static inline ssize_t erofs_listxattr(struct dentry *dentry, #define erofs_listxattr (NULL)
char *buffer, size_t buffer_size) #define erofs_xattr_handlers (NULL)
{
return -EOPNOTSUPP;
}
#endif /* !CONFIG_EROFS_FS_XATTR */ #endif /* !CONFIG_EROFS_FS_XATTR */
#ifdef CONFIG_EROFS_FS_POSIX_ACL #ifdef CONFIG_EROFS_FS_POSIX_ACL
......
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