Sorting source tree a bit
[tpg/acess2.git] / KernelLand / Modules / Filesystems / LEAN / common.h
1 /*
2  * Acess 2 LEAN Filesystem Driver
3  * By John Hodge (thePowersGang)
4  *
5  * lean.h - Filesystem Structure Definitions
6  */
7 #ifndef _COMMON_H_
8 #define _COMMON_H_
9
10 #define EXTENTS_PER_INODE       6
11 #define EXTENTS_PER_INDIRECT    38
12
13 struct sLEAN_Superblock
14 {
15         // TODO
16 };
17
18 struct sLEAN_IndirectBlock
19 {
20         Uint32  Checksum;       // Block checksum
21         Uint32  Magic;  // 'INDX'
22         Uint64  SectorCount;    // Number of blocks referenced by this block
23         Uint64  Inode;  // Inode this block belongs to (in for robustness)
24         Uint64  ThisSector;     // Sector number of this block
25         Uint64  PrevIndirect;   // Backlink to the previous indirect block (or zero)
26         Uint64  NextIndirect;   // Link to the next indirect block (or zero)
27         
28         /**
29          * Number of extents stored in this block (only the last block can
30          * have this as < \a EXTENTS_PER_INDIRECT
31          */
32         Uint8   NumExtents;
33         Uint8   reserved1[3];   //!< Reserved/Padding
34         Uint32  reserved2;      //!< Reserved/Padding
35         
36         Uint64  ExtentsStarts[EXTENTS_PER_INDIRECT];
37         Uint32  ExtentsSizes[EXTENTS_PER_INDIRECT];
38 }
39
40 struct sLEAN_Inode
41 {
42         Uint32  Checksum;       //!< Checksum of the inode
43         Uint32  Magic;  //!< Magic Value 'NODE'
44         
45         Uint8   ExtentCount;    //!< Number of extents defined in the inode structure
46         Uint8   reserved1[3];   //!< Reserved/Padding
47         
48         Uint32  IndirectCount;  //!< Number of indirect extent blocks used by the file
49         Uint32  LinkCount;      //!< Number of directory entires that refer to this inode
50         
51         Uint32  UID;    //!< Owning User
52         Uint32  GID;    //!< Owning Group
53         Uint32  Attributes;     //!< 
54         Uint64  FileSize;       //!< Size of the file data (not including inode and other bookkeeping)
55         Uint64  SectorCount;    //!< Number of sectors allocated to the file
56         Sint64  LastAccessTime; //!< Last access time
57         Sint64  StatusChangeTime;       //!< Last change of the status bits time
58         Sint64  ModifcationTime;        //!< Last modifcation time
59         Sint64  CreationTime;   //!< File creation time
60         
61         Uint64  FirstIndirect;  //!< Sector number of the first indirect block
62         Uint64  LastIndirect;   //!< Sector number of the last indirect block
63         
64         Uint64  Fork;   //!< ????
65         
66         Uint64  ExtentsStarts[EXTENTS_PER_INODE];
67         Uint32  ExtentsSizes[EXTENTS_PER_INODE];
68 };
69
70 enum eLEAN_InodeAttributes
71 {
72         LEAN_iaXOth = 1 << 0,   LEAN_iaWOth = 1 << 1,   LEAN_iaROth = 1 << 2,
73         LEAN_iaXGrp = 1 << 3,   LEAN_iaWGrp = 1 << 4,   LEAN_iaRGrp = 1 << 5,
74         LEAN_iaXUsr = 1 << 6,   LEAN_iaWUsr = 1 << 7,   LEAN_iaRUsr = 1 << 8,
75         
76         LEAN_iaSVTX = 1 << 9,
77         LEAN_iaSGID = 1 << 10,
78         LEAN_iaSUID = 1 << 11,
79         
80         LEAN_iaHidden   = 1 << 12,
81         LEAN_iaSystem   = 1 << 13,
82         LEAN_iaArchive  = 1 << 14,      // Set on any write
83         LEAN_iaSync     = 1 << 15,
84         LEAN_iaNoAccessTime     = 1 << 16,      //!< Don't update the last accessed time
85         LEAN_iaImmutable        = 1 << 17,      //!< Don't move sectors (defragger flag)
86         LEAN_iaPrealloc = 1 << 18,      //!< Keep preallocated sectors after close
87         LEAN_iaInlineExtAttr    = 1 << 19,      //!< Reserve the first sector
88         
89         LEAN_iaFmtMask  = 7 << 29,      //!< Format mask
90         LEAN_iaFmtRegular       = 1 << 29,      //!< Regular File
91         LEAN_iaFmtDirectory     = 2 << 29,      //!< Directory
92         LEAN_iaFmtSymlink       = 3 << 29,      //!< Symlink
93         LEAN_iaFmtFork  = 4 << 29,      //!< Fork
94 };
95
96 struct tLEAN_ExtendedAttribute
97 {
98         Uint32  Header; // 8.24 Name.Value Sizes
99 };
100
101 #endif

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