Merge pull request #1111 from SummerGGift/nfs_fix

[dfs]:fix bug in nfs caused by struct dfs_fd
This commit is contained in:
Bernard Xiong 2017-12-15 23:44:25 +08:00 committed by GitHub
commit 6a5341490b
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 14 additions and 9 deletions

View File

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