X-Git-Url: https://git.ucc.asn.au/?a=blobdiff_plain;f=KernelLand%2FKernel%2Fvfs%2Ffs%2Fdevfs.c;h=ec6c7e2fa29d55b41412c6b08ba99387dc6f0c4b;hb=75c6f0e9aa83ccc662620071eec8bff0a81aa3ef;hp=354f402040599adf19d4929df25907bfc2f6d0b9;hpb=11dbd684e9a3d907d43d71a3145205f1a86992fb;p=tpg%2Facess2.git diff --git a/KernelLand/Kernel/vfs/fs/devfs.c b/KernelLand/Kernel/vfs/fs/devfs.c index 354f4020..ec6c7e2f 100644 --- a/KernelLand/Kernel/vfs/fs/devfs.c +++ b/KernelLand/Kernel/vfs/fs/devfs.c @@ -15,12 +15,14 @@ void DevFS_DelDevice(tDevFS_Driver *Device); #endif tVFS_Node *DevFS_InitDevice(const char *Device, const char **Options); void DevFS_Unmount(tVFS_Node *RootNode); -char *DevFS_ReadDir(tVFS_Node *Node, int Pos); -tVFS_Node *DevFS_FindDir(tVFS_Node *Node, const char *Name); + int DevFS_ReadDir(tVFS_Node *Node, int Pos, char Dest[FILENAME_MAX]); +tVFS_Node *DevFS_FindDir(tVFS_Node *Node, const char *Name, Uint Flags); // === GLOBALS === tVFS_Driver gDevFS_Info = { - "devfs", 0, DevFS_InitDevice, DevFS_Unmount, NULL + .Name = "devfs", + .InitDevice = DevFS_InitDevice, + .Unmount = DevFS_Unmount }; tVFS_NodeType gDevFS_DirType = { .TypeName = "DevFS-Dir", @@ -126,28 +128,31 @@ void DevFS_Unmount(tVFS_Node *RootNode) /** * \fn char *DevFS_ReadDir(tVFS_Node *Node, int Pos) */ -char *DevFS_ReadDir(tVFS_Node *Node, int Pos) +int DevFS_ReadDir(tVFS_Node *Node, int Pos, char Dest[FILENAME_MAX]) { tDevFS_Driver *dev; - if(Pos < 0) return NULL; + if(Pos < 0) return -EINVAL; for(dev = gDevFS_Drivers; dev && Pos--; dev = dev->Next ); - if(dev) - return strdup(dev->Name); - else - return NULL; + if(dev) { + strncpy(Dest, dev->Name, FILENAME_MAX); + return 0; + } + else { + return -ENOENT; + } } /** * \fn tVFS_Node *DevFS_FindDir(tVFS_Node *Node, const char *Name) * \brief Get an entry from the devices directory */ -tVFS_Node *DevFS_FindDir(tVFS_Node *Node, const char *Name) +tVFS_Node *DevFS_FindDir(tVFS_Node *Node, const char *Name, Uint Flags) { tDevFS_Driver *dev;