Merge branch 'contrib/github_pr_10987_v5.1' into 'release/v5.1'

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

See merge request espressif/esp-idf!23871
This commit is contained in:
Jiang Jiang Jian
2023-07-05 19:32:32 +08:00
2 changed files with 18 additions and 1 deletions

View File

@@ -71,6 +71,14 @@ menu "Virtual file system"
help help
Disabling this option can save memory when the support for termios.h is not required. 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)" menu "Host File System I/O (Semihosting)"
depends on VFS_SUPPORT_IO depends on VFS_SUPPORT_IO

View File

@@ -33,7 +33,16 @@
static const char *TAG = "vfs"; 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 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 } #define FD_TABLE_ENTRY_UNUSED (fd_table_t) { .permanent = false, .has_pending_close = false, .has_pending_select = false, .vfs_index = -1, .local_fd = -1 }