0765d08f9e626f6a8a191a2d1c559fb71af770a7
[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 typedef struct sRAMDisk_Inode   tRAMDisk_Inode;
14 typedef struct sRAMDisk_File    tRAMDisk_File;
15 typedef struct sRAMDisk_DirEnt  tRAMDisk_DirEnt;
16 typedef struct sRAMDisk_Dir     tRAMDisk_Dir;
17 typedef struct sRAMDisk         tRAMDisk;
18
19 struct sRAMDisk_Inode
20 {
21         tRAMDisk        *Disk;
22         tVFS_Node       Node;
23          int    Type;   // 0: Normal, 1: Dir, 2: Symlink
24          int    nLink;
25 };
26
27 struct sRAMDisk_File
28 {
29         tRAMDisk_Inode  Inode;
30         size_t  Size;
31          int    nAllocPageSlots;
32         Uint32  PagesDirect[12];
33         Uint32  Indirect1Page;  // PAGE_SIZE/sizeof(Uint32) = 1024 on x86
34         Uint32  Indirect2Page;  // ~1 Million on x86
35 };
36
37 struct sRAMDisk_DirEnt
38 {
39         tRAMDisk_DirEnt *Next;
40         tRAMDisk_Inode  *Inode;
41         Uint8   NameLen;
42         char    Name[];
43 };
44
45 struct sRAMDisk_Dir
46 {
47         tRAMDisk_Inode  Inode;
48
49         tRAMDisk_DirEnt *FirstEnt;
50         tRAMDisk_DirEnt *LastEnt;
51 };
52
53 struct sRAMDisk
54 {
55         tRAMDisk_Dir    RootDir;
56         
57          int    MaxPages;
58         Uint32  *Bitmap;
59          int    nUsedPages;
60         tPAddr  PhysPages[];
61 };
62
63 #endif
64

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