Jelajahi Sumber

修复BUG(simulator):修复bsp/simulator编译报错的BUG

breederbai 2 tahun lalu
induk
melakukan
5e40f3a0d4
1 mengubah file dengan 9 tambahan dan 9 penghapusan
  1. 9 9
      bsp/simulator/drivers/dfs_win32.c

+ 9 - 9
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;