// assume that Page = buffer of PageSize bytes // assume that PageId = block number in file // read page from file into memory buffer void get_page(DB db, PageId p, Page buf) { lseek(db->fd, pageOffset(p), SEEK_SET); read(db->fd, buf, PAGESIZE); } // write page from memory buffer to file void put_page(Db db, PageId p, Page buf) { lseek(db->fd, pageOffset(p), SEEK_SET); write(db->fd, buf, PAGESIZE); }