summaryrefslogtreecommitdiff
path: root/components/dfs/src
diff options
context:
space:
mode:
authorprife <[email protected]>2013-12-21 04:06:25 -0800
committerprife <[email protected]>2013-12-21 04:06:25 -0800
commit95006bb50308e4a2cec932a4f00c68786cf3b1c3 (patch)
treef3e1ef33c86a62d4e86e646c16aa6dd392fc2f36 /components/dfs/src
parent46f9280a9d86857864f1d061dde31ba0e5533472 (diff)
parent26a31d662d2efcae41e723d0928569fbb587dfd0 (diff)
Merge pull request #215 from prife/master
fix dfs_unmount bug
Diffstat (limited to 'components/dfs/src')
-rw-r--r--components/dfs/src/dfs_fs.c19
1 files changed, 15 insertions, 4 deletions
diff --git a/components/dfs/src/dfs_fs.c b/components/dfs/src/dfs_fs.c
index a3a8210225..406403e51e 100644
--- a/components/dfs/src/dfs_fs.c
+++ b/components/dfs/src/dfs_fs.c
@@ -80,7 +80,7 @@ int dfs_register(const struct dfs_filesystem_operation *ops)
struct dfs_filesystem *dfs_filesystem_lookup(const char *path)
{
struct dfs_filesystem *iter;
- struct dfs_filesystem *empty = RT_NULL;
+ struct dfs_filesystem *fs = RT_NULL;
rt_uint32_t fspath, prefixlen;
prefixlen = 0;
@@ -104,13 +104,13 @@ struct dfs_filesystem *dfs_filesystem_lookup(const char *path)
if (fspath > 1 && (strlen(path) > fspath) && (path[fspath] != '/'))
continue;
- empty = iter;
+ fs = iter;
prefixlen = fspath;
}
dfs_unlock();
- return empty;
+ return fs;
}
/**
@@ -329,6 +329,7 @@ err1:
int dfs_unmount(const char *specialfile)
{
char *fullpath;
+ struct dfs_filesystem *iter;
struct dfs_filesystem *fs = RT_NULL;
fullpath = dfs_normalize_path(RT_NULL, specialfile);
@@ -342,7 +343,17 @@ int dfs_unmount(const char *specialfile)
/* lock filesystem */
dfs_lock();
- fs = dfs_filesystem_lookup(fullpath);
+ for (iter = &filesystem_table[0];
+ iter < &filesystem_table[DFS_FILESYSTEMS_MAX]; iter++)
+ {
+ /* check if the PATH is mounted */
+ if ((iter->path != NULL) && (strcmp(iter->path, fullpath) == 0))
+ {
+ fs = iter;
+ break;
+ }
+ }
+
if (fs == RT_NULL ||
fs->ops->unmount == RT_NULL ||
fs->ops->unmount(fs) < 0)