Linux Audio

Check our new training course

Loading...
v3.15
 
  1/*
  2 * inode.h - Defines for inode structures NTFS Linux kernel driver. Part of
  3 *	     the Linux-NTFS project.
  4 *
  5 * Copyright (c) 2001-2007 Anton Altaparmakov
  6 * Copyright (c) 2002 Richard Russon
  7 *
  8 * This program/include file is free software; you can redistribute it and/or
  9 * modify it under the terms of the GNU General Public License as published
 10 * by the Free Software Foundation; either version 2 of the License, or
 11 * (at your option) any later version.
 12 *
 13 * This program/include file is distributed in the hope that it will be
 14 * useful, but WITHOUT ANY WARRANTY; without even the implied warranty
 15 * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 16 * GNU General Public License for more details.
 17 *
 18 * You should have received a copy of the GNU General Public License
 19 * along with this program (in the main directory of the Linux-NTFS
 20 * distribution in the file COPYING); if not, write to the Free Software
 21 * Foundation,Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
 22 */
 23
 24#ifndef _LINUX_NTFS_INODE_H
 25#define _LINUX_NTFS_INODE_H
 26
 27#include <linux/atomic.h>
 28
 29#include <linux/fs.h>
 30#include <linux/list.h>
 31#include <linux/mm.h>
 32#include <linux/mutex.h>
 33#include <linux/seq_file.h>
 34
 35#include "layout.h"
 36#include "volume.h"
 37#include "types.h"
 38#include "runlist.h"
 39#include "debug.h"
 40
 41typedef struct _ntfs_inode ntfs_inode;
 42
 43/*
 44 * The NTFS in-memory inode structure. It is just used as an extension to the
 45 * fields already provided in the VFS inode.
 46 */
 47struct _ntfs_inode {
 48	rwlock_t size_lock;	/* Lock serializing access to inode sizes. */
 49	s64 initialized_size;	/* Copy from the attribute record. */
 50	s64 allocated_size;	/* Copy from the attribute record. */
 51	unsigned long state;	/* NTFS specific flags describing this inode.
 52				   See ntfs_inode_state_bits below. */
 53	unsigned long mft_no;	/* Number of the mft record / inode. */
 54	u16 seq_no;		/* Sequence number of the mft record. */
 55	atomic_t count;		/* Inode reference count for book keeping. */
 56	ntfs_volume *vol;	/* Pointer to the ntfs volume of this inode. */
 57	/*
 58	 * If NInoAttr() is true, the below fields describe the attribute which
 59	 * this fake inode belongs to. The actual inode of this attribute is
 60	 * pointed to by base_ntfs_ino and nr_extents is always set to -1 (see
 61	 * below). For real inodes, we also set the type (AT_DATA for files and
 62	 * AT_INDEX_ALLOCATION for directories), with the name = NULL and
 63	 * name_len = 0 for files and name = I30 (global constant) and
 64	 * name_len = 4 for directories.
 65	 */
 66	ATTR_TYPE type;	/* Attribute type of this fake inode. */
 67	ntfschar *name;		/* Attribute name of this fake inode. */
 68	u32 name_len;		/* Attribute name length of this fake inode. */
 69	runlist runlist;	/* If state has the NI_NonResident bit set,
 70				   the runlist of the unnamed data attribute
 71				   (if a file) or of the index allocation
 72				   attribute (directory) or of the attribute
 73				   described by the fake inode (if NInoAttr()).
 74				   If runlist.rl is NULL, the runlist has not
 75				   been read in yet or has been unmapped. If
 76				   NI_NonResident is clear, the attribute is
 77				   resident (file and fake inode) or there is
 78				   no $I30 index allocation attribute
 79				   (small directory). In the latter case
 80				   runlist.rl is always NULL.*/
 81	/*
 82	 * The following fields are only valid for real inodes and extent
 83	 * inodes.
 84	 */
 85	struct mutex mrec_lock;	/* Lock for serializing access to the
 86				   mft record belonging to this inode. */
 87	struct page *page;	/* The page containing the mft record of the
 88				   inode. This should only be touched by the
 89				   (un)map_mft_record*() functions. */
 90	int page_ofs;		/* Offset into the page at which the mft record
 91				   begins. This should only be touched by the
 92				   (un)map_mft_record*() functions. */
 93	/*
 94	 * Attribute list support (only for use by the attribute lookup
 95	 * functions). Setup during read_inode for all inodes with attribute
 96	 * lists. Only valid if NI_AttrList is set in state, and attr_list_rl is
 97	 * further only valid if NI_AttrListNonResident is set.
 98	 */
 99	u32 attr_list_size;	/* Length of attribute list value in bytes. */
100	u8 *attr_list;		/* Attribute list value itself. */
101	runlist attr_list_rl;	/* Run list for the attribute list value. */
102	union {
103		struct { /* It is a directory, $MFT, or an index inode. */
104			u32 block_size;		/* Size of an index block. */
105			u32 vcn_size;		/* Size of a vcn in this
106						   index. */
107			COLLATION_RULE collation_rule; /* The collation rule
108						   for the index. */
109			u8 block_size_bits; 	/* Log2 of the above. */
110			u8 vcn_size_bits;	/* Log2 of the above. */
111		} index;
112		struct { /* It is a compressed/sparse file/attribute inode. */
113			s64 size;		/* Copy of compressed_size from
114						   $DATA. */
115			u32 block_size;		/* Size of a compression block
116						   (cb). */
117			u8 block_size_bits;	/* Log2 of the size of a cb. */
118			u8 block_clusters;	/* Number of clusters per cb. */
119		} compressed;
120	} itype;
121	struct mutex extent_lock;	/* Lock for accessing/modifying the
122					   below . */
123	s32 nr_extents;	/* For a base mft record, the number of attached extent
124			   inodes (0 if none), for extent records and for fake
125			   inodes describing an attribute this is -1. */
126	union {		/* This union is only used if nr_extents != 0. */
127		ntfs_inode **extent_ntfs_inos;	/* For nr_extents > 0, array of
128						   the ntfs inodes of the extent
129						   mft records belonging to
130						   this base inode which have
131						   been loaded. */
132		ntfs_inode *base_ntfs_ino;	/* For nr_extents == -1, the
133						   ntfs inode of the base mft
134						   record. For fake inodes, the
135						   real (base) inode to which
136						   the attribute belongs. */
137	} ext;
138};
139
140/*
141 * Defined bits for the state field in the ntfs_inode structure.
142 * (f) = files only, (d) = directories only, (a) = attributes/fake inodes only
143 */
144typedef enum {
145	NI_Dirty,		/* 1: Mft record needs to be written to disk. */
146	NI_AttrList,		/* 1: Mft record contains an attribute list. */
147	NI_AttrListNonResident,	/* 1: Attribute list is non-resident. Implies
148				      NI_AttrList is set. */
149
150	NI_Attr,		/* 1: Fake inode for attribute i/o.
151				   0: Real inode or extent inode. */
152
153	NI_MstProtected,	/* 1: Attribute is protected by MST fixups.
154				   0: Attribute is not protected by fixups. */
155	NI_NonResident,		/* 1: Unnamed data attr is non-resident (f).
156				   1: Attribute is non-resident (a). */
157	NI_IndexAllocPresent = NI_NonResident,	/* 1: $I30 index alloc attr is
158						   present (d). */
159	NI_Compressed,		/* 1: Unnamed data attr is compressed (f).
160				   1: Create compressed files by default (d).
161				   1: Attribute is compressed (a). */
162	NI_Encrypted,		/* 1: Unnamed data attr is encrypted (f).
163				   1: Create encrypted files by default (d).
164				   1: Attribute is encrypted (a). */
165	NI_Sparse,		/* 1: Unnamed data attr is sparse (f).
166				   1: Create sparse files by default (d).
167				   1: Attribute is sparse (a). */
168	NI_SparseDisabled,	/* 1: May not create sparse regions. */
169	NI_TruncateFailed,	/* 1: Last ntfs_truncate() call failed. */
170} ntfs_inode_state_bits;
171
172/*
173 * NOTE: We should be adding dirty mft records to a list somewhere and they
174 * should be independent of the (ntfs/vfs) inode structure so that an inode can
175 * be removed but the record can be left dirty for syncing later.
176 */
177
178/*
179 * Macro tricks to expand the NInoFoo(), NInoSetFoo(), and NInoClearFoo()
180 * functions.
181 */
182#define NINO_FNS(flag)					\
183static inline int NIno##flag(ntfs_inode *ni)		\
184{							\
185	return test_bit(NI_##flag, &(ni)->state);	\
186}							\
187static inline void NInoSet##flag(ntfs_inode *ni)	\
188{							\
189	set_bit(NI_##flag, &(ni)->state);		\
190}							\
191static inline void NInoClear##flag(ntfs_inode *ni)	\
192{							\
193	clear_bit(NI_##flag, &(ni)->state);		\
194}
195
196/*
197 * As above for NInoTestSetFoo() and NInoTestClearFoo().
198 */
199#define TAS_NINO_FNS(flag)					\
200static inline int NInoTestSet##flag(ntfs_inode *ni)		\
201{								\
202	return test_and_set_bit(NI_##flag, &(ni)->state);	\
203}								\
204static inline int NInoTestClear##flag(ntfs_inode *ni)		\
205{								\
206	return test_and_clear_bit(NI_##flag, &(ni)->state);	\
207}
208
209/* Emit the ntfs inode bitops functions. */
210NINO_FNS(Dirty)
211TAS_NINO_FNS(Dirty)
212NINO_FNS(AttrList)
213NINO_FNS(AttrListNonResident)
214NINO_FNS(Attr)
215NINO_FNS(MstProtected)
216NINO_FNS(NonResident)
217NINO_FNS(IndexAllocPresent)
218NINO_FNS(Compressed)
219NINO_FNS(Encrypted)
220NINO_FNS(Sparse)
221NINO_FNS(SparseDisabled)
222NINO_FNS(TruncateFailed)
223
224/*
225 * The full structure containing a ntfs_inode and a vfs struct inode. Used for
226 * all real and fake inodes but not for extent inodes which lack the vfs struct
227 * inode.
228 */
229typedef struct {
230	ntfs_inode ntfs_inode;
231	struct inode vfs_inode;		/* The vfs inode structure. */
232} big_ntfs_inode;
233
234/**
235 * NTFS_I - return the ntfs inode given a vfs inode
236 * @inode:	VFS inode
237 *
238 * NTFS_I() returns the ntfs inode associated with the VFS @inode.
239 */
240static inline ntfs_inode *NTFS_I(struct inode *inode)
241{
242	return (ntfs_inode *)list_entry(inode, big_ntfs_inode, vfs_inode);
243}
244
245static inline struct inode *VFS_I(ntfs_inode *ni)
246{
247	return &((big_ntfs_inode *)ni)->vfs_inode;
248}
249
250/**
251 * ntfs_attr - ntfs in memory attribute structure
252 * @mft_no:	mft record number of the base mft record of this attribute
253 * @name:	Unicode name of the attribute (NULL if unnamed)
254 * @name_len:	length of @name in Unicode characters (0 if unnamed)
255 * @type:	attribute type (see layout.h)
256 *
257 * This structure exists only to provide a small structure for the
258 * ntfs_{attr_}iget()/ntfs_test_inode()/ntfs_init_locked_inode() mechanism.
259 *
260 * NOTE: Elements are ordered by size to make the structure as compact as
261 * possible on all architectures.
262 */
263typedef struct {
264	unsigned long mft_no;
265	ntfschar *name;
266	u32 name_len;
267	ATTR_TYPE type;
268} ntfs_attr;
269
270typedef int (*test_t)(struct inode *, void *);
271
272extern int ntfs_test_inode(struct inode *vi, ntfs_attr *na);
273
274extern struct inode *ntfs_iget(struct super_block *sb, unsigned long mft_no);
275extern struct inode *ntfs_attr_iget(struct inode *base_vi, ATTR_TYPE type,
276		ntfschar *name, u32 name_len);
277extern struct inode *ntfs_index_iget(struct inode *base_vi, ntfschar *name,
278		u32 name_len);
279
280extern struct inode *ntfs_alloc_big_inode(struct super_block *sb);
281extern void ntfs_destroy_big_inode(struct inode *inode);
282extern void ntfs_evict_big_inode(struct inode *vi);
283
284extern void __ntfs_init_inode(struct super_block *sb, ntfs_inode *ni);
285
286static inline void ntfs_init_big_inode(struct inode *vi)
287{
288	ntfs_inode *ni = NTFS_I(vi);
289
290	ntfs_debug("Entering.");
291	__ntfs_init_inode(vi->i_sb, ni);
292	ni->mft_no = vi->i_ino;
293}
294
295extern ntfs_inode *ntfs_new_extent_inode(struct super_block *sb,
296		unsigned long mft_no);
297extern void ntfs_clear_extent_inode(ntfs_inode *ni);
298
299extern int ntfs_read_inode_mount(struct inode *vi);
300
301extern int ntfs_show_options(struct seq_file *sf, struct dentry *root);
302
303#ifdef NTFS_RW
304
305extern int ntfs_truncate(struct inode *vi);
306extern void ntfs_truncate_vfs(struct inode *vi);
307
308extern int ntfs_setattr(struct dentry *dentry, struct iattr *attr);
309
310extern int __ntfs_write_inode(struct inode *vi, int sync);
311
312static inline void ntfs_commit_inode(struct inode *vi)
313{
314	if (!is_bad_inode(vi))
315		__ntfs_write_inode(vi, 1);
316	return;
317}
318
319#else
320
321static inline void ntfs_truncate_vfs(struct inode *vi) {}
322
323#endif /* NTFS_RW */
324
325#endif /* _LINUX_NTFS_INODE_H */
v5.4
  1/* SPDX-License-Identifier: GPL-2.0-or-later */
  2/*
  3 * inode.h - Defines for inode structures NTFS Linux kernel driver. Part of
  4 *	     the Linux-NTFS project.
  5 *
  6 * Copyright (c) 2001-2007 Anton Altaparmakov
  7 * Copyright (c) 2002 Richard Russon
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
  8 */
  9
 10#ifndef _LINUX_NTFS_INODE_H
 11#define _LINUX_NTFS_INODE_H
 12
 13#include <linux/atomic.h>
 14
 15#include <linux/fs.h>
 16#include <linux/list.h>
 17#include <linux/mm.h>
 18#include <linux/mutex.h>
 19#include <linux/seq_file.h>
 20
 21#include "layout.h"
 22#include "volume.h"
 23#include "types.h"
 24#include "runlist.h"
 25#include "debug.h"
 26
 27typedef struct _ntfs_inode ntfs_inode;
 28
 29/*
 30 * The NTFS in-memory inode structure. It is just used as an extension to the
 31 * fields already provided in the VFS inode.
 32 */
 33struct _ntfs_inode {
 34	rwlock_t size_lock;	/* Lock serializing access to inode sizes. */
 35	s64 initialized_size;	/* Copy from the attribute record. */
 36	s64 allocated_size;	/* Copy from the attribute record. */
 37	unsigned long state;	/* NTFS specific flags describing this inode.
 38				   See ntfs_inode_state_bits below. */
 39	unsigned long mft_no;	/* Number of the mft record / inode. */
 40	u16 seq_no;		/* Sequence number of the mft record. */
 41	atomic_t count;		/* Inode reference count for book keeping. */
 42	ntfs_volume *vol;	/* Pointer to the ntfs volume of this inode. */
 43	/*
 44	 * If NInoAttr() is true, the below fields describe the attribute which
 45	 * this fake inode belongs to. The actual inode of this attribute is
 46	 * pointed to by base_ntfs_ino and nr_extents is always set to -1 (see
 47	 * below). For real inodes, we also set the type (AT_DATA for files and
 48	 * AT_INDEX_ALLOCATION for directories), with the name = NULL and
 49	 * name_len = 0 for files and name = I30 (global constant) and
 50	 * name_len = 4 for directories.
 51	 */
 52	ATTR_TYPE type;	/* Attribute type of this fake inode. */
 53	ntfschar *name;		/* Attribute name of this fake inode. */
 54	u32 name_len;		/* Attribute name length of this fake inode. */
 55	runlist runlist;	/* If state has the NI_NonResident bit set,
 56				   the runlist of the unnamed data attribute
 57				   (if a file) or of the index allocation
 58				   attribute (directory) or of the attribute
 59				   described by the fake inode (if NInoAttr()).
 60				   If runlist.rl is NULL, the runlist has not
 61				   been read in yet or has been unmapped. If
 62				   NI_NonResident is clear, the attribute is
 63				   resident (file and fake inode) or there is
 64				   no $I30 index allocation attribute
 65				   (small directory). In the latter case
 66				   runlist.rl is always NULL.*/
 67	/*
 68	 * The following fields are only valid for real inodes and extent
 69	 * inodes.
 70	 */
 71	struct mutex mrec_lock;	/* Lock for serializing access to the
 72				   mft record belonging to this inode. */
 73	struct page *page;	/* The page containing the mft record of the
 74				   inode. This should only be touched by the
 75				   (un)map_mft_record*() functions. */
 76	int page_ofs;		/* Offset into the page at which the mft record
 77				   begins. This should only be touched by the
 78				   (un)map_mft_record*() functions. */
 79	/*
 80	 * Attribute list support (only for use by the attribute lookup
 81	 * functions). Setup during read_inode for all inodes with attribute
 82	 * lists. Only valid if NI_AttrList is set in state, and attr_list_rl is
 83	 * further only valid if NI_AttrListNonResident is set.
 84	 */
 85	u32 attr_list_size;	/* Length of attribute list value in bytes. */
 86	u8 *attr_list;		/* Attribute list value itself. */
 87	runlist attr_list_rl;	/* Run list for the attribute list value. */
 88	union {
 89		struct { /* It is a directory, $MFT, or an index inode. */
 90			u32 block_size;		/* Size of an index block. */
 91			u32 vcn_size;		/* Size of a vcn in this
 92						   index. */
 93			COLLATION_RULE collation_rule; /* The collation rule
 94						   for the index. */
 95			u8 block_size_bits; 	/* Log2 of the above. */
 96			u8 vcn_size_bits;	/* Log2 of the above. */
 97		} index;
 98		struct { /* It is a compressed/sparse file/attribute inode. */
 99			s64 size;		/* Copy of compressed_size from
100						   $DATA. */
101			u32 block_size;		/* Size of a compression block
102						   (cb). */
103			u8 block_size_bits;	/* Log2 of the size of a cb. */
104			u8 block_clusters;	/* Number of clusters per cb. */
105		} compressed;
106	} itype;
107	struct mutex extent_lock;	/* Lock for accessing/modifying the
108					   below . */
109	s32 nr_extents;	/* For a base mft record, the number of attached extent
110			   inodes (0 if none), for extent records and for fake
111			   inodes describing an attribute this is -1. */
112	union {		/* This union is only used if nr_extents != 0. */
113		ntfs_inode **extent_ntfs_inos;	/* For nr_extents > 0, array of
114						   the ntfs inodes of the extent
115						   mft records belonging to
116						   this base inode which have
117						   been loaded. */
118		ntfs_inode *base_ntfs_ino;	/* For nr_extents == -1, the
119						   ntfs inode of the base mft
120						   record. For fake inodes, the
121						   real (base) inode to which
122						   the attribute belongs. */
123	} ext;
124};
125
126/*
127 * Defined bits for the state field in the ntfs_inode structure.
128 * (f) = files only, (d) = directories only, (a) = attributes/fake inodes only
129 */
130typedef enum {
131	NI_Dirty,		/* 1: Mft record needs to be written to disk. */
132	NI_AttrList,		/* 1: Mft record contains an attribute list. */
133	NI_AttrListNonResident,	/* 1: Attribute list is non-resident. Implies
134				      NI_AttrList is set. */
135
136	NI_Attr,		/* 1: Fake inode for attribute i/o.
137				   0: Real inode or extent inode. */
138
139	NI_MstProtected,	/* 1: Attribute is protected by MST fixups.
140				   0: Attribute is not protected by fixups. */
141	NI_NonResident,		/* 1: Unnamed data attr is non-resident (f).
142				   1: Attribute is non-resident (a). */
143	NI_IndexAllocPresent = NI_NonResident,	/* 1: $I30 index alloc attr is
144						   present (d). */
145	NI_Compressed,		/* 1: Unnamed data attr is compressed (f).
146				   1: Create compressed files by default (d).
147				   1: Attribute is compressed (a). */
148	NI_Encrypted,		/* 1: Unnamed data attr is encrypted (f).
149				   1: Create encrypted files by default (d).
150				   1: Attribute is encrypted (a). */
151	NI_Sparse,		/* 1: Unnamed data attr is sparse (f).
152				   1: Create sparse files by default (d).
153				   1: Attribute is sparse (a). */
154	NI_SparseDisabled,	/* 1: May not create sparse regions. */
155	NI_TruncateFailed,	/* 1: Last ntfs_truncate() call failed. */
156} ntfs_inode_state_bits;
157
158/*
159 * NOTE: We should be adding dirty mft records to a list somewhere and they
160 * should be independent of the (ntfs/vfs) inode structure so that an inode can
161 * be removed but the record can be left dirty for syncing later.
162 */
163
164/*
165 * Macro tricks to expand the NInoFoo(), NInoSetFoo(), and NInoClearFoo()
166 * functions.
167 */
168#define NINO_FNS(flag)					\
169static inline int NIno##flag(ntfs_inode *ni)		\
170{							\
171	return test_bit(NI_##flag, &(ni)->state);	\
172}							\
173static inline void NInoSet##flag(ntfs_inode *ni)	\
174{							\
175	set_bit(NI_##flag, &(ni)->state);		\
176}							\
177static inline void NInoClear##flag(ntfs_inode *ni)	\
178{							\
179	clear_bit(NI_##flag, &(ni)->state);		\
180}
181
182/*
183 * As above for NInoTestSetFoo() and NInoTestClearFoo().
184 */
185#define TAS_NINO_FNS(flag)					\
186static inline int NInoTestSet##flag(ntfs_inode *ni)		\
187{								\
188	return test_and_set_bit(NI_##flag, &(ni)->state);	\
189}								\
190static inline int NInoTestClear##flag(ntfs_inode *ni)		\
191{								\
192	return test_and_clear_bit(NI_##flag, &(ni)->state);	\
193}
194
195/* Emit the ntfs inode bitops functions. */
196NINO_FNS(Dirty)
197TAS_NINO_FNS(Dirty)
198NINO_FNS(AttrList)
199NINO_FNS(AttrListNonResident)
200NINO_FNS(Attr)
201NINO_FNS(MstProtected)
202NINO_FNS(NonResident)
203NINO_FNS(IndexAllocPresent)
204NINO_FNS(Compressed)
205NINO_FNS(Encrypted)
206NINO_FNS(Sparse)
207NINO_FNS(SparseDisabled)
208NINO_FNS(TruncateFailed)
209
210/*
211 * The full structure containing a ntfs_inode and a vfs struct inode. Used for
212 * all real and fake inodes but not for extent inodes which lack the vfs struct
213 * inode.
214 */
215typedef struct {
216	ntfs_inode ntfs_inode;
217	struct inode vfs_inode;		/* The vfs inode structure. */
218} big_ntfs_inode;
219
220/**
221 * NTFS_I - return the ntfs inode given a vfs inode
222 * @inode:	VFS inode
223 *
224 * NTFS_I() returns the ntfs inode associated with the VFS @inode.
225 */
226static inline ntfs_inode *NTFS_I(struct inode *inode)
227{
228	return (ntfs_inode *)container_of(inode, big_ntfs_inode, vfs_inode);
229}
230
231static inline struct inode *VFS_I(ntfs_inode *ni)
232{
233	return &((big_ntfs_inode *)ni)->vfs_inode;
234}
235
236/**
237 * ntfs_attr - ntfs in memory attribute structure
238 * @mft_no:	mft record number of the base mft record of this attribute
239 * @name:	Unicode name of the attribute (NULL if unnamed)
240 * @name_len:	length of @name in Unicode characters (0 if unnamed)
241 * @type:	attribute type (see layout.h)
242 *
243 * This structure exists only to provide a small structure for the
244 * ntfs_{attr_}iget()/ntfs_test_inode()/ntfs_init_locked_inode() mechanism.
245 *
246 * NOTE: Elements are ordered by size to make the structure as compact as
247 * possible on all architectures.
248 */
249typedef struct {
250	unsigned long mft_no;
251	ntfschar *name;
252	u32 name_len;
253	ATTR_TYPE type;
254} ntfs_attr;
255
256typedef int (*test_t)(struct inode *, void *);
257
258extern int ntfs_test_inode(struct inode *vi, ntfs_attr *na);
259
260extern struct inode *ntfs_iget(struct super_block *sb, unsigned long mft_no);
261extern struct inode *ntfs_attr_iget(struct inode *base_vi, ATTR_TYPE type,
262		ntfschar *name, u32 name_len);
263extern struct inode *ntfs_index_iget(struct inode *base_vi, ntfschar *name,
264		u32 name_len);
265
266extern struct inode *ntfs_alloc_big_inode(struct super_block *sb);
267extern void ntfs_free_big_inode(struct inode *inode);
268extern void ntfs_evict_big_inode(struct inode *vi);
269
270extern void __ntfs_init_inode(struct super_block *sb, ntfs_inode *ni);
271
272static inline void ntfs_init_big_inode(struct inode *vi)
273{
274	ntfs_inode *ni = NTFS_I(vi);
275
276	ntfs_debug("Entering.");
277	__ntfs_init_inode(vi->i_sb, ni);
278	ni->mft_no = vi->i_ino;
279}
280
281extern ntfs_inode *ntfs_new_extent_inode(struct super_block *sb,
282		unsigned long mft_no);
283extern void ntfs_clear_extent_inode(ntfs_inode *ni);
284
285extern int ntfs_read_inode_mount(struct inode *vi);
286
287extern int ntfs_show_options(struct seq_file *sf, struct dentry *root);
288
289#ifdef NTFS_RW
290
291extern int ntfs_truncate(struct inode *vi);
292extern void ntfs_truncate_vfs(struct inode *vi);
293
294extern int ntfs_setattr(struct dentry *dentry, struct iattr *attr);
295
296extern int __ntfs_write_inode(struct inode *vi, int sync);
297
298static inline void ntfs_commit_inode(struct inode *vi)
299{
300	if (!is_bad_inode(vi))
301		__ntfs_write_inode(vi, 1);
302	return;
303}
304
305#else
306
307static inline void ntfs_truncate_vfs(struct inode *vi) {}
308
309#endif /* NTFS_RW */
310
311#endif /* _LINUX_NTFS_INODE_H */