0
|
1 struct file {
|
|
2 enum { FD_NONE, FD_PIPE, FD_INODE } type;
|
|
3 int ref; // reference count
|
|
4 char readable;
|
|
5 char writable;
|
|
6 struct pipe *pipe;
|
|
7 struct inode *ip;
|
|
8 uint off;
|
|
9 };
|
|
10
|
|
11
|
|
12 // in-memory copy of an inode
|
|
13 struct inode {
|
|
14 uint dev; // Device number
|
|
15 uint inum; // Inode number
|
|
16 int ref; // Reference count
|
|
17 int flags; // I_BUSY, I_VALID
|
|
18
|
|
19 short type; // copy of disk inode
|
|
20 short major;
|
|
21 short minor;
|
|
22 short nlink;
|
|
23 uint size;
|
|
24 uint addrs[NDIRECT+1];
|
|
25 };
|
|
26 #define I_BUSY 0x1
|
|
27 #define I_VALID 0x2
|
|
28
|
|
29 // table mapping major device number to
|
|
30 // device functions
|
|
31 struct devsw {
|
|
32 int (*read) (struct inode*, char*, int);
|
|
33 int (*write)(struct inode*, char*, int);
|
|
34 };
|
|
35
|
27
|
36 struct cbc_devsw {
|
33
|
37 __code (*read) (struct inode*, char*, int, __code (*)(int));
|
29
|
38 //__code (*write)(struct inode*, char*, int, __code (*)(int));
|
27
|
39 };
|
|
40
|
0
|
41 extern struct devsw devsw[];
|
27
|
42 extern struct cbc_devsw cbc_devsw[];
|
0
|
43
|
|
44 #define CONSOLE 1
|