X-Git-Url: https://git.ucc.asn.au/?a=blobdiff_plain;f=Modules%2FFilesystems%2FInitRD%2Fmain.c;h=fa9ded6284bb5d667f46945d3dfa8882d8e9ec0a;hb=9bd0feb2cd61d6071a2c3e039b35560e608ab627;hp=ff24b5162595e58938f06c339d6affa2e8d132d2;hpb=a54379686bef79c24e4a1e2337611f33d33c8b4b;p=tpg%2Facess2.git diff --git a/Modules/Filesystems/InitRD/main.c b/Modules/Filesystems/InitRD/main.c index ff24b516..fa9ded62 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(char *Device, 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,7 @@ 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 }; /** @@ -30,6 +33,7 @@ tVFS_Driver gInitRD_FSInfo = { */ int InitRD_Install(char **Arguments) { + Log_Notice("InitRD", "Installed"); VFS_AddDriver( &gInitRD_FSInfo ); return MODULE_ERR_OK; @@ -38,11 +42,12 @@ int InitRD_Install(char **Arguments) /** * \brief Mount the InitRD */ -tVFS_Node *InitRD_InitDevice(char *Device, char **Arguments) +tVFS_Node *InitRD_InitDevice(const char *Device, const char **Arguments) { #if DUMP_ON_MOUNT InitRD_DumpDir( &gInitRD_RootNode, 0 ); #endif + Log_Notice("InitRD", "Mounted"); return &gInitRD_RootNode; } @@ -53,6 +58,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 */ @@ -89,7 +102,7 @@ tVFS_Node *InitRD_FindDir(tVFS_Node *Node, const char *Name) int i; tInitRD_File *dir = Node->ImplPtr; - //Log("InirRD_FindDir: Name = '%s'", Name); + LOG("Name = '%s'", Name); for( i = 0; i < Node->Size; i++ ) { @@ -111,7 +124,7 @@ void InitRD_DumpDir(tVFS_Node *Node, int Indent) for( i = 0; i < Node->Size; i++ ) { - //Log("%s- %p %s", indent, dir[i].Node, dir[i].Name); + Log_Debug("InitRD", "%s- %p %s", indent, dir[i].Node, dir[i].Name); if(dir[i].Node->Flags & VFS_FFLAG_DIRECTORY) InitRD_DumpDir(dir[i].Node, Indent+1); }