1 struct buf { 2 int flags; 3 uint dev; 4 uint blockno; 5 struct buf *prev; // LRU cache list 6 struct buf *next; 7 struct buf *qnext; // disk queue 8 uchar data[BSIZE]; 9 }; 10 #define B_BUSY 0x1 // buffer is locked by some process 11 #define B_VALID 0x2 // buffer has been read from disk 12 #define B_DIRTY 0x4 // buffer needs to be written to disk 13