Chapter 2. API Reference
This function is called when the VFS driver detects a read/write/error condition as it was requested by the
previous call to start_select.
Parameters
• sem: semaphore structure which was passed to the driver by the start_select call
• woken: is set to pdTRUE if the function wakes up a task with higher priority
ssize_t esp_vfs_pread(int fd, void *dst, size_t size, off_t offset)
Implements the VFS layer of POSIX pread()
Return A positive return value indicates the number of bytes read. -1 is return on failure and errno is set
accordingly.
Parameters
• fd: File descriptor used for read
• dst: Pointer to the buffer where the output will be written
• size: Number of bytes to be read
• offset: Starting offset of the read
ssize_t esp_vfs_pwrite(int fd, const void *src, size_t size, off_t offset)
Implements the VFS layer of POSIX pwrite()
Return A positive return value indicates the number of bytes written. -1 is return on failure and errno is set
accordingly.
Parameters
• fd: File descriptor used for write
• src: Pointer to the buffer from where the output will be read
• size: Number of bytes to write
• offset: Starting offset of the write
Structures
struct esp_vfs_select_sem_t
VFS semaphore type for select()
Public Members
bool is_sem_local
type of "sem"is SemaphoreHandle_t when true, defined by socket driver otherwise
void *sem
semaphore instance
struct esp_vfs_t
VFS definition structure.
This structure should be filled with pointers to corresponding FS driver functions.
VFS component will translate all FDs so that the filesystem implementation sees them starting at zero. The
caller sees a global FD which is prefixed with an pre-filesystem-implementation.
Some FS implementations expect some state (e.g. pointer to some structure) to be passed in as a first argument.
For these implementations, populate the members of this structure which have _p suffix, set flags member
to ESP_VFS_FLAG_CONTEXT_PTR and provide the context pointer to esp_vfs_register function. If the
implementation doesn' t use this extra argument, populate the members without _p suffix and set flags member
to ESP_VFS_FLAG_DEFAULT.
If the FS driver doesn't provide some of the functions, set corresponding members to NULL.
Public Members
int flags
ESP_VFS_FLAG_CONTEXT_PTR or ESP_VFS_FLAG_DEFAULT
Espressif Systems
775
Submit Document Feedback
Release v4.4
Need help?
Do you have a question about the ESP32-S2 and is the answer not in the manual?