blob: 1b4ed245f28222860767cff709de5ca0aeefa4c5 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
|
#ifndef _FS_H
#define _FS_H
#include <stdint.h>
#include <sys/types.h>
#define NRSUPER 8
#define NRFILE 128
#define NROPEN 32
/* these shouldn't change */
#define BLOCK_SIZE 1024
#define SUPER_MAGIC 0x137F
struct file {
uint16_t f_mode;
uint16_t f_flags;
struct m_inode *f_inode;
off_t f_pos;
};
struct super_block {
uint16_t s_ninodes;
uint16_t s_nzones;
uint16_t s_imap_blocks;
uint16_t s_zmap_blocks;
uint16_t s_firstdatazone;
uint16_t s_log_zone_size;
uint32_t s_max_size;
uint16_t s_magic;
/* loaded in memory only */
struct s_buff *s_imap[8];
struct s_buff *s_zmap[8];
uint16_t s_dev;
uint16_t s_dirt;
uint16_t s_start;
uint16_t s_super;
uint16_t s_imap_off;
uint16_t s_zmap_off;
uint16_t s_inode_off;
} __attribute__((packed));
struct m_inode {
uint16_t i_mode;
uint16_t i_uid;
uint32_t i_size;
uint32_t i_mtime;
uint8_t i_gid;
uint8_t i_nlinks;
uint16_t i_zone[9];
} __attribute__((packed));
struct buffer {
void *b_data;
int b_present;
uint16_t b_device;
uint16_t b_block;
struct task_struct *b_wait;
struct buffer *b_next;
struct buffer *b_prev;
};
extern struct super_block sblocks[NRSUPER];
void block_read(struct buffer*);
void block_write(struct buffer*);
struct buffer *buffer_get_block(uint16_t, uint16_t);
void mount_root(void);
void fs_init(void);
/* various init functions called by fs_init() */
void buffer_init(void);
#endif
|