/* this function will return the file system mounted on specified path. */
struct dfs_filesystem* dfs_filesystem_lookup(const char *path)
/* this function will return the file system mounted on specified path. */
struct dfs_filesystem* dfs_filesystem_lookup(const char *path)
{
    struct dfs_filesystem *iter;
    struct dfs_filesystem *fs = NULL;
    uint32_t fspath, prefixlen;
    prefixlen = 0;
    RT_ASSERT(path);
    dfs_lock();
    for (iter = &filesystem_table[0];
            iter < &filesystem_table[DFS_FILESYSTEMS_MAX]; iter++)
    {
        if ((iter->path == NULL) || (iter->ops == NULL))
            continue;
        fspath = strlen(iter->path);
        if ((fspath < prefixlen)
            || (strncmp(iter->path, path, fspath) != 0))
            continue;
        if (fspath > 1 && (strlen(path) > fspath) && (path[fspath] != '/'))
            continue;
        fs = iter;
        prefixlen = fspath;
    }
    dfs_unlock();
    return fs;
}