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