diff --git a/components/dfs/include/dfs_file.h b/components/dfs/include/dfs_file.h index 7ef681a247ecfa14e9f83427eaf81b0896538961..aaff3f6e9c00e8db10846632d73b87c2a0b2e2b8 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 1850ac426cdceceea3ac225ffadc223db5caca59..066c800568189fab680b63e4134f649e9607c3b1 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 e7071522cecb74f86a353dfd073d2f64d56f5d33..4505667738169860108d1f1b7796fde125cd0e9d 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;