Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

fs: cleanup slight list_entry abuse

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 <linux@rasmusvillemoes.dk>
Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>

authored by

Rasmus Villemoes and committed by
Al Viro
db6172c4 8ea3a7c0

+13 -13
+1 -1
fs/affs/affs.h
··· 64 64 /* short cut to get to the affs specific inode data */ 65 65 static inline struct affs_inode_info *AFFS_I(struct inode *inode) 66 66 { 67 - return list_entry(inode, struct affs_inode_info, vfs_inode); 67 + return container_of(inode, struct affs_inode_info, vfs_inode); 68 68 } 69 69 70 70 /*
+1 -1
fs/befs/befs.h
··· 112 112 static inline struct befs_inode_info * 113 113 BEFS_I(const struct inode *inode) 114 114 { 115 - return list_entry(inode, struct befs_inode_info, vfs_inode); 115 + return container_of(inode, struct befs_inode_info, vfs_inode); 116 116 } 117 117 118 118 static inline befs_blocknr_t
+1 -1
fs/coda/coda_linux.h
··· 79 79 80 80 static inline struct coda_inode_info *ITOC(struct inode *inode) 81 81 { 82 - return list_entry(inode, struct coda_inode_info, vfs_inode); 82 + return container_of(inode, struct coda_inode_info, vfs_inode); 83 83 } 84 84 85 85 static __inline__ struct CodaFid *coda_i2f(struct inode *inode)
+1 -1
fs/hfs/hfs_fs.h
··· 252 252 #define __hfs_u_to_mtime(sec) cpu_to_be32(sec + 2082844800U - sys_tz.tz_minuteswest * 60) 253 253 #define __hfs_m_to_utime(sec) (be32_to_cpu(sec) - 2082844800U + sys_tz.tz_minuteswest * 60) 254 254 255 - #define HFS_I(inode) (list_entry(inode, struct hfs_inode_info, vfs_inode)) 255 + #define HFS_I(inode) (container_of(inode, struct hfs_inode_info, vfs_inode)) 256 256 #define HFS_SB(sb) ((struct hfs_sb_info *)(sb)->s_fs_info) 257 257 258 258 #define hfs_m_to_utime(time) (struct timespec){ .tv_sec = __hfs_m_to_utime(time) }
+1 -1
fs/hfsplus/hfsplus_fs.h
··· 263 263 264 264 static inline struct hfsplus_inode_info *HFSPLUS_I(struct inode *inode) 265 265 { 266 - return list_entry(inode, struct hfsplus_inode_info, vfs_inode); 266 + return container_of(inode, struct hfsplus_inode_info, vfs_inode); 267 267 } 268 268 269 269 /*
+1 -1
fs/hpfs/hpfs_fn.h
··· 304 304 305 305 static inline struct hpfs_inode_info *hpfs_i(struct inode *inode) 306 306 { 307 - return list_entry(inode, struct hpfs_inode_info, vfs_inode); 307 + return container_of(inode, struct hpfs_inode_info, vfs_inode); 308 308 } 309 309 310 310 static inline struct hpfs_sb_info *hpfs_sb(struct super_block *sb)
+1 -1
fs/jffs2/os-linux.h
··· 19 19 struct kstatfs; 20 20 struct kvec; 21 21 22 - #define JFFS2_INODE_INFO(i) (list_entry(i, struct jffs2_inode_info, vfs_inode)) 22 + #define JFFS2_INODE_INFO(i) (container_of(i, struct jffs2_inode_info, vfs_inode)) 23 23 #define OFNI_EDONI_2SFFJ(f) (&(f)->vfs_inode) 24 24 #define JFFS2_SB_INFO(sb) (sb->s_fs_info) 25 25 #define OFNI_BS_2SFFJ(c) ((struct super_block *)c->os_priv)
+1 -1
fs/jfs/jfs_incore.h
··· 206 206 207 207 static inline struct jfs_inode_info *JFS_IP(struct inode *inode) 208 208 { 209 - return list_entry(inode, struct jfs_inode_info, vfs_inode); 209 + return container_of(inode, struct jfs_inode_info, vfs_inode); 210 210 } 211 211 212 212 static inline int jfs_dirtable_inline(struct inode *inode)
+1 -1
fs/minix/minix.h
··· 84 84 85 85 static inline struct minix_inode_info *minix_i(struct inode *inode) 86 86 { 87 - return list_entry(inode, struct minix_inode_info, vfs_inode); 87 + return container_of(inode, struct minix_inode_info, vfs_inode); 88 88 } 89 89 90 90 static inline unsigned minix_blocks_needed(unsigned bits, unsigned blocksize)
+1 -1
fs/ntfs/inode.h
··· 239 239 */ 240 240 static inline ntfs_inode *NTFS_I(struct inode *inode) 241 241 { 242 - return (ntfs_inode *)list_entry(inode, big_ntfs_inode, vfs_inode); 242 + return (ntfs_inode *)container_of(inode, big_ntfs_inode, vfs_inode); 243 243 } 244 244 245 245 static inline struct inode *VFS_I(ntfs_inode *ni)
+1 -1
fs/squashfs/squashfs_fs_i.h
··· 49 49 50 50 static inline struct squashfs_inode_info *squashfs_i(struct inode *inode) 51 51 { 52 - return list_entry(inode, struct squashfs_inode_info, vfs_inode); 52 + return container_of(inode, struct squashfs_inode_info, vfs_inode); 53 53 } 54 54 #endif
+1 -1
fs/sysv/sysv.h
··· 73 73 74 74 static inline struct sysv_inode_info *SYSV_I(struct inode *inode) 75 75 { 76 - return list_entry(inode, struct sysv_inode_info, vfs_inode); 76 + return container_of(inode, struct sysv_inode_info, vfs_inode); 77 77 } 78 78 79 79 static inline struct sysv_sb_info *SYSV_SB(struct super_block *sb)
+1 -1
fs/udf/udf_i.h
··· 56 56 57 57 static inline struct udf_inode_info *UDF_I(struct inode *inode) 58 58 { 59 - return list_entry(inode, struct udf_inode_info, vfs_inode); 59 + return container_of(inode, struct udf_inode_info, vfs_inode); 60 60 } 61 61 62 62 #endif /* _UDF_I_H) */