Merge branch 'feat/esp-stdio-custom-driver' into 'master'

feat(esp_stdio): Add support for custom IO

Closes IDF-14901 and IDF-15541

See merge request espressif/esp-idf!45955
This commit is contained in:
Guillaume Souchere
2026-09-16 10:32:44 +02:00
22 changed files with 1135 additions and 203 deletions
+5 -3
View File
@@ -6,11 +6,13 @@ if(${target} STREQUAL "linux")
set(inc)
set(priv_inc)
list(APPEND inc include)
# linux_include provides stubs (sys/reent.h, dirent.h, errno.h) required by
# esp_vfs.h unconditionally, so expose it for all Linux builds regardless of
# VFS_SUPPORT_IO, which now defaults to n on Linux.
list(APPEND inc include linux_include)
if(CONFIG_VFS_SUPPORT_IO)
list(APPEND inc linux_include)
list(APPEND priv_inc private_include)
list(APPEND srcs "vfs_linux.c" "vfs_linux_default_coop.c" "vfs.c" "vfs_calls.c")
list(APPEND srcs "vfs_linux.c" "vfs_linux_default_coop.c" "vfs.c" "vfs_calls.c" "nullfs.c")
endif()
if(CMAKE_HOST_SYSTEM_NAME STREQUAL "Linux")
+9 -3
View File
@@ -1,5 +1,5 @@
/*
* SPDX-FileCopyrightText: 2025 Espressif Systems (Shanghai) CO LTD
* SPDX-FileCopyrightText: 2025-2026 Espressif Systems (Shanghai) CO LTD
*
* SPDX-License-Identifier: Apache-2.0
*/
@@ -32,10 +32,16 @@ typedef struct {
/**
* @brief Directory entry structure
*
* Fields match the glibc layout so that this header is binary-compatible with
* glibc's readdir() when CONFIG_VFS_SUPPORT_IO is disabled on Linux (in which
* case glibc's readdir() fills the struct, not the VFS wrapper).
*/
struct dirent {
ino_t d_ino; /*!< file number */
uint8_t d_type; /*!< not defined in POSIX, but present in BSD and Linux */
ino_t d_ino; /*!< file number */
off_t d_off; /*!< implementation-defined offset (glibc extension) */
unsigned short d_reclen; /*!< length of this record (glibc extension) */
uint8_t d_type; /*!< not defined in POSIX, but present in BSD and Linux */
#define DT_UNKNOWN 0
#define DT_REG 1
#define DT_DIR 2
+2 -2
View File
@@ -148,7 +148,7 @@ static ssize_t vfs_null_read(__attribute__((unused)) void *ctx, int fd, void *da
return -1;
}
static int vfs_null_pread(__attribute__((unused)) void *ctx, int fd, void *data, size_t size, off_t offset)
static ssize_t vfs_null_pread(__attribute__((unused)) void *ctx, int fd, void *data, size_t size, off_t offset)
{
UNUSED(data);
UNUSED(size);
@@ -165,7 +165,7 @@ static int vfs_null_pread(__attribute__((unused)) void *ctx, int fd, void *data,
}
static int vfs_null_pwrite(__attribute__((unused)) void *ctx, int fd, const void *data, size_t size, off_t offset)
static ssize_t vfs_null_pwrite(__attribute__((unused)) void *ctx, int fd, const void *data, size_t size, off_t offset)
{
UNUSED(data);
UNUSED(offset);