1*4882a593Smuzhiyun /* SPDX-License-Identifier: GPL-2.0 */ 2*4882a593Smuzhiyun #ifndef _UDF_I_H 3*4882a593Smuzhiyun #define _UDF_I_H 4*4882a593Smuzhiyun 5*4882a593Smuzhiyun struct extent_position { 6*4882a593Smuzhiyun struct buffer_head *bh; 7*4882a593Smuzhiyun uint32_t offset; 8*4882a593Smuzhiyun struct kernel_lb_addr block; 9*4882a593Smuzhiyun }; 10*4882a593Smuzhiyun 11*4882a593Smuzhiyun struct udf_ext_cache { 12*4882a593Smuzhiyun /* Extent position */ 13*4882a593Smuzhiyun struct extent_position epos; 14*4882a593Smuzhiyun /* Start logical offset in bytes */ 15*4882a593Smuzhiyun loff_t lstart; 16*4882a593Smuzhiyun }; 17*4882a593Smuzhiyun 18*4882a593Smuzhiyun /* 19*4882a593Smuzhiyun * The i_data_sem and i_mutex serve for protection of allocation information 20*4882a593Smuzhiyun * of a regular files and symlinks. This includes all extents belonging to 21*4882a593Smuzhiyun * the file/symlink, a fact whether data are in-inode or in external data 22*4882a593Smuzhiyun * blocks, preallocation, goal block information... When extents are read, 23*4882a593Smuzhiyun * i_mutex or i_data_sem must be held (for reading is enough in case of 24*4882a593Smuzhiyun * i_data_sem). When extents are changed, i_data_sem must be held for writing 25*4882a593Smuzhiyun * and also i_mutex must be held. 26*4882a593Smuzhiyun * 27*4882a593Smuzhiyun * For directories i_mutex is used for all the necessary protection. 28*4882a593Smuzhiyun */ 29*4882a593Smuzhiyun 30*4882a593Smuzhiyun struct udf_inode_info { 31*4882a593Smuzhiyun struct timespec64 i_crtime; 32*4882a593Smuzhiyun /* Physical address of inode */ 33*4882a593Smuzhiyun struct kernel_lb_addr i_location; 34*4882a593Smuzhiyun __u64 i_unique; 35*4882a593Smuzhiyun __u32 i_lenEAttr; 36*4882a593Smuzhiyun __u32 i_lenAlloc; 37*4882a593Smuzhiyun __u64 i_lenExtents; 38*4882a593Smuzhiyun __u32 i_next_alloc_block; 39*4882a593Smuzhiyun __u32 i_next_alloc_goal; 40*4882a593Smuzhiyun __u32 i_checkpoint; 41*4882a593Smuzhiyun __u32 i_extraPerms; 42*4882a593Smuzhiyun unsigned i_alloc_type : 3; 43*4882a593Smuzhiyun unsigned i_efe : 1; /* extendedFileEntry */ 44*4882a593Smuzhiyun unsigned i_use : 1; /* unallocSpaceEntry */ 45*4882a593Smuzhiyun unsigned i_strat4096 : 1; 46*4882a593Smuzhiyun unsigned i_streamdir : 1; 47*4882a593Smuzhiyun unsigned reserved : 25; 48*4882a593Smuzhiyun __u8 *i_data; 49*4882a593Smuzhiyun struct kernel_lb_addr i_locStreamdir; 50*4882a593Smuzhiyun __u64 i_lenStreams; 51*4882a593Smuzhiyun struct rw_semaphore i_data_sem; 52*4882a593Smuzhiyun struct udf_ext_cache cached_extent; 53*4882a593Smuzhiyun /* Spinlock for protecting extent cache */ 54*4882a593Smuzhiyun spinlock_t i_extent_cache_lock; 55*4882a593Smuzhiyun struct inode vfs_inode; 56*4882a593Smuzhiyun }; 57*4882a593Smuzhiyun UDF_I(struct inode * inode)58*4882a593Smuzhiyunstatic inline struct udf_inode_info *UDF_I(struct inode *inode) 59*4882a593Smuzhiyun { 60*4882a593Smuzhiyun return container_of(inode, struct udf_inode_info, vfs_inode); 61*4882a593Smuzhiyun } 62*4882a593Smuzhiyun 63*4882a593Smuzhiyun #endif /* _UDF_I_H) */ 64