VFS questions
Posted: Wed Jul 29, 2026 10:31 am
Hello,
How can I convert my local fd to a global VFS id? I looked up documentation and found that there is a function for registering my own FDs but it requires filesystem to be registered _with_id.
Right now I use
esp_err_t esp_vfs_register_fs(const char *base_path, const esp_vfs_fs_ops_t *vfs, int flags, void *ctx);
which has base_path, but does not return vfs_id
This function returns vfs_id but I don't see how can I pass my base_path there:
esp_err_t esp_vfs_register_fs_with_id(const esp_vfs_fs_ops_t *vfs, int flags, void *ctx, esp_vfs_id_t *id);
What I am trying to do:
I'd like to implement dirfd() function for my filesystem. I have my local FD [0..31] and I want to convert it to global VFS FD
Is this doable?
How can I convert my local fd to a global VFS id? I looked up documentation and found that there is a function for registering my own FDs but it requires filesystem to be registered _with_id.
Right now I use
esp_err_t esp_vfs_register_fs(const char *base_path, const esp_vfs_fs_ops_t *vfs, int flags, void *ctx);
which has base_path, but does not return vfs_id
This function returns vfs_id but I don't see how can I pass my base_path there:
esp_err_t esp_vfs_register_fs_with_id(const esp_vfs_fs_ops_t *vfs, int flags, void *ctx, esp_vfs_id_t *id);
What I am trying to do:
I'd like to implement dirfd() function for my filesystem. I have my local FD [0..31] and I want to convert it to global VFS FD
Is this doable?