Home | History | Annotate | Download | only in orig

Lines Matching refs:hdr

21500 ** free.  The first block has format u.hdr.  u.hdr.size4x is 4 times the
21502 ** The u.hdr.size4x&1 bit is true if the chunk is checked out and
21503 ** false if the chunk is on the freelist. The u.hdr.size4x&2 bit
21505 ** previous chunk is free. The u.hdr.prevSize field is the size of
21508 ** u.hdr.prevSize can be part of the data for that chunk and should
21524 ** the u.hdr.prevSize value of the following chunk.
21532 } hdr;
21616 assert( (mem3.aPool[i-1].u.hdr.size4x & 1)==0 );
21618 size = mem3.aPool[i-1].u.hdr.size4x/4;
21619 assert( size==mem3.aPool[i+size-1].u.hdr.prevSize );
21651 assert( (mem3.aPool[i-1].u.hdr.size4x & 1)==0 );
21652 size = mem3.aPool[i-1].u.hdr.size4x/4;
21653 assert( size==mem3.aPool[i+size-1].u.hdr.prevSize );
21702 assert( mem3.aPool[i-1].u.hdr.size4x/4==nBlock );
21703 assert( mem3.aPool[i+nBlock-1].u.hdr.prevSize==nBlock );
21704 x = mem3.aPool[i-1].u.hdr.size4x;
21705 mem3.aPool[i-1].u.hdr.size4x = nBlock*4 | 1 | (x&2);
21706 mem3.aPool[i+nBlock-1].u.hdr.prevSize = nBlock;
21707 mem3.aPool[i+nBlock-1].u.hdr.size4x |= 2;
21731 mem3.aPool[mem3.iMaster+mem3.szMaster-1].u.hdr.prevSize = nBlock;
21732 mem3.aPool[mem3.iMaster+mem3.szMaster-1].u.hdr.size4x |= 2;
21733 mem3.aPool[newi-1].u.hdr.size4x = nBlock*4 + 1;
21735 mem3.aPool[newi-1].u.hdr.prevSize = mem3.szMaster;
21736 x = mem3.aPool[mem3.iMaster-1].u.hdr.size4x & 2;
21737 mem3.aPool[mem3.iMaster-1].u.hdr.size4x = mem3.szMaster*4 | x;
21767 size = mem3.aPool[i-1].u.hdr.size4x;
21771 assert( i > mem3.aPool[i-1].u.hdr.prevSize );
21772 prev = i - mem3.aPool[i-1].u.hdr.prevSize;
21778 x = mem3.aPool[prev-1].u.hdr.size4x & 2;
21779 mem3.aPool[prev-1].u.hdr.size4x = size*4 | x;
21780 mem3.aPool[prev+size-1].u.hdr.prevSize = size;
21828 if( mem3.aPool[i-1].u.hdr.size4x/4==nBlock ){
21889 assert( (mem3.aPool[i-1].u.hdr.size4x&1)==1 );
21890 size = mem3.aPool[i-1].u.hdr.size4x/4;
21892 mem3.aPool[i-1].u.hdr.size4x &= ~1;
21893 mem3.aPool[i+size-1].u.hdr.prevSize = size;
21894 mem3.aPool[i+size-1].u.hdr.size4x &= ~2;
21899 while( (mem3.aPool[mem3.iMaster-1].u.hdr.size4x&2)==0 ){
21900 size = mem3.aPool[mem3.iMaster-1].u.hdr.prevSize;
21904 x = mem3.aPool[mem3.iMaster-1].u.hdr.size4x & 2;
21905 mem3.aPool[mem3.iMaster-1].u.hdr.size4x = mem3.szMaster*4 | x;
21906 mem3.aPool[mem3.iMaster+mem3.szMaster-1].u.hdr.prevSize = mem3.szMaster;
21908 x = mem3.aPool[mem3.iMaster-1].u.hdr.size4x & 2;
21909 while( (mem3.aPool[mem3.iMaster+mem3.szMaster-1].u.hdr.size4x&1)==0 ){
21911 mem3.szMaster += mem3.aPool[mem3.iMaster+mem3.szMaster-1].u.hdr.size4x/4;
21912 mem3.aPool[mem3.iMaster-1].u.hdr.size4x = mem3.szMaster*4 | x;
21913 mem3.aPool[mem3.iMaster+mem3.szMaster-1].u.hdr.prevSize = mem3.szMaster;
21927 assert( (pBlock[-1].u.hdr.size4x&1)!=0 );
21928 return (pBlock[-1].u.hdr.size4x&~3)*2 - 4;
22013 mem3.aPool[0].u.hdr.size4x = (mem3.szMaster<<2) + 2;
22014 mem3.aPool[mem3.nPool].u.hdr.prevSize = mem3.nPool;
22015 mem3.aPool[mem3.nPool].u.hdr.size4x = 1;
22053 size = mem3.aPool[i-1].u.hdr.size4x;
22059 if( (size&1)==0 && mem3.aPool[i+size/4-1].u.hdr.prevSize!=size/4 ){
22064 if( ((mem3.aPool[i+size/4-1].u.hdr.size4x&2)>>1)!=(size&1) ){
22081 (mem3.aPool[j-1].u.hdr.size4x/4)*8-8);
22090 (mem3.aPool[j-1].u.hdr.size4x/4)*8-8);
54846 WalIndexHdr hdr; /* Wal-index header for current transaction */
55060 ** Write the header information in pWal->hdr into the wal-index.
55062 ** The checksum on pWal->hdr is updated before it is written.
55069 pWal->hdr.isInit = 1;
55070 pWal->hdr.iVersion = WALINDEX_MAX_VERSION;
55071 walChecksumBytes(1, (u8*)&pWal->hdr, nCksum, 0, pWal->hdr.aCksum);
55072 memcpy((void*)&aHdr[1], (const void*)&pWal->hdr, sizeof(WalIndexHdr));
55074 memcpy((void*)&aHdr[0], (const void*)&pWal->hdr, sizeof(WalIndexHdr));
55098 u32 *aCksum = pWal->hdr.aFrameCksum;
55103 memcpy(&aFrame[8], pWal->hdr.aSalt, 8);
55105 nativeCksum = (pWal->hdr.bigEndCksum==SQLITE_BIGENDIAN);
55129 u32 *aCksum = pWal->hdr.aFrameCksum;
55136 if( memcmp(&pWal->hdr.aSalt, &aFrame[8], 8)!=0 ){
55152 nativeCksum = (pWal->hdr.bigEndCksum==SQLITE_BIGENDIAN);
55324 ** than pWal->hdr.mxFrame.
55326 ** This function is called whenever pWal->hdr.mxFrame is decreased due
55329 ** At most only the hash table containing pWal->hdr.mxFrame needs to be
55331 ** pWal->hdr.mxFrame advances to the point where those hash tables are
55343 testcase( pWal->hdr.mxFrame==HASHTABLE_NPAGE_ONE-1 );
55344 testcase( pWal->hdr.mxFrame==HASHTABLE_NPAGE_ONE );
55345 testcase( pWal->hdr.mxFrame==HASHTABLE_NPAGE_ONE+1 );
55347 if( pWal->hdr.mxFrame==0 ) return;
55350 ** the entry that corresponds to frame pWal->hdr.mxFrame. It is guaranteed
55353 assert( pWal->nWiData>walFramePage(pWal->hdr.mxFrame) );
55354 assert( pWal->apWiData[walFramePage(pWal->hdr.mxFrame)] );
55355 walHashGet(pWal, walFramePage(pWal->hdr.mxFrame), &aHash, &aPgno, &iZero);
55358 ** than pWal->hdr.mxFrame.
55360 iLimit = pWal->hdr.mxFrame - iZero;
55369 ** frame numbers greater than pWal->hdr.mxFrame.
55510 memset(&pWal->hdr, 0, sizeof(WalIndexHdr));
55549 pWal->hdr.bigEndCksum = (u8)(magic&0x00000001);
55552 memcpy(&pWal->hdr.aSalt, &aBuf[16], 8);
55555 walChecksumBytes(pWal->hdr.bigEndCksum==SQLITE_BIGENDIAN,
55556 aBuf, WAL_HDRSIZE-2*4, 0, pWal->hdr.aFrameCksum
55558 if( pWal->hdr.aFrameCksum[0]!=sqlite3Get4byte(&aBuf[24])
55559 || pWal->hdr.aFrameCksum[1]!=sqlite3Get4byte(&aBuf[28])
55598 pWal->hdr.mxFrame = iFrame;
55599 pWal->hdr.nPage = nTruncate;
55600 pWal->hdr.szPage = (u16)((szPage&0xff00) | (szPage>>16));
55603 aFrameCksum[0] = pWal->hdr.aFrameCksum[0];
55604 aFrameCksum[1] = pWal->hdr.aFrameCksum[1];
55615 pWal->hdr.aFrameCksum[0] = aFrameCksum[0];
55616 pWal->hdr.aFrameCksum[1] = aFrameCksum[1];
55625 pInfo->nBackfillAttempted = pWal->hdr.mxFrame;
55628 if( pWal->hdr.mxFrame ) pInfo->aReadMark[1] = pWal->hdr.mxFrame;
55635 if( pWal->hdr.nPage ){
55638 hdr.mxFrame, pWal->zWalName
55968 assert( pWal->ckptLock && pWal->hdr.mxFrame>0 );
55969 iLast = pWal->hdr.mxFrame;
56057 return (pWal->hdr.szPage&0xfe00) + ((pWal->hdr.szPage&0x0001)<<16);
56080 u32 *aSalt = pWal->hdr.aSalt; /* Big-endian salt values */
56082 pWal->hdr.mxFrame = 0;
56084 memcpy(&pWal->hdr.aSalt[1], &salt1, 4);
56147 if( pInfo->nBackfill<pWal->hdr.mxFrame ){
56165 mxSafeFrame = pWal->hdr.mxFrame;
56166 mxPage = pWal->hdr.nPage;
56178 assert( y<=pWal->hdr.mxFrame );
56241 i64 szDb = pWal->hdr.nPage*(i64)szPage;
56271 if( pInfo->nBackfill<pWal->hdr.mxFrame ){
56276 assert( pInfo->nBackfill==pWal->hdr.mxFrame );
56402 ** pWal->hdr, then pWal->hdr is updated to the content of the new header
56442 if( memcmp(&pWal->hdr, &h1, sizeof(WalIndexHdr)) ){
56444 memcpy(&pWal->hdr, &h1, sizeof(WalIndexHdr));
56445 pWal->szPage = (pWal->hdr.szPage&0xfe00) + ((pWal->hdr.szPage&0x0001)<<16);
56455 ** Read the wal-index header from the wal-index and into pWal->hdr.
56459 ** Set *pChanged to 1 if the wal-index header value in pWal->hdr is
56460 ** changed by this operation. If pWal->hdr is unchanged, set *pChanged
56520 if( badHdr==0 && pWal->hdr.iVersion!=WALINDEX_MAX_VERSION ){
56545 ** to make a copy of the wal-index header into pWal->hdr. If the
56568 ** use WAL frames up to and including pWal->hdr.mxFrame if pWal->readLock>0
56653 if( !useWal && pInfo->nBackfill==pWal->hdr.mxFrame
56655 && (pWal->pSnapshot==0 || pWal->hdr.mxFrame==0
56656 || 0==memcmp(&pWal->hdr, pWal->pSnapshot, sizeof(WalIndexHdr)))
56665 if( memcmp((void *)walIndexHdr(pWal), &pWal->hdr, sizeof(WalIndexHdr)) ){
56692 ** but not exceeding pWal->hdr.mxFrame and lock that entry.
56696 mxFrame = pWal->hdr.mxFrame;
56742 ** that occur later in the log than pWal->hdr.mxFrame may have been
56745 ** pWal->hdr.mxFrame risks reading a corrupted snapshot. So, retry
56756 ** matches the one cached in pWal->hdr, it is guaranteed that the
56758 ** header newer than that cached in pWal->hdr. If it were, that could
56763 ** frame pWal->hdr.mxFrame - then the client would incorrectly assume
56766 ** see any pages past pWal->hdr.mxFrame, this problem does not come up.
56771 || memcmp((void *)walIndexHdr(pWal), &pWal->hdr, sizeof(WalIndexHdr))
56776 assert( mxReadMark<=pWal->hdr.mxFrame );
56881 if( pSnapshot && memcmp(pSnapshot, &pWal->hdr, sizeof(WalIndexHdr))!=0 ){
56896 if( pSnapshot && memcmp(pSnapshot, &pWal->hdr, sizeof(WalIndexHdr))!=0 ){
56898 ** a value equal to or smaller than pSnapshot->mxFrame, but pWal->hdr
56912 assert( pWal->readLock>0 || pWal->hdr.mxFrame==0 );
56933 ** true, return SQLITE_BUSY_SNAPSHOT. Otherwise, overwrite pWal->hdr
56936 if( !memcmp(pSnapshot->aSalt, pWal->hdr.aSalt, sizeof(pWal->hdr.aSalt))
56940 memcpy(&pWal->hdr, pSnapshot, sizeof(WalIndexHdr));
56986 u32 iLast = pWal->hdr.mxFrame; /* Last page in WAL for this reader */
57090 sz = pWal->hdr.szPage;
57104 return pWal->hdr.nPage;
57148 if( memcmp(&pWal->hdr, (void *)walIndexHdr(pWal), sizeof(WalIndexHdr))!=0 ){
57186 Pgno iMax = pWal->hdr.mxFrame;
57192 memcpy(&pWal->hdr, (void *)walIndexHdr(pWal), sizeof(WalIndexHdr));
57194 for(iFrame=pWal->hdr.mxFrame+1;
57212 if( iMax!=pWal->hdr.mxFrame ) walCleanupHash(pWal);
57225 aWalData[0] = pWal->hdr.mxFrame;
57226 aWalData[1] = pWal->hdr.aFrameCksum[0];
57227 aWalData[2] = pWal->hdr.aFrameCksum[1];
57241 assert( aWalData[3]!=pWal->nCkpt || aWalData[0]<=pWal->hdr.mxFrame );
57252 if( aWalData[0]<pWal->hdr.mxFrame ){
57253 pWal->hdr.mxFrame = aWalData[0];
57254 pWal->hdr.aFrameCksum[0] = aWalData[1];
57255 pWal->hdr.aFrameCksum[1] = aWalData[2];
57267 ** it sets pWal->hdr.mxFrame to 0. Otherwise, pWal->hdr.mxFrame is left
57271 ** or not pWal->hdr.mxFrame is modified). An SQLite error code is returned
57280 assert( pInfo->nBackfill==pWal->hdr.mxFrame );
57415 pWal->hdr.aFrameCksum[0] = sqlite3Get4byte(aBuf);
57416 pWal->hdr.aFrameCksum[1] = sqlite3Get4byte(&aBuf[sizeof(u32)]);
57470 pWal, cnt, pWal->hdr.mxFrame, isCommit ? "Commit" : "Spill"));
57475 if( memcmp(&pWal->hdr, (void *)pLive, sizeof(WalIndexHdr))!=0 ){
57480 ** log file, instead of appending to it at pWal->hdr.mxFrame.
57490 iFrame = pWal->hdr.mxFrame;
57499 if( pWal->nCkpt==0 ) sqlite3_randomness(8, pWal->hdr.aSalt);
57500 memcpy(&aWalHdr[16], pWal->hdr.aSalt, 8);
57506 pWal->hdr.bigEndCksum = SQLITE_BIGENDIAN;
57507 pWal->hdr.aFrameCksum[0] = aCksum[0];
57508 pWal->hdr.aFrameCksum[1] = aCksum[1];
57638 iFrame = pWal->hdr.mxFrame;
57652 pWal->hdr.szPage = (u16)((szPage&0xff00) | (szPage>>16));
57655 pWal->hdr.mxFrame = iFrame;
57657 pWal->hdr.iChange++;
57658 pWal->hdr.nPage = nTruncate;
57755 if( pWal->hdr.mxFrame && walPagesize(pWal)!=nBuf ){
57763 if( pnLog ) *pnLog = (int)pWal->hdr.mxFrame;
57775 memset(&pWal->hdr, 0, sizeof(WalIndexHdr));
57882 if( memcmp(&pWal->hdr.aFrameCksum[0],aZero,16)==0 ){
57890 memcpy(pRet, &pWal->hdr, sizeof(WalIndexHdr));
60292 int hdr; /* Offset to the page header */
60311 hdr = pPage->hdrOffset;
60314 assert( nCell==get2byte(&data[hdr+3]) );
60323 if( (int)data[hdr+7]<=nMaxFrag ){
60324 int iFree = get2byte(&data[hdr+1]);
60343 int top = get2byte(&data[hdr+5]);
60392 x = get2byte(&data[hdr+5]);
60398 data[hdr+7] = 0;
60401 if( data[hdr+7]+cbrk-iCellFirst!=pPage->nFree ){
60405 put2byte(&data[hdr+5], cbrk);
60406 data[hdr+1] = 0;
60407 data[hdr+2] = 0;
60428 const int hdr = pPg->hdrOffset;
60430 int iAddr = hdr + 1;
60457 if( aData[hdr+7]>57 ) return 0;
60462 aData[hdr+7] += (u8)x;
60491 const int hdr = pPage->hdrOffset; /* Local cache of pPage->hdrOffset */
60505 assert( pPage->cellOffset == hdr + 12 - 4*pPage->leaf );
60513 top = get2byte(&data[hdr+5]);
60530 if( (data[hdr+2] || data[hdr+1]) && gap+2<=top ){
60549 top = get2byteNotZero(&data[hdr+5]);
60561 put2byte(&data[hdr+5], top);
60583 u8 hdr; /* Page header size. 0 or 100 */
60607 hdr = pPage->hdrOffset;
60608 iPtr = hdr + 1;
60641 if( iPtr>hdr+1 ){
60650 if( nFrag>data[hdr+7] ) return SQLITE_CORRUPT_BKPT;
60651 data[hdr+7] -= nFrag;
60653 if( iStart==get2byte(&data[hdr+5]) ){
60657 if( iPtr!=hdr+1 ) return SQLITE_CORRUPT_BKPT;
60658 put2byte(&data[hdr+1], iFreeBlk);
60659 put2byte(&data[hdr+5], iEnd);
60751 u8 hdr; /* Offset to beginning of page header */
60763 hdr = pPage->hdrOffset;
60767 if( decodeFlags(pPage, data[hdr]) ) return SQLITE_CORRUPT_BKPT;
60772 pPage->cellOffset = cellOffset = hdr + 8 + pPage->childPtrSize;
60779 top = get2byteNotZero(&data[hdr+5]);
60782 pPage->nCell = get2byte(&data[hdr+3]);
60828 pc = get2byte(&data[hdr+1]);
60829 nFree = data[hdr+7] + top; /* Init nFree to non-freeblock free space */
60879 u8 hdr = pPage->hdrOffset;
60888 memset(&data[hdr], 0, pBt->usableSize - hdr);
60890 data[hdr] = (char)flags;
60891 first = hdr + ((flags&PTF_LEAF)==0 ? 12 : 8);
60892 hdr+1], 0, 4);
60893 data[hdr+7] = 0;
60894 put2byte(&data[hdr+5], pBt->usableSize);
61862 int nPageHeader; /* Number of pages in the database according to hdr */
65319 int hdr; /* Beginning of the header. 0 most pages. 100 page 1 */
65329 hdr = pPage->hdrOffset;
65330 testcase( pc==get2byte(&data[hdr+5]) );
65332 if( pc < (u32)get2byte(&data[hdr+5]) || pc+sz > pPage->pBt->usableSize ){
65343 memset(&data[hdr+1], 0, 4);
65344 data[hdr+7] = 0;
65345 put2byte(&data[hdr+5], pPage->pBt->usableSize);
65350 put2byte(&data[hdr+3], pPage->nCell);
65523 const int hdr = pPg->hdrOffset; /* Offset of header on pPg */
65532 i = get2byte(&aData[hdr+5]);
65554 put2byte(&aData[hdr+1], 0);
65555 put2byte(&aData[hdr+3], pPg->nCell);
65556 put2byte(&aData[hdr+5], pData - aData);
65557 aData[hdr+7] = 0x00;
65697 const int hdr = pPg->hdrOffset;
65721 pData = &aData[get2byteNotZero(&aData[hdr+5])];
65761 put2byte(&aData[hdr+3], pPg->nCell);
65762 put2byte(&aData[hdr+5], pData - aData);
67562 int hdr;
67576 hdr = pPage->hdrOffset;
67587 rc = clearDatabasePage(pBt, get4byte(&pPage->aData[hdr+8]), 1, pnChange);
67597 zeroPage(pPage, pPage->aData[hdr] | PTF_LEAF);
68168 int hdr; /* Offset to the page header */
68213 hdr = pPage->hdrOffset;
68217 contentOffset = get2byteNotZero(&data[hdr+5]);
68222 nCell = get2byte(&data[hdr+3]);
68227 cellStart = hdr + 12 - 4*pPage->leaf;
68233 pgno = get4byte(&data[hdr+8]);
68340 i = get2byte(&data[hdr+1]);
68389 if( heap[0]==0 && nFrag!=data[hdr+7] ){
68392 nFrag, data[hdr+7], iPage);
80953 ** | hdr-size | type 0 | type 1 | ... | type N-1 | data0 | ... | data N-1 |
80961 ** hdr-size field is also a varint which is the offset from the beginning