4
0
mirror of https://github.com/RT-Thread/rt-thread.git synced 2025-01-18 21:03:32 +08:00

Merge pull request #2176 from yangfasheng/master

update dfs.c  dfs_file.c  dfs_file.h
This commit is contained in:
Bernard Xiong 2019-01-10 10:57:06 +08:00 committed by GitHub
commit 0720c3a3dc
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 4 additions and 2 deletions

View File

@ -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 */

View File

@ -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);

View File

@ -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;