MCPcopy Create free account
hub / github.com/FirebirdSQL/firebird / PAG_format_pip

Function PAG_format_pip

src/jrd/pag.cpp:978–1031  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

976
977
978void PAG_format_pip(thread_db* tdbb, PageSpace& pageSpace)
979{
980/**************************************
981 *
982 * P A G _ f o r m a t _ p i p
983 *
984 **************************************
985 *
986 * Functional description
987 * Create a page inventory page to
988 * complete the formatting of a new file
989 * into a rudimentary database.
990 *
991 **************************************/
992 SET_TDBB(tdbb);
993 Database* dbb = tdbb->getDatabase();
994 CHECK_DBB(dbb);
995
996 // Initialize first SCN's Page
997 pageSpace.scnFirst = 0;
998 if (!pageSpace.isTemporary())
999 {
1000 pageSpace.scnFirst = FIRST_SCN_PAGE;
1001
1002 WIN window(pageSpace.pageSpaceID, pageSpace.scnFirst);
1003 scns_page* page = (scns_page*) CCH_fake(tdbb, &window, 1);
1004
1005 page->scn_header.pag_type = pag_scns;
1006 page->scn_sequence = 0;
1007
1008 CCH_RELEASE(tdbb, &window);
1009 }
1010
1011 // Initialize Page Inventory Page
1012 {
1013 pageSpace.pipFirst = FIRST_PIP_PAGE;
1014
1015 WIN window(pageSpace.pageSpaceID, pageSpace.pipFirst);
1016 page_inv_page* pages = (page_inv_page*) CCH_fake(tdbb, &window, 1);
1017
1018 pages->pip_header.pag_type = pag_pages;
1019 pages->pip_used = (pageSpace.scnFirst ? pageSpace.scnFirst : pageSpace.pipFirst) + 1;
1020 pages->pip_min = pages->pip_used;
1021 int count = dbb->dbb_page_size - static_cast<int>(offsetof(page_inv_page, pip_bits[0]));
1022
1023 memset(pages->pip_bits, 0xFF, count);
1024
1025 pages->pip_bits[0] &= ~(1 | 2);
1026 if (pageSpace.scnFirst)
1027 pages->pip_bits[0] &= ~(1 << pageSpace.scnFirst);
1028
1029 CCH_RELEASE(tdbb, &window);
1030 }
1031}
1032
1033
1034bool PAG_get_clump(thread_db* tdbb, USHORT type, USHORT* inout_len, UCHAR* entry)

Callers 2

createDatabaseMethod · 0.85
getTempPageSpaceIDMethod · 0.85

Calls 6

SET_TDBBFunction · 0.85
CHECK_DBBFunction · 0.85
CCH_fakeFunction · 0.85
CCH_RELEASEFunction · 0.85
getDatabaseMethod · 0.80
isTemporaryMethod · 0.45

Tested by

no test coverage detected