18c2ecf20Sopenharmony_ci/* SPDX-License-Identifier: GPL-2.0 */ 28c2ecf20Sopenharmony_ci#ifndef _UDF_I_H 38c2ecf20Sopenharmony_ci#define _UDF_I_H 48c2ecf20Sopenharmony_ci 58c2ecf20Sopenharmony_cistruct extent_position { 68c2ecf20Sopenharmony_ci struct buffer_head *bh; 78c2ecf20Sopenharmony_ci uint32_t offset; 88c2ecf20Sopenharmony_ci struct kernel_lb_addr block; 98c2ecf20Sopenharmony_ci}; 108c2ecf20Sopenharmony_ci 118c2ecf20Sopenharmony_cistruct udf_ext_cache { 128c2ecf20Sopenharmony_ci /* Extent position */ 138c2ecf20Sopenharmony_ci struct extent_position epos; 148c2ecf20Sopenharmony_ci /* Start logical offset in bytes */ 158c2ecf20Sopenharmony_ci loff_t lstart; 168c2ecf20Sopenharmony_ci}; 178c2ecf20Sopenharmony_ci 188c2ecf20Sopenharmony_ci/* 198c2ecf20Sopenharmony_ci * The i_data_sem and i_mutex serve for protection of allocation information 208c2ecf20Sopenharmony_ci * of a regular files and symlinks. This includes all extents belonging to 218c2ecf20Sopenharmony_ci * the file/symlink, a fact whether data are in-inode or in external data 228c2ecf20Sopenharmony_ci * blocks, preallocation, goal block information... When extents are read, 238c2ecf20Sopenharmony_ci * i_mutex or i_data_sem must be held (for reading is enough in case of 248c2ecf20Sopenharmony_ci * i_data_sem). When extents are changed, i_data_sem must be held for writing 258c2ecf20Sopenharmony_ci * and also i_mutex must be held. 268c2ecf20Sopenharmony_ci * 278c2ecf20Sopenharmony_ci * For directories i_mutex is used for all the necessary protection. 288c2ecf20Sopenharmony_ci */ 298c2ecf20Sopenharmony_ci 308c2ecf20Sopenharmony_cistruct udf_inode_info { 318c2ecf20Sopenharmony_ci struct timespec64 i_crtime; 328c2ecf20Sopenharmony_ci /* Physical address of inode */ 338c2ecf20Sopenharmony_ci struct kernel_lb_addr i_location; 348c2ecf20Sopenharmony_ci __u64 i_unique; 358c2ecf20Sopenharmony_ci __u32 i_lenEAttr; 368c2ecf20Sopenharmony_ci __u32 i_lenAlloc; 378c2ecf20Sopenharmony_ci __u64 i_lenExtents; 388c2ecf20Sopenharmony_ci __u32 i_next_alloc_block; 398c2ecf20Sopenharmony_ci __u32 i_next_alloc_goal; 408c2ecf20Sopenharmony_ci __u32 i_checkpoint; 418c2ecf20Sopenharmony_ci __u32 i_extraPerms; 428c2ecf20Sopenharmony_ci unsigned i_alloc_type : 3; 438c2ecf20Sopenharmony_ci unsigned i_efe : 1; /* extendedFileEntry */ 448c2ecf20Sopenharmony_ci unsigned i_use : 1; /* unallocSpaceEntry */ 458c2ecf20Sopenharmony_ci unsigned i_strat4096 : 1; 468c2ecf20Sopenharmony_ci unsigned i_streamdir : 1; 478c2ecf20Sopenharmony_ci unsigned i_hidden : 1; /* hidden system inode */ 488c2ecf20Sopenharmony_ci unsigned reserved : 24; 498c2ecf20Sopenharmony_ci __u8 *i_data; 508c2ecf20Sopenharmony_ci struct kernel_lb_addr i_locStreamdir; 518c2ecf20Sopenharmony_ci __u64 i_lenStreams; 528c2ecf20Sopenharmony_ci struct rw_semaphore i_data_sem; 538c2ecf20Sopenharmony_ci struct udf_ext_cache cached_extent; 548c2ecf20Sopenharmony_ci /* Spinlock for protecting extent cache */ 558c2ecf20Sopenharmony_ci spinlock_t i_extent_cache_lock; 568c2ecf20Sopenharmony_ci struct inode vfs_inode; 578c2ecf20Sopenharmony_ci}; 588c2ecf20Sopenharmony_ci 598c2ecf20Sopenharmony_cistatic inline struct udf_inode_info *UDF_I(struct inode *inode) 608c2ecf20Sopenharmony_ci{ 618c2ecf20Sopenharmony_ci return container_of(inode, struct udf_inode_info, vfs_inode); 628c2ecf20Sopenharmony_ci} 638c2ecf20Sopenharmony_ci 648c2ecf20Sopenharmony_ci#endif /* _UDF_I_H) */ 65