#undef sprintf\r
#include <dirent.h> // Posix\r
#include <sys/stat.h> // Posix\r
-#include <stdio.h> // Posix\r
+#include <stdio.h> // C\r
\r
//NOTES:\r
// tVFS_Node->ImplPtr is a pointer to the filesystem flags (tNativeFS)\r
void NativeFS_Unmount(tVFS_Node *Node);\r
tVFS_Node *NativeFS_FindDir(tVFS_Node *Node, const char *Name, Uint Flags);\r
int NativeFS_ReadDir(tVFS_Node *Node, int Position, char Dest[FILENAME_MAX]);\r
+tVFS_Node *NativeFS_MkNod(tVFS_Node *Node, const char *Name, Uint Flags);\r
size_t NativeFS_Read(tVFS_Node *Node, _acess_off_t Offset, size_t Length, void *Buffer, Uint Flags);\r
size_t NativeFS_Write(tVFS_Node *Node, _acess_off_t Offset, size_t Length, const void *Buffer, Uint Flags);\r
void NativeFS_Close(tVFS_Node *Node);\r
tVFS_NodeType gNativeFS_DirNodeType = {\r
.FindDir = NativeFS_FindDir,\r
.ReadDir = NativeFS_ReadDir,\r
+ .MkNod = NativeFS_MkNod,\r
.Close = NativeFS_Close\r
};\r
tVFS_Driver gNativeFS_Driver = {\r
return 0;\r
}\r
\r
+tVFS_Node *NativeFS_MkNod(tVFS_Node *Node, const char *Name, Uint Flags)\r
+{\r
+ char path[Node->ImplInt+1+strlen(Name)+1];\r
+ sprintf(path, "%s/%s", Node->Data, Name);\r
+ if( Flags & VFS_FFLAG_DIRECTORY )\r
+ {\r
+ mkdir(path, 0755);\r
+ }\r
+ else\r
+ {\r
+ FILE *tmp = fopen(path, "w");\r
+ if(!tmp) return NULL;\r
+ fclose(tmp);\r
+ }\r
+ return NativeFS_FindDir(Node, Name, 0);\r
+}\r
+\r
size_t NativeFS_Read(tVFS_Node *Node, _acess_off_t Offset, size_t Length, void *Buffer, Uint Flags)\r
{\r
ENTER("pNode XOffset xLength pBuffer", Node, Offset, Length, Buffer);\r