Skip to content

Commit e7cda1e

Browse files
cgxu519Gao Xiang
authored andcommitted
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: Chengguang Xu <[email protected]> Reviewed-by: Gao Xiang <[email protected]> Reviewed-by: Chao Yu <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Gao Xiang <[email protected]>
1 parent 9cb1fd0 commit e7cda1e

File tree

4 files changed

+3
-16
lines changed

4 files changed

+3
-16
lines changed

fs/erofs/inode.c

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -311,27 +311,21 @@ int erofs_getattr(const struct path *path, struct kstat *stat,
311311

312312
const struct inode_operations erofs_generic_iops = {
313313
.getattr = erofs_getattr,
314-
#ifdef CONFIG_EROFS_FS_XATTR
315314
.listxattr = erofs_listxattr,
316-
#endif
317315
.get_acl = erofs_get_acl,
318316
};
319317

320318
const struct inode_operations erofs_symlink_iops = {
321319
.get_link = page_get_link,
322320
.getattr = erofs_getattr,
323-
#ifdef CONFIG_EROFS_FS_XATTR
324321
.listxattr = erofs_listxattr,
325-
#endif
326322
.get_acl = erofs_get_acl,
327323
};
328324

329325
const struct inode_operations erofs_fast_symlink_iops = {
330326
.get_link = simple_get_link,
331327
.getattr = erofs_getattr,
332-
#ifdef CONFIG_EROFS_FS_XATTR
333328
.listxattr = erofs_listxattr,
334-
#endif
335329
.get_acl = erofs_get_acl,
336330
};
337331

fs/erofs/namei.c

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -244,9 +244,7 @@ static struct dentry *erofs_lookup(struct inode *dir,
244244
const struct inode_operations erofs_dir_iops = {
245245
.lookup = erofs_lookup,
246246
.getattr = erofs_getattr,
247-
#ifdef CONFIG_EROFS_FS_XATTR
248247
.listxattr = erofs_listxattr,
249-
#endif
250248
.get_acl = erofs_get_acl,
251249
};
252250

fs/erofs/super.c

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -408,10 +408,8 @@ static int erofs_fill_super(struct super_block *sb, void *data, int silent)
408408
sb->s_time_gran = 1;
409409

410410
sb->s_op = &erofs_sops;
411-
412-
#ifdef CONFIG_EROFS_FS_XATTR
413411
sb->s_xattr = erofs_xattr_handlers;
414-
#endif
412+
415413
/* set erofs default mount options */
416414
erofs_default_options(sbi);
417415

fs/erofs/xattr.h

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -76,11 +76,8 @@ static inline int erofs_getxattr(struct inode *inode, int index,
7676
return -EOPNOTSUPP;
7777
}
7878

79-
static inline ssize_t erofs_listxattr(struct dentry *dentry,
80-
char *buffer, size_t buffer_size)
81-
{
82-
return -EOPNOTSUPP;
83-
}
79+
#define erofs_listxattr (NULL)
80+
#define erofs_xattr_handlers (NULL)
8481
#endif /* !CONFIG_EROFS_FS_XATTR */
8582

8683
#ifdef CONFIG_EROFS_FS_POSIX_ACL

0 commit comments

Comments
 (0)