Rev 2404 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed
Rev 2404 | Rev 2435 | ||
---|---|---|---|
Line 30... | Line 30... | ||
30 | * BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, |
30 | * BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, |
31 | * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE |
31 | * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE |
32 | * OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, |
32 | * OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, |
33 | * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
33 | * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
34 | */ |
34 | */ |
35 | 35 | ||
- | 36 | /** @addtogroup FileSystemImpl |
|
- | 37 | * @{ |
|
- | 38 | */ |
|
36 | 39 | ||
- | 40 | /** |
|
- | 41 | * @file const.h |
|
37 | /* Constants of all file system. Some of them are not used here in |
42 | * @brief Constants of all file system. Some of them are not used here in |
38 | * current version, but will be used in later versions probably. |
43 | * current version, but will be used in later versions probably. |
39 | */ |
44 | */ |
40 | 45 | ||
41 | #ifndef _CONST_H |
46 | #ifndef _CONST_H |
42 | #define _CONST_H |
47 | #define _CONST_H |
43 | 48 | ||
44 | /* Defined in ../share/base_const.h */ |
- | |
45 | /* |
- | |
46 | #define FALSE 0 |
- | |
47 | #define TRUE 1 |
- | |
48 | #define OK 0 |
- | |
49 | */ |
- | |
50 | - | ||
51 | #define BLOCK_SIZE 1024 /* # bytes in a disk block */ |
49 | #define BLOCK_SIZE 1024 /**< # bytes in a disk block */ |
52 | #define MAJOR 8 /* major device = (dev>>MAJOR) & 0377 */ |
50 | #define MAJOR 8 /**< major device = (dev>>MAJOR) & 0377 */ |
53 | #define MINOR 0 /* minor device = (dev>>MINOR) & 0377 */ |
51 | #define MINOR 0 /**< minor device = (dev>>MINOR) & 0377 */ |
54 | #define BYTE 0377 /* mask for 8 bits */ |
52 | #define BYTE 0377 /**< mask for 8 bits */ |
55 | #define NO_NUM 0x8000 /* used as numerical argument to panic() */ |
53 | #define NO_NUM 0x8000 /**< used as numerical argument to panic() */ |
56 | 54 | ||
57 | /* Not used here. */ |
55 | /* Not used here. */ |
58 | #define NR_SEGS 3 /* # segments per process */ |
56 | #define NR_SEGS 3 /**< # segments per process */ |
59 | #define T 0 /* proc[i].mem_map[T] is for text */ |
57 | #define T 0 /**< proc[i].mem_map[T] is for text */ |
60 | #define D 1 /* proc[i].mem_map[D] is for data */ |
58 | #define D 1 /**< proc[i].mem_map[D] is for data */ |
61 | #define S 2 /* proc[i].mem_map[S] is for stack */ |
59 | #define S 2 /**< proc[i].mem_map[S] is for stack */ |
62 | 60 | ||
63 | #define MAX(a, b) ((a) > (b) ? (a) : (b)) |
61 | #define MAX(a, b) ((a) > (b) ? (a) : (b)) |
64 | #define MIN(a, b) ((a) < (b) ? (a) : (b)) |
62 | #define MIN(a, b) ((a) < (b) ? (a) : (b)) |
65 | 63 | ||
66 | #define I_NOT_ALLOC 0000000 /* this inode is free */ |
64 | #define I_NOT_ALLOC 0000000 /**< this inode is free */ |
67 | 65 | ||
68 | #define I_TYPE 0170000 /* this field gives inode type */ |
66 | #define I_TYPE 0170000 /**< this field gives inode type */ |
69 | #define I_REGULAR 0100000 /* regular file, not dir or special */ |
67 | #define I_REGULAR 0100000 /**< regular file, not dir or special */ |
70 | #define I_DIRECTORY 0040000 /* file is a directory */ |
68 | #define I_DIRECTORY 0040000 /**< file is a directory */ |
71 | #define I_BLOCK_SPECIAL 0060000 /* block special file */ |
69 | #define I_BLOCK_SPECIAL 0060000 /**< block special file */ |
72 | #define I_CHAR_SPECIAL 0020000 /* character special file */ |
70 | #define I_CHAR_SPECIAL 0020000 /**< character special file */ |
73 | 71 | ||
74 | #define MAX_FILE_POS ((off_t) 037777777777) /* largest legal file offset */ |
72 | #define MAX_FILE_POS ((off_t) 037777777777) /**< largest legal file offset */ |
75 | 73 | ||
76 | #define R_BIT 0000004 /* Rwx protection bit */ |
74 | #define R_BIT 0000004 /**< Rwx protection bit */ |
77 | #define W_BIT 0000002 /* rWx protection bit */ |
75 | #define W_BIT 0000002 /**< rWx protection bit */ |
78 | #define X_BIT 0000001 /* rwX protection bit */ |
76 | #define X_BIT 0000001 /**< rwX protection bit */ |
79 | 77 | ||
80 | #define NO_BLOCK ((block_num_t) 0) /* absence of a block number */ |
78 | #define NO_BLOCK ((block_num_t) 0) /**< absence of a block number */ |
81 | #define NO_ZONE ((zone_t) 0) /* absence of a zone number */ |
79 | #define NO_ZONE ((zone_t) 0) /**< absence of a zone number */ |
82 | #define NO_DEV ((dev_t) 0) /* absence of a device numb */ |
80 | #define NO_DEV ((dev_t) 0) /**< absence of a device numb */ |
83 | 81 | ||
84 | 82 | ||
85 | /* Tables sizes. */ |
83 | /* Tables sizes. */ |
86 | #define V1_NR_DZONES 7 /* # direct zone numbers in a V1 inode */ |
84 | #define V1_NR_DZONES 7 /**< # direct zone numbers in a V1 inode */ |
87 | #define V1_NR_TZONES 9 /* total # zone numbers in a V1 inode */ |
85 | #define V1_NR_TZONES 9 /**< total # zone numbers in a V1 inode */ |
88 | #define V2_NR_DZONES 7 /* # direct zone numbers in a V2 inode */ |
86 | #define V2_NR_DZONES 7 /**< # direct zone numbers in a V2 inode */ |
89 | #define V2_NR_TZONES 10 /* total # zone numbers in a V2 inode */ |
87 | #define V2_NR_TZONES 10 /**< total # zone numbers in a V2 inode */ |
90 | 88 | ||
91 | #define NR_FILPS 128 /* # slots in filp table */ |
89 | #define NR_FILPS 128 /**< # slots in filp table */ |
92 | #define NR_INODES 64 /* # slots in "in core" inode table */ |
90 | #define NR_INODES 64 /**< # slots in "in core" inode table */ |
93 | 91 | ||
94 | 92 | ||
- | 93 | /** |
|
95 | /* The type of sizeof may be (unsigned) long. Use the following macro for |
94 | * The type of sizeof may be (unsigned) long. Use the following macro for |
96 | * taking the sizes of small objects so that there are no surprises like |
95 | * taking the sizes of small objects so that there are no surprises like |
97 | * (small) long constants being passed to routines expecting an int. |
96 | * (small) long constants being passed to routines expecting an int. |
98 | */ |
97 | */ |
99 | #define usizeof(t) ((unsigned) sizeof(t)) |
98 | #define usizeof(t) ((unsigned) sizeof(t)) |
100 | 99 | ||
101 | 100 | ||
102 | /* File system macros corresponding with given versions. */ |
101 | /* File system macros corresponding with given versions. */ |
103 | #define SUPER_MAGIC 0x137F /* magic number for V1 file systems */ |
102 | #define SUPER_MAGIC 0x137F /**< magic number for V1 file systems */ |
104 | #define SUPER_MAGIC2 0x138F /* magic number for V1 file systems - 30 char names */ |
103 | #define SUPER_MAGIC2 0x138F /**< magic number for V1 file systems - 30 char names */ |
105 | #define SUPER_V2 0x2468 /* magic number for V2 file systems */ |
104 | #define SUPER_V2 0x2468 /**< magic number for V2 file systems */ |
106 | #define SUPER_V2E 0x2478 /* magic number for V2 file systems - 30 char names */ |
105 | #define SUPER_V2E 0x2478 /**< magic number for V2 file systems - 30 char names */ |
107 | 106 | ||
108 | #define TOTAL_VERSIONS 2 /* number of versions of file system */ |
107 | #define TOTAL_VERSIONS 2 /**< number of versions of file system */ |
109 | 108 | ||
110 | #define V1 1 /* version number of V2 file systems */ |
109 | #define V1 1 /**< version number of V2 file systems */ |
111 | #define V2 2 /* version number of V2 file systems */ |
110 | #define V2 2 /**< version number of V2 file systems */ |
112 | 111 | ||
113 | #define LOOK_UP 0 /* tells search_dir to lookup string */ |
112 | #define LOOK_UP 0 /**< tells search_dir to lookup string */ |
114 | #define IS_EMPTY 3 /* tells search_dir to ret. OK or ENOTEMPTY */ |
113 | #define IS_EMPTY 3 /**< tells search_dir to ret. OK or ENOTEMPTY */ |
115 | 114 | ||
116 | #define BYTE_SWAP 0 /* tells conv2/conv4 to swap bytes */ |
115 | #define BYTE_SWAP 0 /**< tells conv2/conv4 to swap bytes */ |
117 | #define DONT_SWAP 1 /* tells conv2/conv4 not to swap bytes */ |
116 | #define DONT_SWAP 1 /**< tells conv2/conv4 not to swap bytes */ |
118 | 117 | ||
119 | #define END_OF_FILE (-104) /* eof detected */ |
118 | #define END_OF_FILE (-104) /**< eof detected */ |
120 | 119 | ||
121 | #define ROOT_INODE 1 /* inode number for root directory */ |
120 | #define ROOT_INODE 1 /**< inode number for root directory */ |
122 | #define BOOT_BLOCK ((block_num_t) 0) /* block number of boot block */ |
121 | #define BOOT_BLOCK ((block_num_t) 0) /**< block number of boot block */ |
123 | #define SUPER_BLOCK ((block_num_t) 1) /* block number of super block */ |
122 | #define SUPER_BLOCK ((block_num_t) 1) /**< block number of super block */ |
124 | 123 | ||
125 | /* For normal version. */ |
124 | /* For normal version. */ |
126 | #define DIR_ENTRY_SIZE usizeof (direct_t) /* # bytes/dir entry */ |
125 | #define DIR_ENTRY_SIZE usizeof (direct_t) /**< # bytes/dir entry */ |
127 | #define NR_DIR_ENTRIES (BLOCK_SIZE/DIR_ENTRY_SIZE) /* # dir entries/blk */ |
126 | #define NR_DIR_ENTRIES (BLOCK_SIZE/DIR_ENTRY_SIZE) /**< # dir entries/blk */ |
128 | 127 | ||
129 | /* For extended version. */ |
128 | /* For extended version. */ |
130 | #define DIR_ENTRY_SIZE_EX usizeof (directex_t) /* # bytes/dir entry */ |
129 | #define DIR_ENTRY_SIZE_EX usizeof (directex_t) /**< # bytes/dir entry */ |
131 | #define NR_DIR_ENTRIES_EX (BLOCK_SIZE/DIR_ENTRY_SIZE_EX) /* # dir entries/blk */ |
130 | #define NR_DIR_ENTRIES_EX (BLOCK_SIZE/DIR_ENTRY_SIZE_EX) /**< # dir entries/blk */ |
132 | 131 | ||
133 | #define SUPER_SIZE usizeof (super_block_t) /* super_block size */ |
132 | #define SUPER_SIZE usizeof (super_block_t) /**< super_block size */ |
134 | 133 | ||
135 | 134 | ||
136 | /* Derived sizes pertaining to the V1 file system. */ |
135 | /* Derived sizes pertaining to the V1 file system. */ |
137 | #define V1_ZONE_NUM_SIZE usizeof (zone1_t) /* # bytes in V1 zone */ |
136 | #define V1_ZONE_NUM_SIZE usizeof (zone1_t) /**< # bytes in V1 zone */ |
138 | #define V1_INODE_SIZE usizeof (d1_inode_t) /* bytes in V1 dsk ino */ |
137 | #define V1_INODE_SIZE usizeof (d1_inode_t) /**< bytes in V1 dsk ino */ |
139 | #define V1_INDIRECTS (BLOCK_SIZE/V1_ZONE_NUM_SIZE) /* # zones/indir block */ |
138 | #define V1_INDIRECTS (BLOCK_SIZE/V1_ZONE_NUM_SIZE) /**< # zones/indir block */ |
140 | #define V1_INODES_PER_BLOCK (BLOCK_SIZE/V1_INODE_SIZE)/* # V1 dsk inodes/blk */ |
139 | #define V1_INODES_PER_BLOCK (BLOCK_SIZE/V1_INODE_SIZE)/**< # V1 dsk inodes/blk */ |
141 | 140 | ||
142 | /* Derived sizes pertaining to the V2 file system. */ |
141 | /* Derived sizes pertaining to the V2 file system. */ |
143 | #define V2_ZONE_NUM_SIZE usizeof (zone_t) /* # bytes in V2 zone */ |
142 | #define V2_ZONE_NUM_SIZE usizeof (zone_t) /**< # bytes in V2 zone */ |
144 | #define V2_INODE_SIZE usizeof (d2_inode_t) /* bytes in V2 dsk ino */ |
143 | #define V2_INODE_SIZE usizeof (d2_inode_t) /**< bytes in V2 dsk ino */ |
145 | #define V2_INDIRECTS (BLOCK_SIZE/V2_ZONE_NUM_SIZE) /* # zones/indir block */ |
144 | #define V2_INDIRECTS (BLOCK_SIZE/V2_ZONE_NUM_SIZE) /**< # zones/indir block */ |
146 | #define V2_INODES_PER_BLOCK (BLOCK_SIZE/V2_INODE_SIZE)/* # V2 dsk inodes/blk */ |
145 | #define V2_INODES_PER_BLOCK (BLOCK_SIZE/V2_INODE_SIZE)/**< # V2 dsk inodes/blk */ |
147 | 146 | ||
148 | 147 | ||
149 | /* Filesystem supported operations. */ |
148 | /* Filesystem supported operations. */ |
150 | #define FS_NEW_CONSUMER (FIRST_USER_METHOD + 50) /* this is not file system system call */ |
149 | #define FS_NEW_CONSUMER (FIRST_USER_METHOD + 50) /**< this is not file system system call */ |
151 | #define FS_DROP_CONSUMER (FS_NEW_CONSUMER + 1) /* drops connected consument */ |
150 | #define FS_DROP_CONSUMER (FS_NEW_CONSUMER + 1) /**< drops connected consument */ |
152 | 151 | ||
153 | #define FS_BASE FIRST_USER_METHOD |
152 | #define FS_BASE FIRST_USER_METHOD /**> Index of the first FS method */ |
154 | #define FS_NOSYS (0 + FS_BASE) |
153 | #define FS_NOSYS (0 + FS_BASE) /**> */ |
155 | #define FS_OPEN (1 + FS_BASE) |
154 | #define FS_OPEN (1 + FS_BASE) /**> Open file method */ |
156 | #define FS_SEEK (2 + FS_BASE) |
155 | #define FS_SEEK (2 + FS_BASE) /**> Seek in file method */ |
157 | #define FS_READ (3 + FS_BASE) |
156 | #define FS_READ (3 + FS_BASE) /**> File read method */ |
158 | #define FS_CLOSE (4 + FS_BASE) |
157 | #define FS_CLOSE (4 + FS_BASE) /**> File close method */ |
159 | #define FS_CHDIR (5 + FS_BASE) |
158 | #define FS_CHDIR (5 + FS_BASE) /**> Change current directory method */ |
160 | #define FS_STAT (6 + FS_BASE) |
159 | #define FS_STAT (6 + FS_BASE) /**> Stat method */ |
161 | #define FS_FSTAT (7 + FS_BASE) |
160 | #define FS_FSTAT (7 + FS_BASE) /**> File stat method */ |
162 | #define FS_DSUM (8 + FS_BASE) |
161 | #define FS_DSUM (8 + FS_BASE) /**> Directory entry count method */ |
163 | #define FS_READENTRY (9 + FS_BASE) |
162 | #define FS_READENTRY (9 + FS_BASE) /**> Read directory entry method */ |
164 | 163 | ||
165 | #define FS_CALLS 10 |
164 | #define FS_CALLS 10 /**> The number of File system calls */ |
166 | 165 | ||
167 | #define FS_MIN (FS_BASE) |
166 | #define FS_MIN (FS_BASE) |
168 | #define FS_MAX (FS_BASE + FS_CALLS) |
167 | #define FS_MAX (FS_BASE + FS_CALLS) |
169 | 168 | ||
170 | #define FS_IN_RANGE(VAL) ((FS_MIN <= VAL && VAL < FS_MAX)? TRUE:FALSE) |
169 | #define FS_IN_RANGE(VAL) ((FS_MIN <= VAL && VAL < FS_MAX)? TRUE:FALSE) |
171 | 170 | ||
172 | /* Number of attempts the FS will try to connect to each defined services. */ |
171 | #define CON_CONN_ATTEMPTS 1000 /**< Number of attempts the FS will try to connect to the console services. */ |
173 | #define CON_CONN_ATTEMPTS 1000 |
- | |
174 | #define RD_CONN_ATTEMPTS 1000 |
172 | #define RD_CONN_ATTEMPTS 1000 /**< Number of attempts the FS will try to connect to the RAM disk services. */ |
175 | 173 | ||
176 | #endif /* _CONST_H */ |
174 | #endif /* _CONST_H */ |
- | 175 | ||
- | 176 | /** |
|
- | 177 | * } |
|
- | 178 | */ |
|
- | 179 |