Blame view

fs/ntfs/volume.h 6.09 KB
a1d312de7   Thomas Gleixner   treewide: Replace...
1
  /* SPDX-License-Identifier: GPL-2.0-or-later */
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
2
3
4
5
  /*
   * volume.h - Defines for volume structures in NTFS Linux kernel driver. Part
   *	      of the Linux-NTFS project.
   *
1cf3109ff   Anton Altaparmakov   NTFS: Do more det...
6
   * Copyright (c) 2001-2006 Anton Altaparmakov
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
7
   * Copyright (c) 2002 Richard Russon
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
8
9
10
11
12
13
   */
  
  #ifndef _LINUX_NTFS_VOLUME_H
  #define _LINUX_NTFS_VOLUME_H
  
  #include <linux/rwsem.h>
b29f7751c   Eric W. Biederman   userns: Convert n...
14
  #include <linux/uidgid.h>
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
  
  #include "types.h"
  #include "layout.h"
  
  /*
   * The NTFS in memory super block structure.
   */
  typedef struct {
  	/*
  	 * FIXME: Reorder to have commonly used together element within the
  	 * same cache line, aiming at a cache line size of 32 bytes. Aim for
  	 * 64 bytes for less commonly used together elements. Put most commonly
  	 * used elements to front of structure. Obviously do this only when the
  	 * structure has stabilized... (AIA)
  	 */
  	/* Device specifics. */
1cf3109ff   Anton Altaparmakov   NTFS: Do more det...
31
32
  	struct super_block *sb;		/* Pointer back to the super_block. */
  	LCN nr_blocks;			/* Number of sb->s_blocksize bytes
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
33
34
35
  					   sized blocks on the device. */
  	/* Configuration provided by user at mount time. */
  	unsigned long flags;		/* Miscellaneous flags, see below. */
b29f7751c   Eric W. Biederman   userns: Convert n...
36
37
  	kuid_t uid;			/* uid that files will be mounted as. */
  	kgid_t gid;			/* gid that files will be mounted as. */
d0c00d067   Al Viro   ntfs: propagate u...
38
39
  	umode_t fmask;			/* The mask for file permissions. */
  	umode_t dmask;			/* The mask for directory
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
40
41
  					   permissions. */
  	u8 mft_zone_multiplier;		/* Initial mft zone multiplier. */
c002f4254   Anton Altaparmakov   NTFS: - Add disab...
42
  	u8 on_errors;			/* What to do on filesystem errors. */
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
  	/* NTFS bootsector provided information. */
  	u16 sector_size;		/* in bytes */
  	u8 sector_size_bits;		/* log2(sector_size) */
  	u32 cluster_size;		/* in bytes */
  	u32 cluster_size_mask;		/* cluster_size - 1 */
  	u8 cluster_size_bits;		/* log2(cluster_size) */
  	u32 mft_record_size;		/* in bytes */
  	u32 mft_record_size_mask;	/* mft_record_size - 1 */
  	u8 mft_record_size_bits;	/* log2(mft_record_size) */
  	u32 index_record_size;		/* in bytes */
  	u32 index_record_size_mask;	/* index_record_size - 1 */
  	u8 index_record_size_bits;	/* log2(index_record_size) */
  	LCN nr_clusters;		/* Volume size in clusters == number of
  					   bits in lcn bitmap. */
  	LCN mft_lcn;			/* Cluster location of mft data. */
  	LCN mftmirr_lcn;		/* Cluster location of copy of mft. */
  	u64 serial_no;			/* The volume serial number. */
  	/* Mount specific NTFS information. */
  	u32 upcase_len;			/* Number of entries in upcase[]. */
  	ntfschar *upcase;		/* The upcase table. */
  
  	s32 attrdef_size;		/* Size of the attribute definition
  					   table in bytes. */
  	ATTR_DEF *attrdef;		/* Table of attribute definitions.
  					   Obtained from FILE_AttrDef. */
  
  #ifdef NTFS_RW
  	/* Variables used by the cluster and mft allocators. */
  	s64 mft_data_pos;		/* Mft record number at which to
  					   allocate the next mft record. */
  	LCN mft_zone_start;		/* First cluster of the mft zone. */
  	LCN mft_zone_end;		/* First cluster beyond the mft zone. */
  	LCN mft_zone_pos;		/* Current position in the mft zone. */
  	LCN data1_zone_pos;		/* Current position in the first data
  					   zone. */
  	LCN data2_zone_pos;		/* Current position in the second data
  					   zone. */
  #endif /* NTFS_RW */
  
  	struct inode *mft_ino;		/* The VFS inode of $MFT. */
  
  	struct inode *mftbmp_ino;	/* Attribute inode for $MFT/$BITMAP. */
  	struct rw_semaphore mftbmp_lock; /* Lock for serializing accesses to the
  					    mft record bitmap ($MFT/$BITMAP). */
  #ifdef NTFS_RW
  	struct inode *mftmirr_ino;	/* The VFS inode of $MFTMirr. */
  	int mftmirr_size;		/* Size of mft mirror in mft records. */
  
  	struct inode *logfile_ino;	/* The VFS inode of $LogFile. */
  #endif /* NTFS_RW */
  
  	struct inode *lcnbmp_ino;	/* The VFS inode of $Bitmap. */
  	struct rw_semaphore lcnbmp_lock; /* Lock for serializing accesses to the
  					    cluster bitmap ($Bitmap/$DATA). */
  
  	struct inode *vol_ino;		/* The VFS inode of $Volume. */
  	VOLUME_FLAGS vol_flags;		/* Volume flags. */
  	u8 major_ver;			/* Ntfs major version of volume. */
  	u8 minor_ver;			/* Ntfs minor version of volume. */
  
  	struct inode *root_ino;		/* The VFS inode of the root
  					   directory. */
  	struct inode *secure_ino;	/* The VFS inode of $Secure (NTFS3.0+
  					   only, otherwise NULL). */
  	struct inode *extend_ino;	/* The VFS inode of $Extend (NTFS3.0+
  					   only, otherwise NULL). */
  #ifdef NTFS_RW
  	/* $Quota stuff is NTFS3.0+ specific.  Unused/NULL otherwise. */
  	struct inode *quota_ino;	/* The VFS inode of $Quota. */
  	struct inode *quota_q_ino;	/* Attribute inode for $Quota/$Q. */
3f2faef00   Anton Altaparmakov   NTFS: Stamp the t...
113
114
115
116
  	/* $UsnJrnl stuff is NTFS3.0+ specific.  Unused/NULL otherwise. */
  	struct inode *usnjrnl_ino;	/* The VFS inode of $UsnJrnl. */
  	struct inode *usnjrnl_max_ino;	/* Attribute inode for $UsnJrnl/$Max. */
  	struct inode *usnjrnl_j_ino;	/* Attribute inode for $UsnJrnl/$J. */
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
117
118
119
120
121
122
123
124
125
126
127
128
  #endif /* NTFS_RW */
  	struct nls_table *nls_map;
  } ntfs_volume;
  
  /*
   * Defined bits for the flags field in the ntfs_volume structure.
   */
  typedef enum {
  	NV_Errors,		/* 1: Volume has errors, prevent remount rw. */
  	NV_ShowSystemFiles,	/* 1: Return system files in ntfs_readdir(). */
  	NV_CaseSensitive,	/* 1: Treat file names as case sensitive and
  				      create filenames in the POSIX namespace.
1cf3109ff   Anton Altaparmakov   NTFS: Do more det...
129
130
  				      Otherwise be case insensitive but still
  				      create file names in POSIX namespace. */
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
131
132
  	NV_LogFileEmpty,	/* 1: $LogFile journal is empty. */
  	NV_QuotaOutOfDate,	/* 1: $Quota is out of date. */
3f2faef00   Anton Altaparmakov   NTFS: Stamp the t...
133
  	NV_UsnJrnlStamped,	/* 1: $UsnJrnl has been stamped. */
c002f4254   Anton Altaparmakov   NTFS: - Add disab...
134
  	NV_SparseEnabled,	/* 1: May create sparse files. */
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
135
136
137
138
139
140
  } ntfs_volume_flags;
  
  /*
   * Macro tricks to expand the NVolFoo(), NVolSetFoo(), and NVolClearFoo()
   * functions.
   */
1cf3109ff   Anton Altaparmakov   NTFS: Do more det...
141
  #define DEFINE_NVOL_BIT_OPS(flag)					\
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
142
143
144
145
146
147
148
149
150
151
152
153
154
155
  static inline int NVol##flag(ntfs_volume *vol)		\
  {							\
  	return test_bit(NV_##flag, &(vol)->flags);	\
  }							\
  static inline void NVolSet##flag(ntfs_volume *vol)	\
  {							\
  	set_bit(NV_##flag, &(vol)->flags);		\
  }							\
  static inline void NVolClear##flag(ntfs_volume *vol)	\
  {							\
  	clear_bit(NV_##flag, &(vol)->flags);		\
  }
  
  /* Emit the ntfs volume bitops functions. */
1cf3109ff   Anton Altaparmakov   NTFS: Do more det...
156
157
158
159
160
161
162
  DEFINE_NVOL_BIT_OPS(Errors)
  DEFINE_NVOL_BIT_OPS(ShowSystemFiles)
  DEFINE_NVOL_BIT_OPS(CaseSensitive)
  DEFINE_NVOL_BIT_OPS(LogFileEmpty)
  DEFINE_NVOL_BIT_OPS(QuotaOutOfDate)
  DEFINE_NVOL_BIT_OPS(UsnJrnlStamped)
  DEFINE_NVOL_BIT_OPS(SparseEnabled)
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
163
164
  
  #endif /* _LINUX_NTFS_VOLUME_H */