资源简介
db-4.2.52.tar.gz版本,linux平台使用
代码片段和文件信息
/* Do not edit: automatically built by gen_rec.awk. */
#include “db_config.h“
#ifndef NO_SYSTEM_INCLUDES
#include
#include
#include
#endif
#include “db_int.h“
#include “dbinc/crypto.h“
#include “dbinc/db_page.h“
#include “dbinc/db_dispatch.h“
#include “dbinc/db_am.h“
#include “dbinc/btree.h“
#include “dbinc/log.h“
#include “dbinc/txn.h“
/*
* PUBLIC: int __bam_split_log __P((DB * DB_TXN * DB_LSN *
* PUBLIC: u_int32_t db_pgno_t DB_LSN * db_pgno_t DB_LSN * u_int32_t
* PUBLIC: db_pgno_t DB_LSN * db_pgno_t const DBT * u_int32_t));
*/
int
__bam_split_log(dbp txnid ret_lsnp flags left llsn right rlsn indx
npgno nlsn root_pgno pg opflags)
DB *dbp;
DB_TXN *txnid;
DB_LSN *ret_lsnp;
u_int32_t flags;
db_pgno_t left;
DB_LSN * llsn;
db_pgno_t right;
DB_LSN * rlsn;
u_int32_t indx;
db_pgno_t npgno;
DB_LSN * nlsn;
db_pgno_t root_pgno;
const DBT *pg;
u_int32_t opflags;
{
DBT logrec;
DB_ENV *dbenv;
DB_TXNLOGREC *lr;
DB_LSN *lsnp null_lsn;
u_int32_t zero uinttmp rectype txn_num;
u_int npad;
u_int8_t *bp;
int is_durable ret;
dbenv = dbp->dbenv;
rectype = DB___bam_split;
npad = 0;
is_durable = 1;
if (LF_ISSET(DB_LOG_NOT_DURABLE) ||
F_ISSET(dbenv DB_ENV_TXN_NOT_DURABLE) ||
F_ISSET(dbp DB_AM_NOT_DURABLE)) {
if (F_ISSET(dbenv DB_ENV_TXN_NOT_DURABLE) && txnid == NULL)
return (0);
is_durable = 0;
}
if (txnid == NULL) {
txn_num = 0;
null_lsn.file = 0;
null_lsn.offset = 0;
lsnp = &null_lsn;
} else {
if (TAILQ_FIRST(&txnid->kids) != NULL &&
(ret = __txn_activekids(dbenv rectype txnid)) != 0)
return (ret);
txn_num = txnid->txnid;
lsnp = &txnid->last_lsn;
}
logrec.size = sizeof(rectype) + sizeof(txn_num) + sizeof(DB_LSN)
+ sizeof(u_int32_t)
+ sizeof(u_int32_t)
+ sizeof(*llsn)
+ sizeof(u_int32_t)
+ sizeof(*rlsn)
+ sizeof(u_int32_t)
+ sizeof(u_int32_t)
+ sizeof(*nlsn)
+ sizeof(u_int32_t)
+ sizeof(u_int32_t) + (pg == NULL ? 0 : pg->size)
+ sizeof(u_int32_t);
if (CRYPTO_ON(dbenv)) {
npad =
((DB_CIPHER *)dbenv->crypto_handle)->adj_size(logrec.size);
logrec.size += npad;
}
if (!is_durable && txnid != NULL) {
if ((ret = __os_malloc(dbenv
logrec.size + sizeof(DB_TXNLOGREC) &lr)) != 0)
return (ret);
#ifdef DIAGNOSTIC
goto do_malloc;
#else
logrec.data = &lr->data;
#endif
} else {
#ifdef DIAGNOSTIC
do_malloc:
#endif
if ((ret =
__os_malloc(dbenv logrec.size &logrec.data)) != 0) {
#ifdef DIAGNOSTIC
if (!is_durable && txnid != NULL)
(void)__os_free(dbenv lr);
#endif
return (ret);
}
}
if (npad > 0)
memset((u_int8_t *)logrec.data + logrec.size - npad 0 npad);
bp = logrec.data;
memcpy(bp &rectype sizeof(rectype));
bp += sizeof(rectype);
memcpy(bp &txn_num sizeof(txn_num));
bp += sizeof(txn_num);
memcpy(bp lsnp sizeof(DB_LSN));
bp += sizeof(DB_LSN);
DB_ASSERT(dbp->log_filename != NULL);
if (dbp->log
评论
共有 条评论