X-Git-Url: https://git.ucc.asn.au/?a=blobdiff_plain;f=Modules%2FFilesystems%2FInitRD%2Fmain.c;h=b52ab8de2611e1fe7fec03ae6ad18bd31b5867a5;hb=7536e8afcc3018c4ca2a4aa8f8422cf86a6c188c;hp=9a783896a25277bb1f5f00efcf51133d0453fb92;hpb=01b023f2329c2c5b3421231ff7ad3c7a214ac27c;p=tpg%2Facess2.git diff --git a/Modules/Filesystems/InitRD/main.c b/Modules/Filesystems/InitRD/main.c index 9a783896..b52ab8de 100644 --- a/Modules/Filesystems/InitRD/main.c +++ b/Modules/Filesystems/InitRD/main.c @@ -9,11 +9,14 @@ // === IMPORTS == extern tVFS_Node gInitRD_RootNode; +extern const int giInitRD_NumFiles; +extern tVFS_Node * const gInitRD_FileList[]; // === PROTOTYPES === int InitRD_Install(char **Arguments); tVFS_Node *InitRD_InitDevice(const char *Device, const char **Arguments); void InitRD_Unmount(tVFS_Node *Node); +tVFS_Node *InitRD_GetNodeFromINode(tVFS_Node *Root, Uint64 Inode); Uint64 InitRD_ReadFile(tVFS_Node *Node, Uint64 Offset, Uint64 Size, void *Buffer); char *InitRD_ReadDir(tVFS_Node *Node, int ID); tVFS_Node *InitRD_FindDir(tVFS_Node *Node, const char *Name); @@ -22,7 +25,14 @@ void InitRD_DumpDir(tVFS_Node *Node, int Indent); // === GLOBALS === MODULE_DEFINE(0, 0x0A, FS_InitRD, InitRD_Install, NULL); tVFS_Driver gInitRD_FSInfo = { - "initrd", 0, InitRD_InitDevice, InitRD_Unmount, NULL + "initrd", 0, InitRD_InitDevice, InitRD_Unmount, InitRD_GetNodeFromINode + }; +tVFS_NodeType gInitRD_DirType = { + .ReadDir = InitRD_ReadFile, + .FindDir = InitRD_FindDir + }; +tVFS_NodeType gInitRD_FileType = { + .Read = InitRD_ReadFile }; /** @@ -44,7 +54,7 @@ tVFS_Node *InitRD_InitDevice(const char *Device, const char **Arguments) #if DUMP_ON_MOUNT InitRD_DumpDir( &gInitRD_RootNode, 0 ); #endif - Log_Notice("InitRD", "Mounted"); + Log_Notice("InitRD", "Mounted (%i files)", giInitRD_NumFiles); return &gInitRD_RootNode; } @@ -55,6 +65,14 @@ void InitRD_Unmount(tVFS_Node *Node) { } +/** + */ +tVFS_Node *InitRD_GetNodeFromINode(tVFS_Node *Root, Uint64 Inode) +{ + if( Inode >= giInitRD_NumFiles ) return NULL; + return gInitRD_FileList[Inode]; +} + /** * \brief Read from a file */