Mercurial > hg > CbC > CbC_xv6
annotate src/file.h @ 395:17e8a4bc06a7 default tip
add macOS AR/RANLIB
author | Shinji KONO <kono@ie.u-ryukyu.ac.jp> |
---|---|
date | Mon, 14 Dec 2020 21:59:50 +0900 |
parents | efef0767b1bc |
children |
rev | line source |
---|---|
345
efef0767b1bc
emit include guard at context.h
anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents:
336
diff
changeset
|
1 #ifndef FILE_STRUCT |
336
0e1c64818c0d
remove file struct, omit //:skip
anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents:
149
diff
changeset
|
2 struct file { |
116 | 3 enum { FD_NONE, FD_PIPE, FD_INODE } type; |
4 int ref; // reference count | |
5 char readable; | |
6 char writable; | |
7 struct pipe *pipe; | |
8 struct inode *ip; | |
9 uint off; | |
336
0e1c64818c0d
remove file struct, omit //:skip
anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents:
149
diff
changeset
|
10 }; |
345
efef0767b1bc
emit include guard at context.h
anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents:
336
diff
changeset
|
11 |
efef0767b1bc
emit include guard at context.h
anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents:
336
diff
changeset
|
12 #define FILE_STRUCT |
efef0767b1bc
emit include guard at context.h
anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents:
336
diff
changeset
|
13 #endif |
0 | 14 // in-memory copy of an inode |
149 | 15 |
345
efef0767b1bc
emit include guard at context.h
anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents:
336
diff
changeset
|
16 #ifndef INODE_STRUCT |
0 | 17 struct inode { |
18 uint dev; // Device number | |
19 uint inum; // Inode number | |
20 int ref; // Reference count | |
21 int flags; // I_BUSY, I_VALID | |
22 | |
23 short type; // copy of disk inode | |
24 short major; | |
25 short minor; | |
26 short nlink; | |
27 uint size; | |
28 uint addrs[NDIRECT+1]; | |
29 }; | |
345
efef0767b1bc
emit include guard at context.h
anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents:
336
diff
changeset
|
30 #define INODE_STRUCT |
efef0767b1bc
emit include guard at context.h
anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents:
336
diff
changeset
|
31 #endif |
149 | 32 |
0 | 33 #define I_BUSY 0x1 |
34 #define I_VALID 0x2 | |
35 | |
149 | 36 |
37 | |
0 | 38 // table mapping major device number to |
39 // device functions | |
40 struct devsw { | |
41 int (*read) (struct inode*, char*, int); | |
42 int (*write)(struct inode*, char*, int); | |
43 }; | |
44 | |
27 | 45 struct cbc_devsw { |
33 | 46 __code (*read) (struct inode*, char*, int, __code (*)(int)); |
29 | 47 //__code (*write)(struct inode*, char*, int, __code (*)(int)); |
27 | 48 }; |
49 | |
0 | 50 extern struct devsw devsw[]; |
27 | 51 extern struct cbc_devsw cbc_devsw[]; |
0 | 52 |
53 #define CONSOLE 1 |