X-Git-Url: https://git.ucc.asn.au/?a=blobdiff_plain;f=KernelLand%2FKernel%2Fvfs%2Ffs%2Fdevfs.c;h=93898226810b9277f0e2d5e4b2e168db9b087dae;hb=772bccbd2253d1d107eda59e0df6d277b4435558;hp=13552260b41ef9e38923ab580beed9f1a91c2a87;hpb=7dcbae6762b50bdd450559ca455f2374a09f1df9;p=tpg%2Facess2.git diff --git a/KernelLand/Kernel/vfs/fs/devfs.c b/KernelLand/Kernel/vfs/fs/devfs.c index 13552260..93898226 100644 --- a/KernelLand/Kernel/vfs/fs/devfs.c +++ b/KernelLand/Kernel/vfs/fs/devfs.c @@ -14,12 +14,15 @@ void DevFS_DelDevice(tDevFS_Driver *Device); #endif tVFS_Node *DevFS_InitDevice(const char *Device, const char **Options); -char *DevFS_ReadDir(tVFS_Node *Node, int Pos); +void DevFS_Unmount(tVFS_Node *RootNode); + int DevFS_ReadDir(tVFS_Node *Node, int Pos, char Dest[FILENAME_MAX]); tVFS_Node *DevFS_FindDir(tVFS_Node *Node, const char *Name); // === GLOBALS === tVFS_Driver gDevFS_Info = { - "devfs", 0, DevFS_InitDevice, NULL, NULL + .Name = "devfs", + .InitDevice = DevFS_InitDevice, + .Unmount = DevFS_Unmount }; tVFS_NodeType gDevFS_DirType = { .TypeName = "DevFS-Dir", @@ -117,24 +120,32 @@ tVFS_Node *DevFS_InitDevice(const char *Device, const char **Options) return &gDevFS_RootNode; } +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; + } } /**