{FULLFAT]
[reactos.git] / reactos / include / reactos / libs / fullfat / ff_config.h
1 /*****************************************************************************
2 * FullFAT - High Performance, Thread-Safe Embedded FAT File-System *
3 * Copyright (C) 2009 James Walmsley (james@worm.me.uk) *
4 * *
5 * This program is free software: you can redistribute it and/or modify *
6 * it under the terms of the GNU General Public License as published by *
7 * the Free Software Foundation, either version 3 of the License, or *
8 * (at your option) any later version. *
9 * *
10 * This program is distributed in the hope that it will be useful, *
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of *
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
13 * GNU General Public License for more details. *
14 * *
15 * You should have received a copy of the GNU General Public License *
16 * along with this program. If not, see <http://www.gnu.org/licenses/>. *
17 * *
18 * IMPORTANT NOTICE: *
19 * ================= *
20 * Alternative Licensing is available directly from the Copyright holder, *
21 * (James Walmsley). For more information consult LICENSING.TXT to obtain *
22 * a Commercial license. *
23 * *
24 * See RESTRICTIONS.TXT for extra restrictions on the use of FullFAT. *
25 * *
26 * Removing the above notice is illegal and will invalidate this license. *
27 *****************************************************************************
28 * See http://worm.me.uk/fullfat for more information. *
29 * Or http://fullfat.googlecode.com/ for latest releases and the wiki. *
30 *****************************************************************************/
31 #ifndef _FF_CONFIG_H_
32 #define _FF_CONFIG_H_
33 /*
34 Here you can change the configuration of FullFAT as appropriate to your
35 platform.
36 */
37
38 //---------- ENDIANESS
39 #define FF_LITTLE_ENDIAN // Choosing the Byte-order of your system is important.
40 //#define FF_BIG_ENDIAN // You may be able to provide better Byte-order swapping routines to FullFAT.
41 // See ff_memory.c for more information.
42
43 //---------- LFN (Long File-name) SUPPORT
44 #define FF_LFN_SUPPORT // Comment this out if you don't want to worry about Patent Issues.
45 // FullFAT works great with LFNs and without. You choose, its your project!
46
47 //---------- LEGAL LFNS
48 //#define FF_LEGAL_LFNS // Enabling this define causes FullFAT to not infringe on any of Microsoft's patents when making LFN names.
49 // To do this, it will only create LFNs and no shortnames. Microsofts patents are only relevent when mapping
50 // a shortname to a long name. This is the same way that Linux gets around the FAT legal issues:
51 // see http://lkml.org/lkml/2009/6/26/314
52 //
53 // Enabling this may break compatibility with devices that cannot read LFN filenames.
54 // Enabling this option causes no compatibility issues when reading any media.
55
56 //---------- TIME SUPPORT
57 #define FF_TIME_SUPPORT // Should FullFAT use time stamping. Only if you have provided the relevant time drivers in ff_time.c
58 // Note, by default ff_time.c is set-up for the Windows Demonstration. Please see ff_time.c to disable.
59
60 //---------- FILE SPACE ALLOCATION PERFORMANCE
61 // Uncomment the prefered method. (Can only choose a single method).
62 #define FF_ALLOC_DEFAULT // Only allocate as much as is needed. (Provides good performance, without wasting space).
63 //#define FF_ALLOC_DOUBLE // Doubles the size of a file each time allocation is required. (When high-performance writing is required).
64
65 //---------- Use Native STDIO.h
66 //#define FF_USE_NATIVE_STDIO // Makes FullFAT conform to values provided by your native STDIO.h file.
67
68 //---------- FREE SPACE CALCULATION
69 //#define FF_MOUNT_FIND_FREE // Uncomment this option to check for Freespace on a volume mount. (Performance Penalty while mounting).
70 // If not done in the mount, it will be done on the first call to FF_GetFreeSize() function.
71
72 //---------- PATH CACHE
73 #define FF_PATH_CACHE // Enables a simply Path Caching mechanism that increases performance of repeated operations
74 // within the same path. E.g. a copy \dir1\*.* \dir2\*.* command.
75 // This command requires FF_MAX_PATH number of bytes of memory. (Defined below, default 2600).
76
77 //---------- BLKDEV USES SEMAPHORE
78 #define FF_BLKDEV_USES_SEM // When defined, each call to fnReadBlocks and fnWriteBlocks will be done while semaphore is locked
79 // See also ff_safety.c
80 // (HT addition)
81
82
83 #define FF_PATH_CACHE_DEPTH 2 // The Number of PATH's to Cache.
84
85 //---------- DON'T USE MALLOC
86 //#define FF_NO_MALLOC
87
88 #define FF_MALLOC(aSize) malloc(aSize)
89 #define FF_FREE(apPtr) free(apPtr)
90
91 //#define FF_INLINE_MEMORY_ACCESS
92
93 //#define FF_INLINE static __forceinline // Keywords to inline functions (Windows)
94 #define FF_INLINE static inline // Standard for GCC
95
96
97 //---------- Hash Table Support
98 //#define FF_HASH_TABLE_SUPPORT // Enable HASH to speed up file creation.
99 #ifdef FF_HASH_TABLE_SUPPORT
100 #define FF_HASH_FUNCTION CRC16
101 //#define FF_HASH_FUNCTION CRC8
102 #endif
103
104
105
106 //---------- FAT12 SUPPORT
107 #define FF_FAT12_SUPPORT // Enable FAT12 Suppport. You can reduce the code-size by commenting this out.
108 // If you don't need FAT12 support, why have it. FAT12 is more complex to process,
109 // therefore savings can be made by not having it.
110
111 //---------- 64-Bit Number Support
112 #define FF_64_NUM_SUPPORT // This helps to give information about the FreeSpace and VolumeSize of a partition or volume.
113 // If you cannot support 64-bit integers, then FullFAT still works, its just that the functions:
114 // FF_GetFreeSize() and FF_GetVolumeSize() don't make sense when reporting sizes > 4GB.
115
116 //---------- Driver Sleep Time // How long FullFAT should sleep the thread for in ms, if FF_ERR_DRIVER_BUSY is recieved.
117 #define FF_DRIVER_BUSY_SLEEP 20
118
119 //---------- Debugging Features
120 #define FF_DEBUG // Enable the Error Code string functions. const FF_T_INT8 *FF_GetErrMessage( FF_T_SINT32 iErrorCode);
121 // Uncommenting this just stops FullFAT error strings being compiled.
122
123 //---------- Actively Determine if partition is FAT
124 #define FF_FAT_CHECK // This is experimental, so if FullFAT won't mount your volume, comment this out
125 // Also report the problem to james@worm.me.uk
126
127
128 //---------- AUTOMATIC SETTINGS DO NOT EDIT -- These configure your options from above, and check sanity!
129
130 #ifdef FF_LFN_SUPPORT
131 #define FF_MAX_FILENAME (129)
132 #else
133 #define FF_MAX_FILENAME 13
134 #endif
135
136 #ifdef FF_USE_NATIVE_STDIO
137 #ifdef MAX_PATH
138 #define FF_MAX_PATH MAX_PATH
139 #else
140 #define FF_MAX_PATH 2600
141 #endif
142 #else
143 #define FF_MAX_PATH 2600
144 #endif
145
146 #ifndef FF_ALLOC_DOUBLE
147 #ifndef FF_ALLOC_DEFAULT
148 #error FullFAT Invalid ff_config.h file: A file allocation method must be specified. See ff_config.h file.
149 #endif
150 #endif
151
152 #ifdef FF_ALLOC_DOUBLE
153 #ifdef FF_ALLOC_DEFAULT
154 #error FullFAT Invalid ff_config.h file: Must choose a single option for File Allocation Method. DOUBLE or DEFAULT. See ff_config.h file.
155 #endif
156 #endif
157
158 #ifndef FF_LITTLE_ENDIAN
159 #ifndef FF_BIG_ENDIAN
160 #error FullFAT Invalid ff_config.h file: An ENDIANESS must be defined for your platform. See ff_config.h file.
161 #endif
162 #endif
163
164 #ifdef FF_LITTLE_ENDIAN
165 #ifdef FF_BIG_ENDIAN
166 #error FullFAT Invalid ff_config.h file: Cannot be BIG and LITTLE ENDIAN, choose either or BIG or LITTLE. See ff_config.h file.
167 #endif
168 #endif
169
170 #ifdef FF_HASH_TABLE_SUPPORT
171
172 #if FF_HASH_FUNCTION == CRC16
173 #define FF_HASH_TABLE_SIZE 8192
174 #elif FF_HASH_FUNCTION == CRC8
175 #define FF_HASH_TABLE_SIZE 32
176 #else
177 #error Invalid Hashing function selected. CRC16 or CRC8!
178 #endif
179
180 #endif
181
182 #endif