diff options
Diffstat (limited to 'components/dfs/src')
| -rw-r--r-- | components/dfs/src/dfs_fs.c | 31 |
1 files changed, 31 insertions, 0 deletions
diff --git a/components/dfs/src/dfs_fs.c b/components/dfs/src/dfs_fs.c index a41f36cf09..bdd9560d56 100644 --- a/components/dfs/src/dfs_fs.c +++ b/components/dfs/src/dfs_fs.c @@ -116,6 +116,37 @@ struct dfs_filesystem *dfs_filesystem_lookup(const char *path) } /** + * this function will return the mounted path for specified device. + * + * @param device the device object which is mounted. + * + * @return the mounted path or RT_NULL if none device mounted. + */ +const char* dfs_filesystem_get_mounted_path(struct rt_device* device) +{ + const char* path = RT_NULL; + struct dfs_filesystem *iter; + + dfs_lock(); + for (iter = &filesystem_table[0]; + iter < &filesystem_table[DFS_FILESYSTEMS_MAX]; iter++) + { + /* fint the mounted device */ + if (iter->ops == RT_NULL) continue; + else if (iter->dev_id == device) + { + path = iter->path; + break; + } + } + + /* release filesystem_table lock */ + dfs_unlock(); + + return path; +} + +/** * this function will fetch the partition table on specified buffer. * * @param part the returned partition structure. |
