Modules/InitRD - Added bomb command
[tpg/acess2.git] / KernelLand / Modules / Filesystems / RAMDisk / ramdisk.h
1 /*
2  * Acess2 Kernel - RAM Disk Support
3  * - By John Hodge (thePowersGang)
4  *
5  * ramdisk.h
6  * - Core header
7  */
8 #ifndef _RAMDISK_H_
9 #define _RAMDISK_H_
10
11 #include <vfs.h>
12
13 #define RAMFS_NDIRECT   12
14
15 typedef struct sRAMFS_Inode     tRAMFS_Inode;
16 typedef struct sRAMFS_File      tRAMFS_File;
17 typedef struct sRAMFS_DirEnt    tRAMFS_DirEnt;
18 typedef struct sRAMFS_Dir       tRAMFS_Dir;
19 typedef struct sRAMDisk         tRAMDisk;
20
21 struct sRAMFS_Inode
22 {
23         tRAMDisk        *Disk;
24         tVFS_Node       Node;
25          int    Type;   // 0: Normal, 1: Dir, 2: Symlink
26          int    nLink;
27 };
28
29 struct sRAMFS_File
30 {
31         tRAMFS_Inode    Inode;
32         size_t  Size;
33          int    nAllocPageSlots;
34         Uint32  PagesDirect[RAMFS_NDIRECT];
35         Uint32  Indirect1Page;  // PAGE_SIZE/sizeof(Uint32) = 1024 on x86
36         Uint32  Indirect2Page;  // ~1 Million on x86
37 };
38
39 struct sRAMFS_DirEnt
40 {
41         tRAMFS_DirEnt   *Next;
42         tRAMFS_Inode    *Inode;
43         Uint8   NameLen;
44         char    Name[];
45 };
46
47 struct sRAMFS_Dir
48 {
49         tRAMFS_Inode    Inode;
50
51         tRAMFS_DirEnt   *FirstEnt;
52         tRAMFS_DirEnt   *LastEnt;
53 };
54
55 struct sRAMDisk
56 {
57         tRAMFS_Dir      RootDir;
58         
59          int    MaxPages;
60         Uint32  *Bitmap;
61          int    nUsedPages;
62         tPAddr  PhysPages[];
63 };
64
65 #endif
66

UCC git Repository :: git.ucc.asn.au