Greg Kroah-Hartman | b244131 | 2017-11-01 15:07:57 +0100 | [diff] [blame] | 1 | /* SPDX-License-Identifier: GPL-2.0 */ |
Christoph Hellwig | 15aebd2 | 2008-02-22 12:39:12 +0100 | [diff] [blame] | 2 | #ifndef _UDF_I_H |
| 3 | #define _UDF_I_H |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 4 | |
Namjae Jeon | 9960005 | 2013-01-19 11:17:14 +0900 | [diff] [blame] | 5 | struct extent_position { |
| 6 | struct buffer_head *bh; |
| 7 | uint32_t offset; |
| 8 | struct kernel_lb_addr block; |
| 9 | }; |
| 10 | |
| 11 | struct udf_ext_cache { |
| 12 | /* Extent position */ |
| 13 | struct extent_position epos; |
| 14 | /* Start logical offset in bytes */ |
| 15 | loff_t lstart; |
| 16 | }; |
| 17 | |
Alessio Igor Bogani | 4d0fb62 | 2010-11-16 18:40:47 +0100 | [diff] [blame] | 18 | /* |
| 19 | * The i_data_sem and i_mutex serve for protection of allocation information |
| 20 | * of a regular files and symlinks. This includes all extents belonging to |
| 21 | * the file/symlink, a fact whether data are in-inode or in external data |
| 22 | * blocks, preallocation, goal block information... When extents are read, |
| 23 | * i_mutex or i_data_sem must be held (for reading is enough in case of |
| 24 | * i_data_sem). When extents are changed, i_data_sem must be held for writing |
| 25 | * and also i_mutex must be held. |
| 26 | * |
| 27 | * For directories i_mutex is used for all the necessary protection. |
| 28 | */ |
| 29 | |
Christoph Hellwig | 15aebd2 | 2008-02-22 12:39:12 +0100 | [diff] [blame] | 30 | struct udf_inode_info { |
Arnd Bergmann | c3b9cec | 2018-06-20 10:15:13 +0200 | [diff] [blame] | 31 | struct timespec64 i_crtime; |
Christoph Hellwig | 15aebd2 | 2008-02-22 12:39:12 +0100 | [diff] [blame] | 32 | /* Physical address of inode */ |
Pekka Enberg | 5ca4e4b | 2008-10-15 12:28:03 +0200 | [diff] [blame] | 33 | struct kernel_lb_addr i_location; |
Christoph Hellwig | 15aebd2 | 2008-02-22 12:39:12 +0100 | [diff] [blame] | 34 | __u64 i_unique; |
| 35 | __u32 i_lenEAttr; |
| 36 | __u32 i_lenAlloc; |
| 37 | __u64 i_lenExtents; |
| 38 | __u32 i_next_alloc_block; |
| 39 | __u32 i_next_alloc_goal; |
Steve Nickel | d5e2cf0 | 2012-02-14 00:28:42 -0500 | [diff] [blame] | 40 | __u32 i_checkpoint; |
Steven J. Magnani | c3367a1 | 2019-08-27 07:13:59 -0500 | [diff] [blame] | 41 | __u32 i_extraPerms; |
Christoph Hellwig | 15aebd2 | 2008-02-22 12:39:12 +0100 | [diff] [blame] | 42 | unsigned i_alloc_type : 3; |
marcin.slusarz@gmail.com | d652eef | 2008-01-30 22:03:59 +0100 | [diff] [blame] | 43 | unsigned i_efe : 1; /* extendedFileEntry */ |
| 44 | unsigned i_use : 1; /* unallocSpaceEntry */ |
Christoph Hellwig | 15aebd2 | 2008-02-22 12:39:12 +0100 | [diff] [blame] | 45 | unsigned i_strat4096 : 1; |
Steven J. Magnani | ab9a3a7 | 2019-08-14 07:50:02 -0500 | [diff] [blame] | 46 | unsigned i_streamdir : 1; |
| 47 | unsigned reserved : 25; |
Jan Kara | 382a228 | 2020-09-25 12:29:54 +0200 | [diff] [blame] | 48 | __u8 *i_data; |
Steven J. Magnani | ab9a3a7 | 2019-08-14 07:50:02 -0500 | [diff] [blame] | 49 | struct kernel_lb_addr i_locStreamdir; |
| 50 | __u64 i_lenStreams; |
Alessio Igor Bogani | 4d0fb62 | 2010-11-16 18:40:47 +0100 | [diff] [blame] | 51 | struct rw_semaphore i_data_sem; |
Namjae Jeon | 9960005 | 2013-01-19 11:17:14 +0900 | [diff] [blame] | 52 | struct udf_ext_cache cached_extent; |
| 53 | /* Spinlock for protecting extent cache */ |
| 54 | spinlock_t i_extent_cache_lock; |
Christoph Hellwig | 15aebd2 | 2008-02-22 12:39:12 +0100 | [diff] [blame] | 55 | struct inode vfs_inode; |
| 56 | }; |
| 57 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 58 | static inline struct udf_inode_info *UDF_I(struct inode *inode) |
| 59 | { |
Rasmus Villemoes | db6172c | 2015-03-19 12:28:04 +0100 | [diff] [blame] | 60 | return container_of(inode, struct udf_inode_info, vfs_inode); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 61 | } |
| 62 | |
Christoph Hellwig | 15aebd2 | 2008-02-22 12:39:12 +0100 | [diff] [blame] | 63 | #endif /* _UDF_I_H) */ |