1 typedef unsigned long u32
;
2 typedef unsigned short u16
;
3 typedef unsigned char u8
;
5 typedef unsigned short ushort
;
6 typedef unsigned long ulong
;
11 #define NQUEUE NPROC // at most NPROC ready queues
13 #define FREE 0 /* proc statuc */
20 typedef struct ext2_super_block
{
21 u32 s_inodes_count
; /* Inodes count */
22 u32 s_blocks_count
; /* Blocks count */
23 u32 s_r_blocks_count
; /* Reserved blocks count */
24 u32 s_free_blocks_count
; /* Free blocks count */
25 u32 s_free_inodes_count
; /* Free inodes count */
26 u32 s_first_data_block
; /* First Data Block */
27 u32 s_log_block_size
; /* Block size */
28 u32 s_log_frag_size
; /* Fragment size */
29 u32 s_blocks_per_group
; /* # Blocks per group */
30 u32 s_frags_per_group
; /* # Fragments per group */
31 u32 s_inodes_per_group
; /* # Inodes per group */
32 u32 s_mtime
; /* Mount time */
33 u32 s_wtime
; /* Write time */
34 u16 s_mnt_count
; /* Mount count */
35 u16 s_max_mnt_count
; /* Maximal mount count */
36 u16 s_magic
; /* Magic signature */
37 u16 s_state
; /* File system state */
38 u16 s_errors
; /* Behaviour when detecting errors */
41 typedef struct ext2_group_desc
43 u32 bg_block_bitmap
; /* Blocks bitmap block */
44 u32 bg_inode_bitmap
; /* Inodes bitmap block */
45 u32 bg_inode_table
; /* Inodes table block */
46 u16 bg_free_blocks_count
; /* Free blocks count */
47 u16 bg_free_inodes_count
; /* Free inodes count */
48 u16 bg_used_dirs_count
; /* Directories count */
53 typedef struct ext2_inode
{
54 u16 i_mode
; /* File mode */
55 u16 i_uid
; /* Owner Uid */
56 u32 i_size
; /* Size in bytes */
57 u32 i_atime
; /* Access time */
58 u32 i_ctime
; /* Creation time */
59 u32 i_mtime
; /* Modification time */
60 u32 i_dtime
; /* Deletion Time */
61 u16 i_gid
; /* Group Id */
62 u16 i_links_count
; /* Links count */
63 u32 i_blocks
; /* Blocks count */
64 u32 i_flags
; /* File flags */
66 u32 i_block
[15]; /* Pointers to blocks */
67 u32 pad
[7]; /* inode size MUST be 128 bytes */
70 typedef struct ext2_dir_entry_2
{
71 u32 inode
; /* Inode number */
72 u16 rec_len
; /* Directory entry length */
73 u8 name_len
; /* Name length */
75 char name
[255]; /* File name */
95 struct Minode
*inodeptr
;
96 struct pipe
*pipe_ptr
;
101 typedef struct Minode
{
107 struct Mount
*mountptr
;
112 typedef struct Mount
{
116 struct Minode
*mounted_inode
;
123 int head
, tail
, hasData
, hasRoom
;
129 typedef struct stat
{
130 ushort st_dev
; /* major/minor device number */
131 ushort st_ino
; /* i-node number */
132 ushort st_mode
; /* file mode, protection bits, etc. */
133 ushort st_nlink
; /* # links; TEMPORARY HACK: should be nlink_t*/
134 ushort st_uid
; /* uid of the file's owner */
135 ushort st_gid
; /* gid; TEMPORARY HACK: should be gid_t */
137 long st_size
; /* file size */
138 long st_atime
; /* time of last access */
139 long st_mtime
; /* time of last data modification */
140 long st_ctime
; /* time of last file status change */
143 typedef struct stty TTY
;
160 int pri
; /* scheduling priority */
161 char name
[16]; /* name string */
164 OFT
*fd
[NFD
]; /* file descriptors */
165 MINODE
*cwd
; /* CWD */
166 char tty
[16]; /* opened /dev/ttyXX */
170 struct semaphore
*sem
; // ptr to semaphore currently BLOCKed on
171 ushort segment
, tsize
, dsize
, size
; // memory image location & size
176 /* Default dir and regulsr file modes */
177 #define DIR_MODE 0040777
178 #define FILE_MODE 0100644
179 #define SUPER_MAGIC 0xEF53