ubifs: Code cleanup by removing ifdef macro surrounding
authorChengguang Xu <cgxu519@mykernel.net>
Tue, 26 May 2020 09:07:12 +0000 (17:07 +0800)
committerRichard Weinberger <richard@nod.at>
Sun, 13 Dec 2020 20:51:59 +0000 (21:51 +0100)
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 <cgxu519@mykernel.net>
Signed-off-by: Richard Weinberger <richard@nod.at>
fs/ubifs/dir.c
fs/ubifs/file.c
fs/ubifs/super.c
fs/ubifs/ubifs.h

index 301810e5bf92b0393f0a3728abcc2a3ed013504b..3c432f054a50e9275e6300b154bee987e60bdf5b 100644 (file)
@@ -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,
 };
index ed58767143ab05fc4a7bfb56f0abbfbd6fe89529..cacb970bcf48b7ddbf624bb949f8a8d83b3d5d72 100644 (file)
@@ -1645,9 +1645,7 @@ 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,
 };
 
@@ -1655,9 +1653,7 @@ 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,
 };
 
index cb3acfb7dd1fc01e24a53cbde1e3035fc760c95c..b238f0ca1608e0c9c170a11f938bf09765d289b3 100644 (file)
@@ -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);
index 4ffd832e3b93706e2dc05efd508462843725c266..f99450844ac32630cd71c4a65a5bf27d466fc84b 100644 (file)
@@ -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)