本文整理汇总了C++中PageInit函数的典型用法代码示例。如果您正苦于以下问题:C++ PageInit函数的具体用法?C++ PageInit怎么用?C++ PageInit使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了PageInit函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。
示例1: PhysInit
initcode int PhysInit()
{
DWORD maxPfn, memSize;
PhysReadMemoryMap();
maxPfn = GetMaxPfn();
if (maxPfn >= PFN_MAX)
{
KePrint(KERN_INFO "PHYS: Your machine has more than 4GB of RAM. Limiting to 4GB for the moment.\n");
maxPfn = PFN_MAX - 1;
}
PageEarlyInit(maxPfn);
/* Print memory size for information purposes */
memSize=(maxPfn >> 8);
KePrint(KERN_INFO "PHYS: %umb physical memory available\n", memSize);
if (memSize < 8)
KernelPanic("Less than 8mb memory available. Whitix requires more than this\n");
/* So that appropriate areas of the memory are reserved when setting up the page stack */
DoReserveAreas(maxPfn);
/* Set up the page allocation (memory/page_alloc.c) */
PageInit();
return 0;
}
开发者ID:d33tah,项目名称:whitix,代码行数:31,代码来源:init.c
示例2: addChild
void CocosGUIExamplesPageScene::onEnter()
{
CCScene::onEnter();
m_pUILayer = UILayer::create();
m_pUILayer->scheduleUpdate();
addChild(m_pUILayer);
PageInit();
CCSize winSize = CCDirector::sharedDirector()->getWinSize();
UILabel* label = UILabel::create();
label->setText("Move by horizontal direction");
label->setFontName("Marker Felt");
label->setFontSize(32);
label->setAnchorPoint(ccp(0.5f, -1));
label->setPosition(ccp(winSize.width / 2.0f, winSize.height / 2.0f + label->getContentSize().height * 1.5));
m_pUILayer->addWidget(label);
// left button
UIButton* left_button = UIButton::create();
left_button->setTouchEnable(true);
left_button->loadTextures("cocosgui/UITest/b1.png", "cocosgui/UITest/b2.png", "");
float left_button_width = left_button->getContentSize().width;
left_button->setPosition(ccp(left_button_width - left_button_width / 2, m_pUILayer->getContentSize().height / 2));
left_button->addReleaseEvent(this, coco_releaseselector(CocosGUIExamplesPageScene::toCocosGUIExamplesMapScene));
m_pUILayer->addWidget(left_button);
}
开发者ID:2uemg8sq98r3,项目名称:cocos2d-x,代码行数:29,代码来源:CocosGUIExamplesPageScene.cpp
示例3: addChild
void CocosGUIExamplesPageScene::onEnter()
{
CCScene::onEnter();
m_pUILayer = TouchGroup::create();
m_pUILayer->scheduleUpdate();
addChild(m_pUILayer);
PageInit();
CCSize winSize = CCDirector::sharedDirector()->getWinSize();
gui::Label* label = gui::Label::create();
label->setText("Move by horizontal direction");
const char* font =
#if (CC_TARGET_PLATFORM == CC_PLATFORM_IOS)
// custom ttf files are defined in Test-info.plist
"Marker Felt";
#else
"fonts/Marker Felt.ttf";
#endif
label->setFontName(font);
label->setFontSize(32);
label->setAnchorPoint(ccp(0.5f, -1));
label->setPosition(ccp(winSize.width / 2.0f, winSize.height / 2.0f + label->getSize().height * 1.5));
m_pUILayer->addWidget(label);
// exit button
Button* exit_button = Button::create();
exit_button->setTouchEnabled(true);
exit_button->loadTextures("CloseNormal.png", "CloseSelected.png", "");
exit_button->setPosition(ccp(m_pUILayer->getContentSize().width - exit_button->getSize().width, exit_button->getSize().height));
exit_button->addTouchEventListener(this, toucheventselector(CocosGUIExamplesPageScene::menuCloseCallback));
m_pUILayer->addWidget(exit_button);
}
开发者ID:MKSoft,项目名称:CocoStudioSamples,代码行数:35,代码来源:CocosGUIExamplesPageScene.cpp
示例4: brin_page_init
/*
* Initialize a page with the given type.
*
* Caller is responsible for marking it dirty, as appropriate.
*/
void
brin_page_init(Page page, uint16 type)
{
PageInit(page, BLCKSZ, sizeof(BrinSpecialSpace));
BrinPageType(page) = type;
}
开发者ID:dreamsxin,项目名称:postgresql-1,代码行数:12,代码来源:brin_pageops.c
示例5: SetMatViewToPopulated
/*
* SetMatViewToPopulated
* Indicate that the materialized view has been populated by its query.
*
* NOTE: The heap starts out in a state that doesn't look scannable, and can
* only transition from there to scannable at the time a new heap is created.
*
* NOTE: caller must be holding an appropriate lock on the relation.
*/
void
SetMatViewToPopulated(Relation relation)
{
Page page;
Assert(relation->rd_rel->relkind == RELKIND_MATVIEW);
Assert(relation->rd_ispopulated == false);
page = (Page) palloc(BLCKSZ);
PageInit(page, BLCKSZ, 0);
if (RelationNeedsWAL(relation))
log_newpage(&(relation->rd_node), MAIN_FORKNUM, 0, page);
RelationOpenSmgr(relation);
PageSetChecksumInplace(page, 0);
smgrextend(relation->rd_smgr, MAIN_FORKNUM, 0, (char *) page, true);
pfree(page);
smgrimmedsync(relation->rd_smgr, MAIN_FORKNUM);
RelationCacheInvalidateEntry(relation->rd_id);
}
开发者ID:amulsul,项目名称:postgres,代码行数:34,代码来源:matview.c
示例6: XLogRecordPageWithFreeSpace
/*
* XLogRecordPageWithFreeSpace - like RecordPageWithFreeSpace, for use in
* WAL replay
*/
void
XLogRecordPageWithFreeSpace(RelFileNode rnode, BlockNumber heapBlk,
Size spaceAvail)
{
int new_cat = fsm_space_avail_to_cat(spaceAvail);
FSMAddress addr;
uint16 slot;
BlockNumber blkno;
Buffer buf;
Page page;
/* Get the location of the FSM byte representing the heap block */
addr = fsm_get_location(heapBlk, &slot);
blkno = fsm_logical_to_physical(addr);
/* If the page doesn't exist already, extend */
buf = XLogReadBufferExtended(rnode, FSM_FORKNUM, blkno, RBM_ZERO_ON_ERROR);
LockBuffer(buf, BUFFER_LOCK_EXCLUSIVE);
page = BufferGetPage(buf);
if (PageIsNew(page))
PageInit(page, BLCKSZ, 0);
if (fsm_set_avail(page, slot, new_cat))
MarkBufferDirtyHint(buf, false);
UnlockReleaseBuffer(buf);
}
开发者ID:EccentricLoggers,项目名称:peloton,代码行数:31,代码来源:freespace.cpp
示例7: vm_extend
/*
* Ensure that the visibility map fork is at least vm_nblocks long, extending
* it if necessary with zeroed pages.
*/
static void
vm_extend(Relation rel, BlockNumber vm_nblocks)
{
BlockNumber vm_nblocks_now;
Page pg;
pg = (Page) palloc(BLCKSZ);
PageInit(pg, BLCKSZ, 0);
/*
* We use the relation extension lock to lock out other backends trying to
* extend the visibility map at the same time. It also locks out extension
* of the main fork, unnecessarily, but extending the visibility map
* happens seldom enough that it doesn't seem worthwhile to have a
* separate lock tag type for it.
*
* Note that another backend might have extended or created the relation
* by the time we get the lock.
*/
LockRelationForExtension(rel, ExclusiveLock);
/* Might have to re-open if a cache flush happened */
RelationOpenSmgr(rel);
/*
* Create the file first if it doesn't exist. If smgr_vm_nblocks is
* positive then it must exist, no need for an smgrexists call.
*/
if ((rel->rd_smgr->smgr_vm_nblocks == 0 ||
rel->rd_smgr->smgr_vm_nblocks == InvalidBlockNumber) &&
!smgrexists(rel->rd_smgr, VISIBILITYMAP_FORKNUM))
smgrcreate(rel->rd_smgr, VISIBILITYMAP_FORKNUM, false);
vm_nblocks_now = smgrnblocks(rel->rd_smgr, VISIBILITYMAP_FORKNUM);
/* Now extend the file */
while (vm_nblocks_now < vm_nblocks)
{
smgrextend(rel->rd_smgr, VISIBILITYMAP_FORKNUM, vm_nblocks_now,
(char *) pg, false);
vm_nblocks_now++;
}
/*
* Send a shared-inval message to force other backends to close any smgr
* references they may have for this rel, which we are about to change.
* This is a useful optimization because it means that backends don't have
* to keep checking for creation or extension of the file, which happens
* infrequently.
*/
CacheInvalidateSmgr(rel->rd_smgr->smgr_rnode);
/* Update local cache with the up-to-date size */
rel->rd_smgr->smgr_vm_nblocks = vm_nblocks_now;
UnlockRelationForExtension(rel, ExclusiveLock);
pfree(pg);
}
开发者ID:jandas,项目名称:postgres,代码行数:63,代码来源:visibilitymap.c
示例8: SpGistInitPage
void
SpGistInitPage(Page page, uint16 f, Size pageSize)
{
SpGistPageOpaque opaque;
PageInit(page, pageSize, sizeof(SpGistPageOpaqueData));
opaque = SpGistPageGetOpaque(page);
memset(opaque, 0, sizeof(SpGistPageOpaqueData));
opaque->flags = f;
}
开发者ID:jasonhubs,项目名称:sp-gist,代码行数:9,代码来源:spgutils.c
示例9: PageFree
void PageFree(Chunk chunk, Index pi)
{
AVERT(Chunk, chunk);
AVER(pi >= chunk->allocBase);
AVER(pi < chunk->pages);
AVER(BTGet(chunk->allocTable, pi));
PageInit(chunk, pi);
}
开发者ID:clojit,项目名称:rust-mps-obj,代码行数:9,代码来源:tract.c
示例10: _bitmap_init_lovpage
/*
* _bitmap_init_lovpage -- initialize a new LOV page.
*/
void
_bitmap_init_lovpage(Relation rel __attribute__((unused)), Buffer buf)
{
Page page;
page = (Page) BufferGetPage(buf);
if(PageIsNew(page))
PageInit(page, BufferGetPageSize(buf), 0);
}
开发者ID:AnLingm,项目名称:gpdb,代码行数:13,代码来源:bitmappages.c
示例11: brin_page_init
/*
* Initialize a page with the given type.
*
* Caller is responsible for marking it dirty, as appropriate.
*/
void
brin_page_init(Page page, uint16 type)
{
BrinSpecialSpace *special;
PageInit(page, BLCKSZ, sizeof(BrinSpecialSpace));
special = (BrinSpecialSpace *) PageGetSpecialPointer(page);
special->type = type;
}
开发者ID:JiannengSun,项目名称:postgres,代码行数:15,代码来源:brin_pageops.c
示例12: SpGistInitPage
/*
* Initialize an SPGiST page to empty, with specified flags
*/
void
SpGistInitPage(Page page, uint16 f)
{
SpGistPageOpaque opaque;
PageInit(page, BLCKSZ, MAXALIGN(sizeof(SpGistPageOpaqueData)));
opaque = SpGistPageGetOpaque(page);
memset(opaque, 0, sizeof(SpGistPageOpaqueData));
opaque->flags = f;
opaque->spgist_page_id = SPGIST_PAGE_ID;
}
开发者ID:adunstan,项目名称:postgresql-dev,代码行数:14,代码来源:spgutils.c
示例13: BloomInitPage
void
BloomInitPage(Page page, uint16 f, Size pageSize)
{
BloomPageOpaque opaque;
PageInit(page, pageSize, sizeof(BloomPageOpaqueData));
opaque = BloomPageGetOpaque(page);
memset(opaque, 0, sizeof(BloomPageOpaqueData));
opaque->maxoff = 0;
opaque->flags = f;
}
开发者ID:awakmu,项目名称:pgbloom,代码行数:12,代码来源:blutils.c
示例14: BloomInitPage
/*
* Initialize bloom page.
*/
void
BloomInitPage(Page page, uint16 flags)
{
BloomPageOpaque opaque;
PageInit(page, BLCKSZ, sizeof(BloomPageOpaqueData));
opaque = BloomPageGetOpaque(page);
memset(opaque, 0, sizeof(BloomPageOpaqueData));
opaque->flags = flags;
opaque->bloom_page_id = BLOOM_PAGE_ID;
}
开发者ID:bstrie,项目名称:MollyDB,代码行数:15,代码来源:blutils.c
示例15: GinInitPage
void
GinInitPage(Page page, uint32 f, Size pageSize)
{
GinPageOpaque opaque;
PageInit(page, pageSize, sizeof(GinPageOpaqueData));
opaque = GinPageGetOpaque(page);
memset(opaque, 0, sizeof(GinPageOpaqueData));
opaque->flags = f;
opaque->rightlink = InvalidBlockNumber;
}
开发者ID:Joe-xXx,项目名称:postgres-old-soon-decommissioned,代码行数:12,代码来源:ginutil.c
示例16: XLogRecordPageWithFreeSpace
/*
* XLogRecordPageWithFreeSpace - like RecordPageWithFreeSpace, for use in
* WAL replay
*/
void
XLogRecordPageWithFreeSpace(RelFileNode rnode, BlockNumber heapBlk,
Size spaceAvail)
{
int new_cat = fsm_space_avail_to_cat(spaceAvail);
FSMAddress addr;
uint16 slot;
BlockNumber blkno;
Buffer buf;
Page page;
bool write_to_fsm;
/* This is meant to mirror the logic in fsm_allow_writes() */
if (heapBlk >= HEAP_FSM_CREATION_THRESHOLD)
write_to_fsm = true;
else
{
/* Open the relation at smgr level */
SMgrRelation smgr = smgropen(rnode, InvalidBackendId);
if (smgrexists(smgr, FSM_FORKNUM))
write_to_fsm = true;
else
{
BlockNumber heap_nblocks = smgrnblocks(smgr, MAIN_FORKNUM);
if (heap_nblocks > HEAP_FSM_CREATION_THRESHOLD)
write_to_fsm = true;
else
write_to_fsm = false;
}
}
if (!write_to_fsm)
return;
/* Get the location of the FSM byte representing the heap block */
addr = fsm_get_location(heapBlk, &slot);
blkno = fsm_logical_to_physical(addr);
/* If the page doesn't exist already, extend */
buf = XLogReadBufferExtended(rnode, FSM_FORKNUM, blkno, RBM_ZERO_ON_ERROR);
LockBuffer(buf, BUFFER_LOCK_EXCLUSIVE);
page = BufferGetPage(buf);
if (PageIsNew(page))
PageInit(page, BLCKSZ, 0);
if (fsm_set_avail(page, slot, new_cat))
MarkBufferDirtyHint(buf, false);
UnlockReleaseBuffer(buf);
}
开发者ID:glukhovn,项目名称:postgres,代码行数:56,代码来源:freespace.c
示例17: fsm_extend
/*
* Ensure that the FSM fork is at least fsm_nblocks long, extending
* it if necessary with empty pages. And by empty, I mean pages filled
* with zeros, meaning there's no free space.
*/
static void
fsm_extend(Relation rel, BlockNumber fsm_nblocks)
{
BlockNumber fsm_nblocks_now;
Page pg;
pg = (Page) palloc(BLCKSZ);
PageInit(pg, BLCKSZ, 0);
/*
* We use the relation extension lock to lock out other backends trying to
* extend the FSM at the same time. It also locks out extension of the
* main fork, unnecessarily, but extending the FSM happens seldom enough
* that it doesn't seem worthwhile to have a separate lock tag type for
* it.
*
* Note that another backend might have extended or created the relation
* by the time we get the lock.
*/
LockRelationForExtension(rel, ExclusiveLock);
/* Might have to re-open if a cache flush happened */
RelationOpenSmgr(rel);
/*
* Create the FSM file first if it doesn't exist. If smgr_fsm_nblocks is
* positive then it must exist, no need for an smgrexists call.
*/
if ((rel->rd_smgr->smgr_fsm_nblocks == 0 ||
rel->rd_smgr->smgr_fsm_nblocks == InvalidBlockNumber) &&
!smgrexists(rel->rd_smgr, FSM_FORKNUM))
smgrcreate(rel->rd_smgr, FSM_FORKNUM, false);
fsm_nblocks_now = smgrnblocks(rel->rd_smgr, FSM_FORKNUM);
while (fsm_nblocks_now < fsm_nblocks)
{
PageSetChecksumInplace(pg, fsm_nblocks_now);
smgrextend(rel->rd_smgr, FSM_FORKNUM, fsm_nblocks_now,
(char *) pg, false);
fsm_nblocks_now++;
}
/* Update local cache with the up-to-date size */
rel->rd_smgr->smgr_fsm_nblocks = fsm_nblocks_now;
UnlockRelationForExtension(rel, ExclusiveLock);
pfree(pg);
}
开发者ID:EccentricLoggers,项目名称:peloton,代码行数:56,代码来源:freespace.cpp
示例18: RTInitBuffer
static void
RTInitBuffer(Buffer b, uint32 f)
{
RTreePageOpaque opaque;
Page page;
Size pageSize;
pageSize = BufferGetPageSize(b);
page = BufferGetPage(b);
PageInit(page, pageSize, sizeof(RTreePageOpaqueData));
opaque = (RTreePageOpaque) PageGetSpecialPointer(page);
opaque->flags = f;
}
开发者ID:CraigBryan,项目名称:PostgresqlFun,代码行数:16,代码来源:rtree.c
示例19: PageGetTempPageCopySpecial
/*
* PageGetTempPageCopySpecial
* Get a temporary page in local memory for special processing.
* The page is PageInit'd with the same special-space size as the
* given page, and the special space is copied from the given page.
*/
Page
PageGetTempPageCopySpecial(Page page)
{
Size pageSize;
Page temp;
pageSize = PageGetPageSize(page);
temp = (Page) palloc(pageSize);
PageInit(temp, pageSize, PageGetSpecialSize(page));
memcpy(PageGetSpecialPointer(temp),
PageGetSpecialPointer(page),
PageGetSpecialSize(page));
return temp;
}
开发者ID:BertrandAreal,项目名称:postgres,代码行数:22,代码来源:bufpage.c
示例20: vm_extend
/*
* Ensure that the visibility map fork is at least vm_nblocks long, extending
* it if necessary with zeroed pages.
*/
static void
vm_extend(Relation rel, BlockNumber vm_nblocks)
{
BlockNumber vm_nblocks_now;
Page pg;
pg = (Page) palloc(BLCKSZ);
PageInit(pg, BLCKSZ, 0);
/*
* We use the relation extension lock to lock out other backends trying to
* extend the visibility map at the same time. It also locks out extension
* of the main fork, unnecessarily, but extending the visibility map
* happens seldom enough that it doesn't seem worthwhile to have a
* separate lock tag type for it.
*
* Note that another backend might have extended or created the relation
* before we get the lock.
*/
LockRelationForExtension(rel, ExclusiveLock);
/* Create the file first if it doesn't exist */
if ((rel->rd_vm_nblocks == 0 || rel->rd_vm_nblocks == InvalidBlockNumber)
&& !smgrexists(rel->rd_smgr, VISIBILITYMAP_FORKNUM))
{
smgrcreate(rel->rd_smgr, VISIBILITYMAP_FORKNUM, false);
vm_nblocks_now = 0;
}
else
vm_nblocks_now = smgrnblocks(rel->rd_smgr, VISIBILITYMAP_FORKNUM);
while (vm_nblocks_now < vm_nblocks)
{
smgrextend(rel->rd_smgr, VISIBILITYMAP_FORKNUM, vm_nblocks_now,
(char *) pg, rel->rd_istemp);
vm_nblocks_now++;
}
UnlockRelationForExtension(rel, ExclusiveLock);
pfree(pg);
/* Update the relcache with the up-to-date size */
if (!InRecovery)
CacheInvalidateRelcache(rel);
rel->rd_vm_nblocks = vm_nblocks_now;
}
开发者ID:Aldizh,项目名称:buffer_manager,代码行数:51,代码来源:visibilitymap.c
注:本文中的PageInit函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论