3 * InitRD Driver Version 1
9 extern tVFS_Node gInitRD_RootNode;
12 int InitRD_Install(char **Arguments);
13 tVFS_Node *InitRD_InitDevice(char *Device, char **Arguments);
14 void InitRD_Unmount(tVFS_Node *Node);
15 Uint64 InitRD_ReadFile(tVFS_Node *Node, Uint64 Offset, Uint64 Size, void *Buffer);
16 char *InitRD_ReadDir(tVFS_Node *Node, int ID);
17 tVFS_Node *InitRD_FindDir(tVFS_Node *Node, char *Name);
20 MODULE_DEFINE(0, 0x0A, FS_InitRD, InitRD_Install, NULL);
21 tVFS_Driver gInitRD_FSInfo = {
22 "initrd", 0, InitRD_InitDevice, InitRD_Unmount, NULL
26 * \brief Register initrd with the kernel
28 int InitRD_Install(char **Arguments)
30 VFS_AddDriver( &gInitRD_FSInfo );
35 * \brief Mount the InitRD
37 tVFS_Node *InitRD_InitDevice(char *Device, char **Arguments)
39 return &gInitRD_RootNode;
43 * \brief Unmount the InitRD
45 void InitRD_Unmount(tVFS_Node *Node)
50 * \brief Read from a file
52 Uint64 InitRD_ReadFile(tVFS_Node *Node, Uint64 Offset, Uint64 Length, void *Buffer)
54 if(Offset > Node->Size)
56 if(Offset + Length > Node->Size)
57 Length = Node->Size - Offset;
59 memcpy(Buffer, Node->ImplPtr+Offset, Length);
65 * \brief Read from a directory
67 char *InitRD_ReadDir(tVFS_Node *Node, int ID)
69 tInitRD_File *dir = Node->ImplPtr;
74 return strdup(dir[ID].Name);
78 * \brief Find an element in a directory
80 tVFS_Node *InitRD_FindDir(tVFS_Node *Node, char *Name)
83 tInitRD_File *dir = Node->ImplPtr;
85 Log("InirRD_FindDir: Name = '%s'", Name);
87 for( i = 0; i < Node->Size; i++ )
89 if(strcmp(Name, dir[i].Name) == 0)