xref: /haiku/src/add-ons/kernel/file_systems/ntfs/libntfs/param.h (revision 268f99dd7dc4bd7474a8bd2742d3f1ec1de6752a)
10d2c294fSGerasim Troeglazov /*
20d2c294fSGerasim Troeglazov  * param.h - Parameter values for ntfs-3g
30d2c294fSGerasim Troeglazov  *
4a814d850Sthreedeyes  * Copyright (c) 2009-2010 Jean-Pierre Andre
50d2c294fSGerasim Troeglazov  *
60d2c294fSGerasim Troeglazov  * This program/include file is free software; you can redistribute it and/or
70d2c294fSGerasim Troeglazov  * modify it under the terms of the GNU General Public License as published
80d2c294fSGerasim Troeglazov  * by the Free Software Foundation; either version 2 of the License, or
90d2c294fSGerasim Troeglazov  * (at your option) any later version.
100d2c294fSGerasim Troeglazov  *
110d2c294fSGerasim Troeglazov  * This program/include file is distributed in the hope that it will be
120d2c294fSGerasim Troeglazov  * useful, but WITHOUT ANY WARRANTY; without even the implied warranty
130d2c294fSGerasim Troeglazov  * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
140d2c294fSGerasim Troeglazov  * GNU General Public License for more details.
150d2c294fSGerasim Troeglazov  *
160d2c294fSGerasim Troeglazov  * You should have received a copy of the GNU General Public License
170d2c294fSGerasim Troeglazov  * along with this program (in the main directory of the NTFS-3G
180d2c294fSGerasim Troeglazov  * distribution in the file COPYING); if not, write to the Free Software
190d2c294fSGerasim Troeglazov  * Foundation,Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
200d2c294fSGerasim Troeglazov  */
210d2c294fSGerasim Troeglazov 
220d2c294fSGerasim Troeglazov #ifndef _NTFS_PARAM_H
230d2c294fSGerasim Troeglazov #define _NTFS_PARAM_H
240d2c294fSGerasim Troeglazov 
250d2c294fSGerasim Troeglazov #define CACHE_INODE_SIZE 32	/* inode cache, zero or >= 3 and not too big */
260d2c294fSGerasim Troeglazov #define CACHE_NIDATA_SIZE 64	/* idata cache, zero or >= 3 and not too big */
270d2c294fSGerasim Troeglazov #define CACHE_LOOKUP_SIZE 64	/* lookup cache, zero or >= 3 and not too big */
280d2c294fSGerasim Troeglazov #define CACHE_SECURID_SIZE 16    /* securid cache, zero or >= 3 and not too big */
290d2c294fSGerasim Troeglazov #define CACHE_LEGACY_SIZE 8    /* legacy cache size, zero or >= 3 and not too big */
300d2c294fSGerasim Troeglazov 
310d2c294fSGerasim Troeglazov #define FORCE_FORMAT_v1x 0	/* Insert security data as in NTFS v1.x */
320d2c294fSGerasim Troeglazov #define OWNERFROMACL 1		/* Get the owner from ACL (not Windows owner) */
330d2c294fSGerasim Troeglazov 
340d2c294fSGerasim Troeglazov 		/* default security sub-authorities */
350d2c294fSGerasim Troeglazov enum {
360d2c294fSGerasim Troeglazov 	DEFSECAUTH1 = -1153374643, /* 3141592653 */
370d2c294fSGerasim Troeglazov 	DEFSECAUTH2 = 589793238,
380d2c294fSGerasim Troeglazov 	DEFSECAUTH3 = 462843383,
390d2c294fSGerasim Troeglazov 	DEFSECBASE = 10000
400d2c294fSGerasim Troeglazov };
410d2c294fSGerasim Troeglazov 
420d2c294fSGerasim Troeglazov /*
43*9102cad6SAugustin Cavalier  *		Parameters for formatting
44*9102cad6SAugustin Cavalier  */
45*9102cad6SAugustin Cavalier 
46*9102cad6SAugustin Cavalier 		/* Up to Windows 10, the cluster size was limited to 64K */
47*9102cad6SAugustin Cavalier #define NTFS_MAX_CLUSTER_SIZE 2097152 /* Windows 10 Creators allows 2MB */
48*9102cad6SAugustin Cavalier 
49*9102cad6SAugustin Cavalier /*
500d2c294fSGerasim Troeglazov  *		Parameters for compression
510d2c294fSGerasim Troeglazov  */
520d2c294fSGerasim Troeglazov 
530d2c294fSGerasim Troeglazov 	/* default option for compression */
54a814d850Sthreedeyes #define DEFAULT_COMPRESSION 1
550d2c294fSGerasim Troeglazov 	/* (log2 of) number of clusters in a compression block for new files */
560d2c294fSGerasim Troeglazov #define STANDARD_COMPRESSION_UNIT 4
570d2c294fSGerasim Troeglazov 	/* maximum cluster size for allowing compression for new files */
580d2c294fSGerasim Troeglazov #define MAX_COMPRESSION_CLUSTER_SIZE 4096
590d2c294fSGerasim Troeglazov 
600d2c294fSGerasim Troeglazov /*
61da0906f2SGerasim Troeglazov  *		Parameters for default options
62da0906f2SGerasim Troeglazov  */
63da0906f2SGerasim Troeglazov 
64da0906f2SGerasim Troeglazov #define DEFAULT_DMTIME 60 /* default 1mn for delay_mtime */
65da0906f2SGerasim Troeglazov 
66da0906f2SGerasim Troeglazov /*
67a814d850Sthreedeyes  *		Use of big write buffers
68a814d850Sthreedeyes  *
69a814d850Sthreedeyes  *	With small volumes, the cluster allocator may fail to allocate
70a814d850Sthreedeyes  *	enough clusters when the volume is nearly full. At most a run
71a814d850Sthreedeyes  *	can be allocated per bitmap chunk. So, there is a danger when the
72a814d850Sthreedeyes  *	number of chunks (capacity/(32768*clsiz)) is less than the number
73a814d850Sthreedeyes  *	of clusters in the biggest write buffer (131072/clsiz). Hence
74a814d850Sthreedeyes  *	a safe minimal capacity is 4GB
75a814d850Sthreedeyes  */
76a814d850Sthreedeyes 
77a814d850Sthreedeyes #define SAFE_CAPACITY_FOR_BIG_WRITES 0x100000000LL
78a814d850Sthreedeyes 
79a814d850Sthreedeyes /*
80a814d850Sthreedeyes  *		Parameters for runlists
81a814d850Sthreedeyes  */
82a814d850Sthreedeyes 
83a814d850Sthreedeyes 	/* only update the final extent of a runlist when appending data */
84a814d850Sthreedeyes #define PARTIAL_RUNLIST_UPDATING 1
85a814d850Sthreedeyes 
86a814d850Sthreedeyes /*
870490778eSAugustin Cavalier  *		Parameters for upper-case table
880490778eSAugustin Cavalier  */
890490778eSAugustin Cavalier 
900490778eSAugustin Cavalier 	/* Create upper-case tables as defined by Windows 6.1 (Win7) */
910490778eSAugustin Cavalier #define UPCASE_MAJOR 6
920490778eSAugustin Cavalier #define UPCASE_MINOR 1
930490778eSAugustin Cavalier 
940490778eSAugustin Cavalier /*
95a814d850Sthreedeyes  *		Parameters for user and xattr mappings
96a814d850Sthreedeyes  */
97a814d850Sthreedeyes 
98a814d850Sthreedeyes #define XATTRMAPPINGFILE ".NTFS-3G/XattrMapping" /* default mapping file */
99a814d850Sthreedeyes 
100a814d850Sthreedeyes /*
101a814d850Sthreedeyes  *		Parameters for path canonicalization
102a814d850Sthreedeyes  */
103a814d850Sthreedeyes 
104a814d850Sthreedeyes #define MAPPERNAMELTH 256
105a814d850Sthreedeyes 
106a814d850Sthreedeyes /*
1070d2c294fSGerasim Troeglazov  *		Permission checking modes for high level and low level
1080d2c294fSGerasim Troeglazov  *
1090d2c294fSGerasim Troeglazov  *	The choices for high and low lowel are independent, they have
1100d2c294fSGerasim Troeglazov  *	no effect on the library
1110d2c294fSGerasim Troeglazov  *
1120d2c294fSGerasim Troeglazov  *	Stick to the recommended values unless you understand the consequences
1130d2c294fSGerasim Troeglazov  *	on protection and performances. Use of cacheing is good for
114a814d850Sthreedeyes  *	performances, but bad on security with internal fuse or external
115a814d850Sthreedeyes  *	fuse older than 2.8
1160d2c294fSGerasim Troeglazov  *
1170490778eSAugustin Cavalier  *	On Linux, cacheing is discouraged for the high level interface
1180490778eSAugustin Cavalier  *	in order to get proper support of hard links. As a consequence,
1190490778eSAugustin Cavalier  *	having access control in the file system leads to fewer requests
1200490778eSAugustin Cavalier  *	to the file system and fewer context switches.
1210490778eSAugustin Cavalier  *
122*9102cad6SAugustin Cavalier  *	Irrespective of the selected mode, cacheing is always used
123*9102cad6SAugustin Cavalier  *	in read-only mounts
124*9102cad6SAugustin Cavalier  *
1250d2c294fSGerasim Troeglazov  *	Possible values for high level :
1260d2c294fSGerasim Troeglazov  *		1 : no cache, kernel control (recommended)
1270d2c294fSGerasim Troeglazov  *		4 : no cache, file system control
1280490778eSAugustin Cavalier  *		6 : kernel/fuse cache, file system control (OpenIndiana only)
1290d2c294fSGerasim Troeglazov  *		7 : no cache, kernel control for ACLs
1300d2c294fSGerasim Troeglazov  *
1310d2c294fSGerasim Troeglazov  *	Possible values for low level :
1320d2c294fSGerasim Troeglazov  *		2 : no cache, kernel control
1330490778eSAugustin Cavalier  *		3 : use kernel/fuse cache, kernel control (recommended)
1340490778eSAugustin Cavalier  *		5 : no cache, file system control
1350490778eSAugustin Cavalier  *		6 : kernel/fuse cache, file system control (OpenIndiana only)
1360d2c294fSGerasim Troeglazov  *		8 : no cache, kernel control for ACLs
1370490778eSAugustin Cavalier  *		9 : kernel/fuse cache, kernel control for ACLs (target)
1380d2c294fSGerasim Troeglazov  *
1390490778eSAugustin Cavalier  *	Use of options 7, 8 and 9 requires a fuse module upgrade
1400d2c294fSGerasim Troeglazov  *	When Posix ACLs are selected in the configure options, a value
1410d2c294fSGerasim Troeglazov  *	of 6 is added in the mount report.
1420d2c294fSGerasim Troeglazov  */
1430d2c294fSGerasim Troeglazov 
144*9102cad6SAugustin Cavalier #define TIMEOUT_RO 600 /* Attribute time out for read-only mounts */
145da0906f2SGerasim Troeglazov #if defined(__sun) && defined(__SVR4)
1460490778eSAugustin Cavalier /*
1470490778eSAugustin Cavalier  *	Access control by kernel is not implemented on OpenIndiana,
1480490778eSAugustin Cavalier  *	however care is taken of cacheing hard-linked files.
1490490778eSAugustin Cavalier  */
1500490778eSAugustin Cavalier #define HPERMSCONFIG 6
1510490778eSAugustin Cavalier #define LPERMSCONFIG 6
1520490778eSAugustin Cavalier #else /* defined(__sun) && defined(__SVR4) */
1530490778eSAugustin Cavalier /*
1540490778eSAugustin Cavalier  *	Cacheing by kernel is buggy on Linux when access control is done
1550490778eSAugustin Cavalier  *	by the file system, and also when using hard-linked files on
1560490778eSAugustin Cavalier  *	the fuse high level interface.
157*9102cad6SAugustin Cavalier  *	Also ACL checks by recent kernels do not prove satisfactory.
1580490778eSAugustin Cavalier  */
1590d2c294fSGerasim Troeglazov #define HPERMSCONFIG 1
160*9102cad6SAugustin Cavalier #define LPERMSCONFIG 3
1610490778eSAugustin Cavalier #endif /* defined(__sun) && defined(__SVR4) */
1620d2c294fSGerasim Troeglazov 
1630d2c294fSGerasim Troeglazov #endif /* defined _NTFS_PARAM_H */
164