xref: /linux/fs/ntfs/inode.h (revision cdd4dc3aebeab43a72ce0bc2b5bab6f0a80b97a5)
11e9ea7e0SNamjae Jeon /* SPDX-License-Identifier: GPL-2.0-or-later */
21e9ea7e0SNamjae Jeon /*
340796051SNamjae Jeon  * Defines for inode structures NTFS Linux kernel driver.
41e9ea7e0SNamjae Jeon  *
51e9ea7e0SNamjae Jeon  * Copyright (c) 2001-2007 Anton Altaparmakov
61e9ea7e0SNamjae Jeon  * Copyright (c) 2002 Richard Russon
740796051SNamjae Jeon  * Copyright (c) 2025 LG Electronics Co., Ltd.
81e9ea7e0SNamjae Jeon  */
91e9ea7e0SNamjae Jeon 
101e9ea7e0SNamjae Jeon #ifndef _LINUX_NTFS_INODE_H
111e9ea7e0SNamjae Jeon #define _LINUX_NTFS_INODE_H
121e9ea7e0SNamjae Jeon 
131e9ea7e0SNamjae Jeon #include "debug.h"
141e9ea7e0SNamjae Jeon 
1540796051SNamjae Jeon enum ntfs_inode_mutex_lock_class {
1640796051SNamjae Jeon 	NTFS_INODE_MUTEX_PARENT,
1740796051SNamjae Jeon 	NTFS_INODE_MUTEX_NORMAL,
1840796051SNamjae Jeon 	NTFS_INODE_MUTEX_NORMAL_CHILD,
1940796051SNamjae Jeon 	NTFS_INODE_MUTEX_PARENT_2,
2040796051SNamjae Jeon 	NTFS_INODE_MUTEX_NORMAL_2,
2140796051SNamjae Jeon 	NTFS_EXTEND_MUTEX_PARENT,
2240796051SNamjae Jeon 	NTFS_EA_MUTEX_NORMAL
2340796051SNamjae Jeon };
241e9ea7e0SNamjae Jeon 
251e9ea7e0SNamjae Jeon /*
261e9ea7e0SNamjae Jeon  * The NTFS in-memory inode structure. It is just used as an extension to the
271e9ea7e0SNamjae Jeon  * fields already provided in the VFS inode.
2840796051SNamjae Jeon  * @size_lock: Lock serializing access to inode sizes.
2940796051SNamjae Jeon  * @state: NTFS specific flags describing this inode.
3040796051SNamjae Jeon  * @flags: Flags describing the file. (Copy from STANDARD_INFORMATION).
3140796051SNamjae Jeon  * @mft_no: Number of the mft record / inode.
3240796051SNamjae Jeon  * @seq_no: Sequence number of the mft record.
3340796051SNamjae Jeon  * @count: Inode reference count for book keeping.
3440796051SNamjae Jeon  * @vol: Pointer to the ntfs volume of this inode.
3540796051SNamjae Jeon  *
361e9ea7e0SNamjae Jeon  * If NInoAttr() is true, the below fields describe the attribute which
371e9ea7e0SNamjae Jeon  * this fake inode belongs to. The actual inode of this attribute is
381e9ea7e0SNamjae Jeon  * pointed to by base_ntfs_ino and nr_extents is always set to -1 (see
391e9ea7e0SNamjae Jeon  * below). For real inodes, we also set the type (AT_DATA for files and
401e9ea7e0SNamjae Jeon  * AT_INDEX_ALLOCATION for directories), with the name = NULL and
411e9ea7e0SNamjae Jeon  * name_len = 0 for files and name = I30 (global constant) and
421e9ea7e0SNamjae Jeon  * name_len = 4 for directories.
4340796051SNamjae Jeon  * @type: Attribute type of this fake inode.
4440796051SNamjae Jeon  * @name: Attribute name of this fake inode.
4540796051SNamjae Jeon  * @name_len: Attribute name length of this fake inode.
4640796051SNamjae Jeon  * @runlist: If state has the NI_NonResident bit set, the runlist of
4740796051SNamjae Jeon  *   the unnamed data attribute (if a file) or of the index allocation
4840796051SNamjae Jeon  *   attribute (directory) or of the attribute described by the fake inode
4940796051SNamjae Jeon  *   (if NInoAttr()). If runlist.rl is NULL, the runlist has not been read
5040796051SNamjae Jeon  *   in yet or has been unmapped. If NI_NonResident is clear, the attribute
5140796051SNamjae Jeon  *   is resident (file and fake inode) or there is no $I30 index allocation
5240796051SNamjae Jeon  *   attribute (small directory). In the latter case runlist.rl is always
5340796051SNamjae Jeon  *   NULL.
5440796051SNamjae Jeon  * @data_size: Copy from the attribute record.
5540796051SNamjae Jeon  * @initialized_size: Copy from the attribute record.
5640796051SNamjae Jeon  * @allocated_size: Copy from the attribute record.
5740796051SNamjae Jeon  * @i_crtime: File Creation time.
5840796051SNamjae Jeon  * @mrec: MFT record
5940796051SNamjae Jeon  * @mrec_lock: Lock for serializing access to the mft record belonging to
6040796051SNamjae Jeon  *   this inode.
6140796051SNamjae Jeon  * @folio: The folio containing the mft record of the inode.
6240796051SNamjae Jeon  * @folio_ofs: Offset into the folio at which the mft record begins.
6340796051SNamjae Jeon  * @mft_lcn: Number containing the mft record.
6440796051SNamjae Jeon  * @mft_lcn_count: Number of clusters per mft record.
6540796051SNamjae Jeon  *
661e9ea7e0SNamjae Jeon  * Attribute list support (only for use by the attribute lookup
671e9ea7e0SNamjae Jeon  * functions). Setup during read_inode for all inodes with attribute
6840796051SNamjae Jeon  * lists. Only valid if NI_AttrList is set in state.
6940796051SNamjae Jeon  * @attr_list_size: Length of attribute list value in bytes.
7040796051SNamjae Jeon  * @attr_list: Attribute list value itself.
7140796051SNamjae Jeon  *
7240796051SNamjae Jeon  * It is a directory, $MFT, or an index inode.
7340796051SNamjae Jeon  * @block_size: Size of an index block.
7440796051SNamjae Jeon  * @vcn_size: Size of a vcn in this index.
7540796051SNamjae Jeon  * @collation_rule: The collation rule for the index.
7640796051SNamjae Jeon  * @block_size_bits: Log2 of the above.
7740796051SNamjae Jeon  * @vcn_size_bits: Log2 of the above.
7840796051SNamjae Jeon  *
7940796051SNamjae Jeon  * It is a compressed/sparse file/attribute inode.
8040796051SNamjae Jeon  * @size: Copy of compressed_size from $DATA.
8140796051SNamjae Jeon  * @block_size: Size of a compression block (cb).
8240796051SNamjae Jeon  * @block_size_bits: Log2 of the size of a cb.
8340796051SNamjae Jeon  * @block_clusters: Number of clusters per cb.
8440796051SNamjae Jeon  * @extent_lock: Lock for accessing/modifying the below.
8540796051SNamjae Jeon  * @nr_extents: For a base mft record, the number of attached extent inodes
8640796051SNamjae Jeon  *   (0 if none), for extent records and for fake inodes describing an
8740796051SNamjae Jeon  *   attribute this is -1.
8840796051SNamjae Jeon  *
8940796051SNamjae Jeon  * This union is only used if nr_extents != 0.
9040796051SNamjae Jeon  * @extent_ntfs_inos: For nr_extents > 0, array of the ntfs inodes of
9140796051SNamjae Jeon  *   the extent mft records belonging to this base inode which have been
9240796051SNamjae Jeon  *   loaded.
9340796051SNamjae Jeon  * @base_ntfs_ino: For nr_extents == -1, the ntfs inode of the base mft
9440796051SNamjae Jeon  *   record. For fake inodes, the real (base) inode to which the attribute
9540796051SNamjae Jeon  *   belongs.
9640796051SNamjae Jeon  * @i_dealloc_clusters: delayed allocated clusters.
9740796051SNamjae Jeon  * @target: symlink buffer.
981e9ea7e0SNamjae Jeon  */
9940796051SNamjae Jeon struct ntfs_inode {
10040796051SNamjae Jeon 	rwlock_t size_lock;
10140796051SNamjae Jeon 	unsigned long state;
10240796051SNamjae Jeon 	__le32 flags;
103*d9038d99SNamjae Jeon 	u64 mft_no;
10440796051SNamjae Jeon 	u16 seq_no;
10540796051SNamjae Jeon 	atomic_t count;
10640796051SNamjae Jeon 	struct ntfs_volume *vol;
10740796051SNamjae Jeon 	__le32 type;
10840796051SNamjae Jeon 	__le16 *name;
10940796051SNamjae Jeon 	u32 name_len;
11040796051SNamjae Jeon 	struct runlist runlist;
11140796051SNamjae Jeon 	s64 data_size;
11240796051SNamjae Jeon 	s64 initialized_size;
11340796051SNamjae Jeon 	s64 allocated_size;
11440796051SNamjae Jeon 	struct timespec64 i_crtime;
11540796051SNamjae Jeon 	void *mrec;
11640796051SNamjae Jeon 	struct mutex mrec_lock;
11740796051SNamjae Jeon 	struct folio *folio;
11840796051SNamjae Jeon 	int folio_ofs;
11940796051SNamjae Jeon 	s64 mft_lcn[2];
12040796051SNamjae Jeon 	unsigned int mft_lcn_count;
12140796051SNamjae Jeon 	u32 attr_list_size;
12240796051SNamjae Jeon 	u8 *attr_list;
1231e9ea7e0SNamjae Jeon 	union {
12440796051SNamjae Jeon 		struct {
12540796051SNamjae Jeon 			u32 block_size;
12640796051SNamjae Jeon 			u32 vcn_size;
12740796051SNamjae Jeon 			__le32 collation_rule;
12840796051SNamjae Jeon 			u8 block_size_bits;
12940796051SNamjae Jeon 			u8 vcn_size_bits;
1301e9ea7e0SNamjae Jeon 		} index;
13140796051SNamjae Jeon 		struct {
13240796051SNamjae Jeon 			s64 size;
13340796051SNamjae Jeon 			u32 block_size;
13440796051SNamjae Jeon 			u8 block_size_bits;
13540796051SNamjae Jeon 			u8 block_clusters;
1361e9ea7e0SNamjae Jeon 		} compressed;
1371e9ea7e0SNamjae Jeon 	} itype;
13840796051SNamjae Jeon 	struct mutex extent_lock;
13940796051SNamjae Jeon 	s32 nr_extents;
14040796051SNamjae Jeon 	union {
14140796051SNamjae Jeon 		struct ntfs_inode **extent_ntfs_inos;
14240796051SNamjae Jeon 		struct ntfs_inode *base_ntfs_ino;
1431e9ea7e0SNamjae Jeon 	} ext;
14440796051SNamjae Jeon 	unsigned int i_dealloc_clusters;
14540796051SNamjae Jeon 	char *target;
1461e9ea7e0SNamjae Jeon };
1471e9ea7e0SNamjae Jeon 
1481e9ea7e0SNamjae Jeon /*
1491e9ea7e0SNamjae Jeon  * Defined bits for the state field in the ntfs_inode structure.
1501e9ea7e0SNamjae Jeon  * (f) = files only, (d) = directories only, (a) = attributes/fake inodes only
15140796051SNamjae Jeon  *
15240796051SNamjae Jeon  * NI_Dirty			Mft record needs to be written to disk.
15340796051SNamjae Jeon  * NI_AttrListDirty		Mft record contains an attribute list.
15440796051SNamjae Jeon  * NI_AttrList			Mft record contains an attribute list.
15540796051SNamjae Jeon  * NI_AttrListNonResident	Attribute list is non-resident. Implies
15640796051SNamjae Jeon  *				NI_AttrList is set.
15740796051SNamjae Jeon  * NI_Attr			1: Fake inode for attribute i/o.
15840796051SNamjae Jeon  *				0: Real inode or extent inode.
15940796051SNamjae Jeon  * NI_MstProtected		Attribute is protected by MST fixups.
16040796051SNamjae Jeon  * NI_NonResident		Unnamed data attr is non-resident (f)
16140796051SNamjae Jeon  *				Attribute is non-resident (a).
16240796051SNamjae Jeon  * NI_IndexAllocPresent		$I30 index alloc attr is present (d).
16340796051SNamjae Jeon  * NI_Compressed		Unnamed data attr is compressed (f).
16440796051SNamjae Jeon  *				Create compressed files by default (d).
16540796051SNamjae Jeon  *				Attribute is compressed (a).
16640796051SNamjae Jeon  * NI_Encrypted			Unnamed data attr is encrypted (f).
16740796051SNamjae Jeon  *				Create encrypted files by default (d).
16840796051SNamjae Jeon  *				Attribute is encrypted (a).
16940796051SNamjae Jeon  * NI_Sparse			Unnamed data attr is sparse (f).
17040796051SNamjae Jeon  *				Create sparse files by default (d).
17140796051SNamjae Jeon  *				Attribute is sparse (a).
17240796051SNamjae Jeon  * NI_SparseDisabled		May not create sparse regions.
17340796051SNamjae Jeon  * NI_FullyMapped		Runlist is fully mapped.
17440796051SNamjae Jeon  * NI_FileNameDirty		FILE_NAME attributes need to be updated.
17540796051SNamjae Jeon  * NI_BeingDeleted		ntfs inode is being delated.
17640796051SNamjae Jeon  * NI_BeingCreated		ntfs inode is being created.
17740796051SNamjae Jeon  * NI_HasEA			ntfs inode has EA attribute.
17840796051SNamjae Jeon  * NI_RunlistDirty		runlist need to be updated.
1791e9ea7e0SNamjae Jeon  */
18040796051SNamjae Jeon enum {
18140796051SNamjae Jeon 	NI_Dirty,
18240796051SNamjae Jeon 	NI_AttrListDirty,
18340796051SNamjae Jeon 	NI_AttrList,
18440796051SNamjae Jeon 	NI_AttrListNonResident,
18540796051SNamjae Jeon 	NI_Attr,
18640796051SNamjae Jeon 	NI_MstProtected,
18740796051SNamjae Jeon 	NI_NonResident,
18840796051SNamjae Jeon 	NI_IndexAllocPresent,
18940796051SNamjae Jeon 	NI_Compressed,
19040796051SNamjae Jeon 	NI_Encrypted,
19140796051SNamjae Jeon 	NI_Sparse,
19240796051SNamjae Jeon 	NI_SparseDisabled,
19340796051SNamjae Jeon 	NI_FullyMapped,
19440796051SNamjae Jeon 	NI_FileNameDirty,
19540796051SNamjae Jeon 	NI_BeingDeleted,
19640796051SNamjae Jeon 	NI_BeingCreated,
19740796051SNamjae Jeon 	NI_HasEA,
19840796051SNamjae Jeon 	NI_RunlistDirty,
19940796051SNamjae Jeon };
2001e9ea7e0SNamjae Jeon 
2011e9ea7e0SNamjae Jeon /*
2021e9ea7e0SNamjae Jeon  * NOTE: We should be adding dirty mft records to a list somewhere and they
2031e9ea7e0SNamjae Jeon  * should be independent of the (ntfs/vfs) inode structure so that an inode can
2041e9ea7e0SNamjae Jeon  * be removed but the record can be left dirty for syncing later.
2051e9ea7e0SNamjae Jeon  */
2061e9ea7e0SNamjae Jeon 
2071e9ea7e0SNamjae Jeon /*
2081e9ea7e0SNamjae Jeon  * Macro tricks to expand the NInoFoo(), NInoSetFoo(), and NInoClearFoo()
2091e9ea7e0SNamjae Jeon  * functions.
2101e9ea7e0SNamjae Jeon  */
2111e9ea7e0SNamjae Jeon #define NINO_FNS(flag)						\
21240796051SNamjae Jeon static inline int NIno##flag(struct ntfs_inode *ni)		\
2131e9ea7e0SNamjae Jeon {								\
2141e9ea7e0SNamjae Jeon 	return test_bit(NI_##flag, &(ni)->state);		\
2151e9ea7e0SNamjae Jeon }								\
21640796051SNamjae Jeon static inline void NInoSet##flag(struct ntfs_inode *ni)		\
2171e9ea7e0SNamjae Jeon {								\
2181e9ea7e0SNamjae Jeon 	set_bit(NI_##flag, &(ni)->state);			\
2191e9ea7e0SNamjae Jeon }								\
22040796051SNamjae Jeon static inline void NInoClear##flag(struct ntfs_inode *ni)	\
2211e9ea7e0SNamjae Jeon {								\
2221e9ea7e0SNamjae Jeon 	clear_bit(NI_##flag, &(ni)->state);			\
2231e9ea7e0SNamjae Jeon }
2241e9ea7e0SNamjae Jeon 
2251e9ea7e0SNamjae Jeon /*
2261e9ea7e0SNamjae Jeon  * As above for NInoTestSetFoo() and NInoTestClearFoo().
2271e9ea7e0SNamjae Jeon  */
2281e9ea7e0SNamjae Jeon #define TAS_NINO_FNS(flag)						\
22940796051SNamjae Jeon static inline int NInoTestSet##flag(struct ntfs_inode *ni)		\
2301e9ea7e0SNamjae Jeon {									\
2311e9ea7e0SNamjae Jeon 	return test_and_set_bit(NI_##flag, &(ni)->state);		\
2321e9ea7e0SNamjae Jeon }									\
23340796051SNamjae Jeon static inline int NInoTestClear##flag(struct ntfs_inode *ni)		\
2341e9ea7e0SNamjae Jeon {									\
2351e9ea7e0SNamjae Jeon 	return test_and_clear_bit(NI_##flag, &(ni)->state);		\
2361e9ea7e0SNamjae Jeon }
2371e9ea7e0SNamjae Jeon 
2381e9ea7e0SNamjae Jeon /* Emit the ntfs inode bitops functions. */
2391e9ea7e0SNamjae Jeon NINO_FNS(Dirty)
2401e9ea7e0SNamjae Jeon TAS_NINO_FNS(Dirty)
2411e9ea7e0SNamjae Jeon NINO_FNS(AttrList)
24240796051SNamjae Jeon NINO_FNS(AttrListDirty)
2431e9ea7e0SNamjae Jeon NINO_FNS(AttrListNonResident)
2441e9ea7e0SNamjae Jeon NINO_FNS(Attr)
2451e9ea7e0SNamjae Jeon NINO_FNS(MstProtected)
2461e9ea7e0SNamjae Jeon NINO_FNS(NonResident)
2471e9ea7e0SNamjae Jeon NINO_FNS(IndexAllocPresent)
2481e9ea7e0SNamjae Jeon NINO_FNS(Compressed)
2491e9ea7e0SNamjae Jeon NINO_FNS(Encrypted)
2501e9ea7e0SNamjae Jeon NINO_FNS(Sparse)
2511e9ea7e0SNamjae Jeon NINO_FNS(SparseDisabled)
25240796051SNamjae Jeon NINO_FNS(FullyMapped)
25340796051SNamjae Jeon NINO_FNS(FileNameDirty)
25440796051SNamjae Jeon TAS_NINO_FNS(FileNameDirty)
25540796051SNamjae Jeon NINO_FNS(BeingDeleted)
25640796051SNamjae Jeon NINO_FNS(HasEA)
25740796051SNamjae Jeon NINO_FNS(RunlistDirty)
2581e9ea7e0SNamjae Jeon 
2591e9ea7e0SNamjae Jeon /*
2601e9ea7e0SNamjae Jeon  * The full structure containing a ntfs_inode and a vfs struct inode. Used for
2611e9ea7e0SNamjae Jeon  * all real and fake inodes but not for extent inodes which lack the vfs struct
2621e9ea7e0SNamjae Jeon  * inode.
2631e9ea7e0SNamjae Jeon  */
26440796051SNamjae Jeon struct big_ntfs_inode {
26540796051SNamjae Jeon 	struct ntfs_inode ntfs_inode;
2661e9ea7e0SNamjae Jeon 	struct inode vfs_inode;		/* The vfs inode structure. */
26740796051SNamjae Jeon };
2681e9ea7e0SNamjae Jeon 
26940796051SNamjae Jeon /*
2701e9ea7e0SNamjae Jeon  * NTFS_I - return the ntfs inode given a vfs inode
2711e9ea7e0SNamjae Jeon  * @inode:	VFS inode
2721e9ea7e0SNamjae Jeon  *
2731e9ea7e0SNamjae Jeon  * NTFS_I() returns the ntfs inode associated with the VFS @inode.
2741e9ea7e0SNamjae Jeon  */
27540796051SNamjae Jeon static inline struct ntfs_inode *NTFS_I(struct inode *inode)
2761e9ea7e0SNamjae Jeon {
27740796051SNamjae Jeon 	return &container_of(inode, struct big_ntfs_inode, vfs_inode)->ntfs_inode;
2781e9ea7e0SNamjae Jeon }
2791e9ea7e0SNamjae Jeon 
28040796051SNamjae Jeon static inline struct inode *VFS_I(struct ntfs_inode *ni)
2811e9ea7e0SNamjae Jeon {
28240796051SNamjae Jeon 	return &container_of(ni, struct big_ntfs_inode, ntfs_inode)->vfs_inode;
2831e9ea7e0SNamjae Jeon }
2841e9ea7e0SNamjae Jeon 
28540796051SNamjae Jeon /*
2861e9ea7e0SNamjae Jeon  * ntfs_attr - ntfs in memory attribute structure
2871e9ea7e0SNamjae Jeon  *
2881e9ea7e0SNamjae Jeon  * This structure exists only to provide a small structure for the
2891e9ea7e0SNamjae Jeon  * ntfs_{attr_}iget()/ntfs_test_inode()/ntfs_init_locked_inode() mechanism.
2901e9ea7e0SNamjae Jeon  *
2911e9ea7e0SNamjae Jeon  * NOTE: Elements are ordered by size to make the structure as compact as
2921e9ea7e0SNamjae Jeon  * possible on all architectures.
2931e9ea7e0SNamjae Jeon  */
29440796051SNamjae Jeon struct ntfs_attr {
295*d9038d99SNamjae Jeon 	u64 mft_no;
29640796051SNamjae Jeon 	__le16 *name;
2971e9ea7e0SNamjae Jeon 	u32 name_len;
29840796051SNamjae Jeon 	__le32 type;
29940796051SNamjae Jeon 	unsigned long state;
30040796051SNamjae Jeon };
3011e9ea7e0SNamjae Jeon 
30240796051SNamjae Jeon int ntfs_test_inode(struct inode *vi, void *data);
303*d9038d99SNamjae Jeon struct inode *ntfs_iget(struct super_block *sb, u64 mft_no);
30440796051SNamjae Jeon struct inode *ntfs_attr_iget(struct inode *base_vi, __le32 type,
30540796051SNamjae Jeon 		__le16 *name, u32 name_len);
30640796051SNamjae Jeon struct inode *ntfs_index_iget(struct inode *base_vi, __le16 *name,
3071e9ea7e0SNamjae Jeon 		u32 name_len);
30840796051SNamjae Jeon struct inode *ntfs_alloc_big_inode(struct super_block *sb);
30940796051SNamjae Jeon void ntfs_free_big_inode(struct inode *inode);
31040796051SNamjae Jeon int ntfs_drop_big_inode(struct inode *inode);
31140796051SNamjae Jeon void ntfs_evict_big_inode(struct inode *vi);
31240796051SNamjae Jeon void __ntfs_init_inode(struct super_block *sb, struct ntfs_inode *ni);
3131e9ea7e0SNamjae Jeon 
3141e9ea7e0SNamjae Jeon static inline void ntfs_init_big_inode(struct inode *vi)
3151e9ea7e0SNamjae Jeon {
31640796051SNamjae Jeon 	struct ntfs_inode *ni = NTFS_I(vi);
3171e9ea7e0SNamjae Jeon 
3181e9ea7e0SNamjae Jeon 	ntfs_debug("Entering.");
3191e9ea7e0SNamjae Jeon 	__ntfs_init_inode(vi->i_sb, ni);
3201e9ea7e0SNamjae Jeon 	ni->mft_no = vi->i_ino;
3211e9ea7e0SNamjae Jeon }
3221e9ea7e0SNamjae Jeon 
323*d9038d99SNamjae Jeon struct ntfs_inode *ntfs_new_extent_inode(struct super_block *sb, u64 mft_no);
32440796051SNamjae Jeon void ntfs_clear_extent_inode(struct ntfs_inode *ni);
32540796051SNamjae Jeon int ntfs_read_inode_mount(struct inode *vi);
32640796051SNamjae Jeon int ntfs_show_options(struct seq_file *sf, struct dentry *root);
32740796051SNamjae Jeon int ntfs_truncate_vfs(struct inode *vi, loff_t new_size, loff_t i_size);
3281e9ea7e0SNamjae Jeon 
32940796051SNamjae Jeon int ntfs_setattr(struct mnt_idmap *idmap, struct dentry *dentry,
33040796051SNamjae Jeon 		 struct iattr *attr);
33140796051SNamjae Jeon int ntfs_getattr(struct mnt_idmap *idmap, const struct path *path,
33240796051SNamjae Jeon 		struct kstat *stat, unsigned int request_mask,
33340796051SNamjae Jeon 		unsigned int query_flags);
3341e9ea7e0SNamjae Jeon 
33540796051SNamjae Jeon int ntfs_get_block_mft_record(struct ntfs_inode *mft_ni, struct ntfs_inode *ni);
33640796051SNamjae Jeon int __ntfs_write_inode(struct inode *vi, int sync);
33740796051SNamjae Jeon int ntfs_inode_attach_all_extents(struct ntfs_inode *ni);
33840796051SNamjae Jeon int ntfs_inode_add_attrlist(struct ntfs_inode *ni);
33940796051SNamjae Jeon void ntfs_destroy_ext_inode(struct ntfs_inode *ni);
34040796051SNamjae Jeon int ntfs_inode_free_space(struct ntfs_inode *ni, int size);
34140796051SNamjae Jeon s64 ntfs_inode_attr_pread(struct inode *vi, s64 pos, s64 count, u8 *buf);
34240796051SNamjae Jeon s64 ntfs_inode_attr_pwrite(struct inode *vi, s64 pos, s64 count, u8 *buf,
34340796051SNamjae Jeon 		bool sync);
34440796051SNamjae Jeon int ntfs_inode_close(struct ntfs_inode *ni);
3451e9ea7e0SNamjae Jeon 
3461e9ea7e0SNamjae Jeon static inline void ntfs_commit_inode(struct inode *vi)
3471e9ea7e0SNamjae Jeon {
3481e9ea7e0SNamjae Jeon 	__ntfs_write_inode(vi, 1);
3491e9ea7e0SNamjae Jeon }
3501e9ea7e0SNamjae Jeon 
35140796051SNamjae Jeon int ntfs_inode_sync_filename(struct ntfs_inode *ni);
35240796051SNamjae Jeon int ntfs_extend_initialized_size(struct inode *vi, const loff_t offset,
35340796051SNamjae Jeon 		const loff_t new_size, bool bsync);
35440796051SNamjae Jeon void ntfs_set_vfs_operations(struct inode *inode, mode_t mode, dev_t dev);
35540796051SNamjae Jeon struct folio *ntfs_get_locked_folio(struct address_space *mapping,
35640796051SNamjae Jeon 		pgoff_t index, pgoff_t end_index, struct file_ra_state *ra);
3571e9ea7e0SNamjae Jeon 
3581e9ea7e0SNamjae Jeon #endif /* _LINUX_NTFS_INODE_H */
359