mirror of
https://github.com/RIOT-OS/RIOT.git
synced 2024-12-29 04:50:03 +01:00
vfs: allow filesystem to request absolute paths
This commit is contained in:
parent
a37fe464d2
commit
49e1720d5c
@ -316,6 +316,11 @@ typedef struct vfs_mount_struct vfs_mount_t;
|
||||
*/
|
||||
extern const vfs_file_ops_t mtd_vfs_ops;
|
||||
|
||||
/**
|
||||
* @brief File system always wants the full VFS path
|
||||
*/
|
||||
#define VFS_FS_FLAG_WANT_ABS_PATH (1 << 0)
|
||||
|
||||
/**
|
||||
* @brief A file system driver
|
||||
*/
|
||||
@ -323,6 +328,7 @@ typedef struct {
|
||||
const vfs_file_ops_t *f_op; /**< File operations table */
|
||||
const vfs_dir_ops_t *d_op; /**< Directory operations table */
|
||||
const vfs_file_system_ops_t *fs_op; /**< File system operations table */
|
||||
const uint32_t flags; /**< File system flags */
|
||||
} vfs_file_system_t;
|
||||
|
||||
/**
|
||||
|
@ -1083,8 +1083,13 @@ static inline int _find_mount(vfs_mount_t **mountpp, const char *name, const cha
|
||||
atomic_fetch_add(&mountp->open_files, 1);
|
||||
mutex_unlock(&_mount_mutex);
|
||||
*mountpp = mountp;
|
||||
|
||||
if (rel_path != NULL) {
|
||||
*rel_path = name + longest_match;
|
||||
if (mountp->fs->flags & VFS_FS_FLAG_WANT_ABS_PATH) {
|
||||
*rel_path = name;
|
||||
} else {
|
||||
*rel_path = name + longest_match;
|
||||
}
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user