diff options
| author | Bernard Xiong <[email protected]> | 2019-01-10 10:57:06 +0800 |
|---|---|---|
| committer | GitHub <[email protected]> | 2019-01-10 10:57:06 +0800 |
| commit | 0720c3a3dcfafae2a40f44fa1bcfbf782513ba41 (patch) | |
| tree | bcde7db9fe3ac21964afce4a0a1a85b0b1660a55 | |
| parent | 80c1354771f2938847c36feacbd72d193f4b7118 (diff) | |
| parent | c16d3de633ef1ef1a92b1a3d377de44a46f93865 (diff) | |
Merge pull request #2176 from yangfasheng/master
update dfs.c dfs_file.c dfs_file.h
| -rw-r--r-- | components/dfs/include/dfs_file.h | 1 | ||||
| -rw-r--r-- | components/dfs/src/dfs.c | 2 | ||||
| -rw-r--r-- | components/dfs/src/dfs_file.c | 3 |
3 files changed, 4 insertions, 2 deletions
diff --git a/components/dfs/include/dfs_file.h b/components/dfs/include/dfs_file.h index 7ef681a247..aaff3f6e9c 100644 --- a/components/dfs/include/dfs_file.h +++ b/components/dfs/include/dfs_file.h @@ -44,6 +44,7 @@ struct dfs_fd char *path; /* Name (below mount point) */ int ref_count; /* Descriptor reference count */ + struct dfs_filesystem *fs; const struct dfs_file_ops *fops; uint32_t flags; /* Descriptor flags */ diff --git a/components/dfs/src/dfs.c b/components/dfs/src/dfs.c index 1850ac426c..066c800568 100644 --- a/components/dfs/src/dfs.c +++ b/components/dfs/src/dfs.c @@ -320,7 +320,7 @@ int fd_is_open(const char *pathname) fd = fdt->fds[index]; if (fd == NULL || fd->fops == NULL || fd->path == NULL) continue; - if (fd->fops == fs->ops->fops && strcmp(fd->path, mountpath) == 0) + if (fd->fs == fs && strcmp(fd->path, mountpath) == 0) { /* found file in file descriptor table */ rt_free(fullpath); diff --git a/components/dfs/src/dfs_file.c b/components/dfs/src/dfs_file.c index e7071522ce..4505667738 100644 --- a/components/dfs/src/dfs_file.c +++ b/components/dfs/src/dfs_file.c @@ -66,7 +66,8 @@ int dfs_file_open(struct dfs_fd *fd, const char *path, int flags) } LOG_D("open in filesystem:%s", fs->ops->name); - fd->fops = fs->ops->fops; /* set file ops */ + fd->fs = fs; /* set file system */ + fd->fops = fs->ops->fops; /* set file ops */ /* initialize the fd item */ fd->type = FT_REGULAR; |
