added base src
[xv6-db.git] / file.h
blob55918cc178ed319bf6894beebaba8552b657fb64
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 };
12 // in-core file system types
14 struct inode {
15 uint dev; // Device number
16 uint inum; // Inode number
17 int ref; // Reference count
18 int flags; // I_BUSY, I_VALID
20 short type; // copy of disk inode
21 short major;
22 short minor;
23 short nlink;
24 uint size;
25 uint addrs[NDIRECT+1];
28 #define I_BUSY 0x1
29 #define I_VALID 0x2
32 // device implementations
34 struct devsw {
35 int (*read)(struct inode*, char*, int);
36 int (*write)(struct inode*, char*, int);
39 extern struct devsw devsw[];
41 #define CONSOLE 1