char *NativeFS_ReadDir(tVFS_Node *Node, int Position);\r
size_t NativeFS_Read(tVFS_Node *Node, _acess_off_t Offset, size_t Length, void *Buffer);\r
size_t NativeFS_Write(tVFS_Node *Node, _acess_off_t Offset, size_t Length, const void *Buffer);\r
+void NativeFS_Close(tVFS_Node *Node);\r
\r
// === GLOBALS ===\r
tVFS_NodeType gNativeFS_FileNodeType = {\r
.Read = NativeFS_Read,\r
.Write = NativeFS_Write,\r
+ .Close = NativeFS_Close\r
};\r
tVFS_NodeType gNativeFS_DirNodeType = {\r
.FindDir = NativeFS_FindDir,\r
.ReadDir = NativeFS_ReadDir,\r
+ .Close = NativeFS_Close\r
};\r
tVFS_Driver gNativeFS_Driver = {\r
"nativefs", 0,\r
void NativeFS_Close(tVFS_Node *Node)\r
{\r
tNativeFS *info = Node->ImplPtr;\r
- Inode_UncacheNode( info->InodeHandle, Node->Inode );\r
+ DIR *dp = (Node->Flags & VFS_FFLAG_DIRECTORY) ? (DIR*)(tVAddr)Node->Inode : 0;\r
+ FILE *fp = (Node->Flags & VFS_FFLAG_DIRECTORY) ? 0 : (FILE*)(tVAddr)Node->Inode;\r
+ \r
+ if( Inode_UncacheNode( info->InodeHandle, Node->Inode ) == 1 ) {\r
+ if(dp) closedir(dp);\r
+ if(fp) fclose(fp);\r
+ }\r
}\r
\r
tVFS_Node *NativeFS_FindDir(tVFS_Node *Node, const char *Name)\r
{\r
- char *path = malloc(Node->ImplInt + 1 + strlen(Name) + 1);\r
+ char *path;\r
tNativeFS *info = Node->ImplPtr;\r
tVFS_Node baseRet;\r
struct stat statbuf;\r
ENTER("pNode sName", Node, Name);\r
\r
// Create path\r
+ path = malloc(Node->ImplInt + 1 + strlen(Name) + 1);\r
strcpy(path, Node->Data);\r
path[Node->ImplInt] = '/';\r
strcpy(path + Node->ImplInt + 1, Name);\r