diff options
author | Aidan MacDonald <amachronic@protonmail.com> | 2023-01-02 20:18:21 +0000 |
---|---|---|
committer | Aidan MacDonald <amachronic@protonmail.com> | 2023-01-02 20:55:48 +0000 |
commit | a23ae63a317d73802edaf1d6d9a618ad9caaf8a9 (patch) | |
tree | ece51b2defddc06023c0ce546f2edd1cb8249099 /apps/settings_list.c | |
parent | 9d6f9441ae32c895a24653f95c080929c00da732 (diff) | |
download | rockbox-a23ae63a317d73802edaf1d6d9a618ad9caaf8a9.tar.gz rockbox-a23ae63a317d73802edaf1d6d9a618ad9caaf8a9.zip |
Increase maximum files in directory limit
Increase the default limit to 5000 files for targets with at
least 8 MiB of RAM (the vast majority). The upper limit of the
setting is now 40,000 or 100,000 if you have at least 8 MiB or
16 MiB of RAM, respectively.
Update the manual to mention that this setting can also impact
the database browser. "Using the Database" already mentions it,
but it's useful to say so in the setting's description.
Change-Id: I6f204eec6cf2ccaea2af81d2fa287f92476eed4a
Diffstat (limited to 'apps/settings_list.c')
-rw-r--r-- | apps/settings_list.c | 36 |
1 files changed, 29 insertions, 7 deletions
diff --git a/apps/settings_list.c b/apps/settings_list.c index 1bf8b4202f..0ea6026346 100644 --- a/apps/settings_list.c +++ b/apps/settings_list.c | |||
@@ -354,6 +354,31 @@ static const char graphic_numeric[] = "graphic,numeric"; | |||
354 | # endif | 354 | # endif |
355 | #endif | 355 | #endif |
356 | 356 | ||
357 | /* | ||
358 | * Total buffer size due to this setting = max files in dir * 52 bytes | ||
359 | * Keep this in mind when selecting the maximum - if the maximum is too | ||
360 | * high it's possible rockbox could hit OOM and become unusable until | ||
361 | * the config file is deleted manually. | ||
362 | * | ||
363 | * Note the FAT32 limit is 65534 files per directory, but this limit | ||
364 | * also applies to the database browser so it makes sense to support | ||
365 | * larger maximums. | ||
366 | */ | ||
367 | #if MEMORYSIZE >= 16 | ||
368 | # define MAX_FILES_IN_DIR_DEFAULT 5000 | ||
369 | # define MAX_FILES_IN_DIR_MAX 100000 | ||
370 | # define MAX_FILES_IN_DIR_STEP 1000 | ||
371 | #elif MEMORYSIZE >= 8 | ||
372 | # define MAX_FILES_IN_DIR_DEFAULT 5000 | ||
373 | # define MAX_FILES_IN_DIR_MAX 40000 | ||
374 | # define MAX_FILES_IN_DIR_STEP 500 | ||
375 | #else | ||
376 | /* historical defaults, only for 2 MiB targets these days */ | ||
377 | # define MAX_FILES_IN_DIR_DEFAULT 1000 | ||
378 | # define MAX_FILES_IN_DIR_MAX 10000 | ||
379 | # define MAX_FILES_IN_DIR_STEP 50 | ||
380 | #endif | ||
381 | |||
357 | #if LCD_DEPTH > 1 | 382 | #if LCD_DEPTH > 1 |
358 | static const char* list_pad_formatter(char *buffer, size_t buffer_size, | 383 | static const char* list_pad_formatter(char *buffer, size_t buffer_size, |
359 | int val, const char *unit) | 384 | int val, const char *unit) |
@@ -1028,13 +1053,10 @@ const struct settings_list settings[] = { | |||
1028 | "max files in playlist", UNIT_INT, 1000, 32000, 1000, | 1053 | "max files in playlist", UNIT_INT, 1000, 32000, 1000, |
1029 | NULL, NULL, NULL), | 1054 | NULL, NULL, NULL), |
1030 | INT_SETTING(F_BANFROMQS, max_files_in_dir, LANG_MAX_FILES_IN_DIR, | 1055 | INT_SETTING(F_BANFROMQS, max_files_in_dir, LANG_MAX_FILES_IN_DIR, |
1031 | #if MEMORYSIZE > 1 | 1056 | MAX_FILES_IN_DIR_DEFAULT, "max files in dir", UNIT_INT, |
1032 | 1000, | 1057 | MAX_FILES_IN_DIR_STEP /* min */, MAX_FILES_IN_DIR_MAX, |
1033 | #else | 1058 | MAX_FILES_IN_DIR_STEP, |
1034 | 200, | 1059 | NULL, NULL, NULL), |
1035 | #endif | ||
1036 | "max files in dir", UNIT_INT, 50, 10000, 50, | ||
1037 | NULL, NULL, NULL), | ||
1038 | /* use this setting for user code even if there's no exchangable battery | 1060 | /* use this setting for user code even if there's no exchangable battery |
1039 | * support enabled */ | 1061 | * support enabled */ |
1040 | #if BATTERY_CAPACITY_INC > 0 | 1062 | #if BATTERY_CAPACITY_INC > 0 |