Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix for issue #72394 and additional checks for CONFIG_FILE_SYSTEM_MAX_FILE_NAME #73596

Merged
merged 2 commits into from
Jun 4, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 16 additions & 3 deletions include/zephyr/fs/fs_interface.h
Original file line number Diff line number Diff line change
Expand Up @@ -13,10 +13,23 @@
extern "C" {
#endif

#if defined(CONFIG_FILE_SYSTEM_MAX_FILE_NAME) && (CONFIG_FILE_SYSTEM_MAX_FILE_NAME - 0) > 0
#if defined(CONFIG_FILE_SYSTEM_MAX_FILE_NAME) && (CONFIG_FILE_SYSTEM_MAX_FILE_NAME - 0) > 0

/* No in-tree file system supports name longer than 255 characters */
#if (CONFIG_FILE_SYSTEM_LITTLEFS || CONFIG_FAT_FILESYSTEM_ELM || \
CONFIG_FILE_SYSTEM_EXT2) && (CONFIG_FILE_SYSTEM_MAX_FILE_NAME > 255)
#error "Max allowed CONFIG_FILE_SYSTEM_MAX_FILE_NAME is 255 characters, when any in-tree FS enabled"
#endif

/* Enabled FAT driver, without LFN, restricts name length to 12 characters */
#if defined(CONFIG_FAT_FILESYSTEM_ELM) && !(CONFIG_FS_FATFS_LFN) && \
(CONFIG_FILE_SYSTEM_MAX_FILE_NAME > 12)
#error "CONFIG_FILE_SYSTEM_MAX_FILE_NAME can not be > 12 if FAT is enabled without LFN"
#endif

#define MAX_FILE_NAME CONFIG_FILE_SYSTEM_MAX_FILE_NAME

#else /* CONFIG_FILE_SYSTEM_MAX_FILE_NAME */
#else
/* Select from enabled file systems */

#if defined(CONFIG_FAT_FILESYSTEM_ELM)
Expand All @@ -34,7 +47,7 @@ extern "C" {
#endif

#if !defined(MAX_FILE_NAME) && defined(CONFIG_FILE_SYSTEM_LITTLEFS)
#define MAX_FILE_NAME 256
#define MAX_FILE_NAME 255
#endif

#if !defined(MAX_FILE_NAME) /* filesystem selection */
Expand Down
Loading