ext2: code cleanup by removing ifdef macro surrounding
authorChengguang Xu <cgxu519@mykernel.net>
Fri, 22 May 2020 04:40:35 +0000 (12:40 +0800)
committerJan Kara <jack@suse.cz>
Fri, 22 May 2020 13:11:00 +0000 (15:11 +0200)
Define ext2_listxattr to NULL when CONFIG_EROFS_FS_XATTR
is not enabled, then we can remove many ugly ifdef macros
in the code.

Link: https://lore.kernel.org/r/20200522044035.24190-2-cgxu519@mykernel.net
Signed-off-by: Chengguang Xu <cgxu519@mykernel.net>
Signed-off-by: Jan Kara <jack@suse.cz>
fs/ext2/file.c
fs/ext2/namei.c
fs/ext2/symlink.c
fs/ext2/xattr.h

index 39c4772..b4de9a0 100644 (file)
@@ -196,9 +196,7 @@ const struct file_operations ext2_file_operations = {
 };
 
 const struct inode_operations ext2_file_inode_operations = {
-#ifdef CONFIG_EXT2_FS_XATTR
        .listxattr      = ext2_listxattr,
-#endif
        .getattr        = ext2_getattr,
        .setattr        = ext2_setattr,
        .get_acl        = ext2_get_acl,
index 1a5421a..ba3e3e0 100644 (file)
@@ -411,9 +411,7 @@ const struct inode_operations ext2_dir_inode_operations = {
        .rmdir          = ext2_rmdir,
        .mknod          = ext2_mknod,
        .rename         = ext2_rename,
-#ifdef CONFIG_EXT2_FS_XATTR
        .listxattr      = ext2_listxattr,
-#endif
        .getattr        = ext2_getattr,
        .setattr        = ext2_setattr,
        .get_acl        = ext2_get_acl,
@@ -422,9 +420,7 @@ const struct inode_operations ext2_dir_inode_operations = {
 };
 
 const struct inode_operations ext2_special_inode_operations = {
-#ifdef CONFIG_EXT2_FS_XATTR
        .listxattr      = ext2_listxattr,
-#endif
        .getattr        = ext2_getattr,
        .setattr        = ext2_setattr,
        .get_acl        = ext2_get_acl,
index 00cdb86..948d3a4 100644 (file)
@@ -25,16 +25,12 @@ const struct inode_operations ext2_symlink_inode_operations = {
        .get_link       = page_get_link,
        .getattr        = ext2_getattr,
        .setattr        = ext2_setattr,
-#ifdef CONFIG_EXT2_FS_XATTR
        .listxattr      = ext2_listxattr,
-#endif
 };
  
 const struct inode_operations ext2_fast_symlink_inode_operations = {
        .get_link       = simple_get_link,
        .getattr        = ext2_getattr,
        .setattr        = ext2_setattr,
-#ifdef CONFIG_EXT2_FS_XATTR
        .listxattr      = ext2_listxattr,
-#endif
 };
index 16272e6..7925f59 100644 (file)
@@ -100,6 +100,7 @@ static inline void ext2_xattr_destroy_cache(struct mb_cache *cache)
 }
 
 #define ext2_xattr_handlers NULL
+#define ext2_listxattr NULL
 
 # endif  /* CONFIG_EXT2_FS_XATTR */