ReactOS 0.4.15-dev-7961-gdcf9eb0
ff_config.h
Go to the documentation of this file.
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//---------- ENDIANESS
38#define FF_LITTLE_ENDIAN // Choosing the Byte-order of your system is important.
39//#define FF_BIG_ENDIAN // You may be able to provide better Byte-order swapping routines to FullFAT.
40 // See ff_memory.c for more information.
41
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//#define FF_INCLUDE_SHORT_NAME // HT addition, in 'FF_DIRENT', beside FileName, ShortName will be filled as well
48 // Useful for debugging, but also some situations its useful to know both.
49//---------- SHORTNAMES CAN USE THE CASE BITS
50#define FF_SHORTNAME_CASE // Works for XP+ e.g. short.TXT or SHORT.txt.
51
52
53//---------- UNICODE SUPPORT
54#define FF_UNICODE_SUPPORT // If this is defined, then all of FullFAT's API's will expect to receive UTF-16 formatted strings.
55 // FF_FindFirst() and FF_FindNext() will also return Filenames in UTF-16 format.
56 // NOTE: This option may cause FullFAT to not "Clean-compile" when using GCC. This is because
57 // pedantically GCC refuses to accept C99 library functions, unless the -std=c99 flag is used.
58 // To use UNICODE (UTF-16, or UTF-32 depending on the size of wchar_t) you must have a C99 compliant
59 // compiler and library.
60
61//#define FF_UNICODE_UTF8_SUPPORT // If this is defined, then all of FullFAT's API's will expect to receive UTF-8 formatted strings.
62 // FF_FindFirst() and FF_FindNext() will also return Filenames in UTF-8 format.
63
64 // Note the 2 UNICODE options are mutually exclusive. Only one can be enabled.
65
66 // Ensure that dirents are big enough to hold the maximum UTF-8 sequence.
67
68
69//---------- FAT12 SUPPORT
70#define FF_FAT12_SUPPORT // Enable FAT12 Suppport. You can reduce the code-size by commenting this out.
71 // If you don't need FAT12 support, why have it. FAT12 is more complex to process,
72 // therefore savings can be made by not having it.
73
74
75//---------- TIME SUPPORT
76#define FF_TIME_SUPPORT // Should FullFAT use time stamping. Only if you have provided the relevant time drivers in ff_time.c
77 // Note, by default ff_time.c is set-up for the Windows Demonstration. Please see ff_time.c to disable.
78
79
80//---------- FILE SPACE ALLOCATION PERFORMANCE
81 // Uncomment the prefered method. (Can only choose a single method).
82#define FF_ALLOC_DEFAULT // Only allocate as much as is needed. (Provides good performance, without wasting space).
83//#define FF_ALLOC_DOUBLE // Doubles the size of a file each time allocation is required. (When high-performance writing is required).
84
85
86//---------- Use Native STDIO.h
87//#define FF_USE_NATIVE_STDIO // Makes FullFAT conform to values provided by your native STDIO.h file.
88
89
90//---------- FREE SPACE CALCULATION
91//#define FF_MOUNT_FIND_FREE // Uncomment this option to check for Freespace on a volume mount. (Performance Penalty while mounting).
92 // If not done in the mount, it will be done on the first call to FF_GetFreeSize() function.
93
94
95//---------- FIND API WILD-CARD SUPPORT
96#define FF_FINDAPI_ALLOW_WILDCARDS // Defined to enable Wild-cards in the API. Disabling this, makes the API consistent with 1.0.x series.
97
98#define FF_WILDCARD_CASE_INSENSITIVE // Alter the case insensitivity of the Wild-card checking behaviour.
99
100
101//---------- PATH CACHE ----------
102#define FF_PATH_CACHE // Enables a simply Path Caching mechanism that increases performance of repeated operations
103 // within the same path. E.g. a copy \dir1\*.* \dir2\*.* command.
104 // This command requires FF_MAX_PATH number of bytes of memory. (Defined below, default 2600).
105
106#define FF_PATH_CACHE_DEPTH 5 // The Number of PATH's to Cache. (Memory Requirement ~= FF_PATH_CACHE_DEPTH * FF_MAX_PATH).
107
108
109//---------- HASH CACHE // Speed up File-creation with a HASH table. Provides up to 20x performance boost.
110//#define FF_HASH_CACHE // Enable HASH to speed up file creation.
111#define FF_HASH_CACHE_DEPTH 10 // Number of Directories to be Hashed. (For CRC16 memory is 8KB * DEPTH)
112#define FF_HASH_FUNCTION CRC16 // Choose a 16-bit hash.
113//#define FF_HASH_FUNCTION CRC8 // Choose an 8-bit hash.
114
115
116//---------- BLKDEV USES SEMAPHORE
117#define FF_BLKDEV_USES_SEM // When defined, each call to fnReadBlocks and fnWriteBlocks will be done while semaphore is locked
118 // See also ff_safety.c
119 // (HT addition) - Thanks to Hein Tibosch
120
121
122//---------- MALLOC
123 // These should map on to platform specific memory allocators.
124#define FF_MALLOC(aSize) FF_Malloc(aSize)
125#define FF_FREE(apPtr) FF_Free(apPtr)
126
127
128//---------- IN-LINE FUNCTIONS
129//---------- INLINE KeyWord // Define FF_INLINE as your compiler's inline keyword. This is placed before the type qualifier.
130#define FF_INLINE static __forceinline // Keywords to inline functions (Windows)
131//#define FF_INLINE static inline // Standard for GCC
132
133//---------- Inline Memory Independence Routines for better performance, but bigger codesize.
134//#define FF_INLINE_MEMORY_ACCESS
135//---------- Inline Block Calculation Routines for slightly better performance in critical sections.
136//#define FF_INLINE_BLOCK_CALCULATIONS
137
138
139//---------- 64-Bit Number Support
140#define FF_64_NUM_SUPPORT // This helps to give information about the FreeSpace and VolumeSize of a partition or volume.
141 // If you cannot support 64-bit integers, then FullFAT still works, its just that the functions:
142 // FF_GetFreeSize() and FF_GetVolumeSize() don't make sense when reporting sizes > 4GB.
143
144
145//---------- Driver Sleep Time
146#define FF_DRIVER_BUSY_SLEEP 20 // How long FullFAT should sleep the thread for in ms, if FF_ERR_DRIVER_BUSY is recieved.
147
148
149//---------- DEBUGGING FEATURES (HELPFUL ERROR MESSAGES)
150#define FF_DEBUG // Enable the Error Code string functions. const FF_T_INT8 *FF_GetErrMessage( FF_T_SINT32 iErrorCode);
151 // Uncommenting this just stops FullFAT error strings being compiled.
152 // Further calls to FF_GetErrMessage() are safe, and simply returns a pointer to a NULL string. ("").
153 // This should be disabled to reduce code-size dramatically.
154
155
156//---------- AUTOMATIC SETTINGS DO NOT EDIT -- These configure your options from above, and check sanity!
157
158#ifdef FF_LFN_SUPPORT
159#define FF_MAX_FILENAME (260)
160#else
161#define FF_MAX_FILENAME (13)
162#endif
163
164#ifdef FF_USE_NATIVE_STDIO
165#ifdef MAX_PATH
166#define FF_MAX_PATH MAX_PATH
167#elif PATH_MAX
168#define FF_MAX_PATH PATH_MAX
169#else
170#define FF_MAX_PATH 2600
171#endif
172#else
173#define FF_MAX_PATH 2600
174#endif
175
176#ifndef FF_ALLOC_DOUBLE
177#ifndef FF_ALLOC_DEFAULT
178#error FullFAT Invalid ff_config.h file: A file allocation method must be specified. See ff_config.h file.
179#endif
180#endif
181
182#ifdef FF_ALLOC_DOUBLE
183#ifdef FF_ALLOC_DEFAULT
184#error FullFAT Invalid ff_config.h file: Must choose a single option for File Allocation Method. DOUBLE or DEFAULT. See ff_config.h file.
185#endif
186#endif
187
188#ifdef FF_UNICODE_SUPPORT
189#ifdef FF_UNICODE_UTF8_SUPPORT
190#error FullFAT Invalid ff_config.h file: Must choose a single UNICODE support option. FF_UNICODE_SUPPORT for UTF-16, FF_UNICODE_UTF8_SUPPORT for UTF-8.
191#endif
192#endif
193
194#ifndef FF_FAT_CHECK // FF_FAT_CHECK is now forced.
195#define FF_FAT_CHECK
196#endif
197
198#ifndef FF_LITTLE_ENDIAN
199#ifndef FF_BIG_ENDIAN
200#error FullFAT Invalid ff_config.h file: An ENDIANESS must be defined for your platform. See ff_config.h file.
201#endif
202#endif
203
204#ifdef FF_LITTLE_ENDIAN
205#ifdef FF_BIG_ENDIAN
206#error FullFAT Invalid ff_config.h file: Cannot be BIG and LITTLE ENDIAN, choose either or BIG or LITTLE. See ff_config.h file.
207#endif
208#endif
209
210#ifdef FF_HASH_CACHE
211
212#if FF_HASH_FUNCTION == CRC16
213#define FF_HASH_TABLE_SIZE 8192
214#elif FF_HASH_FUNCTION == CRC8
215#define FF_HASH_TABLE_SIZE 32
216#else
217#error FullFAT Invalid ff_config.h file: Invalid Hashing function selected. CRC16 or CRC8!
218#endif
219
220#endif
221
222#endif
223
224//---------- END-OF-CONFIGURATION