Home | History | Annotate | Download | only in orig

Lines Matching defs:pNode

23712   os2ShmNode *pNode,    /* Apply locks to this open shared-memory segment */
23722 assert( sqlite3_mutex_held(pNode->mutex) || pNode->nRef==0 );
23735 rc = DosSetFileLocks(pNode->hLockFile,
23740 rc = DosSetFileLocks(pNode->hLockFile,
23746 pNode->hLockFile,
23751 ERR_TRACE(rc, ("os2ShmSystemLock: %d %s\n", rc, pNode->shmBaseName))
23764 os2ShmNode *pNode;
23788 for( pNode = os2ShmNodeList;
23789 pNode && stricmp(shmName, pNode->shmBaseName) != 0;
23790 pNode = pNode->pNext ) ;
23793 if( !pNode ) {
23794 pNode = sqlite3_malloc( sizeof(*pNode) + cbShmName );
23795 if( pNode ) {
23796 memset(pNode, 0, sizeof(*pNode) );
23797 pNode->szRegion = szRegion;
23798 pNode->hLockFile = (HFILE)-1;
23799 strcpy(pNode->shmBaseName, shmName);
23802 if( DosDupHandle(fd->h, &pNode->hLockFile) != 0 ) {
23805 if( DosOpen((PSZ)shmName, &pNode->hLockFile, &action, 0, FILE_NORMAL,
23811 sqlite3_free(pNode);
23814 pNode->mutex = sqlite3_mutex_alloc(SQLITE_MUTEX_FAST);
23815 if( !pNode->mutex ) {
23816 sqlite3_free(pNode);
23825 pNode->pNext = os2ShmNodeList;
23826 os2ShmNodeList = pNode;
23828 pNode = NULL;
23830 } else if( pNode->szRegion != szRegion ) {
23832 pNode = NULL;
23835 if( pNode ) {
23836 sqlite3_mutex_enter(pNode->mutex);
23840 pLink->pShmNode = pNode;
23841 pLink->pNext = pNode->pFirst;
23842 pNode->pFirst = pLink;
23843 pNode->nRef++;
23847 sqlite3_mutex_leave(pNode->mutex);
23868 os2ShmNode *pNode;
23876 pNode = *ppNode;
23878 if( pNode->nRef == 0 ) {
23879 *ppNode = pNode->pNext;
23881 if( pNode->apRegion ) {
23883 os2ShmSystemLock(pNode, _SHM_WRLCK_WAIT, OS2_SHM_DMS, 1);
23885 while( pNode->nRegion-- ) {
23889 DosFreeMem(pNode->apRegion[pNode->nRegion]);
23892 (int)GetCurrentProcessId(), pNode->nRegion,
23897 os2ShmSystemLock(pNode, _SHM_UNLCK, OS2_SHM_DMS, 1);
23899 sqlite3_free(pNode->apRegion);
23902 DosClose(pNode->hLockFile);
23908 sprintf(fileName, "%s-lck", pNode->shmBaseName + 10);
23916 sqlite3_mutex_free(pNode->mutex);
23918 sqlite3_free(pNode);
23921 ppNode = &pNode->pNext;
23956 os2ShmNode *pNode;
23967 pNode = pFile->pShmLink->pShmNode ;
23969 sqlite3_mutex_enter(pNode->mutex);
23971 assert( szRegion==pNode->szRegion );
23974 if( iRegion >= pNode->nRegion ) {
23976 os2ShmSystemLock(pNode, _SHM_WRLCK_WAIT, OS2_SHM_DMS, 1);
23979 pNode->apRegion, (iRegion + 1) * sizeof(apRegion[0]));
23982 pNode->apRegion = apRegion;
23984 while( pNode->nRegion <= iRegion ) {
23986 pNode->shmBaseName, pNode->nRegion);
24002 apRegion[pNode->nRegion++] = pvTemp;
24006 for( n = pNode->nRegion; n <= iRegion; n++ )
24007 pNode->apRegion[n] = NULL;
24010 *pp = pNode->apRegion[iRegion];
24016 os2ShmSystemLock(pNode, _SHM_UNLCK, OS2_SHM_DMS, 1);
24020 *pp = pNode->apRegion[iRegion];
24023 sqlite3_mutex_leave(pNode->mutex);
24049 os2ShmNode *pNode = pLink->pShmNode;
24051 sqlite3_mutex_enter(pNode->mutex);
24053 for( ppLink = &pNode->pFirst;
24061 nRef = --pNode->nRef;
24064 pNode->shmBaseName))
24070 sqlite3_mutex_leave(pNode->mutex);
130325 RtreeNode *pNode; /* Node cursor is currently pointing at */
130326 int iCell; /* Index of current cell in pNode */
130378 #define NCELL(pNode) readInt16(&(pNode)->zData[2])
130530 ** Add node pNode to the node hash table.
130532 static void nodeHashInsert(Rtree *pRtree, RtreeNode *pNode){
130534 assert( pNode->pNext==0 );
130535 iHash = nodeHash(pNode->iNode);
130536 pNode->pNext = pRtree->aHash[iHash];
130537 pRtree->aHash[iHash] = pNode;
130541 ** Remove node pNode from the node hash table.
130543 static void nodeHashDelete(Rtree *pRtree, RtreeNode *pNode){
130545 if( pNode->iNode!=0 ){
130546 pp = &pRtree->aHash[nodeHash(pNode->iNode)];
130547 for( ; (*pp)!=pNode; pp = &(*pp)->pNext){ assert(*pp); }
130548 *pp = pNode->pNext;
130549 pNode->pNext = 0;
130560 RtreeNode *pNode;
130561 pNode = (RtreeNode *)sqlite3_malloc(sizeof(RtreeNode) + pRtree->iNodeSize);
130562 if( pNode ){
130563 memset(pNode, 0, sizeof(RtreeNode) + pRtree->iNodeSize);
130564 pNode->zData = (u8 *)&pNode[1];
130565 pNode->nRef = 1;
130566 pNode->pParent = pParent;
130567 pNode->isDirty = 1;
130570 return pNode;
130585 RtreeNode *pNode;
130590 if( (pNode = nodeHashLookup(pRtree, iNode)) ){
130591 assert( !pParent || !pNode->pParent || pNode->pParent==pParent );
130592 if( pParent && !pNode->pParent ){
130594 pNode->pParent = pParent;
130596 pNode->nRef++;
130597 *ppNode = pNode;
130606 pNode = (RtreeNode *)sqlite3_malloc(sizeof(RtreeNode)+pRtree->iNodeSize);
130607 if( !pNode ){
130610 pNode->pParent = pParent;
130611 pNode->zData = (u8 *)&pNode[1];
130612 pNode->nRef = 1;
130613 pNode->iNode = iNode;
130614 pNode->isDirty = 0;
130615 pNode->pNext = 0;
130616 memcpy(pNode->zData, zBlob, pRtree->iNodeSize);
130630 if( pNode && iNode==1 ){
130631 pRtree->iDepth = readInt16(pNode->zData);
130641 if( pNode && rc==SQLITE_OK ){
130642 if( NCELL(pNode)>((pRtree->iNodeSize-4)/pRtree->nBytesPerCell) ){
130648 if( pNode!=0 ){
130649 nodeHashInsert(pRtree, pNode);
130653 *ppNode = pNode;
130655 sqlite3_free(pNode);
130663 ** Overwrite cell iCell of node pNode with the contents of pCell.
130667 RtreeNode *pNode,
130672 u8 *p = &pNode->zData[4 + pRtree->nBytesPerCell*iCell];
130677 pNode->isDirty = 1;
130681 ** Remove cell the cell with index iCell from node pNode.
130683 static void nodeDeleteCell(Rtree *pRtree, RtreeNode *pNode, int iCell){
130684 u8 *pDst = &pNode->zData[4 + pRtree->nBytesPerCell*iCell];
130686 int nByte = (NCELL(pNode) - iCell - 1) * pRtree->nBytesPerCell;
130688 writeInt16(&pNode->zData[2], NCELL(pNode)-1);
130689 pNode->isDirty = 1;
130693 ** Insert the contents of cell pCell into node pNode. If the insert
130696 ** If there is not enough free space in pNode, return SQLITE_FULL.
130701 RtreeNode *pNode,
130704 int nCell; /* Current number of cells in pNode */
130705 int nMaxCell; /* Maximum number of cells for pNode */
130708 nCell = NCELL(pNode);
130712 nodeOverwriteCell(pRtree, pNode, pCell, nCell);
130713 writeInt16(&pNode->zData[2], nCell+1);
130714 pNode->isDirty = 1;
130724 nodeWrite(Rtree *pRtree, RtreeNode *pNode){
130726 if( pNode->isDirty ){
130728 if( pNode->iNode ){
130729 sqlite3_bind_int64(p, 1, pNode->iNode);
130733 sqlite3_bind_blob(p, 2, pNode->zData, pRtree->iNodeSize, SQLITE_STATIC);
130735 pNode->isDirty = 0;
130737 if( pNode->iNode==0 && rc==SQLITE_OK ){
130738 pNode->iNode = sqlite3_last_insert_rowid(pRtree->db);
130739 nodeHashInsert(pRtree, pNode);
130750 nodeRelease(Rtree *pRtree, RtreeNode *pNode){
130752 if( pNode ){
130753 assert( pNode->nRef>0 );
130754 pNode->nRef--;
130755 if( pNode->nRef==0 ){
130756 if( pNode->iNode==1 ){
130759 if( pNode->pParent ){
130760 rc = nodeRelease(pRtree, pNode->pParent);
130763 rc = nodeWrite(pRtree, pNode);
130765 nodeHashDelete(pRtree, pNode);
130766 sqlite3_free(pNode);
130774 ** node pNode. If pNode is a leaf node, this is a rowid. If it is
130779 RtreeNode *pNode,
130782 assert( iCell<NCELL(pNode) );
130783 return readInt64(&pNode->zData[4 + pRtree->nBytesPerCell*iCell]);
130787 ** Return coordinate iCoord from cell iCell in node pNode.
130791 RtreeNode *pNode,
130796 readCoord(&pNode->zData[12 + pRtree->nBytesPerCell*iCell + 4*iCoord], pCoord);
130800 ** Deserialize cell iCell of node pNode. Populate the structure pointed
130805 RtreeNode *pNode,
130810 pNode, iCell);
130812 nodeGetCoord(pRtree, pNode, iCell, ii, &pCell->aCoord[ii]);
130957 rc = nodeRelease(pRtree, pCsr->pNode);
130970 return (pCsr->pNode==0);
131011 nodeGetCell(pRtree, pCursor->pNode, pCursor->iCell, &cell);
131064 nodeGetCell(pRtree, pCursor->pNode, pCursor->iCell, &cell);
131116 RtreeNode *pSavedNode = pCursor->pNode;
131130 iRowid = nodeGetRowid(pRtree, pCursor->pNode, pCursor->iCell);
131131 rc = nodeAcquire(pRtree, iRowid, pCursor->pNode, &pChild);
131136 nodeRelease(pRtree, pCursor->pNode);
131137 pCursor->pNode = pChild;
131148 assert( pCursor->pNode==pChild );
131151 pCursor->pNode = pSavedNode;
131161 ** One of the cells in node pNode is guaranteed to have a 64-bit
131166 RtreeNode *pNode,
131171 int nCell = NCELL(pNode);
131173 if( nodeGetRowid(pRtree, pNode, ii)==iRowid ){
131182 ** Return the index of the cell containing a pointer to node pNode
131183 ** in its parent. If pNode is the root node, return -1.
131185 static int nodeParentIndex(Rtree *pRtree, RtreeNode *pNode, int *piIndex){
131186 RtreeNode *pParent = pNode->pParent;
131188 return nodeRowidIndex(pRtree, pParent, pNode->iNode, piIndex);
131202 /* RtreeCursor.pNode must not be NULL. If is is NULL, then this cursor is
131206 assert( pCsr->pNode );
131210 nodeRelease(pRtree, pCsr->pNode);
131211 pCsr->pNode = 0;
131215 while( pCsr->pNode ){
131216 RtreeNode *pNode = pCsr->pNode;
131217 int nCell = NCELL(pNode);
131225 pCsr->pNode = pNode->pParent;
131226 rc = nodeParentIndex(pRtree, pNode, &pCsr->iCell);
131230 nodeReference(pCsr->pNode);
131231 nodeRelease(pRtree, pNode);
131246 assert(pCsr->pNode);
131247 *pRowid = nodeGetRowid(pRtree, pCsr->pNode, pCsr->iCell);
131260 i64 iRowid = nodeGetRowid(pRtree, pCsr->pNode, pCsr->iCell);
131264 nodeGetCoord(pRtree, pCsr->pNode, pCsr->iCell, i-1, &c);
131368 pCsr->pNode = pLeaf;
131407 pCsr->pNode = 0;
131413 pCsr->pNode = pRoot;
131415 assert( pCsr->pNode==pRoot );
131422 assert( pCsr->pNode==pRoot );
131424 pCsr->pNode = 0;
131426 assert( rc!=SQLITE_OK || !pCsr->pNode || pCsr->iCell<NCELL(pCsr->pNode) );
131677 RtreeNode *pNode;
131678 rc = nodeAcquire(pRtree, 1, 0, &pNode);
131691 int nCell = NCELL(pNode);
131703 nodeRelease(pRtree, pNode);
131704 pNode = 0;
131708 nodeGetCell(pRtree, pNode, jj, &aCell[jj]);
131721 nodeGetCell(pRtree, pNode, iCell, &cell);
131752 rc = nodeAcquire(pRtree, iBest, pNode, &pChild);
131753 nodeRelease(pRtree, pNode);
131754 pNode = pChild;
131757 *ppLeaf = pNode;
131763 ** the node pNode. This function updates the bounding box cells in
131768 RtreeNode *pNode, /* Adjust ancestry of this node. */
131771 RtreeNode *p = pNode;
132264 RtreeNode *pNode,
132273 nodeReference(pNode);
132274 pChild->pParent = pNode;
132277 return xSetMapping(pRtree, iRowid, pNode->iNode);
132282 RtreeNode *pNode,
132290 int nCell = NCELL(pNode);
132311 nodeGetCell(pRtree, pNode, i, &aCell[i]);
132313 nodeZero(pRtree, pNode);
132317 if( pNode->iNode==1 ){
132318 pRight = nodeNew(pRtree, pNode);
132319 pLeft = nodeNew(pRtree, pNode);
132321 pNode->isDirty = 1;
132322 writeInt16(pNode->zData, pRtree->iDepth);
132324 pLeft = pNode;
132356 if( pNode->iNode==1 ){
132387 if( pNode->iNode==1 ){
132458 static int removeNode(Rtree *pRtree, RtreeNode *pNode, int iHeight){
132464 assert( pNode->nRef==1 );
132467 rc = nodeParentIndex(pRtree, pNode, &iCell);
132469 pParent = pNode->pParent;
132470 pNode->pParent = 0;
132482 sqlite3_bind_int64(pRtree->pDeleteNode, 1, pNode->iNode);
132489 sqlite3_bind_int64(pRtree->pDeleteParent, 1, pNode->iNode);
132498 nodeHashDelete(pRtree, pNode);
132499 pNode->iNode = iHeight;
132500 pNode->pNext = pRtree->pDeleted;
132501 pNode->nRef++;
132502 pRtree->pDeleted = pNode;
132507 static int fixBoundingBox(Rtree *pRtree, RtreeNode *pNode){
132508 RtreeNode *pParent = pNode->pParent;
132512 int nCell = NCELL(pNode);
132513 RtreeCell box; /* Bounding box for pNode */
132514 nodeGetCell(pRtree, pNode, 0, &box);
132517 nodeGetCell(pRtree, pNode, ii, &cell);
132520 box.iRowid = pNode->iNode;
132521 rc = nodeParentIndex(pRtree, pNode, &ii);
132531 ** Delete the cell at index iCell of node pNode. After removing the
132534 static int deleteCell(Rtree *pRtree, RtreeNode *pNode, int iCell, int iHeight){
132538 if( SQLITE_OK!=(rc = fixLeafParent(pRtree, pNode)) ){
132545 nodeDeleteCell(pRtree, pNode, iCell);
132552 pParent = pNode->pParent;
132553 assert( pParent || pNode->iNode==1 );
132555 if( NCELL(pNode)<RTREE_MINCELLS(pRtree) ){
132556 rc = removeNode(pRtree, pNode, iHeight);
132558 rc = fixBoundingBox(pRtree, pNode);
132567 RtreeNode *pNode,
132583 nCell = NCELL(pNode)+1;
132605 nodeGetCell(pRtree, pNode, ii, &aCell[ii]);
132627 nodeZero(pRtree, pNode);
132631 nodeInsertCell(pRtree, pNode, p);
132634 rc = rowidWrite(pRtree, p->iRowid, pNode->iNode);
132636 rc = parentWrite(pRtree, p->iRowid, pNode->iNode);
132641 rc = fixBoundingBox(pRtree, pNode);
132644 /* Find a node to store this cell in. pNode->iNode currently contains
132665 ** Insert cell pCell into node pNode. Node pNode is the head of a
132670 RtreeNode *pNode,
132679 nodeReference(pNode);
132680 pChild->pParent = pNode;
132683 if( nodeInsertCell(pRtree, pNode, pCell) ){
132685 if( iHeight<=pRtree->iReinsertHeight || pNode->iNode==1){
132686 rc = SplitNode(pRtree, pNode, pCell, iHeight);
132689 rc = Reinsert(pRtree, pNode, pCell, iHeight);
132692 rc = SplitNode(pRtree, pNode, pCell, iHeight);
132695 rc = AdjustTree(pRtree, pNode, pCell);
132698 rc = rowidWrite(pRtree, pCell->iRowid, pNode->iNode);
132700 rc = parentWrite(pRtree, pCell->iRowid, pNode->iNode);
132707 static int reinsertNodeContent(Rtree *pRtree, RtreeNode *pNode){
132710 int nCell = NCELL(pNode);
132715 nodeGetCell(pRtree, pNode, ii, &cell);
132717 /* Find a node to store this cell in. pNode->iNode currently contains
132720 rc = ChooseLeaf(pRtree, &cell, (int)pNode->iNode, &pInsert);
132723 rc = rtreeInsertCell(pRtree, pInsert, &cell, (int)pNode->iNode);