summaryrefslogtreecommitdiff
path: root/firmware/include/file_internal.h
diff options
context:
space:
mode:
authorMichael Sevakis <jethead71@rockbox.org>2017-03-12 22:05:44 -0400
committerMichael Sevakis <jethead71@rockbox.org>2017-03-12 22:05:44 -0400
commit6db80020b45ae22b19524b01f60d0653d70ac7ca (patch)
tree924a9944abe38e094cdbc4b70d0489ed6bc162ce /firmware/include/file_internal.h
parent70c929179b80e0657e31558e34d2bc62e1176564 (diff)
downloadrockbox-6db80020b45ae22b19524b01f60d0653d70ac7ca.tar.gz
rockbox-6db80020b45ae22b19524b01f60d0653d70ac7ca.zip
Do some housekeeping with fat.h and SECTOR_SIZE
Many includes of fat.h are pointless. Some includes are just for SECTOR_SIZE. Add a file 'firmware/include/fs_defines.h' for that and to define tuneable values that were scattered amongst various headers. Remove some local definitions of SECTOR_SIZE since they have to be in agreement with the rest of the fs code anyway. (We'll see what's in fact pointless in a moment ;) Change-Id: I9ba183bf58bd87f5c45eba7bd675c7e2c1c18ed5
Diffstat (limited to 'firmware/include/file_internal.h')
-rw-r--r--firmware/include/file_internal.h43
1 files changed, 1 insertions, 42 deletions
diff --git a/firmware/include/file_internal.h b/firmware/include/file_internal.h
index 5893737833..d62b5a8541 100644
--- a/firmware/include/file_internal.h
+++ b/firmware/include/file_internal.h
@@ -28,55 +28,14 @@
28#include "mutex.h" 28#include "mutex.h"
29#include "mrsw_lock.h" 29#include "mrsw_lock.h"
30#include "fs_attr.h" 30#include "fs_attr.h"
31#include "fs_defines.h"
31#include "fat.h" 32#include "fat.h"
32#ifdef HAVE_DIRCACHE 33#ifdef HAVE_DIRCACHE
33#include "dircache.h" 34#include "dircache.h"
34#endif 35#endif
35 36
36/** Tuneable parameters **/
37
38/* limits for number of open descriptors - if you increase these values, make
39 certain that the disk cache has enough available buffers */
40#define MAX_OPEN_FILES 11
41#define MAX_OPEN_DIRS 12
42#define MAX_OPEN_HANDLES (MAX_OPEN_FILES+MAX_OPEN_DIRS) 37#define MAX_OPEN_HANDLES (MAX_OPEN_FILES+MAX_OPEN_DIRS)
43 38
44/* internal functions open streams as well; make sure they don't fail if all
45 user descs are busy; this needs to be at least the greatest quantity needed
46 at once by all internal functions */
47#ifdef HAVE_DIRCACHE
48#define AUX_FILEOBJS 3
49#else
50#define AUX_FILEOBJS 2
51#endif
52
53/* number of components statically allocated to handle the vast majority
54 of path depths; should maybe be tuned for >= 90th percentile but for now,
55 imma just guessing based on something like:
56 root + 'Music' + 'Artist' + 'Album' + 'Disc N' + filename */
57#define STATIC_PATHCOMP_NUM 6
58
59#define MAX_COMPNAME 260
60
61/* unsigned value that will also hold the off_t range we need without
62 overflow */
63#define file_size_t uint32_t
64
65#ifdef __USE_FILE_OFFSET64
66/* if we want, we can deal with files up to 2^32-1 bytes-- the full FAT16/32
67 range */
68#define FILE_SIZE_MAX (0xffffffffu)
69#else
70/* file contents and size will be preserved by the APIs so long as ftruncate()
71 isn't used; bytes passed 2^31-1 will not accessible nor will writes succeed
72 that would extend the file beyond the max for a 32-bit off_t */
73#define FILE_SIZE_MAX (0x7fffffffu)
74#endif
75
76/* if file is "large(ish)", then get rid of the contents now rather than
77 lazily when the file is synced or closed in order to free-up space */
78#define O_TRUNC_THRESH 65536
79
80/* default attributes when creating new files and directories */ 39/* default attributes when creating new files and directories */
81#define ATTR_NEW_FILE (ATTR_ARCHIVE) 40#define ATTR_NEW_FILE (ATTR_ARCHIVE)
82#define ATTR_NEW_DIRECTORY (ATTR_DIRECTORY) 41#define ATTR_NEW_DIRECTORY (ATTR_DIRECTORY)