162306a36Sopenharmony_ci/* SPDX-License-Identifier: GPL-2.0 */ 262306a36Sopenharmony_ci#ifndef _UDF_I_H 362306a36Sopenharmony_ci#define _UDF_I_H 462306a36Sopenharmony_ci 562306a36Sopenharmony_cistruct extent_position { 662306a36Sopenharmony_ci struct buffer_head *bh; 762306a36Sopenharmony_ci uint32_t offset; 862306a36Sopenharmony_ci struct kernel_lb_addr block; 962306a36Sopenharmony_ci}; 1062306a36Sopenharmony_ci 1162306a36Sopenharmony_cistruct udf_ext_cache { 1262306a36Sopenharmony_ci /* Extent position */ 1362306a36Sopenharmony_ci struct extent_position epos; 1462306a36Sopenharmony_ci /* Start logical offset in bytes */ 1562306a36Sopenharmony_ci loff_t lstart; 1662306a36Sopenharmony_ci}; 1762306a36Sopenharmony_ci 1862306a36Sopenharmony_ci/* 1962306a36Sopenharmony_ci * The i_data_sem and i_mutex serve for protection of allocation information 2062306a36Sopenharmony_ci * of a regular files and symlinks. This includes all extents belonging to 2162306a36Sopenharmony_ci * the file/symlink, a fact whether data are in-inode or in external data 2262306a36Sopenharmony_ci * blocks, preallocation, goal block information... When extents are read, 2362306a36Sopenharmony_ci * i_mutex or i_data_sem must be held (for reading is enough in case of 2462306a36Sopenharmony_ci * i_data_sem). When extents are changed, i_data_sem must be held for writing 2562306a36Sopenharmony_ci * and also i_mutex must be held. 2662306a36Sopenharmony_ci * 2762306a36Sopenharmony_ci * For directories i_mutex is used for all the necessary protection. 2862306a36Sopenharmony_ci */ 2962306a36Sopenharmony_ci 3062306a36Sopenharmony_cistruct udf_inode_info { 3162306a36Sopenharmony_ci struct timespec64 i_crtime; 3262306a36Sopenharmony_ci /* Physical address of inode */ 3362306a36Sopenharmony_ci struct kernel_lb_addr i_location; 3462306a36Sopenharmony_ci __u64 i_unique; 3562306a36Sopenharmony_ci __u32 i_lenEAttr; 3662306a36Sopenharmony_ci __u32 i_lenAlloc; 3762306a36Sopenharmony_ci __u64 i_lenExtents; 3862306a36Sopenharmony_ci __u32 i_next_alloc_block; 3962306a36Sopenharmony_ci __u32 i_next_alloc_goal; 4062306a36Sopenharmony_ci __u32 i_checkpoint; 4162306a36Sopenharmony_ci __u32 i_extraPerms; 4262306a36Sopenharmony_ci unsigned i_alloc_type : 3; 4362306a36Sopenharmony_ci unsigned i_efe : 1; /* extendedFileEntry */ 4462306a36Sopenharmony_ci unsigned i_use : 1; /* unallocSpaceEntry */ 4562306a36Sopenharmony_ci unsigned i_strat4096 : 1; 4662306a36Sopenharmony_ci unsigned i_streamdir : 1; 4762306a36Sopenharmony_ci unsigned i_hidden : 1; /* hidden system inode */ 4862306a36Sopenharmony_ci unsigned reserved : 24; 4962306a36Sopenharmony_ci __u8 *i_data; 5062306a36Sopenharmony_ci struct kernel_lb_addr i_locStreamdir; 5162306a36Sopenharmony_ci __u64 i_lenStreams; 5262306a36Sopenharmony_ci struct rw_semaphore i_data_sem; 5362306a36Sopenharmony_ci struct udf_ext_cache cached_extent; 5462306a36Sopenharmony_ci /* Spinlock for protecting extent cache */ 5562306a36Sopenharmony_ci spinlock_t i_extent_cache_lock; 5662306a36Sopenharmony_ci struct inode vfs_inode; 5762306a36Sopenharmony_ci}; 5862306a36Sopenharmony_ci 5962306a36Sopenharmony_cistatic inline struct udf_inode_info *UDF_I(struct inode *inode) 6062306a36Sopenharmony_ci{ 6162306a36Sopenharmony_ci return container_of(inode, struct udf_inode_info, vfs_inode); 6262306a36Sopenharmony_ci} 6362306a36Sopenharmony_ci 6462306a36Sopenharmony_ci#endif /* _UDF_I_H) */ 65