Skip to content

Commit

Permalink
fs: cleanup slight list_entry abuse
Browse files Browse the repository at this point in the history
list_entry is just a wrapper for container_of, but it is arguably
wrong (and slightly confusing) to use it when the pointed-to struct
member is not a struct list_head. Use container_of directly instead.

Signed-off-by: Rasmus Villemoes <[email protected]>
Signed-off-by: Al Viro <[email protected]>
  • Loading branch information
Villemoes authored and Al Viro committed Jun 23, 2015
1 parent 8ea3a7c commit db6172c
Show file tree
Hide file tree
Showing 13 changed files with 13 additions and 13 deletions.
2 changes: 1 addition & 1 deletion fs/affs/affs.h
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ struct affs_inode_info {
/* short cut to get to the affs specific inode data */
static inline struct affs_inode_info *AFFS_I(struct inode *inode)
{
return list_entry(inode, struct affs_inode_info, vfs_inode);
return container_of(inode, struct affs_inode_info, vfs_inode);
}

/*
Expand Down
2 changes: 1 addition & 1 deletion fs/befs/befs.h
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,7 @@ BEFS_SB(const struct super_block *super)
static inline struct befs_inode_info *
BEFS_I(const struct inode *inode)
{
return list_entry(inode, struct befs_inode_info, vfs_inode);
return container_of(inode, struct befs_inode_info, vfs_inode);
}

static inline befs_blocknr_t
Expand Down
2 changes: 1 addition & 1 deletion fs/coda/coda_linux.h
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ void coda_sysctl_clean(void);

static inline struct coda_inode_info *ITOC(struct inode *inode)
{
return list_entry(inode, struct coda_inode_info, vfs_inode);
return container_of(inode, struct coda_inode_info, vfs_inode);
}

static __inline__ struct CodaFid *coda_i2f(struct inode *inode)
Expand Down
2 changes: 1 addition & 1 deletion fs/hfs/hfs_fs.h
Original file line number Diff line number Diff line change
Expand Up @@ -252,7 +252,7 @@ extern void hfs_mark_mdb_dirty(struct super_block *sb);
#define __hfs_u_to_mtime(sec) cpu_to_be32(sec + 2082844800U - sys_tz.tz_minuteswest * 60)
#define __hfs_m_to_utime(sec) (be32_to_cpu(sec) - 2082844800U + sys_tz.tz_minuteswest * 60)

#define HFS_I(inode) (list_entry(inode, struct hfs_inode_info, vfs_inode))
#define HFS_I(inode) (container_of(inode, struct hfs_inode_info, vfs_inode))
#define HFS_SB(sb) ((struct hfs_sb_info *)(sb)->s_fs_info)

#define hfs_m_to_utime(time) (struct timespec){ .tv_sec = __hfs_m_to_utime(time) }
Expand Down
2 changes: 1 addition & 1 deletion fs/hfsplus/hfsplus_fs.h
Original file line number Diff line number Diff line change
Expand Up @@ -263,7 +263,7 @@ struct hfsplus_inode_info {

static inline struct hfsplus_inode_info *HFSPLUS_I(struct inode *inode)
{
return list_entry(inode, struct hfsplus_inode_info, vfs_inode);
return container_of(inode, struct hfsplus_inode_info, vfs_inode);
}

/*
Expand Down
2 changes: 1 addition & 1 deletion fs/hpfs/hpfs_fn.h
Original file line number Diff line number Diff line change
Expand Up @@ -304,7 +304,7 @@ extern const struct address_space_operations hpfs_symlink_aops;

static inline struct hpfs_inode_info *hpfs_i(struct inode *inode)
{
return list_entry(inode, struct hpfs_inode_info, vfs_inode);
return container_of(inode, struct hpfs_inode_info, vfs_inode);
}

static inline struct hpfs_sb_info *hpfs_sb(struct super_block *sb)
Expand Down
2 changes: 1 addition & 1 deletion fs/jffs2/os-linux.h
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
struct kstatfs;
struct kvec;

#define JFFS2_INODE_INFO(i) (list_entry(i, struct jffs2_inode_info, vfs_inode))
#define JFFS2_INODE_INFO(i) (container_of(i, struct jffs2_inode_info, vfs_inode))
#define OFNI_EDONI_2SFFJ(f) (&(f)->vfs_inode)
#define JFFS2_SB_INFO(sb) (sb->s_fs_info)
#define OFNI_BS_2SFFJ(c) ((struct super_block *)c->os_priv)
Expand Down
2 changes: 1 addition & 1 deletion fs/jfs/jfs_incore.h
Original file line number Diff line number Diff line change
Expand Up @@ -206,7 +206,7 @@ struct jfs_sb_info {

static inline struct jfs_inode_info *JFS_IP(struct inode *inode)
{
return list_entry(inode, struct jfs_inode_info, vfs_inode);
return container_of(inode, struct jfs_inode_info, vfs_inode);
}

static inline int jfs_dirtable_inline(struct inode *inode)
Expand Down
2 changes: 1 addition & 1 deletion fs/minix/minix.h
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ static inline struct minix_sb_info *minix_sb(struct super_block *sb)

static inline struct minix_inode_info *minix_i(struct inode *inode)
{
return list_entry(inode, struct minix_inode_info, vfs_inode);
return container_of(inode, struct minix_inode_info, vfs_inode);
}

static inline unsigned minix_blocks_needed(unsigned bits, unsigned blocksize)
Expand Down
2 changes: 1 addition & 1 deletion fs/ntfs/inode.h
Original file line number Diff line number Diff line change
Expand Up @@ -239,7 +239,7 @@ typedef struct {
*/
static inline ntfs_inode *NTFS_I(struct inode *inode)
{
return (ntfs_inode *)list_entry(inode, big_ntfs_inode, vfs_inode);
return (ntfs_inode *)container_of(inode, big_ntfs_inode, vfs_inode);
}

static inline struct inode *VFS_I(ntfs_inode *ni)
Expand Down
2 changes: 1 addition & 1 deletion fs/squashfs/squashfs_fs_i.h
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,6 @@ struct squashfs_inode_info {

static inline struct squashfs_inode_info *squashfs_i(struct inode *inode)
{
return list_entry(inode, struct squashfs_inode_info, vfs_inode);
return container_of(inode, struct squashfs_inode_info, vfs_inode);
}
#endif
2 changes: 1 addition & 1 deletion fs/sysv/sysv.h
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ struct sysv_inode_info {

static inline struct sysv_inode_info *SYSV_I(struct inode *inode)
{
return list_entry(inode, struct sysv_inode_info, vfs_inode);
return container_of(inode, struct sysv_inode_info, vfs_inode);
}

static inline struct sysv_sb_info *SYSV_SB(struct super_block *sb)
Expand Down
2 changes: 1 addition & 1 deletion fs/udf/udf_i.h
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ struct udf_inode_info {

static inline struct udf_inode_info *UDF_I(struct inode *inode)
{
return list_entry(inode, struct udf_inode_info, vfs_inode);
return container_of(inode, struct udf_inode_info, vfs_inode);
}

#endif /* _UDF_I_H) */

0 comments on commit db6172c

Please sign in to comment.