Merge branch 'contrib/github_pr_10987' into 'master'

Allow to config the maximum number of VFS entries. (GitHub PR)

Closes IDFGH-9641

See merge request espressif/esp-idf!23171
This commit is contained in:
Ivan Grokhotkov 2023-04-19 04:52:50 +08:00
commit 690aa433a2
2 changed files with 18 additions and 1 deletions

View File

@ -71,6 +71,14 @@ menu "Virtual file system"
help
Disabling this option can save memory when the support for termios.h is not required.
config VFS_MAX_COUNT
int "Maximum Number of Virtual Filesystems"
default 8
range 1 20
depends on VFS_SUPPORT_IO
help
Define maximum number of virtual filesystems that can be registered.
menu "Host File System I/O (Semihosting)"
depends on VFS_SUPPORT_IO

View File

@ -33,7 +33,16 @@
static const char *TAG = "vfs";
#define VFS_MAX_COUNT 8 /* max number of VFS entries (registered filesystems) */
/* Max number of VFS entries (registered filesystems) */
#ifdef CONFIG_VFS_MAX_COUNT
#define VFS_MAX_COUNT CONFIG_VFS_MAX_COUNT
#else
/* If IO support is disabled, keep this defined to 1 to avoid compiler warnings in this file.
* The s_vfs array and the functions defined here will be removed by the linker, anyway.
*/
#define VFS_MAX_COUNT 1
#endif
#define LEN_PATH_PREFIX_IGNORED SIZE_MAX /* special length value for VFS which is never recognised by open() */
#define FD_TABLE_ENTRY_UNUSED (fd_table_t) { .permanent = false, .has_pending_close = false, .has_pending_select = false, .vfs_index = -1, .local_fd = -1 }