baseRet.FindDir = NativeFS_FindDir;\r
baseRet.ReadDir = NativeFS_ReadDir;\r
baseRet.Flags |= VFS_FFLAG_DIRECTORY;\r
+ baseRet.Size = -1;\r
}\r
else\r
{\r
LOG("File");\r
baseRet.Inode = (Uint64) fopen(path, "r+");\r
baseRet.Read = NativeFS_Read;\r
+ \r
+ fseek( (FILE*)(tVAddr)baseRet.Inode, 0, SEEK_END );\r
+ baseRet.Size = ftell( (FILE*)(tVAddr)baseRet.Inode );\r
}\r
\r
// Create new node\r
\r
char *NativeFS_ReadDir(tVFS_Node *Node, int Position)\r
{\r
- // Keep track of the current directory position\r
- // TODO: Implement NativeFS_ReadDir\r
- return NULL;\r
+ struct dirent *ent;\r
+ DIR *dp = (void*)(tVAddr)Node->Inode;\r
+ char *ret;\r
+\r
+ ENTER("pNode iPosition", Node, Position);\r
+\r
+ // TODO: Keep track of current position in the directory\r
+ // TODO: Lock node during this\r
+ rewinddir(dp);\r
+ do {\r
+ ent = readdir(dp);\r
+ } while(Position-- && ent);\r
+\r
+ if( !ent ) {\r
+ LEAVE('n');\r
+ return NULL;\r
+ }\r
+ \r
+ ret = strdup(ent->d_name);\r
+\r
+ // TODO: Unlock node \r
+\r
+ LEAVE('s', ret);\r
+ return ret;\r
}\r
\r
Uint64 NativeFS_Read(tVFS_Node *Node, Uint64 Offset, Uint64 Length, void *Buffer)\r