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,
23 .ACLs = &gVFS_ACL_EveryoneRW,
24 .ReadDir = DevFS_ReadDir,
25 .FindDir = DevFS_FindDir
27 tDevFS_Driver *gDevFS_Drivers = NULL;
28 int giDevFS_NextID = 1;
32 * \fn int DevFS_AddDevice(tDevFS_Driver *Dev)
34 int DevFS_AddDevice(tDevFS_Driver *Dev)
36 Dev->Next = gDevFS_Drivers;
39 return giDevFS_NextID++;
43 * \fn tVFS_Node *DevFS_InitDevice(char *Device, char *Options)
44 * \brief Initialise the DevFS and detect double-mounting, or just do nothing
47 tVFS_Node *DevFS_InitDevice(char *Device, char *Options)
49 return &gDevFS_RootNode;
53 * \fn char *DevFS_ReadDir(tVFS_Node *Node, int Pos)
55 char *DevFS_ReadDir(tVFS_Node *Node, int Pos)
59 if(Pos < 0) return NULL;
61 for(dev = gDevFS_Drivers;
70 * \fn tVFS_Node *DevFS_FindDir(tVFS_Node *Node, char *Name)
71 * \brief Get an entry from the devices directory
73 tVFS_Node *DevFS_FindDir(tVFS_Node *Node, char *Name)
77 //ENTER("pNode sName", Node, Name);
79 for(dev = gDevFS_Drivers;
84 //LOG("dev = %p", dev);
85 //LOG("dev->Name = '%s'", dev->Name);
86 if(strcmp(dev->Name, Name) == 0) {
87 //LEAVE('p', &dev->RootNode);
88 return &dev->RootNode;
97 EXPORT(DevFS_AddDevice);