1 #define MREAD_MAPS 8 2 #define MREAD_BUF_SHIFT 9 3 #define PAGE_SHIFT 12 4 #define MREAD_BUF_SIZE (1ULL<<(PAGE_SHIFT+MREAD_BUF_SHIFT)) 5 #define MREAD_BUF_MASK (~(MREAD_BUF_SIZE-1)) 6 typedef struct mread_ctrl { 7 int fd; 8 off_t file_size; 9 struct mread_buffer { 10 char * buffer; 11 off_t start_offset; 12 int accessed; 13 } map[MREAD_MAPS]; 14 int clock, last; 15 } *mread_handle_t; 16 17 mread_handle_t mread_init(int fd); 18 ssize_t mread64(mread_handle_t h, void *dst, ssize_t len, off_t offset); 19