minor corrections by M.Taguchi
[reactos.git] / reactos / drivers / fs / ntfs / linux-ntfs / volume.h
1 /*
2 * volume.h - Defines for volume structures in NTFS Linux kernel driver. Part
3 * of the Linux-NTFS project.
4 *
5 * Copyright (c) 2001,2002 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_VOLUME_H
25 #define _LINUX_NTFS_VOLUME_H
26
27 #include "types.h"
28
29 /*
30 * The NTFS in memory super block structure.
31 */
32 typedef struct {
33 /*
34 * FIXME: Reorder to have commonly used together element within the
35 * same cache line, aiming at a cache line size of 32 bytes. Aim for
36 * 64 bytes for less commonly used together elements. Put most commonly
37 * used elements to front of structure. Obviously do this only when the
38 * structure has stabilized... (AIA)
39 */
40 /* Device specifics. */
41 struct super_block *sb; /* Pointer back to the super_block,
42 so we don't have to get the offset
43 every time. */
44 LCN nr_blocks; /* Number of NTFS_BLOCK_SIZE bytes
45 sized blocks on the device. */
46 /* Configuration provided by user at mount time. */
47 unsigned long flags; /* Miscellaneous flags, see above. */
48 uid_t uid; /* uid that files will be mounted as. */
49 gid_t gid; /* gid that files will be mounted as. */
50 mode_t fmask; /* The mask for file permissions. */
51 mode_t dmask; /* The mask for directory
52 permissions. */
53 u8 mft_zone_multiplier; /* Initial mft zone multiplier. */
54 u8 on_errors; /* What to do on file system errors. */
55 /* NTFS bootsector provided information. */
56 u16 sector_size; /* in bytes */
57 u8 sector_size_bits; /* log2(sector_size) */
58 u32 cluster_size; /* in bytes */
59 u32 cluster_size_mask; /* cluster_size - 1 */
60 u8 cluster_size_bits; /* log2(cluster_size) */
61 u32 mft_record_size; /* in bytes */
62 u32 mft_record_size_mask; /* mft_record_size - 1 */
63 u8 mft_record_size_bits; /* log2(mft_record_size) */
64 u32 index_record_size; /* in bytes */
65 u32 index_record_size_mask; /* index_record_size - 1 */
66 u8 index_record_size_bits; /* log2(index_record_size) */
67 LCN nr_clusters; /* Volume size in clusters == number of
68 bits in lcn bitmap. */
69 LCN mft_lcn; /* Cluster location of mft data. */
70 LCN mftmirr_lcn; /* Cluster location of copy of mft. */
71 u64 serial_no; /* The volume serial number. */
72 /* Mount specific NTFS information. */
73 u32 upcase_len; /* Number of entries in upcase[]. */
74 uchar_t *upcase; /* The upcase table. */
75 LCN mft_zone_start; /* First cluster of the mft zone. */
76 LCN mft_zone_end; /* First cluster beyond the mft zone. */
77 struct inode *mft_ino; /* The VFS inode of $MFT. */
78
79 struct inode *mftbmp_ino; /* Attribute inode for $MFT/$BITMAP. */
80 struct rw_semaphore mftbmp_lock; /* Lock for serializing accesses to the
81 mft record bitmap ($MFT/$BITMAP). */
82 unsigned long nr_mft_records; /* Number of mft records == number of
83 bits in mft bitmap. */
84
85 struct inode *mftmirr_ino; /* The VFS inode of $MFTMirr. */
86 struct inode *lcnbmp_ino; /* The VFS inode of $Bitmap. */
87 struct rw_semaphore lcnbmp_lock; /* Lock for serializing accesses to the
88 cluster bitmap ($Bitmap/$DATA). */
89 struct inode *vol_ino; /* The VFS inode of $Volume. */
90 unsigned long vol_flags; /* Volume flags (VOLUME_*). */
91 u8 major_ver; /* Ntfs major version of volume. */
92 u8 minor_ver; /* Ntfs minor version of volume. */
93 struct inode *root_ino; /* The VFS inode of the root
94 directory. */
95 struct inode *secure_ino; /* The VFS inode of $Secure (NTFS3.0+
96 only, otherwise NULL). */
97 struct nls_table *nls_map;
98 } ntfs_volume;
99
100 /*
101 * Defined bits for the flags field in the ntfs_volume structure.
102 */
103 typedef enum {
104 NV_Errors, /* 1: Volume has errors, prevent remount rw. */
105 NV_ShowSystemFiles, /* 1: Return system files in ntfs_readdir(). */
106 NV_CaseSensitive, /* 1: Treat file names as case sensitive and
107 create filenames in the POSIX namespace.
108 Otherwise be case insensitive and create
109 file names in WIN32 namespace. */
110 } ntfs_volume_flags;
111
112 /*
113 * Macro tricks to expand the NVolFoo(), NVolSetFoo(), and NVolClearFoo()
114 * functions.
115 */
116 #define NVOL_FNS(flag) \
117 static inline int NVol##flag(ntfs_volume *vol) \
118 { \
119 return test_bit(NV_##flag, &(vol)->flags); \
120 } \
121 static inline void NVolSet##flag(ntfs_volume *vol) \
122 { \
123 set_bit(NV_##flag, &(vol)->flags); \
124 } \
125 static inline void NVolClear##flag(ntfs_volume *vol) \
126 { \
127 clear_bit(NV_##flag, &(vol)->flags); \
128 }
129
130 /* Emit the ntfs volume bitops functions. */
131 NVOL_FNS(Errors)
132 NVOL_FNS(ShowSystemFiles)
133 NVOL_FNS(CaseSensitive)
134
135 #endif /* _LINUX_NTFS_VOLUME_H */
136