2 * Acess2 Networking Test Suite (NetTest)
3 * - By John Hodge (thePowersGang)
6 * - VFS Layer Emulation
13 int VFS_AllocHandle(int bIsUser, tVFS_Node *Node, int Mode)
15 const int maxfd = *Threads_GetMaxFD(NULL);
16 tVFS_Handle *handles = *Threads_GetHandlesPtr();
18 handles = calloc( maxfd, sizeof(tVFS_Handle) );
19 *Threads_GetHandlesPtr() = handles;
22 // TODO: Global handles
24 for( int i = 0; i < maxfd; i ++ )
26 if( handles[i].Node == NULL ) {
27 handles[i].Node = Node;
28 handles[i].Mode = Mode;
35 tVFS_Handle *VFS_GetHandle(int FD)
37 const int maxfd = *Threads_GetMaxFD(NULL);
38 tVFS_Handle *handles = *Threads_GetHandlesPtr();
42 if( FD < 0 || FD >= maxfd )
48 int VFS_SetHandle(int FD, tVFS_Node *Node, int Mode)
50 const int maxfd = *Threads_GetMaxFD(NULL);
51 tVFS_Handle *handles = *Threads_GetHandlesPtr();
55 if( FD < 0 || FD >= maxfd )
58 handles[FD].Node = Node;
59 handles[FD].Mode = Mode;