EasyManua.ls Logo

Espressif ESP32-S2 - Page 784

Espressif ESP32-S2
1695 pages
To Next Page IconTo Next Page
To Next Page IconTo Next Page
To Previous Page IconTo Previous Page
To Previous Page IconTo Previous Page
Loading...
Chapter 2. API Reference
int esp_vfs_link(struct _reent *r, const char *n1, const char *n2)
int esp_vfs_unlink(struct _reent *r, const char *path)
int esp_vfs_rename(struct _reent *r, const char *src, const char *dst)
int esp_vfs_utime(const char *path, const struct utimbuf *times)
esp_err_t esp_vfs_register(const char *base_path, const esp_vfs_t *vfs, void *ctx)
Register a virtual filesystem for given path prefix.
Return ESP_OK if successful, ESP_ERR_NO_MEM if too many VFSes are registered.
Parameters
base_path: file path prefix associated with the lesystem. Must be a zero-terminated C string,
may be empty. If not empty, must be up to ESP_VFS_PATH_MAX characters long, and at least 2
characters long. Name must start with a/and must not end with/. For example,/dataor
/dev/spiare valid. These VFSes would then be called to handle file paths such as/data/myfile.txt
or/dev/spi/0. In the special case of an empty base_path, afallbackVFS is registered. Such
VFS will handle paths which are not matched by any other registered VFS.
vfs: Pointer to esp_vfs_t, a structure which maps syscalls to the filesystem driver functions. VFS
component doesnt assume ownership of this pointer.
ctx: If vfs->flags has ESP_VFS_FLAG_CONTEXT_PTR set, a pointer which should be passed
to VFS functions. Otherwise, NULL.
esp_err_t esp_vfs_register_fd_range(const esp_vfs_t *vfs, void *ctx, int min_fd, int max_fd)
Special case function for registering a VFS that uses a method other than open() to open new file descriptors
from the interval <min_fd; max_fd).
This is a special-purpose function intended for registering LWIP sockets to VFS.
Return ESP_OK if successful, ESP_ERR_NO_MEM if too many VFSes are registered,
ESP_ERR_INVALID_ARG if the file descriptor boundaries are incorrect.
Parameters
vfs: Pointer to esp_vfs_t. Meaning is the same as for esp_vfs_register().
ctx: Pointer to context structure. Meaning is the same as for esp_vfs_register().
min_fd: The smallest file descriptor this VFS will use.
max_fd: Upper boundary for file descriptors this VFS will use (the biggest file descriptor plus one).
esp_err_t esp_vfs_register_with_id(const esp_vfs_t *vfs, void *ctx, esp_vfs_id_t *vfs_id)
Special case function for registering a VFS that uses a method other than open() to open new file descriptors. In
comparison with esp_vfs_register_fd_range, this function doesnt pre-registers an interval of file descriptors.
File descriptors can be registered later, by using esp_vfs_register_fd.
Return ESP_OK if successful, ESP_ERR_NO_MEM if too many VFSes are registered,
ESP_ERR_INVALID_ARG if the file descriptor boundaries are incorrect.
Parameters
vfs: Pointer to esp_vfs_t. Meaning is the same as for esp_vfs_register().
ctx: Pointer to context structure. Meaning is the same as for esp_vfs_register().
vfs_id: Here will be written the VFS ID which can be passed to esp_vfs_register_fd for registering
file descriptors.
esp_err_t esp_vfs_unregister(const char *base_path)
Unregister a virtual filesystem for given path prefix
Return ESP_OK if successful, ESP_ERR_INVALID_STATE if VFS for given prefix hasnt been registered
Parameters
base_path: file prefix previously used in esp_vfs_register call
esp_err_t esp_vfs_unregister_with_id(esp_vfs_id_t vfs_id)
Unregister a virtual filesystem with the given index
Return ESP_OK if successful, ESP_ERR_INVALID_STATE if VFS for the given index hasnt been reg-
istered
Parameters
vfs_id: The VFS ID returned by esp_vfs_register_with_id
Espressif Systems 773
Submit Document Feedback
Release v4.4

Table of Contents