1 struct buf { 2 int flags; 3 uint dev; 4 uint sector; 5 struct buf *prev; // LRU cache list 6 struct buf *next; 7 struct buf *qnext; // disk queue 8 int done; 9 uchar data[512]; 10 }; 11 #define B_BUSY 0x1 // buffer is locked by some process 12 #define B_VALID 0x2 // buffer contains the data of the sector 13 #define B_WRITE 0x4 // asking device driver to write, else read 14