/* * __bm_checkpoint_load -- * Load a checkpoint. */ static int __bm_checkpoint_load(WT_BM *bm, WT_SESSION_IMPL *session, const uint8_t *addr, size_t addr_size, uint8_t *root_addr, size_t *root_addr_sizep, int checkpoint) { WT_CONNECTION_IMPL *conn; conn = S2C(session); /* If not opening a checkpoint, we're opening the live system. */ bm->is_live = !checkpoint; WT_RET(__wt_block_checkpoint_load(session, bm->block, addr, addr_size, root_addr, root_addr_sizep, checkpoint)); if (checkpoint) { /* * Read-only objects are optionally mapped into memory instead * of being read into cache buffers. */ if (conn->mmap) WT_RET(__wt_block_map(session, bm->block, &bm->map, &bm->maplen, &bm->mappingcookie)); /* * If this handle is for a checkpoint, that is, read-only, there * isn't a lot you can do with it. Although the btree layer * prevents attempts to write a checkpoint reference, paranoia * is healthy. */ __bm_method_set(bm, 1); } return (0); }
/* * __wt_block_manager_open -- * Open a file. */ int __wt_block_manager_open(WT_SESSION_IMPL *session, const char *filename, const char *cfg[], int forced_salvage, WT_BM **bmp) { WT_BM *bm; WT_DECL_RET; *bmp = NULL; WT_RET(__wt_calloc_def(session, 1, &bm)); __bm_method_set(bm, 0); WT_ERR(__wt_block_open( session, filename, cfg, forced_salvage, &bm->block)); *bmp = bm; return (0); err: WT_TRET(bm->close(bm, session)); return (ret); }
/* * __wt_block_manager_open -- * Open a file. */ int __wt_block_manager_open(WT_SESSION_IMPL *session, const char *filename, const char *cfg[], bool forced_salvage, bool readonly, uint32_t allocsize, WT_BM **bmp) { WT_BM *bm; WT_DECL_RET; *bmp = NULL; WT_RET(__wt_calloc_one(session, &bm)); __bm_method_set(bm, false); WT_ERR(__wt_block_open(session, filename, cfg, forced_salvage, readonly, allocsize, &bm->block)); *bmp = bm; return (0); err: WT_TRET(bm->close(bm, session)); return (ret); }