Skip to content

Commit

Permalink
Merge branch 'contrib/github_pr_10987' into 'master'
Browse files Browse the repository at this point in the history
Allow to config the maximum number of VFS entries. (GitHub PR)

Closes IDFGH-9641

See merge request espressif/esp-idf!23171
  • Loading branch information
igrr committed Apr 18, 2023
2 parents 9adafb0 + fee3082 commit 690aa43
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 1 deletion.
8 changes: 8 additions & 0 deletions components/vfs/Kconfig
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
11 changes: 10 additions & 1 deletion components/vfs/vfs.c
Original file line number Diff line number Diff line change
Expand Up @@ -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 }

Expand Down

0 comments on commit 690aa43

Please sign in to comment.