11 extern tVFS_Driver gRootFS_Info;
12 extern tVFS_Driver gDevFS_Info;
15 tVFS_Node NULLNode = {0};
16 static int siDriverListLock = 0;
17 tVFS_Driver *gVFS_Drivers = NULL;
22 * \brief Initialises the VFS for use by the kernel and user
27 gVFS_Drivers = &gRootFS_Info;
28 gVFS_Drivers->Next = &gDevFS_Info;
30 VFS_Mount("root", "/", "rootfs", "");
31 VFS_MkDir("/Devices");
33 VFS_Mount("dev", "/Devices", "devfs", "");
35 CFGINT(CFG_VFS_MAXFILES) = 32;
40 * \fn char *VFS_GetTruePath(char *Path)
41 * \brief Gets the true path (non-symlink) of a file
43 char *VFS_GetTruePath(char *Path)
48 tmp = VFS_GetAbsPath(Path);
49 if(tmp == NULL) return NULL;
50 node = VFS_ParsePath(tmp, &ret);
53 if(!node) return NULL;
54 if(node->Close) node->Close(node);
60 * \fn void VFS_GetMemPath(void *Base, Uint Length, char *Dest)
61 * \brief Create a VFS memory pointer path
63 void VFS_GetMemPath(void *Base, Uint Length, char *Dest)
65 Log("VFS_GetMemPath: (Base=%p, Length=0x%x, Dest=%p)", Base, Length, Dest);
67 itoa( &Dest[1], (Uint)Base, 16, BITS/4, '0' );
69 itoa( &Dest[BITS/4+2], Length, 16, BITS/4, '0' );
71 Log("VFS_GetMemPath: Dest = \"%s\"", Dest);
75 * \fn tVFS_Driver *VFS_GetFSByName(char *Name)
76 * \brief Gets a filesystem structure given a name
78 tVFS_Driver *VFS_GetFSByName(char *Name)
80 tVFS_Driver *drv = gVFS_Drivers;
82 for(;drv;drv=drv->Next)
84 if(strcmp(drv->Name, Name) == 0)
91 * \fn int VFS_AddDriver(tVFS_Driver *Info)
93 int VFS_AddDriver(tVFS_Driver *Info)
97 LOCK( &siDriverListLock );
98 Info->Next = gVFS_Drivers;
100 RELEASE( &siDriverListLock );