From 5e40f3a0d46113dcbbe28149599c0f57d9ab8742 Mon Sep 17 00:00:00 2001 From: breederbai Date: Thu, 29 Dec 2022 13:56:04 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E5=A4=8DBUG(simulator)=EF=BC=9A?= =?UTF-8?q?=E4=BF=AE=E5=A4=8Dbsp/simulator=E7=BC=96=E8=AF=91=E6=8A=A5?= =?UTF-8?q?=E9=94=99=E7=9A=84BUG?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- bsp/simulator/drivers/dfs_win32.c | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/bsp/simulator/drivers/dfs_win32.c b/bsp/simulator/drivers/dfs_win32.c index 15ad0fdb51..5edb2b211c 100644 --- a/bsp/simulator/drivers/dfs_win32.c +++ b/bsp/simulator/drivers/dfs_win32.c @@ -158,7 +158,7 @@ static int dfs_win32_open(struct dfs_fd *file) HANDLE handle; int len; - file_path = winpath_dirdup(WIN32_DIRDISK_ROOT, file->path); + file_path = winpath_dirdup(WIN32_DIRDISK_ROOT, file->vnode->path); if (oflag & O_CREAT) /* create a dir*/ { @@ -196,7 +196,7 @@ static int dfs_win32_open(struct dfs_fd *file) wdirp->end += len; rt_strncpy(wdirp->curr, wdirp->finddata.name, len); - file->data = (void *)wdirp; + file->vnode->data = (void *)wdirp; rt_free(file_path); return 0; } @@ -212,7 +212,7 @@ static int dfs_win32_open(struct dfs_fd *file) /* Creates a new file. The function fails if the file is already existing. */ if (oflag & O_EXCL) mode |= O_EXCL; - file_path = winpath_dirdup(WIN32_DIRDISK_ROOT, file->path); + file_path = winpath_dirdup(WIN32_DIRDISK_ROOT, file->vnode->path); fd = _open(file_path, mode, 0x0100 | 0x0080); /* _S_IREAD | _S_IWRITE */ rt_free(file_path); @@ -223,11 +223,11 @@ static int dfs_win32_open(struct dfs_fd *file) * flush(), seek(), and will be free when calling close()*/ file->data = (void *)fd; file->pos = 0; - file->size = _lseek(fd, 0, SEEK_END); + file->vnode->size = _lseek(fd, 0, SEEK_END); if (oflag & O_APPEND) { - file->pos = file->size; + file->pos = file->vnode->size; } else _lseek(fd, 0, SEEK_SET); @@ -243,7 +243,7 @@ static int dfs_win32_close(struct dfs_fd *file) { if (file->flags & O_DIRECTORY) { - WINDIR *wdirp = (WINDIR*)(file->data); + WINDIR *wdirp = (WINDIR*)(file->vnode->data); RT_ASSERT(wdirp != RT_NULL); if (_findclose((intptr_t)wdirp->handle) == 0) { free(wdirp->start); /* NOTE: here we don't use rt_free! */ @@ -307,9 +307,9 @@ static int dfs_win32_seek(struct dfs_fd *file, int result; /* set offset as current offset */ - if (file->type == FT_DIRECTORY) + if (file->vnode->type == FT_DIRECTORY) { - WINDIR* wdirp = (WINDIR*)(file->data); + WINDIR* wdirp = (WINDIR*)(file->vnode->data); RT_ASSERT(wdirp != RT_NULL); wdirp->curr = wdirp->start + offset; return offset; @@ -335,7 +335,7 @@ static int dfs_win32_getdents(struct dfs_fd *file, struct dirent *dirp, rt_uint3 if (count / sizeof(struct dirent) != 1) return -EINVAL; - wdirp = (WINDIR*)(file->data); + wdirp = (WINDIR*)(file->vnode->data); RT_ASSERT(wdirp != RT_NULL); if (wdirp->curr == NULL) //no more entries in this directory return 0;