MOXA linux-2.6.x / linux-2.6.9-uc0 from sdlinux-moxaart.tgz
[linux-2.6.9-moxart.git] / fs / ntfs / volume.h
blob9775fa65895ee0df96ce0ebdb9f64659fa734674
1 /*
2 * volume.h - Defines for volume structures in NTFS Linux kernel driver. Part
3 * of the Linux-NTFS project.
5 * Copyright (c) 2001-2004 Anton Altaparmakov
6 * Copyright (c) 2002 Richard Russon
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.
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.
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
24 #ifndef _LINUX_NTFS_VOLUME_H
25 #define _LINUX_NTFS_VOLUME_H
27 #include "types.h"
28 #include "layout.h"
31 * The NTFS in memory super block structure.
33 typedef struct {
35 * FIXME: Reorder to have commonly used together element within the
36 * same cache line, aiming at a cache line size of 32 bytes. Aim for
37 * 64 bytes for less commonly used together elements. Put most commonly
38 * used elements to front of structure. Obviously do this only when the
39 * structure has stabilized... (AIA)
41 /* Device specifics. */
42 struct super_block *sb; /* Pointer back to the super_block,
43 so we don't have to get the offset
44 every time. */
45 LCN nr_blocks; /* Number of NTFS_BLOCK_SIZE bytes
46 sized blocks on the device. */
47 /* Configuration provided by user at mount time. */
48 unsigned long flags; /* Miscellaneous flags, see below. */
49 uid_t uid; /* uid that files will be mounted as. */
50 gid_t gid; /* gid that files will be mounted as. */
51 mode_t fmask; /* The mask for file permissions. */
52 mode_t dmask; /* The mask for directory
53 permissions. */
54 u8 mft_zone_multiplier; /* Initial mft zone multiplier. */
55 u8 on_errors; /* What to do on file system errors. */
56 /* NTFS bootsector provided information. */
57 u16 sector_size; /* in bytes */
58 u8 sector_size_bits; /* log2(sector_size) */
59 u32 cluster_size; /* in bytes */
60 u32 cluster_size_mask; /* cluster_size - 1 */
61 u8 cluster_size_bits; /* log2(cluster_size) */
62 u32 mft_record_size; /* in bytes */
63 u32 mft_record_size_mask; /* mft_record_size - 1 */
64 u8 mft_record_size_bits; /* log2(mft_record_size) */
65 u32 index_record_size; /* in bytes */
66 u32 index_record_size_mask; /* index_record_size - 1 */
67 u8 index_record_size_bits; /* log2(index_record_size) */
68 LCN nr_clusters; /* Volume size in clusters == number of
69 bits in lcn bitmap. */
70 LCN mft_lcn; /* Cluster location of mft data. */
71 LCN mftmirr_lcn; /* Cluster location of copy of mft. */
72 u64 serial_no; /* The volume serial number. */
73 /* Mount specific NTFS information. */
74 u32 upcase_len; /* Number of entries in upcase[]. */
75 ntfschar *upcase; /* The upcase table. */
77 s32 attrdef_size; /* Size of the attribute definition
78 table in bytes. */
79 ATTR_DEF *attrdef; /* Table of attribute definitions.
80 Obtained from FILE_AttrDef. */
82 #ifdef NTFS_RW
83 /* Variables used by the cluster and mft allocators. */
84 LCN mft_zone_start; /* First cluster of the mft zone. */
85 LCN mft_zone_end; /* First cluster beyond the mft zone. */
86 LCN mft_zone_pos; /* Current position in the mft zone. */
87 LCN data1_zone_pos; /* Current position in the first data
88 zone. */
89 LCN data2_zone_pos; /* Current position in the second data
90 zone. */
91 #endif /* NTFS_RW */
93 struct inode *mft_ino; /* The VFS inode of $MFT. */
95 struct inode *mftbmp_ino; /* Attribute inode for $MFT/$BITMAP. */
96 struct rw_semaphore mftbmp_lock; /* Lock for serializing accesses to the
97 mft record bitmap ($MFT/$BITMAP). */
98 #ifdef NTFS_RW
99 struct inode *mftmirr_ino; /* The VFS inode of $MFTMirr. */
100 int mftmirr_size; /* Size of mft mirror in mft records. */
102 struct inode *logfile_ino; /* The VFS inode of $LogFile. */
103 #endif /* NTFS_RW */
105 struct inode *lcnbmp_ino; /* The VFS inode of $Bitmap. */
106 struct rw_semaphore lcnbmp_lock; /* Lock for serializing accesses to the
107 cluster bitmap ($Bitmap/$DATA). */
109 struct inode *vol_ino; /* The VFS inode of $Volume. */
110 VOLUME_FLAGS vol_flags; /* Volume flags. */
111 u8 major_ver; /* Ntfs major version of volume. */
112 u8 minor_ver; /* Ntfs minor version of volume. */
114 struct inode *root_ino; /* The VFS inode of the root
115 directory. */
116 struct inode *secure_ino; /* The VFS inode of $Secure (NTFS3.0+
117 only, otherwise NULL). */
118 struct inode *extend_ino; /* The VFS inode of $Extend (NTFS3.0+
119 only, otherwise NULL). */
120 #ifdef NTFS_RW
121 /* $Quota stuff is NTFS3.0+ specific. Unused/NULL otherwise. */
122 struct inode *quota_ino; /* The VFS inode of $Quota. */
123 struct inode *quota_q_ino; /* Attribute inode for $Quota/$Q. */
124 #endif /* NTFS_RW */
125 struct nls_table *nls_map;
126 } ntfs_volume;
129 * Defined bits for the flags field in the ntfs_volume structure.
131 typedef enum {
132 NV_Errors, /* 1: Volume has errors, prevent remount rw. */
133 NV_ShowSystemFiles, /* 1: Return system files in ntfs_readdir(). */
134 NV_CaseSensitive, /* 1: Treat file names as case sensitive and
135 create filenames in the POSIX namespace.
136 Otherwise be case insensitive and create
137 file names in WIN32 namespace. */
138 NV_LogFileEmpty, /* 1: $LogFile journal is empty. */
139 NV_QuotaOutOfDate, /* 1: $Quota is out of date. */
140 } ntfs_volume_flags;
143 * Macro tricks to expand the NVolFoo(), NVolSetFoo(), and NVolClearFoo()
144 * functions.
146 #define NVOL_FNS(flag) \
147 static inline int NVol##flag(ntfs_volume *vol) \
149 return test_bit(NV_##flag, &(vol)->flags); \
151 static inline void NVolSet##flag(ntfs_volume *vol) \
153 set_bit(NV_##flag, &(vol)->flags); \
155 static inline void NVolClear##flag(ntfs_volume *vol) \
157 clear_bit(NV_##flag, &(vol)->flags); \
160 /* Emit the ntfs volume bitops functions. */
161 NVOL_FNS(Errors)
162 NVOL_FNS(ShowSystemFiles)
163 NVOL_FNS(CaseSensitive)
164 NVOL_FNS(LogFileEmpty)
165 NVOL_FNS(QuotaOutOfDate)
167 #endif /* _LINUX_NTFS_VOLUME_H */