2 * Acess2 Networking Test Suite (NetTest)
3 * - By John Hodge (thePowersGang)
6 * - VFS Layer Emulation
13 int VFS_SelectNode(tVFS_Node *Node, int Type, tTime *Timeout, const char *Name)
19 int VFS_MarkAvaliable(tVFS_Node *Node, BOOL bAvail)
21 Node->DataAvaliable = bAvail;
22 if( Node->DataAvaliable && Node->ReadThreads )
23 Threads_PostEvent( (void*)Node->ReadThreads, THREAD_EVENT_VFS );
27 int VFS_MarkError(tVFS_Node *Node, BOOL bError)
29 Node->ErrorOccurred = bError;
30 if( Node->ErrorOccurred && Node->ErrorThreads )
31 Threads_PostEvent( (void*)Node->ErrorThreads, THREAD_EVENT_VFS );
36 int VFS_Open(const char *Path, Uint Flags)
41 void VFS_Close(int FD)
46 int VFS_AllocHandle(int bIsUser, tVFS_Node *Node, int Mode)
48 const int maxfd = *Threads_GetMaxFD();
49 tVFS_Handle *handles = *Threads_GetHandlesPtr();
51 handles = calloc( maxfd, sizeof(tVFS_Handle) );
52 *Threads_GetHandlesPtr() = handles;
55 // TODO: Global handles
57 for( int i = 0; i < maxfd; i ++ )
59 if( handles[i].Node == NULL ) {
60 handles[i].Node = Node;
61 handles[i].Mode = Mode;
68 tVFS_Handle *VFS_GetHandle(int FD)
70 const int maxfd = *Threads_GetMaxFD();
71 tVFS_Handle *handles = *Threads_GetHandlesPtr();
75 if( FD < 0 || FD >= maxfd )