提交 73e32ddf 编写于 作者: H Hongze Cheng

more TDB

上级 a5834073
......@@ -106,6 +106,29 @@ int pgFileWrite(SPage *pPage) {
}
static int pgFileRead(SPgFile *pPgFile, pgno_t pgno, uint8_t *pData) {
// TODO
pgsize_t pgSize;
ssize_t rsize;
uint8_t *pTData;
size_t szToRead;
// pgSize = ; (TODO)
pTData = pData;
szToRead = pgSize;
for (; szToRead > 0;) {
rsize = pread(pPgFile->fd, pTData, szToRead, pgno * pgSize);
if (rsize < 0) {
if (errno == EINTR) {
continue;
} else {
return -1;
}
} else if (rsize == 0) {
return -1;
}
szToRead -= rsize;
pTData += rsize;
}
return 0;
}
\ No newline at end of file
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册