提交 42e28446 编写于 作者: B bernard.xiong

fix the closedir issue, which does not release fd. add static ioman support in EFSL.

git-svn-id: https://rt-thread.googlecode.com/svn/trunk@158 bbd45198-f89e-11dd-88c7-29a3b14d5316
上级 774c4d96
......@@ -25,6 +25,10 @@
struct dfs_filesystem_operation efs;
#ifdef DFS_EFLS_USING_STATIC_CACHE
IOManager _ioman;
#endif
/**
* This function will initialize efsl to DFS interface.
*
......@@ -72,7 +76,11 @@ int efs_mount(struct dfs_filesystem* fs)
efsfs = (efsl_fs*) rt_malloc (sizeof(efsl_fs));
/* init efs filesystem struct */
#ifdef DFS_EFLS_USING_STATIC_CACHE
efsfs->partition.ioman = &_ioman;
#else
efsfs->partition.ioman = rt_malloc(sizeof(IOManager));
#endif
efsfs->partition.ioman->device = fs->dev_id;
part_initPartition(&efsfs->partition);
......@@ -99,7 +107,11 @@ int efs_unmount(struct dfs_filesystem* fs)
if ( efsfs == RT_NULL ) return -DFS_STATUS_EINVAL;
fs_flushFs(&efsfs->filesystem);
#ifdef DFS_EFLS_USING_STATIC_CACHE
efsfs->partition.ioman = RT_NULL;
#else
rt_free(efsfs->partition.ioman);
#endif
rt_free(efsfs);
fs->data = RT_NULL;
......
......@@ -72,7 +72,6 @@ typedef struct
char buf[512];
int num;
int cur;
rt_sem_t *sem;
} DIR;
/* file api*/
......
......@@ -344,6 +344,7 @@ DIR* opendir(const char* name)
/* allocate a fd */
fd = fd_new();
if (fd == -1) { rt_kprintf("no fd\n"); return RT_NULL; }
d = fd_get(fd);
result = dfile_raw_open(d, name, DFS_O_RDONLY | DFS_O_DIRECTORY);
......@@ -490,10 +491,10 @@ int closedir(DIR* d)
struct dfs_fd* fd;
fd = fd_get(d->fd);
result = dfile_raw_close(fd);
fd_put(fd);
fd_put(fd);
rt_free(d);
if (result < 0)
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册