未验证 提交 6a534149 编写于 作者: B Bernard Xiong 提交者: GitHub

Merge pull request #1111 from SummerGGift/nfs_fix

 [dfs]:fix bug in nfs caused by struct dfs_fd
...@@ -578,7 +578,8 @@ int nfs_read(struct dfs_fd *file, void *buf, size_t count) ...@@ -578,7 +578,8 @@ int nfs_read(struct dfs_fd *file, void *buf, size_t count)
RT_ASSERT(file->data != NULL); RT_ASSERT(file->data != NULL);
nfs = (nfs_filesystem *)((struct dfs_filesystem*)(file->data)); struct dfs_filesystem *dfs_nfs = ((struct dfs_filesystem*)(file->data));
nfs = (struct nfs_filesystem *)(dfs_nfs->data);
fd = (nfs_file *)(nfs->data); fd = (nfs_file *)(nfs->data);
RT_ASSERT(fd != NULL); RT_ASSERT(fd != NULL);
...@@ -644,7 +645,8 @@ int nfs_write(struct dfs_fd *file, const void *buf, size_t count) ...@@ -644,7 +645,8 @@ int nfs_write(struct dfs_fd *file, const void *buf, size_t count)
return -EISDIR; return -EISDIR;
RT_ASSERT(file->data != NULL); RT_ASSERT(file->data != NULL);
nfs = (nfs_filesystem *)((struct dfs_filesystem*)(file->data)); struct dfs_filesystem *dfs_nfs = ((struct dfs_filesystem*)(file->data));
nfs = (struct nfs_filesystem *)(dfs_nfs->data);
fd = (nfs_file *)(nfs->data); fd = (nfs_file *)(nfs->data);
RT_ASSERT(fd != NULL); RT_ASSERT(fd != NULL);
...@@ -684,8 +686,8 @@ int nfs_write(struct dfs_fd *file, const void *buf, size_t count) ...@@ -684,8 +686,8 @@ int nfs_write(struct dfs_fd *file, const void *buf, size_t count)
/* update current position */ /* update current position */
file->pos = fd->offset; file->pos = fd->offset;
/* update file size */ /* update file size */
if (fd->size < fd->offset) fd->size = fd->offset; if (fd->size < fd->offset) fd->size = fd->offset;
file->size = fd->size; file->size = fd->size;
} }
xdr_free((xdrproc_t)xdr_WRITE3res, (char *)&res); xdr_free((xdrproc_t)xdr_WRITE3res, (char *)&res);
} while (count > 0); } while (count > 0);
...@@ -704,7 +706,8 @@ int nfs_lseek(struct dfs_fd *file, off_t offset) ...@@ -704,7 +706,8 @@ int nfs_lseek(struct dfs_fd *file, off_t offset)
return -EISDIR; return -EISDIR;
RT_ASSERT(file->data != NULL); RT_ASSERT(file->data != NULL);
nfs = (nfs_filesystem *)((struct dfs_filesystem*)(file->data)); struct dfs_filesystem *dfs_nfs = ((struct dfs_filesystem*)(file->data));
nfs = (struct nfs_filesystem *)(dfs_nfs->data);
fd = (nfs_file *)(nfs->data); fd = (nfs_file *)(nfs->data);
RT_ASSERT(fd != NULL); RT_ASSERT(fd != NULL);
...@@ -722,7 +725,8 @@ int nfs_close(struct dfs_fd *file) ...@@ -722,7 +725,8 @@ int nfs_close(struct dfs_fd *file)
{ {
nfs_filesystem *nfs; nfs_filesystem *nfs;
RT_ASSERT(file->data != NULL); RT_ASSERT(file->data != NULL);
nfs = (nfs_filesystem *)((struct dfs_filesystem*)(file->data)); struct dfs_filesystem *dfs_nfs = ((struct dfs_filesystem*)(file->data));
nfs = (struct nfs_filesystem *)(dfs_nfs->data);
if (file->type == FT_DIRECTORY) if (file->type == FT_DIRECTORY)
{ {
...@@ -751,7 +755,8 @@ int nfs_open(struct dfs_fd *file) ...@@ -751,7 +755,8 @@ int nfs_open(struct dfs_fd *file)
{ {
nfs_filesystem *nfs; nfs_filesystem *nfs;
RT_ASSERT(file->data != NULL); RT_ASSERT(file->data != NULL);
nfs = (nfs_filesystem *)((struct dfs_filesystem*)(file->data)); struct dfs_filesystem *dfs_nfs = ((struct dfs_filesystem*)(file->data));
nfs = (struct nfs_filesystem *)(dfs_nfs->data);
if (file->flags & O_DIRECTORY) if (file->flags & O_DIRECTORY)
...@@ -883,7 +888,6 @@ nfs_dir *nfs_opendir(nfs_filesystem *nfs, const char *path) ...@@ -883,7 +888,6 @@ nfs_dir *nfs_opendir(nfs_filesystem *nfs, const char *path)
if (handle == NULL) if (handle == NULL)
{ {
rt_free(dir); rt_free(dir);
return NULL; return NULL;
} }
...@@ -1093,7 +1097,8 @@ int nfs_getdents(struct dfs_fd *file, struct dirent *dirp, uint32_t count) ...@@ -1093,7 +1097,8 @@ int nfs_getdents(struct dfs_fd *file, struct dirent *dirp, uint32_t count)
RT_ASSERT(file->data != NULL); RT_ASSERT(file->data != NULL);
nfs = (nfs_filesystem *)((struct dfs_filesystem*)(file->data)); struct dfs_filesystem *dfs_nfs = ((struct dfs_filesystem*)(file->data));
nfs = (struct nfs_filesystem *)(dfs_nfs->data);
dir = (nfs_dir *)(nfs->data); dir = (nfs_dir *)(nfs->data);
RT_ASSERT(dir != NULL); RT_ASSERT(dir != NULL);
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册