提交 7ca2cf2e 编写于 作者: H Hongze Cheng

more

上级 b4a2bed4
...@@ -48,14 +48,18 @@ int tdbPFileOpen(SPCache *pCache, const char *fileName, SPFile **ppFile) { ...@@ -48,14 +48,18 @@ int tdbPFileOpen(SPCache *pCache, const char *fileName, SPFile **ppFile) {
pFile = (SPFile *)pPtr; pFile = (SPFile *)pPtr;
pPtr += sizeof(*pFile); pPtr += sizeof(*pFile);
// pFile->dbFileName
pFile->dbFileName = (char *)pPtr; pFile->dbFileName = (char *)pPtr;
memcpy(pFile->dbFileName, fileName, fsize); memcpy(pFile->dbFileName, fileName, fsize);
pFile->dbFileName[fsize] = '\0'; pFile->dbFileName[fsize] = '\0';
pPtr += fsize + 1; pPtr += fsize + 1;
// pFile->jFileName
pFile->jFileName = (char *)pPtr; pFile->jFileName = (char *)pPtr;
memcpy(pFile->jFileName, fileName, fsize); memcpy(pFile->jFileName, fileName, fsize);
memcpy(pFile->jFileName + fsize, "-journal", 8); memcpy(pFile->jFileName + fsize, "-journal", 8);
pFile->jFileName[fsize + 8] = '\0'; pFile->jFileName[fsize + 8] = '\0';
// pFile->pCache
pFile->pCache = pCache;
pFile->fd = open(pFile->dbFileName, O_RDWR | O_CREAT, 0755); pFile->fd = open(pFile->dbFileName, O_RDWR | O_CREAT, 0755);
if (pFile->fd < 0) { if (pFile->fd < 0) {
...@@ -103,6 +107,7 @@ SPage *tdbPFileGet(SPFile *pFile, SPgno pgno) { ...@@ -103,6 +107,7 @@ SPage *tdbPFileGet(SPFile *pFile, SPgno pgno) {
ASSERT(pPage->isLoad); ASSERT(pPage->isLoad);
return pPage; return pPage;
}
int tdbPFileWrite(SPFile *pFile, SPage *pPage) { int tdbPFileWrite(SPFile *pFile, SPage *pPage) {
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册