Skip to content

Commit

Permalink
ubifs: Code cleanup by removing ifdef macro surrounding
Browse files Browse the repository at this point in the history
Define ubifs_listxattr and ubifs_xattr_handlers to NULL
when CONFIG_UBIFS_FS_XATTR is not enabled, then we can
remove many ugly ifdef macros in the code.

Signed-off-by: Chengguang Xu <[email protected]>
Signed-off-by: Richard Weinberger <[email protected]>
  • Loading branch information
cgxu519 authored and richardweinberger committed Dec 13, 2020
1 parent 8fdaaf4 commit 2976c19
Show file tree
Hide file tree
Showing 4 changed files with 4 additions and 10 deletions.
2 changes: 0 additions & 2 deletions fs/ubifs/dir.c
Original file line number Diff line number Diff line change
Expand Up @@ -1630,9 +1630,7 @@ const struct inode_operations ubifs_dir_inode_operations = {
.rename = ubifs_rename,
.setattr = ubifs_setattr,
.getattr = ubifs_getattr,
#ifdef CONFIG_UBIFS_FS_XATTR
.listxattr = ubifs_listxattr,
#endif
.update_time = ubifs_update_time,
.tmpfile = ubifs_tmpfile,
};
Expand Down
4 changes: 0 additions & 4 deletions fs/ubifs/file.c
Original file line number Diff line number Diff line change
Expand Up @@ -1645,19 +1645,15 @@ const struct address_space_operations ubifs_file_address_operations = {
const struct inode_operations ubifs_file_inode_operations = {
.setattr = ubifs_setattr,
.getattr = ubifs_getattr,
#ifdef CONFIG_UBIFS_FS_XATTR
.listxattr = ubifs_listxattr,
#endif
.update_time = ubifs_update_time,
};

const struct inode_operations ubifs_symlink_inode_operations = {
.get_link = ubifs_get_link,
.setattr = ubifs_setattr,
.getattr = ubifs_getattr,
#ifdef CONFIG_UBIFS_FS_XATTR
.listxattr = ubifs_listxattr,
#endif
.update_time = ubifs_update_time,
};

Expand Down
2 changes: 0 additions & 2 deletions fs/ubifs/super.c
Original file line number Diff line number Diff line change
Expand Up @@ -2207,9 +2207,7 @@ static int ubifs_fill_super(struct super_block *sb, void *data, int silent)
if (c->max_inode_sz > MAX_LFS_FILESIZE)
sb->s_maxbytes = c->max_inode_sz = MAX_LFS_FILESIZE;
sb->s_op = &ubifs_super_operations;
#ifdef CONFIG_UBIFS_FS_XATTR
sb->s_xattr = ubifs_xattr_handlers;
#endif
fscrypt_set_ops(sb, &ubifs_crypt_operations);

mutex_lock(&c->umount_mutex);
Expand Down
6 changes: 4 additions & 2 deletions fs/ubifs/ubifs.h
Original file line number Diff line number Diff line change
Expand Up @@ -2000,17 +2000,19 @@ int ubifs_getattr(const struct path *path, struct kstat *stat,
int ubifs_check_dir_empty(struct inode *dir);

/* xattr.c */
extern const struct xattr_handler *ubifs_xattr_handlers[];
ssize_t ubifs_listxattr(struct dentry *dentry, char *buffer, size_t size);
int ubifs_xattr_set(struct inode *host, const char *name, const void *value,
size_t size, int flags, bool check_lock);
ssize_t ubifs_xattr_get(struct inode *host, const char *name, void *buf,
size_t size);

#ifdef CONFIG_UBIFS_FS_XATTR
extern const struct xattr_handler *ubifs_xattr_handlers[];
ssize_t ubifs_listxattr(struct dentry *dentry, char *buffer, size_t size);
void ubifs_evict_xattr_inode(struct ubifs_info *c, ino_t xattr_inum);
int ubifs_purge_xattrs(struct inode *host);
#else
#define ubifs_listxattr NULL
#define ubifs_xattr_handlers NULL
static inline void ubifs_evict_xattr_inode(struct ubifs_info *c,
ino_t xattr_inum) { }
static inline int ubifs_purge_xattrs(struct inode *host)
Expand Down

0 comments on commit 2976c19

Please sign in to comment.