132
|
1 /*
|
116
|
2 typedef struct file {
|
|
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;
|
|
10 } file;
|
132
|
11 */
|
0
|
12 // in-memory copy of an inode
|
149
|
13
|
|
14 /*
|
0
|
15 struct inode {
|
|
16 uint dev; // Device number
|
|
17 uint inum; // Inode number
|
|
18 int ref; // Reference count
|
|
19 int flags; // I_BUSY, I_VALID
|
|
20
|
|
21 short type; // copy of disk inode
|
|
22 short major;
|
|
23 short minor;
|
|
24 short nlink;
|
|
25 uint size;
|
|
26 uint addrs[NDIRECT+1];
|
|
27 };
|
149
|
28 */
|
|
29
|
0
|
30 #define I_BUSY 0x1
|
|
31 #define I_VALID 0x2
|
|
32
|
149
|
33
|
|
34
|
0
|
35 // table mapping major device number to
|
|
36 // device functions
|
|
37 struct devsw {
|
|
38 int (*read) (struct inode*, char*, int);
|
|
39 int (*write)(struct inode*, char*, int);
|
|
40 };
|
|
41
|
27
|
42 struct cbc_devsw {
|
33
|
43 __code (*read) (struct inode*, char*, int, __code (*)(int));
|
29
|
44 //__code (*write)(struct inode*, char*, int, __code (*)(int));
|
27
|
45 };
|
|
46
|
0
|
47 extern struct devsw devsw[];
|
27
|
48 extern struct cbc_devsw cbc_devsw[];
|
0
|
49
|
|
50 #define CONSOLE 1
|