X-Git-Url: https://git.ucc.asn.au/?a=blobdiff_plain;f=AcessNative%2Facesskernel_src%2Fnativefs.c;h=e603c26b123370b6b0be94a7d67dfb4cd9d00dd0;hb=7b64f5e7f00e445a5637e9e3289a1332a14d28e5;hp=1a0762745b21a7a822c7bf16c86a5a7a5aa7afdf;hpb=132e159bfadf0f7669e80ef34ef660b99aa8b83c;p=tpg%2Facess2.git diff --git a/AcessNative/acesskernel_src/nativefs.c b/AcessNative/acesskernel_src/nativefs.c index 1a076274..e603c26b 100644 --- a/AcessNative/acesskernel_src/nativefs.c +++ b/AcessNative/acesskernel_src/nativefs.c @@ -14,7 +14,7 @@ #undef sprintf #include // Posix #include // Posix -#include // Posix +#include // C //NOTES: // tVFS_Node->ImplPtr is a pointer to the filesystem flags (tNativeFS) @@ -34,6 +34,7 @@ tVFS_Node *NativeFS_Mount(const char *Device, const char **Arguments); void NativeFS_Unmount(tVFS_Node *Node); tVFS_Node *NativeFS_FindDir(tVFS_Node *Node, const char *Name, Uint Flags); int NativeFS_ReadDir(tVFS_Node *Node, int Position, char Dest[FILENAME_MAX]); +tVFS_Node *NativeFS_MkNod(tVFS_Node *Node, const char *Name, Uint Flags); size_t NativeFS_Read(tVFS_Node *Node, _acess_off_t Offset, size_t Length, void *Buffer, Uint Flags); size_t NativeFS_Write(tVFS_Node *Node, _acess_off_t Offset, size_t Length, const void *Buffer, Uint Flags); void NativeFS_Close(tVFS_Node *Node); @@ -47,6 +48,7 @@ tVFS_NodeType gNativeFS_FileNodeType = { tVFS_NodeType gNativeFS_DirNodeType = { .FindDir = NativeFS_FindDir, .ReadDir = NativeFS_ReadDir, + .MkNod = NativeFS_MkNod, .Close = NativeFS_Close }; tVFS_Driver gNativeFS_Driver = { @@ -204,6 +206,23 @@ int NativeFS_ReadDir(tVFS_Node *Node, int Position, char Dest[FILENAME_MAX]) return 0; } +tVFS_Node *NativeFS_MkNod(tVFS_Node *Node, const char *Name, Uint Flags) +{ + char path[Node->ImplInt+1+strlen(Name)+1]; + sprintf(path, "%s/%s", Node->Data, Name); + if( Flags & VFS_FFLAG_DIRECTORY ) + { + mkdir(path, 0755); + } + else + { + FILE *tmp = fopen(path, "w"); + if(!tmp) return NULL; + fclose(tmp); + } + return NativeFS_FindDir(Node, Name, 0); +} + size_t NativeFS_Read(tVFS_Node *Node, _acess_off_t Offset, size_t Length, void *Buffer, Uint Flags) { ENTER("pNode XOffset xLength pBuffer", Node, Offset, Length, Buffer);