3 * Device Filesystem (DevFS)
11 int DevFS_AddDevice(tDevFS_Driver *Dev);
12 tVFS_Node *DevFS_InitDevice(char *Device, char **Options);
13 char *DevFS_ReadDir(tVFS_Node *Node, int Pos);
14 tVFS_Node *DevFS_FindDir(tVFS_Node *Node, char *Name);
17 tVFS_Driver gDevFS_Info = {
18 "devfs", 0, DevFS_InitDevice, NULL, NULL
20 tVFS_Node gDevFS_RootNode = {
22 .Flags = VFS_FFLAG_DIRECTORY,
24 .ACLs = &gVFS_ACL_EveryoneRW,
25 .ReadDir = DevFS_ReadDir,
26 .FindDir = DevFS_FindDir
28 tDevFS_Driver *gDevFS_Drivers = NULL;
29 int giDevFS_NextID = 1;
33 * \fn int DevFS_AddDevice(tDevFS_Driver *Dev)
35 int DevFS_AddDevice(tDevFS_Driver *Dev)
37 Dev->Next = gDevFS_Drivers;
39 gDevFS_RootNode.Size ++;
40 return giDevFS_NextID++;
44 * \fn tVFS_Node *DevFS_InitDevice(char *Device, char **Options)
45 * \brief Initialise the DevFS and detect double-mounting, or just do nothing
48 tVFS_Node *DevFS_InitDevice(char *Device, char **Options)
50 return &gDevFS_RootNode;
54 * \fn char *DevFS_ReadDir(tVFS_Node *Node, int Pos)
56 char *DevFS_ReadDir(tVFS_Node *Node, int Pos)
60 if(Pos < 0) return NULL;
62 for(dev = gDevFS_Drivers;
67 return strdup(dev->Name);
71 * \fn tVFS_Node *DevFS_FindDir(tVFS_Node *Node, char *Name)
72 * \brief Get an entry from the devices directory
74 tVFS_Node *DevFS_FindDir(tVFS_Node *Node, char *Name)
78 //ENTER("pNode sName", Node, Name);
80 for(dev = gDevFS_Drivers;
85 //LOG("dev = %p", dev);
86 //LOG("dev->Name = '%s'", dev->Name);
87 if(strcmp(dev->Name, Name) == 0) {
88 //LEAVE('p', &dev->RootNode);
89 return &dev->RootNode;
98 EXPORT(DevFS_AddDevice);