fs: allow setting max file name explicitly
Zephyr allows an application to register additional file systems, which may have maximum filename lengths different from the in-tree FatFs and littlefs options. Provide a Kconfig variable that allows the default inference to be overridden. Signed-off-by: Peter A. Bigot <pab@pabigot.com>
This commit is contained in:
parent
d0d3c4a3a7
commit
ad782596ea
2 changed files with 17 additions and 0 deletions
|
@ -13,6 +13,10 @@
|
|||
extern "C" {
|
||||
#endif
|
||||
|
||||
#if (CONFIG_FILE_SYSTEM_MAX_FILE_NAME - 0) > 0
|
||||
#define MAX_FILE_NAME CONFIG_FILE_SYSTEM_MAX_FILE_NAME
|
||||
#else /* CONFIG_FILE_SYSTEM_MAX_FILE_NAME */
|
||||
/* Select from enabled file systems */
|
||||
#if defined(CONFIG_FILE_SYSTEM_LITTLEFS)
|
||||
#define MAX_FILE_NAME 256
|
||||
#elif defined(CONFIG_FAT_FILESYSTEM_ELM)
|
||||
|
@ -25,6 +29,7 @@ extern "C" {
|
|||
/* Use standard 8.3 when no filesystem is explicitly selected */
|
||||
#define MAX_FILE_NAME 12
|
||||
#endif /* filesystem selection */
|
||||
#endif /* CONFIG_FILE_SYSTEM_MAX_FILE_NAME */
|
||||
|
||||
/* Type for fs_open flags */
|
||||
typedef uint8_t fs_mode_t;
|
||||
|
|
|
@ -36,6 +36,18 @@ config FILE_SYSTEM_MAX_TYPES
|
|||
LittleFS, but it is possible to define additional ones and
|
||||
register them. A slot is required for each type.
|
||||
|
||||
config FILE_SYSTEM_MAX_FILE_NAME
|
||||
int "Optional override for maximum file name length"
|
||||
default -1
|
||||
help
|
||||
Specify the maximum file name allowed across all enabled file
|
||||
system types. Zero or a negative value selects the maximum
|
||||
file name length for enabled in-tree file systems. This
|
||||
default may be inappropriate when registering an out-of-tree
|
||||
file system. Selecting a value less than the actual length
|
||||
supported by a file system may result in memory access
|
||||
violations.
|
||||
|
||||
menu "FatFs Settings"
|
||||
visible if FAT_FILESYSTEM_ELM
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue