00001 struct file { 00002 enum { FD_NONE, FD_PIPE, FD_INODE } type; 00003 int ref; // reference count 00004 char readable; 00005 char writable; 00006 struct pipe *pipe; 00007 struct inode *ip; 00008 uint off; 00009 }; 00010 00011 00012 // in-core file system types 00013 00014 struct inode { 00015 uint dev; // Device number 00016 uint inum; // Inode number 00017 int ref; // Reference count 00018 int flags; // I_BUSY, I_VALID 00019 00020 short type; // copy of disk inode 00021 short major; 00022 short minor; 00023 short nlink; 00024 uint size; 00025 uint addrs[NDIRECT+1]; 00026 }; 00027 00028 #define I_BUSY 0x1 00029 #define I_VALID 0x2 00030 00031 00032 // device implementations 00033 00034 struct devsw { 00035 int (*read)(struct inode*, char*, int); 00036 int (*write)(struct inode*, char*, int); 00037 }; 00038 00039 extern struct devsw devsw[]; 00040 00041 #define CONSOLE 1
1.5.6