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
20 tVFS_Node gDevFS_RootNode = {
22 .ACLs = &gVFS_ACL_EveryoneRW,
23 .ReadDir = DevFS_ReadDir,
24 .FindDir = DevFS_FindDir
26 tDevFS_Driver *gDevFS_Drivers = NULL;
27 int giDevFS_NextID = 1;
31 * \fn int DevFS_AddDevice(tDevFS_Driver *Dev)
33 int DevFS_AddDevice(tDevFS_Driver *Dev)
35 Dev->Next = gDevFS_Drivers;
38 return giDevFS_NextID++;
42 * \fn tVFS_Node *DevFS_InitDevice(char *Device, char *Options)
43 * \brief Initialise the DevFS and detect double-mounting, or just do nothing
46 tVFS_Node *DevFS_InitDevice(char *Device, char *Options)
48 return &gDevFS_RootNode;
52 * \fn char *DevFS_ReadDir(tVFS_Node *Node, int Pos)
54 char *DevFS_ReadDir(tVFS_Node *Node, int Pos)
58 if(Pos < 0) return NULL;
60 for(dev = gDevFS_Drivers;
69 * \fn tVFS_Node *DevFS_FindDir(tVFS_Node *Node, char *Name)
70 * \brief Get an entry from the devices directory
72 tVFS_Node *DevFS_FindDir(tVFS_Node *Node, char *Name)
76 //ENTER("pNode sName", Node, Name);
78 for(dev = gDevFS_Drivers;
83 //LOG("dev = %p", dev);
84 //LOG("dev->Name = '%s'", dev->Name);
85 if(strcmp(dev->Name, Name) == 0) {
86 //LEAVE('p', &dev->RootNode);
87 return &dev->RootNode;
96 EXPORT(DevFS_AddDevice);