tVFS_Node *NativeFS_FindDir(tVFS_Node *Node, const char *Name);\r
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
\r
// === GLOBALS ===\r
tVFS_NodeType gNativeFS_FileNodeType = {\r
- .Read = NativeFS_Read\r
+ .Read = NativeFS_Read,\r
+ .Write = NativeFS_Write,\r
};\r
tVFS_NodeType gNativeFS_DirNodeType = {\r
.FindDir = NativeFS_FindDir,\r
size_t NativeFS_Read(tVFS_Node *Node, _acess_off_t Offset, size_t Length, void *Buffer)\r
{\r
ENTER("pNode XOffset xLength pBuffer", Node, Offset, Length, Buffer);\r
- if( fseek( (void *)(tVAddr)Node->Inode, Offset, SEEK_SET ) != 0 )\r
+ if( fseek( (FILE *)(tVAddr)Node->Inode, Offset, SEEK_SET ) != 0 )\r
{\r
LEAVE('i', 0);\r
return 0;\r
}\r
LEAVE('-');\r
- return fread( Buffer, 1, Length, (void *)(tVAddr)Node->Inode );\r
+ return fread( Buffer, 1, Length, (FILE *)(tVAddr)Node->Inode );\r
+}\r
+\r
+size_t NativeFS_Write(tVFS_Node *Node, _acess_off_t Offset, size_t Length, const void *Buffer)\r
+{\r
+ FILE *fp = (FILE *)(tVAddr)Node->Inode;\r
+ ENTER("pNode XOffset xLength pBuffer", Node, Offset, Length, Buffer);\r
+ if( fseek( fp, Offset, SEEK_SET ) != 0 )\r
+ {\r
+ LEAVE('i', 0);\r
+ return 0;\r
+ }\r
+ size_t ret = fwrite( Buffer, 1, Length, fp );\r
+ fflush( fp );\r
+ LEAVE('i', ret);\r
+ return ret;\r
+\r
}\r