1 struct file {
2 enum { FD_NONE, FD_PIPE, FD_INODE, FD_DEVICE } type;
3 int ref;
4 char readable;
5 char writable;
6 struct pipe *pipe;
7 struct inode *ip;
8 uint off;
9 short major;
10 };
11
12 #define major(dev) ((dev) >> 16 & 0xFFFF)
13 #define minor(dev) ((dev) & 0xFFFF)
14 #define mkdev(m,n) ((uint)((m)<<16| (n)))
15
16
17 struct inode {
18 uint dev;
19 uint inum;
20 int ref;
21 struct sleeplock lock;
22 int valid;
23
24 short type;
25 short major;
26 short minor;
27 short nlink;
28 uint size;
29 uint addrs[NDIRECT+1];
30 };
31
32
33 struct devsw {
34 int (*read)(int, uint64, int);
35 int (*write)(int, uint64, int);
36 };
37
38 extern struct devsw devsw[];
39
40 #define CONSOLE 1