mirror of
https://github.com/espressif/esp-idf.git
synced 2026-06-04 20:26:38 +03:00
feat(storage/vfs): Deprecate legacy API
This commit is contained in:
committed by
Zhang Shuxian
parent
515975d2bb
commit
3e41a5de6f
@@ -48,7 +48,7 @@ extern "C" {
|
||||
#define ESP_VFS_PATH_MAX 15
|
||||
|
||||
/**
|
||||
* Default value of flags member in esp_vfs_t structure.
|
||||
* Default value of flags member in esp_vfs_fs_ops_t structure.
|
||||
*/
|
||||
#define ESP_VFS_FLAG_DEFAULT (1 << 0)
|
||||
|
||||
@@ -70,6 +70,7 @@ extern "C" {
|
||||
|
||||
/**
|
||||
* @brief VFS definition structure
|
||||
* @note Prefer using esp_vfs_fs_ops_t with esp_vfs_register_fs*() instead.
|
||||
*
|
||||
* This structure should be filled with pointers to corresponding
|
||||
* FS driver functions.
|
||||
@@ -250,8 +251,6 @@ typedef struct
|
||||
#endif // CONFIG_VFS_SUPPORT_SELECT || defined __DOXYGEN__
|
||||
} esp_vfs_t;
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Register a virtual filesystem for given path prefix.
|
||||
*
|
||||
@@ -293,7 +292,7 @@ esp_err_t esp_vfs_register(const char* base_path, const esp_vfs_t* vfs, void* ct
|
||||
* registered, ESP_ERR_INVALID_ARG if the file descriptor boundaries
|
||||
* are incorrect.
|
||||
*/
|
||||
esp_err_t esp_vfs_register_with_id(const esp_vfs_t *vfs, void *ctx, esp_vfs_id_t *vfs_id);
|
||||
esp_err_t esp_vfs_register_with_id(const esp_vfs_t *vfs, void *ctx, esp_vfs_id_t *vfs_id) __attribute__((deprecated("Use esp_vfs_register_fs_with_id() instead")));
|
||||
|
||||
/**
|
||||
* Unregister a virtual filesystem for given path prefix
|
||||
|
||||
@@ -522,6 +522,16 @@ esp_err_t esp_vfs_register(const char* base_path, const esp_vfs_t* vfs, void* ct
|
||||
return esp_vfs_register_common(base_path, strlen(base_path), vfs, ctx, NULL);
|
||||
}
|
||||
|
||||
esp_err_t esp_vfs_register_with_id(const esp_vfs_t *vfs, void *ctx, esp_vfs_id_t *vfs_id)
|
||||
{
|
||||
if (vfs_id == NULL) {
|
||||
return ESP_ERR_INVALID_ARG;
|
||||
}
|
||||
|
||||
*vfs_id = -1;
|
||||
return esp_vfs_register_common("", LEN_PATH_PREFIX_IGNORED, vfs, ctx, vfs_id);
|
||||
}
|
||||
|
||||
esp_err_t esp_vfs_register_fd_range(const esp_vfs_fs_ops_t *vfs, int flags, void *ctx, int min_fd, int max_fd)
|
||||
{
|
||||
if (min_fd < 0 || max_fd < 0 || min_fd > MAX_FDS || max_fd > MAX_FDS || min_fd > max_fd) {
|
||||
@@ -530,7 +540,7 @@ esp_err_t esp_vfs_register_fd_range(const esp_vfs_fs_ops_t *vfs, int flags, void
|
||||
}
|
||||
|
||||
int index = 0;
|
||||
esp_err_t ret = esp_vfs_register_common("", LEN_PATH_PREFIX_IGNORED, vfs, ctx, &index);
|
||||
esp_err_t ret = esp_vfs_register_fs_common(NULL, vfs, flags, ctx, &index);
|
||||
|
||||
if (ret == ESP_OK) {
|
||||
_lock_acquire(&s_fd_table_lock);
|
||||
@@ -569,16 +579,6 @@ esp_err_t esp_vfs_register_fs_with_id(const esp_vfs_fs_ops_t *vfs, int flags, vo
|
||||
return esp_vfs_register_fs_common(NULL, vfs, flags, ctx, vfs_id);
|
||||
}
|
||||
|
||||
esp_err_t esp_vfs_register_with_id(const esp_vfs_t *vfs, void *ctx, esp_vfs_id_t *vfs_id)
|
||||
{
|
||||
if (vfs_id == NULL) {
|
||||
return ESP_ERR_INVALID_ARG;
|
||||
}
|
||||
|
||||
*vfs_id = -1;
|
||||
return esp_vfs_register_common("", LEN_PATH_PREFIX_IGNORED, vfs, ctx, vfs_id);
|
||||
}
|
||||
|
||||
esp_err_t esp_vfs_unregister_with_id(esp_vfs_id_t vfs_id)
|
||||
{
|
||||
if (vfs_id < 0 || vfs_id >= VFS_MAX_COUNT || s_vfs[vfs_id] == NULL) {
|
||||
|
||||
Reference in New Issue
Block a user