DiskTool - Usability fixes
[tpg/acess2.git] / Tools / DiskTool / src / vfs_handles.c
index 53c932f..4f30151 100644 (file)
@@ -1,10 +1,33 @@
 /*
  * 
  */
+#include <acess.h>
+#include <vfs.h>
 #include <vfs_int.h>
 
+#define MAX_KERNEL_FILES       32
+
+// === GLOBALS ===
+tVFS_Handle    gaKernelHandles[MAX_KERNEL_FILES];
+
 // === CODE ===
+int VFS_AllocHandle(int bIsUser, tVFS_Node *Node, int Mode)
+{
+       for( int i = 0; i < MAX_KERNEL_FILES; i ++ )
+       {
+               if(gaKernelHandles[i].Node)     continue;
+               gaKernelHandles[i].Node = Node;
+               gaKernelHandles[i].Position = 0;
+               gaKernelHandles[i].Mode = Mode;
+               return i;
+       }       
+
+       return -1;
+}
+
 tVFS_Handle *VFS_GetHandle(int ID)
 {
-       return NULL;
+       if( ID < 0 || ID >= MAX_KERNEL_FILES )
+               return NULL;
+       return &gaKernelHandles[ID];
 }

UCC git Repository :: git.ucc.asn.au