1*7c478bd9Sstevel@tonic-gate /* Do not edit: automatically built by dist/db_gen.sh. */ 2*7c478bd9Sstevel@tonic-gate #include "config.h" 3*7c478bd9Sstevel@tonic-gate 4*7c478bd9Sstevel@tonic-gate #ifndef NO_SYSTEM_INCLUDES 5*7c478bd9Sstevel@tonic-gate #include <ctype.h> 6*7c478bd9Sstevel@tonic-gate #include <errno.h> 7*7c478bd9Sstevel@tonic-gate #include <stddef.h> 8*7c478bd9Sstevel@tonic-gate #include <stdlib.h> 9*7c478bd9Sstevel@tonic-gate #include <string.h> 10*7c478bd9Sstevel@tonic-gate #endif 11*7c478bd9Sstevel@tonic-gate 12*7c478bd9Sstevel@tonic-gate #include "db_int.h" 13*7c478bd9Sstevel@tonic-gate #include "db_page.h" 14*7c478bd9Sstevel@tonic-gate #include "db_dispatch.h" 15*7c478bd9Sstevel@tonic-gate #include "btree.h" 16*7c478bd9Sstevel@tonic-gate #include "db_am.h" 17*7c478bd9Sstevel@tonic-gate /* 18*7c478bd9Sstevel@tonic-gate * PUBLIC: int __bam_pg_alloc_log 19*7c478bd9Sstevel@tonic-gate * PUBLIC: __P((DB_LOG *, DB_TXN *, DB_LSN *, u_int32_t, 20*7c478bd9Sstevel@tonic-gate * PUBLIC: u_int32_t, DB_LSN *, DB_LSN *, db_pgno_t, 21*7c478bd9Sstevel@tonic-gate * PUBLIC: u_int32_t, db_pgno_t)); 22*7c478bd9Sstevel@tonic-gate */ 23*7c478bd9Sstevel@tonic-gate int __bam_pg_alloc_log(logp, txnid, ret_lsnp, flags, 24*7c478bd9Sstevel@tonic-gate fileid, meta_lsn, page_lsn, pgno, ptype, next) 25*7c478bd9Sstevel@tonic-gate DB_LOG *logp; 26*7c478bd9Sstevel@tonic-gate DB_TXN *txnid; 27*7c478bd9Sstevel@tonic-gate DB_LSN *ret_lsnp; 28*7c478bd9Sstevel@tonic-gate u_int32_t flags; 29*7c478bd9Sstevel@tonic-gate u_int32_t fileid; 30*7c478bd9Sstevel@tonic-gate DB_LSN * meta_lsn; 31*7c478bd9Sstevel@tonic-gate DB_LSN * page_lsn; 32*7c478bd9Sstevel@tonic-gate db_pgno_t pgno; 33*7c478bd9Sstevel@tonic-gate u_int32_t ptype; 34*7c478bd9Sstevel@tonic-gate db_pgno_t next; 35*7c478bd9Sstevel@tonic-gate { 36*7c478bd9Sstevel@tonic-gate DBT logrec; 37*7c478bd9Sstevel@tonic-gate DB_LSN *lsnp, null_lsn; 38*7c478bd9Sstevel@tonic-gate u_int32_t rectype, txn_num; 39*7c478bd9Sstevel@tonic-gate int ret; 40*7c478bd9Sstevel@tonic-gate u_int8_t *bp; 41*7c478bd9Sstevel@tonic-gate 42*7c478bd9Sstevel@tonic-gate rectype = DB_bam_pg_alloc; 43*7c478bd9Sstevel@tonic-gate txn_num = txnid == NULL ? 0 : txnid->txnid; 44*7c478bd9Sstevel@tonic-gate if (txnid == NULL) { 45*7c478bd9Sstevel@tonic-gate ZERO_LSN(null_lsn); 46*7c478bd9Sstevel@tonic-gate lsnp = &null_lsn; 47*7c478bd9Sstevel@tonic-gate } else 48*7c478bd9Sstevel@tonic-gate lsnp = &txnid->last_lsn; 49*7c478bd9Sstevel@tonic-gate logrec.size = sizeof(rectype) + sizeof(txn_num) + sizeof(DB_LSN) 50*7c478bd9Sstevel@tonic-gate + sizeof(fileid) 51*7c478bd9Sstevel@tonic-gate + sizeof(*meta_lsn) 52*7c478bd9Sstevel@tonic-gate + sizeof(*page_lsn) 53*7c478bd9Sstevel@tonic-gate + sizeof(pgno) 54*7c478bd9Sstevel@tonic-gate + sizeof(ptype) 55*7c478bd9Sstevel@tonic-gate + sizeof(next); 56*7c478bd9Sstevel@tonic-gate if ((ret = __os_malloc(logrec.size, NULL, &logrec.data)) != 0) 57*7c478bd9Sstevel@tonic-gate return (ret); 58*7c478bd9Sstevel@tonic-gate 59*7c478bd9Sstevel@tonic-gate bp = logrec.data; 60*7c478bd9Sstevel@tonic-gate memcpy(bp, &rectype, sizeof(rectype)); 61*7c478bd9Sstevel@tonic-gate bp += sizeof(rectype); 62*7c478bd9Sstevel@tonic-gate memcpy(bp, &txn_num, sizeof(txn_num)); 63*7c478bd9Sstevel@tonic-gate bp += sizeof(txn_num); 64*7c478bd9Sstevel@tonic-gate memcpy(bp, lsnp, sizeof(DB_LSN)); 65*7c478bd9Sstevel@tonic-gate bp += sizeof(DB_LSN); 66*7c478bd9Sstevel@tonic-gate memcpy(bp, &fileid, sizeof(fileid)); 67*7c478bd9Sstevel@tonic-gate bp += sizeof(fileid); 68*7c478bd9Sstevel@tonic-gate if (meta_lsn != NULL) 69*7c478bd9Sstevel@tonic-gate memcpy(bp, meta_lsn, sizeof(*meta_lsn)); 70*7c478bd9Sstevel@tonic-gate else 71*7c478bd9Sstevel@tonic-gate memset(bp, 0, sizeof(*meta_lsn)); 72*7c478bd9Sstevel@tonic-gate bp += sizeof(*meta_lsn); 73*7c478bd9Sstevel@tonic-gate if (page_lsn != NULL) 74*7c478bd9Sstevel@tonic-gate memcpy(bp, page_lsn, sizeof(*page_lsn)); 75*7c478bd9Sstevel@tonic-gate else 76*7c478bd9Sstevel@tonic-gate memset(bp, 0, sizeof(*page_lsn)); 77*7c478bd9Sstevel@tonic-gate bp += sizeof(*page_lsn); 78*7c478bd9Sstevel@tonic-gate memcpy(bp, &pgno, sizeof(pgno)); 79*7c478bd9Sstevel@tonic-gate bp += sizeof(pgno); 80*7c478bd9Sstevel@tonic-gate memcpy(bp, &ptype, sizeof(ptype)); 81*7c478bd9Sstevel@tonic-gate bp += sizeof(ptype); 82*7c478bd9Sstevel@tonic-gate memcpy(bp, &next, sizeof(next)); 83*7c478bd9Sstevel@tonic-gate bp += sizeof(next); 84*7c478bd9Sstevel@tonic-gate #ifdef DIAGNOSTIC 85*7c478bd9Sstevel@tonic-gate if ((u_int32_t)(bp - (u_int8_t *)logrec.data) != logrec.size) 86*7c478bd9Sstevel@tonic-gate fprintf(stderr, "Error in log record length"); 87*7c478bd9Sstevel@tonic-gate #endif 88*7c478bd9Sstevel@tonic-gate ret = log_put(logp, ret_lsnp, (DBT *)&logrec, flags); 89*7c478bd9Sstevel@tonic-gate if (txnid != NULL) 90*7c478bd9Sstevel@tonic-gate txnid->last_lsn = *ret_lsnp; 91*7c478bd9Sstevel@tonic-gate __os_free(logrec.data, 0); 92*7c478bd9Sstevel@tonic-gate return (ret); 93*7c478bd9Sstevel@tonic-gate } 94*7c478bd9Sstevel@tonic-gate 95*7c478bd9Sstevel@tonic-gate /* 96*7c478bd9Sstevel@tonic-gate * PUBLIC: int __bam_pg_alloc_print 97*7c478bd9Sstevel@tonic-gate * PUBLIC: __P((DB_LOG *, DBT *, DB_LSN *, int, void *)); 98*7c478bd9Sstevel@tonic-gate */ 99*7c478bd9Sstevel@tonic-gate int 100*7c478bd9Sstevel@tonic-gate __bam_pg_alloc_print(notused1, dbtp, lsnp, notused2, notused3) 101*7c478bd9Sstevel@tonic-gate DB_LOG *notused1; 102*7c478bd9Sstevel@tonic-gate DBT *dbtp; 103*7c478bd9Sstevel@tonic-gate DB_LSN *lsnp; 104*7c478bd9Sstevel@tonic-gate int notused2; 105*7c478bd9Sstevel@tonic-gate void *notused3; 106*7c478bd9Sstevel@tonic-gate { 107*7c478bd9Sstevel@tonic-gate __bam_pg_alloc_args *argp; 108*7c478bd9Sstevel@tonic-gate u_int32_t i; 109*7c478bd9Sstevel@tonic-gate u_int ch; 110*7c478bd9Sstevel@tonic-gate int ret; 111*7c478bd9Sstevel@tonic-gate 112*7c478bd9Sstevel@tonic-gate i = 0; 113*7c478bd9Sstevel@tonic-gate ch = 0; 114*7c478bd9Sstevel@tonic-gate notused1 = NULL; 115*7c478bd9Sstevel@tonic-gate notused2 = 0; 116*7c478bd9Sstevel@tonic-gate notused3 = NULL; 117*7c478bd9Sstevel@tonic-gate 118*7c478bd9Sstevel@tonic-gate if ((ret = __bam_pg_alloc_read(dbtp->data, &argp)) != 0) 119*7c478bd9Sstevel@tonic-gate return (ret); 120*7c478bd9Sstevel@tonic-gate printf("[%lu][%lu]bam_pg_alloc: rec: %lu txnid %lx prevlsn [%lu][%lu]\n", 121*7c478bd9Sstevel@tonic-gate (u_long)lsnp->file, 122*7c478bd9Sstevel@tonic-gate (u_long)lsnp->offset, 123*7c478bd9Sstevel@tonic-gate (u_long)argp->type, 124*7c478bd9Sstevel@tonic-gate (u_long)argp->txnid->txnid, 125*7c478bd9Sstevel@tonic-gate (u_long)argp->prev_lsn.file, 126*7c478bd9Sstevel@tonic-gate (u_long)argp->prev_lsn.offset); 127*7c478bd9Sstevel@tonic-gate printf("\tfileid: %lu\n", (u_long)argp->fileid); 128*7c478bd9Sstevel@tonic-gate printf("\tmeta_lsn: [%lu][%lu]\n", 129*7c478bd9Sstevel@tonic-gate (u_long)argp->meta_lsn.file, (u_long)argp->meta_lsn.offset); 130*7c478bd9Sstevel@tonic-gate printf("\tpage_lsn: [%lu][%lu]\n", 131*7c478bd9Sstevel@tonic-gate (u_long)argp->page_lsn.file, (u_long)argp->page_lsn.offset); 132*7c478bd9Sstevel@tonic-gate printf("\tpgno: %lu\n", (u_long)argp->pgno); 133*7c478bd9Sstevel@tonic-gate printf("\tptype: %lu\n", (u_long)argp->ptype); 134*7c478bd9Sstevel@tonic-gate printf("\tnext: %lu\n", (u_long)argp->next); 135*7c478bd9Sstevel@tonic-gate printf("\n"); 136*7c478bd9Sstevel@tonic-gate __os_free(argp, 0); 137*7c478bd9Sstevel@tonic-gate return (0); 138*7c478bd9Sstevel@tonic-gate } 139*7c478bd9Sstevel@tonic-gate 140*7c478bd9Sstevel@tonic-gate /* 141*7c478bd9Sstevel@tonic-gate * PUBLIC: int __bam_pg_alloc_read __P((void *, __bam_pg_alloc_args **)); 142*7c478bd9Sstevel@tonic-gate */ 143*7c478bd9Sstevel@tonic-gate int 144*7c478bd9Sstevel@tonic-gate __bam_pg_alloc_read(recbuf, argpp) 145*7c478bd9Sstevel@tonic-gate void *recbuf; 146*7c478bd9Sstevel@tonic-gate __bam_pg_alloc_args **argpp; 147*7c478bd9Sstevel@tonic-gate { 148*7c478bd9Sstevel@tonic-gate __bam_pg_alloc_args *argp; 149*7c478bd9Sstevel@tonic-gate u_int8_t *bp; 150*7c478bd9Sstevel@tonic-gate int ret; 151*7c478bd9Sstevel@tonic-gate 152*7c478bd9Sstevel@tonic-gate ret = __os_malloc(sizeof(__bam_pg_alloc_args) + 153*7c478bd9Sstevel@tonic-gate sizeof(DB_TXN), NULL, &argp); 154*7c478bd9Sstevel@tonic-gate if (ret != 0) 155*7c478bd9Sstevel@tonic-gate return (ret); 156*7c478bd9Sstevel@tonic-gate argp->txnid = (DB_TXN *)&argp[1]; 157*7c478bd9Sstevel@tonic-gate bp = recbuf; 158*7c478bd9Sstevel@tonic-gate memcpy(&argp->type, bp, sizeof(argp->type)); 159*7c478bd9Sstevel@tonic-gate bp += sizeof(argp->type); 160*7c478bd9Sstevel@tonic-gate memcpy(&argp->txnid->txnid, bp, sizeof(argp->txnid->txnid)); 161*7c478bd9Sstevel@tonic-gate bp += sizeof(argp->txnid->txnid); 162*7c478bd9Sstevel@tonic-gate memcpy(&argp->prev_lsn, bp, sizeof(DB_LSN)); 163*7c478bd9Sstevel@tonic-gate bp += sizeof(DB_LSN); 164*7c478bd9Sstevel@tonic-gate memcpy(&argp->fileid, bp, sizeof(argp->fileid)); 165*7c478bd9Sstevel@tonic-gate bp += sizeof(argp->fileid); 166*7c478bd9Sstevel@tonic-gate memcpy(&argp->meta_lsn, bp, sizeof(argp->meta_lsn)); 167*7c478bd9Sstevel@tonic-gate bp += sizeof(argp->meta_lsn); 168*7c478bd9Sstevel@tonic-gate memcpy(&argp->page_lsn, bp, sizeof(argp->page_lsn)); 169*7c478bd9Sstevel@tonic-gate bp += sizeof(argp->page_lsn); 170*7c478bd9Sstevel@tonic-gate memcpy(&argp->pgno, bp, sizeof(argp->pgno)); 171*7c478bd9Sstevel@tonic-gate bp += sizeof(argp->pgno); 172*7c478bd9Sstevel@tonic-gate memcpy(&argp->ptype, bp, sizeof(argp->ptype)); 173*7c478bd9Sstevel@tonic-gate bp += sizeof(argp->ptype); 174*7c478bd9Sstevel@tonic-gate memcpy(&argp->next, bp, sizeof(argp->next)); 175*7c478bd9Sstevel@tonic-gate bp += sizeof(argp->next); 176*7c478bd9Sstevel@tonic-gate *argpp = argp; 177*7c478bd9Sstevel@tonic-gate return (0); 178*7c478bd9Sstevel@tonic-gate } 179*7c478bd9Sstevel@tonic-gate 180*7c478bd9Sstevel@tonic-gate /* 181*7c478bd9Sstevel@tonic-gate * PUBLIC: int __bam_pg_free_log 182*7c478bd9Sstevel@tonic-gate * PUBLIC: __P((DB_LOG *, DB_TXN *, DB_LSN *, u_int32_t, 183*7c478bd9Sstevel@tonic-gate * PUBLIC: u_int32_t, db_pgno_t, DB_LSN *, const DBT *, 184*7c478bd9Sstevel@tonic-gate * PUBLIC: db_pgno_t)); 185*7c478bd9Sstevel@tonic-gate */ 186*7c478bd9Sstevel@tonic-gate int __bam_pg_free_log(logp, txnid, ret_lsnp, flags, 187*7c478bd9Sstevel@tonic-gate fileid, pgno, meta_lsn, header, next) 188*7c478bd9Sstevel@tonic-gate DB_LOG *logp; 189*7c478bd9Sstevel@tonic-gate DB_TXN *txnid; 190*7c478bd9Sstevel@tonic-gate DB_LSN *ret_lsnp; 191*7c478bd9Sstevel@tonic-gate u_int32_t flags; 192*7c478bd9Sstevel@tonic-gate u_int32_t fileid; 193*7c478bd9Sstevel@tonic-gate db_pgno_t pgno; 194*7c478bd9Sstevel@tonic-gate DB_LSN * meta_lsn; 195*7c478bd9Sstevel@tonic-gate const DBT *header; 196*7c478bd9Sstevel@tonic-gate db_pgno_t next; 197*7c478bd9Sstevel@tonic-gate { 198*7c478bd9Sstevel@tonic-gate DBT logrec; 199*7c478bd9Sstevel@tonic-gate DB_LSN *lsnp, null_lsn; 200*7c478bd9Sstevel@tonic-gate u_int32_t zero; 201*7c478bd9Sstevel@tonic-gate u_int32_t rectype, txn_num; 202*7c478bd9Sstevel@tonic-gate int ret; 203*7c478bd9Sstevel@tonic-gate u_int8_t *bp; 204*7c478bd9Sstevel@tonic-gate 205*7c478bd9Sstevel@tonic-gate rectype = DB_bam_pg_free; 206*7c478bd9Sstevel@tonic-gate txn_num = txnid == NULL ? 0 : txnid->txnid; 207*7c478bd9Sstevel@tonic-gate if (txnid == NULL) { 208*7c478bd9Sstevel@tonic-gate ZERO_LSN(null_lsn); 209*7c478bd9Sstevel@tonic-gate lsnp = &null_lsn; 210*7c478bd9Sstevel@tonic-gate } else 211*7c478bd9Sstevel@tonic-gate lsnp = &txnid->last_lsn; 212*7c478bd9Sstevel@tonic-gate logrec.size = sizeof(rectype) + sizeof(txn_num) + sizeof(DB_LSN) 213*7c478bd9Sstevel@tonic-gate + sizeof(fileid) 214*7c478bd9Sstevel@tonic-gate + sizeof(pgno) 215*7c478bd9Sstevel@tonic-gate + sizeof(*meta_lsn) 216*7c478bd9Sstevel@tonic-gate + sizeof(u_int32_t) + (header == NULL ? 0 : header->size) 217*7c478bd9Sstevel@tonic-gate + sizeof(next); 218*7c478bd9Sstevel@tonic-gate if ((ret = __os_malloc(logrec.size, NULL, &logrec.data)) != 0) 219*7c478bd9Sstevel@tonic-gate return (ret); 220*7c478bd9Sstevel@tonic-gate 221*7c478bd9Sstevel@tonic-gate bp = logrec.data; 222*7c478bd9Sstevel@tonic-gate memcpy(bp, &rectype, sizeof(rectype)); 223*7c478bd9Sstevel@tonic-gate bp += sizeof(rectype); 224*7c478bd9Sstevel@tonic-gate memcpy(bp, &txn_num, sizeof(txn_num)); 225*7c478bd9Sstevel@tonic-gate bp += sizeof(txn_num); 226*7c478bd9Sstevel@tonic-gate memcpy(bp, lsnp, sizeof(DB_LSN)); 227*7c478bd9Sstevel@tonic-gate bp += sizeof(DB_LSN); 228*7c478bd9Sstevel@tonic-gate memcpy(bp, &fileid, sizeof(fileid)); 229*7c478bd9Sstevel@tonic-gate bp += sizeof(fileid); 230*7c478bd9Sstevel@tonic-gate memcpy(bp, &pgno, sizeof(pgno)); 231*7c478bd9Sstevel@tonic-gate bp += sizeof(pgno); 232*7c478bd9Sstevel@tonic-gate if (meta_lsn != NULL) 233*7c478bd9Sstevel@tonic-gate memcpy(bp, meta_lsn, sizeof(*meta_lsn)); 234*7c478bd9Sstevel@tonic-gate else 235*7c478bd9Sstevel@tonic-gate memset(bp, 0, sizeof(*meta_lsn)); 236*7c478bd9Sstevel@tonic-gate bp += sizeof(*meta_lsn); 237*7c478bd9Sstevel@tonic-gate if (header == NULL) { 238*7c478bd9Sstevel@tonic-gate zero = 0; 239*7c478bd9Sstevel@tonic-gate memcpy(bp, &zero, sizeof(u_int32_t)); 240*7c478bd9Sstevel@tonic-gate bp += sizeof(u_int32_t); 241*7c478bd9Sstevel@tonic-gate } else { 242*7c478bd9Sstevel@tonic-gate memcpy(bp, &header->size, sizeof(header->size)); 243*7c478bd9Sstevel@tonic-gate bp += sizeof(header->size); 244*7c478bd9Sstevel@tonic-gate memcpy(bp, header->data, header->size); 245*7c478bd9Sstevel@tonic-gate bp += header->size; 246*7c478bd9Sstevel@tonic-gate } 247*7c478bd9Sstevel@tonic-gate memcpy(bp, &next, sizeof(next)); 248*7c478bd9Sstevel@tonic-gate bp += sizeof(next); 249*7c478bd9Sstevel@tonic-gate #ifdef DIAGNOSTIC 250*7c478bd9Sstevel@tonic-gate if ((u_int32_t)(bp - (u_int8_t *)logrec.data) != logrec.size) 251*7c478bd9Sstevel@tonic-gate fprintf(stderr, "Error in log record length"); 252*7c478bd9Sstevel@tonic-gate #endif 253*7c478bd9Sstevel@tonic-gate ret = log_put(logp, ret_lsnp, (DBT *)&logrec, flags); 254*7c478bd9Sstevel@tonic-gate if (txnid != NULL) 255*7c478bd9Sstevel@tonic-gate txnid->last_lsn = *ret_lsnp; 256*7c478bd9Sstevel@tonic-gate __os_free(logrec.data, 0); 257*7c478bd9Sstevel@tonic-gate return (ret); 258*7c478bd9Sstevel@tonic-gate } 259*7c478bd9Sstevel@tonic-gate 260*7c478bd9Sstevel@tonic-gate /* 261*7c478bd9Sstevel@tonic-gate * PUBLIC: int __bam_pg_free_print 262*7c478bd9Sstevel@tonic-gate * PUBLIC: __P((DB_LOG *, DBT *, DB_LSN *, int, void *)); 263*7c478bd9Sstevel@tonic-gate */ 264*7c478bd9Sstevel@tonic-gate int 265*7c478bd9Sstevel@tonic-gate __bam_pg_free_print(notused1, dbtp, lsnp, notused2, notused3) 266*7c478bd9Sstevel@tonic-gate DB_LOG *notused1; 267*7c478bd9Sstevel@tonic-gate DBT *dbtp; 268*7c478bd9Sstevel@tonic-gate DB_LSN *lsnp; 269*7c478bd9Sstevel@tonic-gate int notused2; 270*7c478bd9Sstevel@tonic-gate void *notused3; 271*7c478bd9Sstevel@tonic-gate { 272*7c478bd9Sstevel@tonic-gate __bam_pg_free_args *argp; 273*7c478bd9Sstevel@tonic-gate u_int32_t i; 274*7c478bd9Sstevel@tonic-gate u_int ch; 275*7c478bd9Sstevel@tonic-gate int ret; 276*7c478bd9Sstevel@tonic-gate 277*7c478bd9Sstevel@tonic-gate i = 0; 278*7c478bd9Sstevel@tonic-gate ch = 0; 279*7c478bd9Sstevel@tonic-gate notused1 = NULL; 280*7c478bd9Sstevel@tonic-gate notused2 = 0; 281*7c478bd9Sstevel@tonic-gate notused3 = NULL; 282*7c478bd9Sstevel@tonic-gate 283*7c478bd9Sstevel@tonic-gate if ((ret = __bam_pg_free_read(dbtp->data, &argp)) != 0) 284*7c478bd9Sstevel@tonic-gate return (ret); 285*7c478bd9Sstevel@tonic-gate printf("[%lu][%lu]bam_pg_free: rec: %lu txnid %lx prevlsn [%lu][%lu]\n", 286*7c478bd9Sstevel@tonic-gate (u_long)lsnp->file, 287*7c478bd9Sstevel@tonic-gate (u_long)lsnp->offset, 288*7c478bd9Sstevel@tonic-gate (u_long)argp->type, 289*7c478bd9Sstevel@tonic-gate (u_long)argp->txnid->txnid, 290*7c478bd9Sstevel@tonic-gate (u_long)argp->prev_lsn.file, 291*7c478bd9Sstevel@tonic-gate (u_long)argp->prev_lsn.offset); 292*7c478bd9Sstevel@tonic-gate printf("\tfileid: %lu\n", (u_long)argp->fileid); 293*7c478bd9Sstevel@tonic-gate printf("\tpgno: %lu\n", (u_long)argp->pgno); 294*7c478bd9Sstevel@tonic-gate printf("\tmeta_lsn: [%lu][%lu]\n", 295*7c478bd9Sstevel@tonic-gate (u_long)argp->meta_lsn.file, (u_long)argp->meta_lsn.offset); 296*7c478bd9Sstevel@tonic-gate printf("\theader: "); 297*7c478bd9Sstevel@tonic-gate for (i = 0; i < argp->header.size; i++) { 298*7c478bd9Sstevel@tonic-gate ch = ((u_int8_t *)argp->header.data)[i]; 299*7c478bd9Sstevel@tonic-gate if (isprint(ch) || ch == 0xa) 300*7c478bd9Sstevel@tonic-gate putchar(ch); 301*7c478bd9Sstevel@tonic-gate else 302*7c478bd9Sstevel@tonic-gate printf("%#x ", ch); 303*7c478bd9Sstevel@tonic-gate } 304*7c478bd9Sstevel@tonic-gate printf("\n"); 305*7c478bd9Sstevel@tonic-gate printf("\tnext: %lu\n", (u_long)argp->next); 306*7c478bd9Sstevel@tonic-gate printf("\n"); 307*7c478bd9Sstevel@tonic-gate __os_free(argp, 0); 308*7c478bd9Sstevel@tonic-gate return (0); 309*7c478bd9Sstevel@tonic-gate } 310*7c478bd9Sstevel@tonic-gate 311*7c478bd9Sstevel@tonic-gate /* 312*7c478bd9Sstevel@tonic-gate * PUBLIC: int __bam_pg_free_read __P((void *, __bam_pg_free_args **)); 313*7c478bd9Sstevel@tonic-gate */ 314*7c478bd9Sstevel@tonic-gate int 315*7c478bd9Sstevel@tonic-gate __bam_pg_free_read(recbuf, argpp) 316*7c478bd9Sstevel@tonic-gate void *recbuf; 317*7c478bd9Sstevel@tonic-gate __bam_pg_free_args **argpp; 318*7c478bd9Sstevel@tonic-gate { 319*7c478bd9Sstevel@tonic-gate __bam_pg_free_args *argp; 320*7c478bd9Sstevel@tonic-gate u_int8_t *bp; 321*7c478bd9Sstevel@tonic-gate int ret; 322*7c478bd9Sstevel@tonic-gate 323*7c478bd9Sstevel@tonic-gate ret = __os_malloc(sizeof(__bam_pg_free_args) + 324*7c478bd9Sstevel@tonic-gate sizeof(DB_TXN), NULL, &argp); 325*7c478bd9Sstevel@tonic-gate if (ret != 0) 326*7c478bd9Sstevel@tonic-gate return (ret); 327*7c478bd9Sstevel@tonic-gate argp->txnid = (DB_TXN *)&argp[1]; 328*7c478bd9Sstevel@tonic-gate bp = recbuf; 329*7c478bd9Sstevel@tonic-gate memcpy(&argp->type, bp, sizeof(argp->type)); 330*7c478bd9Sstevel@tonic-gate bp += sizeof(argp->type); 331*7c478bd9Sstevel@tonic-gate memcpy(&argp->txnid->txnid, bp, sizeof(argp->txnid->txnid)); 332*7c478bd9Sstevel@tonic-gate bp += sizeof(argp->txnid->txnid); 333*7c478bd9Sstevel@tonic-gate memcpy(&argp->prev_lsn, bp, sizeof(DB_LSN)); 334*7c478bd9Sstevel@tonic-gate bp += sizeof(DB_LSN); 335*7c478bd9Sstevel@tonic-gate memcpy(&argp->fileid, bp, sizeof(argp->fileid)); 336*7c478bd9Sstevel@tonic-gate bp += sizeof(argp->fileid); 337*7c478bd9Sstevel@tonic-gate memcpy(&argp->pgno, bp, sizeof(argp->pgno)); 338*7c478bd9Sstevel@tonic-gate bp += sizeof(argp->pgno); 339*7c478bd9Sstevel@tonic-gate memcpy(&argp->meta_lsn, bp, sizeof(argp->meta_lsn)); 340*7c478bd9Sstevel@tonic-gate bp += sizeof(argp->meta_lsn); 341*7c478bd9Sstevel@tonic-gate memcpy(&argp->header.size, bp, sizeof(u_int32_t)); 342*7c478bd9Sstevel@tonic-gate bp += sizeof(u_int32_t); 343*7c478bd9Sstevel@tonic-gate argp->header.data = bp; 344*7c478bd9Sstevel@tonic-gate bp += argp->header.size; 345*7c478bd9Sstevel@tonic-gate memcpy(&argp->next, bp, sizeof(argp->next)); 346*7c478bd9Sstevel@tonic-gate bp += sizeof(argp->next); 347*7c478bd9Sstevel@tonic-gate *argpp = argp; 348*7c478bd9Sstevel@tonic-gate return (0); 349*7c478bd9Sstevel@tonic-gate } 350*7c478bd9Sstevel@tonic-gate 351*7c478bd9Sstevel@tonic-gate /* 352*7c478bd9Sstevel@tonic-gate * PUBLIC: int __bam_split_log 353*7c478bd9Sstevel@tonic-gate * PUBLIC: __P((DB_LOG *, DB_TXN *, DB_LSN *, u_int32_t, 354*7c478bd9Sstevel@tonic-gate * PUBLIC: u_int32_t, db_pgno_t, DB_LSN *, db_pgno_t, 355*7c478bd9Sstevel@tonic-gate * PUBLIC: DB_LSN *, u_int32_t, db_pgno_t, DB_LSN *, 356*7c478bd9Sstevel@tonic-gate * PUBLIC: const DBT *)); 357*7c478bd9Sstevel@tonic-gate */ 358*7c478bd9Sstevel@tonic-gate int __bam_split_log(logp, txnid, ret_lsnp, flags, 359*7c478bd9Sstevel@tonic-gate fileid, left, llsn, right, rlsn, indx, 360*7c478bd9Sstevel@tonic-gate npgno, nlsn, pg) 361*7c478bd9Sstevel@tonic-gate DB_LOG *logp; 362*7c478bd9Sstevel@tonic-gate DB_TXN *txnid; 363*7c478bd9Sstevel@tonic-gate DB_LSN *ret_lsnp; 364*7c478bd9Sstevel@tonic-gate u_int32_t flags; 365*7c478bd9Sstevel@tonic-gate u_int32_t fileid; 366*7c478bd9Sstevel@tonic-gate db_pgno_t left; 367*7c478bd9Sstevel@tonic-gate DB_LSN * llsn; 368*7c478bd9Sstevel@tonic-gate db_pgno_t right; 369*7c478bd9Sstevel@tonic-gate DB_LSN * rlsn; 370*7c478bd9Sstevel@tonic-gate u_int32_t indx; 371*7c478bd9Sstevel@tonic-gate db_pgno_t npgno; 372*7c478bd9Sstevel@tonic-gate DB_LSN * nlsn; 373*7c478bd9Sstevel@tonic-gate const DBT *pg; 374*7c478bd9Sstevel@tonic-gate { 375*7c478bd9Sstevel@tonic-gate DBT logrec; 376*7c478bd9Sstevel@tonic-gate DB_LSN *lsnp, null_lsn; 377*7c478bd9Sstevel@tonic-gate u_int32_t zero; 378*7c478bd9Sstevel@tonic-gate u_int32_t rectype, txn_num; 379*7c478bd9Sstevel@tonic-gate int ret; 380*7c478bd9Sstevel@tonic-gate u_int8_t *bp; 381*7c478bd9Sstevel@tonic-gate 382*7c478bd9Sstevel@tonic-gate rectype = DB_bam_split; 383*7c478bd9Sstevel@tonic-gate txn_num = txnid == NULL ? 0 : txnid->txnid; 384*7c478bd9Sstevel@tonic-gate if (txnid == NULL) { 385*7c478bd9Sstevel@tonic-gate ZERO_LSN(null_lsn); 386*7c478bd9Sstevel@tonic-gate lsnp = &null_lsn; 387*7c478bd9Sstevel@tonic-gate } else 388*7c478bd9Sstevel@tonic-gate lsnp = &txnid->last_lsn; 389*7c478bd9Sstevel@tonic-gate logrec.size = sizeof(rectype) + sizeof(txn_num) + sizeof(DB_LSN) 390*7c478bd9Sstevel@tonic-gate + sizeof(fileid) 391*7c478bd9Sstevel@tonic-gate + sizeof(left) 392*7c478bd9Sstevel@tonic-gate + sizeof(*llsn) 393*7c478bd9Sstevel@tonic-gate + sizeof(right) 394*7c478bd9Sstevel@tonic-gate + sizeof(*rlsn) 395*7c478bd9Sstevel@tonic-gate + sizeof(indx) 396*7c478bd9Sstevel@tonic-gate + sizeof(npgno) 397*7c478bd9Sstevel@tonic-gate + sizeof(*nlsn) 398*7c478bd9Sstevel@tonic-gate + sizeof(u_int32_t) + (pg == NULL ? 0 : pg->size); 399*7c478bd9Sstevel@tonic-gate if ((ret = __os_malloc(logrec.size, NULL, &logrec.data)) != 0) 400*7c478bd9Sstevel@tonic-gate return (ret); 401*7c478bd9Sstevel@tonic-gate 402*7c478bd9Sstevel@tonic-gate bp = logrec.data; 403*7c478bd9Sstevel@tonic-gate memcpy(bp, &rectype, sizeof(rectype)); 404*7c478bd9Sstevel@tonic-gate bp += sizeof(rectype); 405*7c478bd9Sstevel@tonic-gate memcpy(bp, &txn_num, sizeof(txn_num)); 406*7c478bd9Sstevel@tonic-gate bp += sizeof(txn_num); 407*7c478bd9Sstevel@tonic-gate memcpy(bp, lsnp, sizeof(DB_LSN)); 408*7c478bd9Sstevel@tonic-gate bp += sizeof(DB_LSN); 409*7c478bd9Sstevel@tonic-gate memcpy(bp, &fileid, sizeof(fileid)); 410*7c478bd9Sstevel@tonic-gate bp += sizeof(fileid); 411*7c478bd9Sstevel@tonic-gate memcpy(bp, &left, sizeof(left)); 412*7c478bd9Sstevel@tonic-gate bp += sizeof(left); 413*7c478bd9Sstevel@tonic-gate if (llsn != NULL) 414*7c478bd9Sstevel@tonic-gate memcpy(bp, llsn, sizeof(*llsn)); 415*7c478bd9Sstevel@tonic-gate else 416*7c478bd9Sstevel@tonic-gate memset(bp, 0, sizeof(*llsn)); 417*7c478bd9Sstevel@tonic-gate bp += sizeof(*llsn); 418*7c478bd9Sstevel@tonic-gate memcpy(bp, &right, sizeof(right)); 419*7c478bd9Sstevel@tonic-gate bp += sizeof(right); 420*7c478bd9Sstevel@tonic-gate if (rlsn != NULL) 421*7c478bd9Sstevel@tonic-gate memcpy(bp, rlsn, sizeof(*rlsn)); 422*7c478bd9Sstevel@tonic-gate else 423*7c478bd9Sstevel@tonic-gate memset(bp, 0, sizeof(*rlsn)); 424*7c478bd9Sstevel@tonic-gate bp += sizeof(*rlsn); 425*7c478bd9Sstevel@tonic-gate memcpy(bp, &indx, sizeof(indx)); 426*7c478bd9Sstevel@tonic-gate bp += sizeof(indx); 427*7c478bd9Sstevel@tonic-gate memcpy(bp, &npgno, sizeof(npgno)); 428*7c478bd9Sstevel@tonic-gate bp += sizeof(npgno); 429*7c478bd9Sstevel@tonic-gate if (nlsn != NULL) 430*7c478bd9Sstevel@tonic-gate memcpy(bp, nlsn, sizeof(*nlsn)); 431*7c478bd9Sstevel@tonic-gate else 432*7c478bd9Sstevel@tonic-gate memset(bp, 0, sizeof(*nlsn)); 433*7c478bd9Sstevel@tonic-gate bp += sizeof(*nlsn); 434*7c478bd9Sstevel@tonic-gate if (pg == NULL) { 435*7c478bd9Sstevel@tonic-gate zero = 0; 436*7c478bd9Sstevel@tonic-gate memcpy(bp, &zero, sizeof(u_int32_t)); 437*7c478bd9Sstevel@tonic-gate bp += sizeof(u_int32_t); 438*7c478bd9Sstevel@tonic-gate } else { 439*7c478bd9Sstevel@tonic-gate memcpy(bp, &pg->size, sizeof(pg->size)); 440*7c478bd9Sstevel@tonic-gate bp += sizeof(pg->size); 441*7c478bd9Sstevel@tonic-gate memcpy(bp, pg->data, pg->size); 442*7c478bd9Sstevel@tonic-gate bp += pg->size; 443*7c478bd9Sstevel@tonic-gate } 444*7c478bd9Sstevel@tonic-gate #ifdef DIAGNOSTIC 445*7c478bd9Sstevel@tonic-gate if ((u_int32_t)(bp - (u_int8_t *)logrec.data) != logrec.size) 446*7c478bd9Sstevel@tonic-gate fprintf(stderr, "Error in log record length"); 447*7c478bd9Sstevel@tonic-gate #endif 448*7c478bd9Sstevel@tonic-gate ret = log_put(logp, ret_lsnp, (DBT *)&logrec, flags); 449*7c478bd9Sstevel@tonic-gate if (txnid != NULL) 450*7c478bd9Sstevel@tonic-gate txnid->last_lsn = *ret_lsnp; 451*7c478bd9Sstevel@tonic-gate __os_free(logrec.data, 0); 452*7c478bd9Sstevel@tonic-gate return (ret); 453*7c478bd9Sstevel@tonic-gate } 454*7c478bd9Sstevel@tonic-gate 455*7c478bd9Sstevel@tonic-gate /* 456*7c478bd9Sstevel@tonic-gate * PUBLIC: int __bam_split_print 457*7c478bd9Sstevel@tonic-gate * PUBLIC: __P((DB_LOG *, DBT *, DB_LSN *, int, void *)); 458*7c478bd9Sstevel@tonic-gate */ 459*7c478bd9Sstevel@tonic-gate int 460*7c478bd9Sstevel@tonic-gate __bam_split_print(notused1, dbtp, lsnp, notused2, notused3) 461*7c478bd9Sstevel@tonic-gate DB_LOG *notused1; 462*7c478bd9Sstevel@tonic-gate DBT *dbtp; 463*7c478bd9Sstevel@tonic-gate DB_LSN *lsnp; 464*7c478bd9Sstevel@tonic-gate int notused2; 465*7c478bd9Sstevel@tonic-gate void *notused3; 466*7c478bd9Sstevel@tonic-gate { 467*7c478bd9Sstevel@tonic-gate __bam_split_args *argp; 468*7c478bd9Sstevel@tonic-gate u_int32_t i; 469*7c478bd9Sstevel@tonic-gate u_int ch; 470*7c478bd9Sstevel@tonic-gate int ret; 471*7c478bd9Sstevel@tonic-gate 472*7c478bd9Sstevel@tonic-gate i = 0; 473*7c478bd9Sstevel@tonic-gate ch = 0; 474*7c478bd9Sstevel@tonic-gate notused1 = NULL; 475*7c478bd9Sstevel@tonic-gate notused2 = 0; 476*7c478bd9Sstevel@tonic-gate notused3 = NULL; 477*7c478bd9Sstevel@tonic-gate 478*7c478bd9Sstevel@tonic-gate if ((ret = __bam_split_read(dbtp->data, &argp)) != 0) 479*7c478bd9Sstevel@tonic-gate return (ret); 480*7c478bd9Sstevel@tonic-gate printf("[%lu][%lu]bam_split: rec: %lu txnid %lx prevlsn [%lu][%lu]\n", 481*7c478bd9Sstevel@tonic-gate (u_long)lsnp->file, 482*7c478bd9Sstevel@tonic-gate (u_long)lsnp->offset, 483*7c478bd9Sstevel@tonic-gate (u_long)argp->type, 484*7c478bd9Sstevel@tonic-gate (u_long)argp->txnid->txnid, 485*7c478bd9Sstevel@tonic-gate (u_long)argp->prev_lsn.file, 486*7c478bd9Sstevel@tonic-gate (u_long)argp->prev_lsn.offset); 487*7c478bd9Sstevel@tonic-gate printf("\tfileid: %lu\n", (u_long)argp->fileid); 488*7c478bd9Sstevel@tonic-gate printf("\tleft: %lu\n", (u_long)argp->left); 489*7c478bd9Sstevel@tonic-gate printf("\tllsn: [%lu][%lu]\n", 490*7c478bd9Sstevel@tonic-gate (u_long)argp->llsn.file, (u_long)argp->llsn.offset); 491*7c478bd9Sstevel@tonic-gate printf("\tright: %lu\n", (u_long)argp->right); 492*7c478bd9Sstevel@tonic-gate printf("\trlsn: [%lu][%lu]\n", 493*7c478bd9Sstevel@tonic-gate (u_long)argp->rlsn.file, (u_long)argp->rlsn.offset); 494*7c478bd9Sstevel@tonic-gate printf("\tindx: %lu\n", (u_long)argp->indx); 495*7c478bd9Sstevel@tonic-gate printf("\tnpgno: %lu\n", (u_long)argp->npgno); 496*7c478bd9Sstevel@tonic-gate printf("\tnlsn: [%lu][%lu]\n", 497*7c478bd9Sstevel@tonic-gate (u_long)argp->nlsn.file, (u_long)argp->nlsn.offset); 498*7c478bd9Sstevel@tonic-gate printf("\tpg: "); 499*7c478bd9Sstevel@tonic-gate for (i = 0; i < argp->pg.size; i++) { 500*7c478bd9Sstevel@tonic-gate ch = ((u_int8_t *)argp->pg.data)[i]; 501*7c478bd9Sstevel@tonic-gate if (isprint(ch) || ch == 0xa) 502*7c478bd9Sstevel@tonic-gate putchar(ch); 503*7c478bd9Sstevel@tonic-gate else 504*7c478bd9Sstevel@tonic-gate printf("%#x ", ch); 505*7c478bd9Sstevel@tonic-gate } 506*7c478bd9Sstevel@tonic-gate printf("\n"); 507*7c478bd9Sstevel@tonic-gate printf("\n"); 508*7c478bd9Sstevel@tonic-gate __os_free(argp, 0); 509*7c478bd9Sstevel@tonic-gate return (0); 510*7c478bd9Sstevel@tonic-gate } 511*7c478bd9Sstevel@tonic-gate 512*7c478bd9Sstevel@tonic-gate /* 513*7c478bd9Sstevel@tonic-gate * PUBLIC: int __bam_split_read __P((void *, __bam_split_args **)); 514*7c478bd9Sstevel@tonic-gate */ 515*7c478bd9Sstevel@tonic-gate int 516*7c478bd9Sstevel@tonic-gate __bam_split_read(recbuf, argpp) 517*7c478bd9Sstevel@tonic-gate void *recbuf; 518*7c478bd9Sstevel@tonic-gate __bam_split_args **argpp; 519*7c478bd9Sstevel@tonic-gate { 520*7c478bd9Sstevel@tonic-gate __bam_split_args *argp; 521*7c478bd9Sstevel@tonic-gate u_int8_t *bp; 522*7c478bd9Sstevel@tonic-gate int ret; 523*7c478bd9Sstevel@tonic-gate 524*7c478bd9Sstevel@tonic-gate ret = __os_malloc(sizeof(__bam_split_args) + 525*7c478bd9Sstevel@tonic-gate sizeof(DB_TXN), NULL, &argp); 526*7c478bd9Sstevel@tonic-gate if (ret != 0) 527*7c478bd9Sstevel@tonic-gate return (ret); 528*7c478bd9Sstevel@tonic-gate argp->txnid = (DB_TXN *)&argp[1]; 529*7c478bd9Sstevel@tonic-gate bp = recbuf; 530*7c478bd9Sstevel@tonic-gate memcpy(&argp->type, bp, sizeof(argp->type)); 531*7c478bd9Sstevel@tonic-gate bp += sizeof(argp->type); 532*7c478bd9Sstevel@tonic-gate memcpy(&argp->txnid->txnid, bp, sizeof(argp->txnid->txnid)); 533*7c478bd9Sstevel@tonic-gate bp += sizeof(argp->txnid->txnid); 534*7c478bd9Sstevel@tonic-gate memcpy(&argp->prev_lsn, bp, sizeof(DB_LSN)); 535*7c478bd9Sstevel@tonic-gate bp += sizeof(DB_LSN); 536*7c478bd9Sstevel@tonic-gate memcpy(&argp->fileid, bp, sizeof(argp->fileid)); 537*7c478bd9Sstevel@tonic-gate bp += sizeof(argp->fileid); 538*7c478bd9Sstevel@tonic-gate memcpy(&argp->left, bp, sizeof(argp->left)); 539*7c478bd9Sstevel@tonic-gate bp += sizeof(argp->left); 540*7c478bd9Sstevel@tonic-gate memcpy(&argp->llsn, bp, sizeof(argp->llsn)); 541*7c478bd9Sstevel@tonic-gate bp += sizeof(argp->llsn); 542*7c478bd9Sstevel@tonic-gate memcpy(&argp->right, bp, sizeof(argp->right)); 543*7c478bd9Sstevel@tonic-gate bp += sizeof(argp->right); 544*7c478bd9Sstevel@tonic-gate memcpy(&argp->rlsn, bp, sizeof(argp->rlsn)); 545*7c478bd9Sstevel@tonic-gate bp += sizeof(argp->rlsn); 546*7c478bd9Sstevel@tonic-gate memcpy(&argp->indx, bp, sizeof(argp->indx)); 547*7c478bd9Sstevel@tonic-gate bp += sizeof(argp->indx); 548*7c478bd9Sstevel@tonic-gate memcpy(&argp->npgno, bp, sizeof(argp->npgno)); 549*7c478bd9Sstevel@tonic-gate bp += sizeof(argp->npgno); 550*7c478bd9Sstevel@tonic-gate memcpy(&argp->nlsn, bp, sizeof(argp->nlsn)); 551*7c478bd9Sstevel@tonic-gate bp += sizeof(argp->nlsn); 552*7c478bd9Sstevel@tonic-gate memcpy(&argp->pg.size, bp, sizeof(u_int32_t)); 553*7c478bd9Sstevel@tonic-gate bp += sizeof(u_int32_t); 554*7c478bd9Sstevel@tonic-gate argp->pg.data = bp; 555*7c478bd9Sstevel@tonic-gate bp += argp->pg.size; 556*7c478bd9Sstevel@tonic-gate *argpp = argp; 557*7c478bd9Sstevel@tonic-gate return (0); 558*7c478bd9Sstevel@tonic-gate } 559*7c478bd9Sstevel@tonic-gate 560*7c478bd9Sstevel@tonic-gate /* 561*7c478bd9Sstevel@tonic-gate * PUBLIC: int __bam_rsplit_log 562*7c478bd9Sstevel@tonic-gate * PUBLIC: __P((DB_LOG *, DB_TXN *, DB_LSN *, u_int32_t, 563*7c478bd9Sstevel@tonic-gate * PUBLIC: u_int32_t, db_pgno_t, const DBT *, db_pgno_t, 564*7c478bd9Sstevel@tonic-gate * PUBLIC: const DBT *, DB_LSN *)); 565*7c478bd9Sstevel@tonic-gate */ 566*7c478bd9Sstevel@tonic-gate int __bam_rsplit_log(logp, txnid, ret_lsnp, flags, 567*7c478bd9Sstevel@tonic-gate fileid, pgno, pgdbt, nrec, rootent, rootlsn) 568*7c478bd9Sstevel@tonic-gate DB_LOG *logp; 569*7c478bd9Sstevel@tonic-gate DB_TXN *txnid; 570*7c478bd9Sstevel@tonic-gate DB_LSN *ret_lsnp; 571*7c478bd9Sstevel@tonic-gate u_int32_t flags; 572*7c478bd9Sstevel@tonic-gate u_int32_t fileid; 573*7c478bd9Sstevel@tonic-gate db_pgno_t pgno; 574*7c478bd9Sstevel@tonic-gate const DBT *pgdbt; 575*7c478bd9Sstevel@tonic-gate db_pgno_t nrec; 576*7c478bd9Sstevel@tonic-gate const DBT *rootent; 577*7c478bd9Sstevel@tonic-gate DB_LSN * rootlsn; 578*7c478bd9Sstevel@tonic-gate { 579*7c478bd9Sstevel@tonic-gate DBT logrec; 580*7c478bd9Sstevel@tonic-gate DB_LSN *lsnp, null_lsn; 581*7c478bd9Sstevel@tonic-gate u_int32_t zero; 582*7c478bd9Sstevel@tonic-gate u_int32_t rectype, txn_num; 583*7c478bd9Sstevel@tonic-gate int ret; 584*7c478bd9Sstevel@tonic-gate u_int8_t *bp; 585*7c478bd9Sstevel@tonic-gate 586*7c478bd9Sstevel@tonic-gate rectype = DB_bam_rsplit; 587*7c478bd9Sstevel@tonic-gate txn_num = txnid == NULL ? 0 : txnid->txnid; 588*7c478bd9Sstevel@tonic-gate if (txnid == NULL) { 589*7c478bd9Sstevel@tonic-gate ZERO_LSN(null_lsn); 590*7c478bd9Sstevel@tonic-gate lsnp = &null_lsn; 591*7c478bd9Sstevel@tonic-gate } else 592*7c478bd9Sstevel@tonic-gate lsnp = &txnid->last_lsn; 593*7c478bd9Sstevel@tonic-gate logrec.size = sizeof(rectype) + sizeof(txn_num) + sizeof(DB_LSN) 594*7c478bd9Sstevel@tonic-gate + sizeof(fileid) 595*7c478bd9Sstevel@tonic-gate + sizeof(pgno) 596*7c478bd9Sstevel@tonic-gate + sizeof(u_int32_t) + (pgdbt == NULL ? 0 : pgdbt->size) 597*7c478bd9Sstevel@tonic-gate + sizeof(nrec) 598*7c478bd9Sstevel@tonic-gate + sizeof(u_int32_t) + (rootent == NULL ? 0 : rootent->size) 599*7c478bd9Sstevel@tonic-gate + sizeof(*rootlsn); 600*7c478bd9Sstevel@tonic-gate if ((ret = __os_malloc(logrec.size, NULL, &logrec.data)) != 0) 601*7c478bd9Sstevel@tonic-gate return (ret); 602*7c478bd9Sstevel@tonic-gate 603*7c478bd9Sstevel@tonic-gate bp = logrec.data; 604*7c478bd9Sstevel@tonic-gate memcpy(bp, &rectype, sizeof(rectype)); 605*7c478bd9Sstevel@tonic-gate bp += sizeof(rectype); 606*7c478bd9Sstevel@tonic-gate memcpy(bp, &txn_num, sizeof(txn_num)); 607*7c478bd9Sstevel@tonic-gate bp += sizeof(txn_num); 608*7c478bd9Sstevel@tonic-gate memcpy(bp, lsnp, sizeof(DB_LSN)); 609*7c478bd9Sstevel@tonic-gate bp += sizeof(DB_LSN); 610*7c478bd9Sstevel@tonic-gate memcpy(bp, &fileid, sizeof(fileid)); 611*7c478bd9Sstevel@tonic-gate bp += sizeof(fileid); 612*7c478bd9Sstevel@tonic-gate memcpy(bp, &pgno, sizeof(pgno)); 613*7c478bd9Sstevel@tonic-gate bp += sizeof(pgno); 614*7c478bd9Sstevel@tonic-gate if (pgdbt == NULL) { 615*7c478bd9Sstevel@tonic-gate zero = 0; 616*7c478bd9Sstevel@tonic-gate memcpy(bp, &zero, sizeof(u_int32_t)); 617*7c478bd9Sstevel@tonic-gate bp += sizeof(u_int32_t); 618*7c478bd9Sstevel@tonic-gate } else { 619*7c478bd9Sstevel@tonic-gate memcpy(bp, &pgdbt->size, sizeof(pgdbt->size)); 620*7c478bd9Sstevel@tonic-gate bp += sizeof(pgdbt->size); 621*7c478bd9Sstevel@tonic-gate memcpy(bp, pgdbt->data, pgdbt->size); 622*7c478bd9Sstevel@tonic-gate bp += pgdbt->size; 623*7c478bd9Sstevel@tonic-gate } 624*7c478bd9Sstevel@tonic-gate memcpy(bp, &nrec, sizeof(nrec)); 625*7c478bd9Sstevel@tonic-gate bp += sizeof(nrec); 626*7c478bd9Sstevel@tonic-gate if (rootent == NULL) { 627*7c478bd9Sstevel@tonic-gate zero = 0; 628*7c478bd9Sstevel@tonic-gate memcpy(bp, &zero, sizeof(u_int32_t)); 629*7c478bd9Sstevel@tonic-gate bp += sizeof(u_int32_t); 630*7c478bd9Sstevel@tonic-gate } else { 631*7c478bd9Sstevel@tonic-gate memcpy(bp, &rootent->size, sizeof(rootent->size)); 632*7c478bd9Sstevel@tonic-gate bp += sizeof(rootent->size); 633*7c478bd9Sstevel@tonic-gate memcpy(bp, rootent->data, rootent->size); 634*7c478bd9Sstevel@tonic-gate bp += rootent->size; 635*7c478bd9Sstevel@tonic-gate } 636*7c478bd9Sstevel@tonic-gate if (rootlsn != NULL) 637*7c478bd9Sstevel@tonic-gate memcpy(bp, rootlsn, sizeof(*rootlsn)); 638*7c478bd9Sstevel@tonic-gate else 639*7c478bd9Sstevel@tonic-gate memset(bp, 0, sizeof(*rootlsn)); 640*7c478bd9Sstevel@tonic-gate bp += sizeof(*rootlsn); 641*7c478bd9Sstevel@tonic-gate #ifdef DIAGNOSTIC 642*7c478bd9Sstevel@tonic-gate if ((u_int32_t)(bp - (u_int8_t *)logrec.data) != logrec.size) 643*7c478bd9Sstevel@tonic-gate fprintf(stderr, "Error in log record length"); 644*7c478bd9Sstevel@tonic-gate #endif 645*7c478bd9Sstevel@tonic-gate ret = log_put(logp, ret_lsnp, (DBT *)&logrec, flags); 646*7c478bd9Sstevel@tonic-gate if (txnid != NULL) 647*7c478bd9Sstevel@tonic-gate txnid->last_lsn = *ret_lsnp; 648*7c478bd9Sstevel@tonic-gate __os_free(logrec.data, 0); 649*7c478bd9Sstevel@tonic-gate return (ret); 650*7c478bd9Sstevel@tonic-gate } 651*7c478bd9Sstevel@tonic-gate 652*7c478bd9Sstevel@tonic-gate /* 653*7c478bd9Sstevel@tonic-gate * PUBLIC: int __bam_rsplit_print 654*7c478bd9Sstevel@tonic-gate * PUBLIC: __P((DB_LOG *, DBT *, DB_LSN *, int, void *)); 655*7c478bd9Sstevel@tonic-gate */ 656*7c478bd9Sstevel@tonic-gate int 657*7c478bd9Sstevel@tonic-gate __bam_rsplit_print(notused1, dbtp, lsnp, notused2, notused3) 658*7c478bd9Sstevel@tonic-gate DB_LOG *notused1; 659*7c478bd9Sstevel@tonic-gate DBT *dbtp; 660*7c478bd9Sstevel@tonic-gate DB_LSN *lsnp; 661*7c478bd9Sstevel@tonic-gate int notused2; 662*7c478bd9Sstevel@tonic-gate void *notused3; 663*7c478bd9Sstevel@tonic-gate { 664*7c478bd9Sstevel@tonic-gate __bam_rsplit_args *argp; 665*7c478bd9Sstevel@tonic-gate u_int32_t i; 666*7c478bd9Sstevel@tonic-gate u_int ch; 667*7c478bd9Sstevel@tonic-gate int ret; 668*7c478bd9Sstevel@tonic-gate 669*7c478bd9Sstevel@tonic-gate i = 0; 670*7c478bd9Sstevel@tonic-gate ch = 0; 671*7c478bd9Sstevel@tonic-gate notused1 = NULL; 672*7c478bd9Sstevel@tonic-gate notused2 = 0; 673*7c478bd9Sstevel@tonic-gate notused3 = NULL; 674*7c478bd9Sstevel@tonic-gate 675*7c478bd9Sstevel@tonic-gate if ((ret = __bam_rsplit_read(dbtp->data, &argp)) != 0) 676*7c478bd9Sstevel@tonic-gate return (ret); 677*7c478bd9Sstevel@tonic-gate printf("[%lu][%lu]bam_rsplit: rec: %lu txnid %lx prevlsn [%lu][%lu]\n", 678*7c478bd9Sstevel@tonic-gate (u_long)lsnp->file, 679*7c478bd9Sstevel@tonic-gate (u_long)lsnp->offset, 680*7c478bd9Sstevel@tonic-gate (u_long)argp->type, 681*7c478bd9Sstevel@tonic-gate (u_long)argp->txnid->txnid, 682*7c478bd9Sstevel@tonic-gate (u_long)argp->prev_lsn.file, 683*7c478bd9Sstevel@tonic-gate (u_long)argp->prev_lsn.offset); 684*7c478bd9Sstevel@tonic-gate printf("\tfileid: %lu\n", (u_long)argp->fileid); 685*7c478bd9Sstevel@tonic-gate printf("\tpgno: %lu\n", (u_long)argp->pgno); 686*7c478bd9Sstevel@tonic-gate printf("\tpgdbt: "); 687*7c478bd9Sstevel@tonic-gate for (i = 0; i < argp->pgdbt.size; i++) { 688*7c478bd9Sstevel@tonic-gate ch = ((u_int8_t *)argp->pgdbt.data)[i]; 689*7c478bd9Sstevel@tonic-gate if (isprint(ch) || ch == 0xa) 690*7c478bd9Sstevel@tonic-gate putchar(ch); 691*7c478bd9Sstevel@tonic-gate else 692*7c478bd9Sstevel@tonic-gate printf("%#x ", ch); 693*7c478bd9Sstevel@tonic-gate } 694*7c478bd9Sstevel@tonic-gate printf("\n"); 695*7c478bd9Sstevel@tonic-gate printf("\tnrec: %lu\n", (u_long)argp->nrec); 696*7c478bd9Sstevel@tonic-gate printf("\trootent: "); 697*7c478bd9Sstevel@tonic-gate for (i = 0; i < argp->rootent.size; i++) { 698*7c478bd9Sstevel@tonic-gate ch = ((u_int8_t *)argp->rootent.data)[i]; 699*7c478bd9Sstevel@tonic-gate if (isprint(ch) || ch == 0xa) 700*7c478bd9Sstevel@tonic-gate putchar(ch); 701*7c478bd9Sstevel@tonic-gate else 702*7c478bd9Sstevel@tonic-gate printf("%#x ", ch); 703*7c478bd9Sstevel@tonic-gate } 704*7c478bd9Sstevel@tonic-gate printf("\n"); 705*7c478bd9Sstevel@tonic-gate printf("\trootlsn: [%lu][%lu]\n", 706*7c478bd9Sstevel@tonic-gate (u_long)argp->rootlsn.file, (u_long)argp->rootlsn.offset); 707*7c478bd9Sstevel@tonic-gate printf("\n"); 708*7c478bd9Sstevel@tonic-gate __os_free(argp, 0); 709*7c478bd9Sstevel@tonic-gate return (0); 710*7c478bd9Sstevel@tonic-gate } 711*7c478bd9Sstevel@tonic-gate 712*7c478bd9Sstevel@tonic-gate /* 713*7c478bd9Sstevel@tonic-gate * PUBLIC: int __bam_rsplit_read __P((void *, __bam_rsplit_args **)); 714*7c478bd9Sstevel@tonic-gate */ 715*7c478bd9Sstevel@tonic-gate int 716*7c478bd9Sstevel@tonic-gate __bam_rsplit_read(recbuf, argpp) 717*7c478bd9Sstevel@tonic-gate void *recbuf; 718*7c478bd9Sstevel@tonic-gate __bam_rsplit_args **argpp; 719*7c478bd9Sstevel@tonic-gate { 720*7c478bd9Sstevel@tonic-gate __bam_rsplit_args *argp; 721*7c478bd9Sstevel@tonic-gate u_int8_t *bp; 722*7c478bd9Sstevel@tonic-gate int ret; 723*7c478bd9Sstevel@tonic-gate 724*7c478bd9Sstevel@tonic-gate ret = __os_malloc(sizeof(__bam_rsplit_args) + 725*7c478bd9Sstevel@tonic-gate sizeof(DB_TXN), NULL, &argp); 726*7c478bd9Sstevel@tonic-gate if (ret != 0) 727*7c478bd9Sstevel@tonic-gate return (ret); 728*7c478bd9Sstevel@tonic-gate argp->txnid = (DB_TXN *)&argp[1]; 729*7c478bd9Sstevel@tonic-gate bp = recbuf; 730*7c478bd9Sstevel@tonic-gate memcpy(&argp->type, bp, sizeof(argp->type)); 731*7c478bd9Sstevel@tonic-gate bp += sizeof(argp->type); 732*7c478bd9Sstevel@tonic-gate memcpy(&argp->txnid->txnid, bp, sizeof(argp->txnid->txnid)); 733*7c478bd9Sstevel@tonic-gate bp += sizeof(argp->txnid->txnid); 734*7c478bd9Sstevel@tonic-gate memcpy(&argp->prev_lsn, bp, sizeof(DB_LSN)); 735*7c478bd9Sstevel@tonic-gate bp += sizeof(DB_LSN); 736*7c478bd9Sstevel@tonic-gate memcpy(&argp->fileid, bp, sizeof(argp->fileid)); 737*7c478bd9Sstevel@tonic-gate bp += sizeof(argp->fileid); 738*7c478bd9Sstevel@tonic-gate memcpy(&argp->pgno, bp, sizeof(argp->pgno)); 739*7c478bd9Sstevel@tonic-gate bp += sizeof(argp->pgno); 740*7c478bd9Sstevel@tonic-gate memcpy(&argp->pgdbt.size, bp, sizeof(u_int32_t)); 741*7c478bd9Sstevel@tonic-gate bp += sizeof(u_int32_t); 742*7c478bd9Sstevel@tonic-gate argp->pgdbt.data = bp; 743*7c478bd9Sstevel@tonic-gate bp += argp->pgdbt.size; 744*7c478bd9Sstevel@tonic-gate memcpy(&argp->nrec, bp, sizeof(argp->nrec)); 745*7c478bd9Sstevel@tonic-gate bp += sizeof(argp->nrec); 746*7c478bd9Sstevel@tonic-gate memcpy(&argp->rootent.size, bp, sizeof(u_int32_t)); 747*7c478bd9Sstevel@tonic-gate bp += sizeof(u_int32_t); 748*7c478bd9Sstevel@tonic-gate argp->rootent.data = bp; 749*7c478bd9Sstevel@tonic-gate bp += argp->rootent.size; 750*7c478bd9Sstevel@tonic-gate memcpy(&argp->rootlsn, bp, sizeof(argp->rootlsn)); 751*7c478bd9Sstevel@tonic-gate bp += sizeof(argp->rootlsn); 752*7c478bd9Sstevel@tonic-gate *argpp = argp; 753*7c478bd9Sstevel@tonic-gate return (0); 754*7c478bd9Sstevel@tonic-gate } 755*7c478bd9Sstevel@tonic-gate 756*7c478bd9Sstevel@tonic-gate /* 757*7c478bd9Sstevel@tonic-gate * PUBLIC: int __bam_adj_log 758*7c478bd9Sstevel@tonic-gate * PUBLIC: __P((DB_LOG *, DB_TXN *, DB_LSN *, u_int32_t, 759*7c478bd9Sstevel@tonic-gate * PUBLIC: u_int32_t, db_pgno_t, DB_LSN *, u_int32_t, 760*7c478bd9Sstevel@tonic-gate * PUBLIC: u_int32_t, u_int32_t)); 761*7c478bd9Sstevel@tonic-gate */ 762*7c478bd9Sstevel@tonic-gate int __bam_adj_log(logp, txnid, ret_lsnp, flags, 763*7c478bd9Sstevel@tonic-gate fileid, pgno, lsn, indx, indx_copy, is_insert) 764*7c478bd9Sstevel@tonic-gate DB_LOG *logp; 765*7c478bd9Sstevel@tonic-gate DB_TXN *txnid; 766*7c478bd9Sstevel@tonic-gate DB_LSN *ret_lsnp; 767*7c478bd9Sstevel@tonic-gate u_int32_t flags; 768*7c478bd9Sstevel@tonic-gate u_int32_t fileid; 769*7c478bd9Sstevel@tonic-gate db_pgno_t pgno; 770*7c478bd9Sstevel@tonic-gate DB_LSN * lsn; 771*7c478bd9Sstevel@tonic-gate u_int32_t indx; 772*7c478bd9Sstevel@tonic-gate u_int32_t indx_copy; 773*7c478bd9Sstevel@tonic-gate u_int32_t is_insert; 774*7c478bd9Sstevel@tonic-gate { 775*7c478bd9Sstevel@tonic-gate DBT logrec; 776*7c478bd9Sstevel@tonic-gate DB_LSN *lsnp, null_lsn; 777*7c478bd9Sstevel@tonic-gate u_int32_t rectype, txn_num; 778*7c478bd9Sstevel@tonic-gate int ret; 779*7c478bd9Sstevel@tonic-gate u_int8_t *bp; 780*7c478bd9Sstevel@tonic-gate 781*7c478bd9Sstevel@tonic-gate rectype = DB_bam_adj; 782*7c478bd9Sstevel@tonic-gate txn_num = txnid == NULL ? 0 : txnid->txnid; 783*7c478bd9Sstevel@tonic-gate if (txnid == NULL) { 784*7c478bd9Sstevel@tonic-gate ZERO_LSN(null_lsn); 785*7c478bd9Sstevel@tonic-gate lsnp = &null_lsn; 786*7c478bd9Sstevel@tonic-gate } else 787*7c478bd9Sstevel@tonic-gate lsnp = &txnid->last_lsn; 788*7c478bd9Sstevel@tonic-gate logrec.size = sizeof(rectype) + sizeof(txn_num) + sizeof(DB_LSN) 789*7c478bd9Sstevel@tonic-gate + sizeof(fileid) 790*7c478bd9Sstevel@tonic-gate + sizeof(pgno) 791*7c478bd9Sstevel@tonic-gate + sizeof(*lsn) 792*7c478bd9Sstevel@tonic-gate + sizeof(indx) 793*7c478bd9Sstevel@tonic-gate + sizeof(indx_copy) 794*7c478bd9Sstevel@tonic-gate + sizeof(is_insert); 795*7c478bd9Sstevel@tonic-gate if ((ret = __os_malloc(logrec.size, NULL, &logrec.data)) != 0) 796*7c478bd9Sstevel@tonic-gate return (ret); 797*7c478bd9Sstevel@tonic-gate 798*7c478bd9Sstevel@tonic-gate bp = logrec.data; 799*7c478bd9Sstevel@tonic-gate memcpy(bp, &rectype, sizeof(rectype)); 800*7c478bd9Sstevel@tonic-gate bp += sizeof(rectype); 801*7c478bd9Sstevel@tonic-gate memcpy(bp, &txn_num, sizeof(txn_num)); 802*7c478bd9Sstevel@tonic-gate bp += sizeof(txn_num); 803*7c478bd9Sstevel@tonic-gate memcpy(bp, lsnp, sizeof(DB_LSN)); 804*7c478bd9Sstevel@tonic-gate bp += sizeof(DB_LSN); 805*7c478bd9Sstevel@tonic-gate memcpy(bp, &fileid, sizeof(fileid)); 806*7c478bd9Sstevel@tonic-gate bp += sizeof(fileid); 807*7c478bd9Sstevel@tonic-gate memcpy(bp, &pgno, sizeof(pgno)); 808*7c478bd9Sstevel@tonic-gate bp += sizeof(pgno); 809*7c478bd9Sstevel@tonic-gate if (lsn != NULL) 810*7c478bd9Sstevel@tonic-gate memcpy(bp, lsn, sizeof(*lsn)); 811*7c478bd9Sstevel@tonic-gate else 812*7c478bd9Sstevel@tonic-gate memset(bp, 0, sizeof(*lsn)); 813*7c478bd9Sstevel@tonic-gate bp += sizeof(*lsn); 814*7c478bd9Sstevel@tonic-gate memcpy(bp, &indx, sizeof(indx)); 815*7c478bd9Sstevel@tonic-gate bp += sizeof(indx); 816*7c478bd9Sstevel@tonic-gate memcpy(bp, &indx_copy, sizeof(indx_copy)); 817*7c478bd9Sstevel@tonic-gate bp += sizeof(indx_copy); 818*7c478bd9Sstevel@tonic-gate memcpy(bp, &is_insert, sizeof(is_insert)); 819*7c478bd9Sstevel@tonic-gate bp += sizeof(is_insert); 820*7c478bd9Sstevel@tonic-gate #ifdef DIAGNOSTIC 821*7c478bd9Sstevel@tonic-gate if ((u_int32_t)(bp - (u_int8_t *)logrec.data) != logrec.size) 822*7c478bd9Sstevel@tonic-gate fprintf(stderr, "Error in log record length"); 823*7c478bd9Sstevel@tonic-gate #endif 824*7c478bd9Sstevel@tonic-gate ret = log_put(logp, ret_lsnp, (DBT *)&logrec, flags); 825*7c478bd9Sstevel@tonic-gate if (txnid != NULL) 826*7c478bd9Sstevel@tonic-gate txnid->last_lsn = *ret_lsnp; 827*7c478bd9Sstevel@tonic-gate __os_free(logrec.data, 0); 828*7c478bd9Sstevel@tonic-gate return (ret); 829*7c478bd9Sstevel@tonic-gate } 830*7c478bd9Sstevel@tonic-gate 831*7c478bd9Sstevel@tonic-gate /* 832*7c478bd9Sstevel@tonic-gate * PUBLIC: int __bam_adj_print 833*7c478bd9Sstevel@tonic-gate * PUBLIC: __P((DB_LOG *, DBT *, DB_LSN *, int, void *)); 834*7c478bd9Sstevel@tonic-gate */ 835*7c478bd9Sstevel@tonic-gate int 836*7c478bd9Sstevel@tonic-gate __bam_adj_print(notused1, dbtp, lsnp, notused2, notused3) 837*7c478bd9Sstevel@tonic-gate DB_LOG *notused1; 838*7c478bd9Sstevel@tonic-gate DBT *dbtp; 839*7c478bd9Sstevel@tonic-gate DB_LSN *lsnp; 840*7c478bd9Sstevel@tonic-gate int notused2; 841*7c478bd9Sstevel@tonic-gate void *notused3; 842*7c478bd9Sstevel@tonic-gate { 843*7c478bd9Sstevel@tonic-gate __bam_adj_args *argp; 844*7c478bd9Sstevel@tonic-gate u_int32_t i; 845*7c478bd9Sstevel@tonic-gate u_int ch; 846*7c478bd9Sstevel@tonic-gate int ret; 847*7c478bd9Sstevel@tonic-gate 848*7c478bd9Sstevel@tonic-gate i = 0; 849*7c478bd9Sstevel@tonic-gate ch = 0; 850*7c478bd9Sstevel@tonic-gate notused1 = NULL; 851*7c478bd9Sstevel@tonic-gate notused2 = 0; 852*7c478bd9Sstevel@tonic-gate notused3 = NULL; 853*7c478bd9Sstevel@tonic-gate 854*7c478bd9Sstevel@tonic-gate if ((ret = __bam_adj_read(dbtp->data, &argp)) != 0) 855*7c478bd9Sstevel@tonic-gate return (ret); 856*7c478bd9Sstevel@tonic-gate printf("[%lu][%lu]bam_adj: rec: %lu txnid %lx prevlsn [%lu][%lu]\n", 857*7c478bd9Sstevel@tonic-gate (u_long)lsnp->file, 858*7c478bd9Sstevel@tonic-gate (u_long)lsnp->offset, 859*7c478bd9Sstevel@tonic-gate (u_long)argp->type, 860*7c478bd9Sstevel@tonic-gate (u_long)argp->txnid->txnid, 861*7c478bd9Sstevel@tonic-gate (u_long)argp->prev_lsn.file, 862*7c478bd9Sstevel@tonic-gate (u_long)argp->prev_lsn.offset); 863*7c478bd9Sstevel@tonic-gate printf("\tfileid: %lu\n", (u_long)argp->fileid); 864*7c478bd9Sstevel@tonic-gate printf("\tpgno: %lu\n", (u_long)argp->pgno); 865*7c478bd9Sstevel@tonic-gate printf("\tlsn: [%lu][%lu]\n", 866*7c478bd9Sstevel@tonic-gate (u_long)argp->lsn.file, (u_long)argp->lsn.offset); 867*7c478bd9Sstevel@tonic-gate printf("\tindx: %lu\n", (u_long)argp->indx); 868*7c478bd9Sstevel@tonic-gate printf("\tindx_copy: %lu\n", (u_long)argp->indx_copy); 869*7c478bd9Sstevel@tonic-gate printf("\tis_insert: %lu\n", (u_long)argp->is_insert); 870*7c478bd9Sstevel@tonic-gate printf("\n"); 871*7c478bd9Sstevel@tonic-gate __os_free(argp, 0); 872*7c478bd9Sstevel@tonic-gate return (0); 873*7c478bd9Sstevel@tonic-gate } 874*7c478bd9Sstevel@tonic-gate 875*7c478bd9Sstevel@tonic-gate /* 876*7c478bd9Sstevel@tonic-gate * PUBLIC: int __bam_adj_read __P((void *, __bam_adj_args **)); 877*7c478bd9Sstevel@tonic-gate */ 878*7c478bd9Sstevel@tonic-gate int 879*7c478bd9Sstevel@tonic-gate __bam_adj_read(recbuf, argpp) 880*7c478bd9Sstevel@tonic-gate void *recbuf; 881*7c478bd9Sstevel@tonic-gate __bam_adj_args **argpp; 882*7c478bd9Sstevel@tonic-gate { 883*7c478bd9Sstevel@tonic-gate __bam_adj_args *argp; 884*7c478bd9Sstevel@tonic-gate u_int8_t *bp; 885*7c478bd9Sstevel@tonic-gate int ret; 886*7c478bd9Sstevel@tonic-gate 887*7c478bd9Sstevel@tonic-gate ret = __os_malloc(sizeof(__bam_adj_args) + 888*7c478bd9Sstevel@tonic-gate sizeof(DB_TXN), NULL, &argp); 889*7c478bd9Sstevel@tonic-gate if (ret != 0) 890*7c478bd9Sstevel@tonic-gate return (ret); 891*7c478bd9Sstevel@tonic-gate argp->txnid = (DB_TXN *)&argp[1]; 892*7c478bd9Sstevel@tonic-gate bp = recbuf; 893*7c478bd9Sstevel@tonic-gate memcpy(&argp->type, bp, sizeof(argp->type)); 894*7c478bd9Sstevel@tonic-gate bp += sizeof(argp->type); 895*7c478bd9Sstevel@tonic-gate memcpy(&argp->txnid->txnid, bp, sizeof(argp->txnid->txnid)); 896*7c478bd9Sstevel@tonic-gate bp += sizeof(argp->txnid->txnid); 897*7c478bd9Sstevel@tonic-gate memcpy(&argp->prev_lsn, bp, sizeof(DB_LSN)); 898*7c478bd9Sstevel@tonic-gate bp += sizeof(DB_LSN); 899*7c478bd9Sstevel@tonic-gate memcpy(&argp->fileid, bp, sizeof(argp->fileid)); 900*7c478bd9Sstevel@tonic-gate bp += sizeof(argp->fileid); 901*7c478bd9Sstevel@tonic-gate memcpy(&argp->pgno, bp, sizeof(argp->pgno)); 902*7c478bd9Sstevel@tonic-gate bp += sizeof(argp->pgno); 903*7c478bd9Sstevel@tonic-gate memcpy(&argp->lsn, bp, sizeof(argp->lsn)); 904*7c478bd9Sstevel@tonic-gate bp += sizeof(argp->lsn); 905*7c478bd9Sstevel@tonic-gate memcpy(&argp->indx, bp, sizeof(argp->indx)); 906*7c478bd9Sstevel@tonic-gate bp += sizeof(argp->indx); 907*7c478bd9Sstevel@tonic-gate memcpy(&argp->indx_copy, bp, sizeof(argp->indx_copy)); 908*7c478bd9Sstevel@tonic-gate bp += sizeof(argp->indx_copy); 909*7c478bd9Sstevel@tonic-gate memcpy(&argp->is_insert, bp, sizeof(argp->is_insert)); 910*7c478bd9Sstevel@tonic-gate bp += sizeof(argp->is_insert); 911*7c478bd9Sstevel@tonic-gate *argpp = argp; 912*7c478bd9Sstevel@tonic-gate return (0); 913*7c478bd9Sstevel@tonic-gate } 914*7c478bd9Sstevel@tonic-gate 915*7c478bd9Sstevel@tonic-gate /* 916*7c478bd9Sstevel@tonic-gate * PUBLIC: int __bam_cadjust_log 917*7c478bd9Sstevel@tonic-gate * PUBLIC: __P((DB_LOG *, DB_TXN *, DB_LSN *, u_int32_t, 918*7c478bd9Sstevel@tonic-gate * PUBLIC: u_int32_t, db_pgno_t, DB_LSN *, u_int32_t, 919*7c478bd9Sstevel@tonic-gate * PUBLIC: int32_t, int32_t)); 920*7c478bd9Sstevel@tonic-gate */ 921*7c478bd9Sstevel@tonic-gate int __bam_cadjust_log(logp, txnid, ret_lsnp, flags, 922*7c478bd9Sstevel@tonic-gate fileid, pgno, lsn, indx, adjust, total) 923*7c478bd9Sstevel@tonic-gate DB_LOG *logp; 924*7c478bd9Sstevel@tonic-gate DB_TXN *txnid; 925*7c478bd9Sstevel@tonic-gate DB_LSN *ret_lsnp; 926*7c478bd9Sstevel@tonic-gate u_int32_t flags; 927*7c478bd9Sstevel@tonic-gate u_int32_t fileid; 928*7c478bd9Sstevel@tonic-gate db_pgno_t pgno; 929*7c478bd9Sstevel@tonic-gate DB_LSN * lsn; 930*7c478bd9Sstevel@tonic-gate u_int32_t indx; 931*7c478bd9Sstevel@tonic-gate int32_t adjust; 932*7c478bd9Sstevel@tonic-gate int32_t total; 933*7c478bd9Sstevel@tonic-gate { 934*7c478bd9Sstevel@tonic-gate DBT logrec; 935*7c478bd9Sstevel@tonic-gate DB_LSN *lsnp, null_lsn; 936*7c478bd9Sstevel@tonic-gate u_int32_t rectype, txn_num; 937*7c478bd9Sstevel@tonic-gate int ret; 938*7c478bd9Sstevel@tonic-gate u_int8_t *bp; 939*7c478bd9Sstevel@tonic-gate 940*7c478bd9Sstevel@tonic-gate rectype = DB_bam_cadjust; 941*7c478bd9Sstevel@tonic-gate txn_num = txnid == NULL ? 0 : txnid->txnid; 942*7c478bd9Sstevel@tonic-gate if (txnid == NULL) { 943*7c478bd9Sstevel@tonic-gate ZERO_LSN(null_lsn); 944*7c478bd9Sstevel@tonic-gate lsnp = &null_lsn; 945*7c478bd9Sstevel@tonic-gate } else 946*7c478bd9Sstevel@tonic-gate lsnp = &txnid->last_lsn; 947*7c478bd9Sstevel@tonic-gate logrec.size = sizeof(rectype) + sizeof(txn_num) + sizeof(DB_LSN) 948*7c478bd9Sstevel@tonic-gate + sizeof(fileid) 949*7c478bd9Sstevel@tonic-gate + sizeof(pgno) 950*7c478bd9Sstevel@tonic-gate + sizeof(*lsn) 951*7c478bd9Sstevel@tonic-gate + sizeof(indx) 952*7c478bd9Sstevel@tonic-gate + sizeof(adjust) 953*7c478bd9Sstevel@tonic-gate + sizeof(total); 954*7c478bd9Sstevel@tonic-gate if ((ret = __os_malloc(logrec.size, NULL, &logrec.data)) != 0) 955*7c478bd9Sstevel@tonic-gate return (ret); 956*7c478bd9Sstevel@tonic-gate 957*7c478bd9Sstevel@tonic-gate bp = logrec.data; 958*7c478bd9Sstevel@tonic-gate memcpy(bp, &rectype, sizeof(rectype)); 959*7c478bd9Sstevel@tonic-gate bp += sizeof(rectype); 960*7c478bd9Sstevel@tonic-gate memcpy(bp, &txn_num, sizeof(txn_num)); 961*7c478bd9Sstevel@tonic-gate bp += sizeof(txn_num); 962*7c478bd9Sstevel@tonic-gate memcpy(bp, lsnp, sizeof(DB_LSN)); 963*7c478bd9Sstevel@tonic-gate bp += sizeof(DB_LSN); 964*7c478bd9Sstevel@tonic-gate memcpy(bp, &fileid, sizeof(fileid)); 965*7c478bd9Sstevel@tonic-gate bp += sizeof(fileid); 966*7c478bd9Sstevel@tonic-gate memcpy(bp, &pgno, sizeof(pgno)); 967*7c478bd9Sstevel@tonic-gate bp += sizeof(pgno); 968*7c478bd9Sstevel@tonic-gate if (lsn != NULL) 969*7c478bd9Sstevel@tonic-gate memcpy(bp, lsn, sizeof(*lsn)); 970*7c478bd9Sstevel@tonic-gate else 971*7c478bd9Sstevel@tonic-gate memset(bp, 0, sizeof(*lsn)); 972*7c478bd9Sstevel@tonic-gate bp += sizeof(*lsn); 973*7c478bd9Sstevel@tonic-gate memcpy(bp, &indx, sizeof(indx)); 974*7c478bd9Sstevel@tonic-gate bp += sizeof(indx); 975*7c478bd9Sstevel@tonic-gate memcpy(bp, &adjust, sizeof(adjust)); 976*7c478bd9Sstevel@tonic-gate bp += sizeof(adjust); 977*7c478bd9Sstevel@tonic-gate memcpy(bp, &total, sizeof(total)); 978*7c478bd9Sstevel@tonic-gate bp += sizeof(total); 979*7c478bd9Sstevel@tonic-gate #ifdef DIAGNOSTIC 980*7c478bd9Sstevel@tonic-gate if ((u_int32_t)(bp - (u_int8_t *)logrec.data) != logrec.size) 981*7c478bd9Sstevel@tonic-gate fprintf(stderr, "Error in log record length"); 982*7c478bd9Sstevel@tonic-gate #endif 983*7c478bd9Sstevel@tonic-gate ret = log_put(logp, ret_lsnp, (DBT *)&logrec, flags); 984*7c478bd9Sstevel@tonic-gate if (txnid != NULL) 985*7c478bd9Sstevel@tonic-gate txnid->last_lsn = *ret_lsnp; 986*7c478bd9Sstevel@tonic-gate __os_free(logrec.data, 0); 987*7c478bd9Sstevel@tonic-gate return (ret); 988*7c478bd9Sstevel@tonic-gate } 989*7c478bd9Sstevel@tonic-gate 990*7c478bd9Sstevel@tonic-gate /* 991*7c478bd9Sstevel@tonic-gate * PUBLIC: int __bam_cadjust_print 992*7c478bd9Sstevel@tonic-gate * PUBLIC: __P((DB_LOG *, DBT *, DB_LSN *, int, void *)); 993*7c478bd9Sstevel@tonic-gate */ 994*7c478bd9Sstevel@tonic-gate int 995*7c478bd9Sstevel@tonic-gate __bam_cadjust_print(notused1, dbtp, lsnp, notused2, notused3) 996*7c478bd9Sstevel@tonic-gate DB_LOG *notused1; 997*7c478bd9Sstevel@tonic-gate DBT *dbtp; 998*7c478bd9Sstevel@tonic-gate DB_LSN *lsnp; 999*7c478bd9Sstevel@tonic-gate int notused2; 1000*7c478bd9Sstevel@tonic-gate void *notused3; 1001*7c478bd9Sstevel@tonic-gate { 1002*7c478bd9Sstevel@tonic-gate __bam_cadjust_args *argp; 1003*7c478bd9Sstevel@tonic-gate u_int32_t i; 1004*7c478bd9Sstevel@tonic-gate u_int ch; 1005*7c478bd9Sstevel@tonic-gate int ret; 1006*7c478bd9Sstevel@tonic-gate 1007*7c478bd9Sstevel@tonic-gate i = 0; 1008*7c478bd9Sstevel@tonic-gate ch = 0; 1009*7c478bd9Sstevel@tonic-gate notused1 = NULL; 1010*7c478bd9Sstevel@tonic-gate notused2 = 0; 1011*7c478bd9Sstevel@tonic-gate notused3 = NULL; 1012*7c478bd9Sstevel@tonic-gate 1013*7c478bd9Sstevel@tonic-gate if ((ret = __bam_cadjust_read(dbtp->data, &argp)) != 0) 1014*7c478bd9Sstevel@tonic-gate return (ret); 1015*7c478bd9Sstevel@tonic-gate printf("[%lu][%lu]bam_cadjust: rec: %lu txnid %lx prevlsn [%lu][%lu]\n", 1016*7c478bd9Sstevel@tonic-gate (u_long)lsnp->file, 1017*7c478bd9Sstevel@tonic-gate (u_long)lsnp->offset, 1018*7c478bd9Sstevel@tonic-gate (u_long)argp->type, 1019*7c478bd9Sstevel@tonic-gate (u_long)argp->txnid->txnid, 1020*7c478bd9Sstevel@tonic-gate (u_long)argp->prev_lsn.file, 1021*7c478bd9Sstevel@tonic-gate (u_long)argp->prev_lsn.offset); 1022*7c478bd9Sstevel@tonic-gate printf("\tfileid: %lu\n", (u_long)argp->fileid); 1023*7c478bd9Sstevel@tonic-gate printf("\tpgno: %lu\n", (u_long)argp->pgno); 1024*7c478bd9Sstevel@tonic-gate printf("\tlsn: [%lu][%lu]\n", 1025*7c478bd9Sstevel@tonic-gate (u_long)argp->lsn.file, (u_long)argp->lsn.offset); 1026*7c478bd9Sstevel@tonic-gate printf("\tindx: %lu\n", (u_long)argp->indx); 1027*7c478bd9Sstevel@tonic-gate printf("\tadjust: %ld\n", (long)argp->adjust); 1028*7c478bd9Sstevel@tonic-gate printf("\ttotal: %ld\n", (long)argp->total); 1029*7c478bd9Sstevel@tonic-gate printf("\n"); 1030*7c478bd9Sstevel@tonic-gate __os_free(argp, 0); 1031*7c478bd9Sstevel@tonic-gate return (0); 1032*7c478bd9Sstevel@tonic-gate } 1033*7c478bd9Sstevel@tonic-gate 1034*7c478bd9Sstevel@tonic-gate /* 1035*7c478bd9Sstevel@tonic-gate * PUBLIC: int __bam_cadjust_read __P((void *, __bam_cadjust_args **)); 1036*7c478bd9Sstevel@tonic-gate */ 1037*7c478bd9Sstevel@tonic-gate int 1038*7c478bd9Sstevel@tonic-gate __bam_cadjust_read(recbuf, argpp) 1039*7c478bd9Sstevel@tonic-gate void *recbuf; 1040*7c478bd9Sstevel@tonic-gate __bam_cadjust_args **argpp; 1041*7c478bd9Sstevel@tonic-gate { 1042*7c478bd9Sstevel@tonic-gate __bam_cadjust_args *argp; 1043*7c478bd9Sstevel@tonic-gate u_int8_t *bp; 1044*7c478bd9Sstevel@tonic-gate int ret; 1045*7c478bd9Sstevel@tonic-gate 1046*7c478bd9Sstevel@tonic-gate ret = __os_malloc(sizeof(__bam_cadjust_args) + 1047*7c478bd9Sstevel@tonic-gate sizeof(DB_TXN), NULL, &argp); 1048*7c478bd9Sstevel@tonic-gate if (ret != 0) 1049*7c478bd9Sstevel@tonic-gate return (ret); 1050*7c478bd9Sstevel@tonic-gate argp->txnid = (DB_TXN *)&argp[1]; 1051*7c478bd9Sstevel@tonic-gate bp = recbuf; 1052*7c478bd9Sstevel@tonic-gate memcpy(&argp->type, bp, sizeof(argp->type)); 1053*7c478bd9Sstevel@tonic-gate bp += sizeof(argp->type); 1054*7c478bd9Sstevel@tonic-gate memcpy(&argp->txnid->txnid, bp, sizeof(argp->txnid->txnid)); 1055*7c478bd9Sstevel@tonic-gate bp += sizeof(argp->txnid->txnid); 1056*7c478bd9Sstevel@tonic-gate memcpy(&argp->prev_lsn, bp, sizeof(DB_LSN)); 1057*7c478bd9Sstevel@tonic-gate bp += sizeof(DB_LSN); 1058*7c478bd9Sstevel@tonic-gate memcpy(&argp->fileid, bp, sizeof(argp->fileid)); 1059*7c478bd9Sstevel@tonic-gate bp += sizeof(argp->fileid); 1060*7c478bd9Sstevel@tonic-gate memcpy(&argp->pgno, bp, sizeof(argp->pgno)); 1061*7c478bd9Sstevel@tonic-gate bp += sizeof(argp->pgno); 1062*7c478bd9Sstevel@tonic-gate memcpy(&argp->lsn, bp, sizeof(argp->lsn)); 1063*7c478bd9Sstevel@tonic-gate bp += sizeof(argp->lsn); 1064*7c478bd9Sstevel@tonic-gate memcpy(&argp->indx, bp, sizeof(argp->indx)); 1065*7c478bd9Sstevel@tonic-gate bp += sizeof(argp->indx); 1066*7c478bd9Sstevel@tonic-gate memcpy(&argp->adjust, bp, sizeof(argp->adjust)); 1067*7c478bd9Sstevel@tonic-gate bp += sizeof(argp->adjust); 1068*7c478bd9Sstevel@tonic-gate memcpy(&argp->total, bp, sizeof(argp->total)); 1069*7c478bd9Sstevel@tonic-gate bp += sizeof(argp->total); 1070*7c478bd9Sstevel@tonic-gate *argpp = argp; 1071*7c478bd9Sstevel@tonic-gate return (0); 1072*7c478bd9Sstevel@tonic-gate } 1073*7c478bd9Sstevel@tonic-gate 1074*7c478bd9Sstevel@tonic-gate /* 1075*7c478bd9Sstevel@tonic-gate * PUBLIC: int __bam_cdel_log 1076*7c478bd9Sstevel@tonic-gate * PUBLIC: __P((DB_LOG *, DB_TXN *, DB_LSN *, u_int32_t, 1077*7c478bd9Sstevel@tonic-gate * PUBLIC: u_int32_t, db_pgno_t, DB_LSN *, u_int32_t)); 1078*7c478bd9Sstevel@tonic-gate */ 1079*7c478bd9Sstevel@tonic-gate int __bam_cdel_log(logp, txnid, ret_lsnp, flags, 1080*7c478bd9Sstevel@tonic-gate fileid, pgno, lsn, indx) 1081*7c478bd9Sstevel@tonic-gate DB_LOG *logp; 1082*7c478bd9Sstevel@tonic-gate DB_TXN *txnid; 1083*7c478bd9Sstevel@tonic-gate DB_LSN *ret_lsnp; 1084*7c478bd9Sstevel@tonic-gate u_int32_t flags; 1085*7c478bd9Sstevel@tonic-gate u_int32_t fileid; 1086*7c478bd9Sstevel@tonic-gate db_pgno_t pgno; 1087*7c478bd9Sstevel@tonic-gate DB_LSN * lsn; 1088*7c478bd9Sstevel@tonic-gate u_int32_t indx; 1089*7c478bd9Sstevel@tonic-gate { 1090*7c478bd9Sstevel@tonic-gate DBT logrec; 1091*7c478bd9Sstevel@tonic-gate DB_LSN *lsnp, null_lsn; 1092*7c478bd9Sstevel@tonic-gate u_int32_t rectype, txn_num; 1093*7c478bd9Sstevel@tonic-gate int ret; 1094*7c478bd9Sstevel@tonic-gate u_int8_t *bp; 1095*7c478bd9Sstevel@tonic-gate 1096*7c478bd9Sstevel@tonic-gate rectype = DB_bam_cdel; 1097*7c478bd9Sstevel@tonic-gate txn_num = txnid == NULL ? 0 : txnid->txnid; 1098*7c478bd9Sstevel@tonic-gate if (txnid == NULL) { 1099*7c478bd9Sstevel@tonic-gate ZERO_LSN(null_lsn); 1100*7c478bd9Sstevel@tonic-gate lsnp = &null_lsn; 1101*7c478bd9Sstevel@tonic-gate } else 1102*7c478bd9Sstevel@tonic-gate lsnp = &txnid->last_lsn; 1103*7c478bd9Sstevel@tonic-gate logrec.size = sizeof(rectype) + sizeof(txn_num) + sizeof(DB_LSN) 1104*7c478bd9Sstevel@tonic-gate + sizeof(fileid) 1105*7c478bd9Sstevel@tonic-gate + sizeof(pgno) 1106*7c478bd9Sstevel@tonic-gate + sizeof(*lsn) 1107*7c478bd9Sstevel@tonic-gate + sizeof(indx); 1108*7c478bd9Sstevel@tonic-gate if ((ret = __os_malloc(logrec.size, NULL, &logrec.data)) != 0) 1109*7c478bd9Sstevel@tonic-gate return (ret); 1110*7c478bd9Sstevel@tonic-gate 1111*7c478bd9Sstevel@tonic-gate bp = logrec.data; 1112*7c478bd9Sstevel@tonic-gate memcpy(bp, &rectype, sizeof(rectype)); 1113*7c478bd9Sstevel@tonic-gate bp += sizeof(rectype); 1114*7c478bd9Sstevel@tonic-gate memcpy(bp, &txn_num, sizeof(txn_num)); 1115*7c478bd9Sstevel@tonic-gate bp += sizeof(txn_num); 1116*7c478bd9Sstevel@tonic-gate memcpy(bp, lsnp, sizeof(DB_LSN)); 1117*7c478bd9Sstevel@tonic-gate bp += sizeof(DB_LSN); 1118*7c478bd9Sstevel@tonic-gate memcpy(bp, &fileid, sizeof(fileid)); 1119*7c478bd9Sstevel@tonic-gate bp += sizeof(fileid); 1120*7c478bd9Sstevel@tonic-gate memcpy(bp, &pgno, sizeof(pgno)); 1121*7c478bd9Sstevel@tonic-gate bp += sizeof(pgno); 1122*7c478bd9Sstevel@tonic-gate if (lsn != NULL) 1123*7c478bd9Sstevel@tonic-gate memcpy(bp, lsn, sizeof(*lsn)); 1124*7c478bd9Sstevel@tonic-gate else 1125*7c478bd9Sstevel@tonic-gate memset(bp, 0, sizeof(*lsn)); 1126*7c478bd9Sstevel@tonic-gate bp += sizeof(*lsn); 1127*7c478bd9Sstevel@tonic-gate memcpy(bp, &indx, sizeof(indx)); 1128*7c478bd9Sstevel@tonic-gate bp += sizeof(indx); 1129*7c478bd9Sstevel@tonic-gate #ifdef DIAGNOSTIC 1130*7c478bd9Sstevel@tonic-gate if ((u_int32_t)(bp - (u_int8_t *)logrec.data) != logrec.size) 1131*7c478bd9Sstevel@tonic-gate fprintf(stderr, "Error in log record length"); 1132*7c478bd9Sstevel@tonic-gate #endif 1133*7c478bd9Sstevel@tonic-gate ret = log_put(logp, ret_lsnp, (DBT *)&logrec, flags); 1134*7c478bd9Sstevel@tonic-gate if (txnid != NULL) 1135*7c478bd9Sstevel@tonic-gate txnid->last_lsn = *ret_lsnp; 1136*7c478bd9Sstevel@tonic-gate __os_free(logrec.data, 0); 1137*7c478bd9Sstevel@tonic-gate return (ret); 1138*7c478bd9Sstevel@tonic-gate } 1139*7c478bd9Sstevel@tonic-gate 1140*7c478bd9Sstevel@tonic-gate /* 1141*7c478bd9Sstevel@tonic-gate * PUBLIC: int __bam_cdel_print 1142*7c478bd9Sstevel@tonic-gate * PUBLIC: __P((DB_LOG *, DBT *, DB_LSN *, int, void *)); 1143*7c478bd9Sstevel@tonic-gate */ 1144*7c478bd9Sstevel@tonic-gate int 1145*7c478bd9Sstevel@tonic-gate __bam_cdel_print(notused1, dbtp, lsnp, notused2, notused3) 1146*7c478bd9Sstevel@tonic-gate DB_LOG *notused1; 1147*7c478bd9Sstevel@tonic-gate DBT *dbtp; 1148*7c478bd9Sstevel@tonic-gate DB_LSN *lsnp; 1149*7c478bd9Sstevel@tonic-gate int notused2; 1150*7c478bd9Sstevel@tonic-gate void *notused3; 1151*7c478bd9Sstevel@tonic-gate { 1152*7c478bd9Sstevel@tonic-gate __bam_cdel_args *argp; 1153*7c478bd9Sstevel@tonic-gate u_int32_t i; 1154*7c478bd9Sstevel@tonic-gate u_int ch; 1155*7c478bd9Sstevel@tonic-gate int ret; 1156*7c478bd9Sstevel@tonic-gate 1157*7c478bd9Sstevel@tonic-gate i = 0; 1158*7c478bd9Sstevel@tonic-gate ch = 0; 1159*7c478bd9Sstevel@tonic-gate notused1 = NULL; 1160*7c478bd9Sstevel@tonic-gate notused2 = 0; 1161*7c478bd9Sstevel@tonic-gate notused3 = NULL; 1162*7c478bd9Sstevel@tonic-gate 1163*7c478bd9Sstevel@tonic-gate if ((ret = __bam_cdel_read(dbtp->data, &argp)) != 0) 1164*7c478bd9Sstevel@tonic-gate return (ret); 1165*7c478bd9Sstevel@tonic-gate printf("[%lu][%lu]bam_cdel: rec: %lu txnid %lx prevlsn [%lu][%lu]\n", 1166*7c478bd9Sstevel@tonic-gate (u_long)lsnp->file, 1167*7c478bd9Sstevel@tonic-gate (u_long)lsnp->offset, 1168*7c478bd9Sstevel@tonic-gate (u_long)argp->type, 1169*7c478bd9Sstevel@tonic-gate (u_long)argp->txnid->txnid, 1170*7c478bd9Sstevel@tonic-gate (u_long)argp->prev_lsn.file, 1171*7c478bd9Sstevel@tonic-gate (u_long)argp->prev_lsn.offset); 1172*7c478bd9Sstevel@tonic-gate printf("\tfileid: %lu\n", (u_long)argp->fileid); 1173*7c478bd9Sstevel@tonic-gate printf("\tpgno: %lu\n", (u_long)argp->pgno); 1174*7c478bd9Sstevel@tonic-gate printf("\tlsn: [%lu][%lu]\n", 1175*7c478bd9Sstevel@tonic-gate (u_long)argp->lsn.file, (u_long)argp->lsn.offset); 1176*7c478bd9Sstevel@tonic-gate printf("\tindx: %lu\n", (u_long)argp->indx); 1177*7c478bd9Sstevel@tonic-gate printf("\n"); 1178*7c478bd9Sstevel@tonic-gate __os_free(argp, 0); 1179*7c478bd9Sstevel@tonic-gate return (0); 1180*7c478bd9Sstevel@tonic-gate } 1181*7c478bd9Sstevel@tonic-gate 1182*7c478bd9Sstevel@tonic-gate /* 1183*7c478bd9Sstevel@tonic-gate * PUBLIC: int __bam_cdel_read __P((void *, __bam_cdel_args **)); 1184*7c478bd9Sstevel@tonic-gate */ 1185*7c478bd9Sstevel@tonic-gate int 1186*7c478bd9Sstevel@tonic-gate __bam_cdel_read(recbuf, argpp) 1187*7c478bd9Sstevel@tonic-gate void *recbuf; 1188*7c478bd9Sstevel@tonic-gate __bam_cdel_args **argpp; 1189*7c478bd9Sstevel@tonic-gate { 1190*7c478bd9Sstevel@tonic-gate __bam_cdel_args *argp; 1191*7c478bd9Sstevel@tonic-gate u_int8_t *bp; 1192*7c478bd9Sstevel@tonic-gate int ret; 1193*7c478bd9Sstevel@tonic-gate 1194*7c478bd9Sstevel@tonic-gate ret = __os_malloc(sizeof(__bam_cdel_args) + 1195*7c478bd9Sstevel@tonic-gate sizeof(DB_TXN), NULL, &argp); 1196*7c478bd9Sstevel@tonic-gate if (ret != 0) 1197*7c478bd9Sstevel@tonic-gate return (ret); 1198*7c478bd9Sstevel@tonic-gate argp->txnid = (DB_TXN *)&argp[1]; 1199*7c478bd9Sstevel@tonic-gate bp = recbuf; 1200*7c478bd9Sstevel@tonic-gate memcpy(&argp->type, bp, sizeof(argp->type)); 1201*7c478bd9Sstevel@tonic-gate bp += sizeof(argp->type); 1202*7c478bd9Sstevel@tonic-gate memcpy(&argp->txnid->txnid, bp, sizeof(argp->txnid->txnid)); 1203*7c478bd9Sstevel@tonic-gate bp += sizeof(argp->txnid->txnid); 1204*7c478bd9Sstevel@tonic-gate memcpy(&argp->prev_lsn, bp, sizeof(DB_LSN)); 1205*7c478bd9Sstevel@tonic-gate bp += sizeof(DB_LSN); 1206*7c478bd9Sstevel@tonic-gate memcpy(&argp->fileid, bp, sizeof(argp->fileid)); 1207*7c478bd9Sstevel@tonic-gate bp += sizeof(argp->fileid); 1208*7c478bd9Sstevel@tonic-gate memcpy(&argp->pgno, bp, sizeof(argp->pgno)); 1209*7c478bd9Sstevel@tonic-gate bp += sizeof(argp->pgno); 1210*7c478bd9Sstevel@tonic-gate memcpy(&argp->lsn, bp, sizeof(argp->lsn)); 1211*7c478bd9Sstevel@tonic-gate bp += sizeof(argp->lsn); 1212*7c478bd9Sstevel@tonic-gate memcpy(&argp->indx, bp, sizeof(argp->indx)); 1213*7c478bd9Sstevel@tonic-gate bp += sizeof(argp->indx); 1214*7c478bd9Sstevel@tonic-gate *argpp = argp; 1215*7c478bd9Sstevel@tonic-gate return (0); 1216*7c478bd9Sstevel@tonic-gate } 1217*7c478bd9Sstevel@tonic-gate 1218*7c478bd9Sstevel@tonic-gate /* 1219*7c478bd9Sstevel@tonic-gate * PUBLIC: int __bam_repl_log 1220*7c478bd9Sstevel@tonic-gate * PUBLIC: __P((DB_LOG *, DB_TXN *, DB_LSN *, u_int32_t, 1221*7c478bd9Sstevel@tonic-gate * PUBLIC: u_int32_t, db_pgno_t, DB_LSN *, u_int32_t, 1222*7c478bd9Sstevel@tonic-gate * PUBLIC: u_int32_t, const DBT *, const DBT *, u_int32_t, 1223*7c478bd9Sstevel@tonic-gate * PUBLIC: u_int32_t)); 1224*7c478bd9Sstevel@tonic-gate */ 1225*7c478bd9Sstevel@tonic-gate int __bam_repl_log(logp, txnid, ret_lsnp, flags, 1226*7c478bd9Sstevel@tonic-gate fileid, pgno, lsn, indx, isdeleted, orig, 1227*7c478bd9Sstevel@tonic-gate repl, prefix, suffix) 1228*7c478bd9Sstevel@tonic-gate DB_LOG *logp; 1229*7c478bd9Sstevel@tonic-gate DB_TXN *txnid; 1230*7c478bd9Sstevel@tonic-gate DB_LSN *ret_lsnp; 1231*7c478bd9Sstevel@tonic-gate u_int32_t flags; 1232*7c478bd9Sstevel@tonic-gate u_int32_t fileid; 1233*7c478bd9Sstevel@tonic-gate db_pgno_t pgno; 1234*7c478bd9Sstevel@tonic-gate DB_LSN * lsn; 1235*7c478bd9Sstevel@tonic-gate u_int32_t indx; 1236*7c478bd9Sstevel@tonic-gate u_int32_t isdeleted; 1237*7c478bd9Sstevel@tonic-gate const DBT *orig; 1238*7c478bd9Sstevel@tonic-gate const DBT *repl; 1239*7c478bd9Sstevel@tonic-gate u_int32_t prefix; 1240*7c478bd9Sstevel@tonic-gate u_int32_t suffix; 1241*7c478bd9Sstevel@tonic-gate { 1242*7c478bd9Sstevel@tonic-gate DBT logrec; 1243*7c478bd9Sstevel@tonic-gate DB_LSN *lsnp, null_lsn; 1244*7c478bd9Sstevel@tonic-gate u_int32_t zero; 1245*7c478bd9Sstevel@tonic-gate u_int32_t rectype, txn_num; 1246*7c478bd9Sstevel@tonic-gate int ret; 1247*7c478bd9Sstevel@tonic-gate u_int8_t *bp; 1248*7c478bd9Sstevel@tonic-gate 1249*7c478bd9Sstevel@tonic-gate rectype = DB_bam_repl; 1250*7c478bd9Sstevel@tonic-gate txn_num = txnid == NULL ? 0 : txnid->txnid; 1251*7c478bd9Sstevel@tonic-gate if (txnid == NULL) { 1252*7c478bd9Sstevel@tonic-gate ZERO_LSN(null_lsn); 1253*7c478bd9Sstevel@tonic-gate lsnp = &null_lsn; 1254*7c478bd9Sstevel@tonic-gate } else 1255*7c478bd9Sstevel@tonic-gate lsnp = &txnid->last_lsn; 1256*7c478bd9Sstevel@tonic-gate logrec.size = sizeof(rectype) + sizeof(txn_num) + sizeof(DB_LSN) 1257*7c478bd9Sstevel@tonic-gate + sizeof(fileid) 1258*7c478bd9Sstevel@tonic-gate + sizeof(pgno) 1259*7c478bd9Sstevel@tonic-gate + sizeof(*lsn) 1260*7c478bd9Sstevel@tonic-gate + sizeof(indx) 1261*7c478bd9Sstevel@tonic-gate + sizeof(isdeleted) 1262*7c478bd9Sstevel@tonic-gate + sizeof(u_int32_t) + (orig == NULL ? 0 : orig->size) 1263*7c478bd9Sstevel@tonic-gate + sizeof(u_int32_t) + (repl == NULL ? 0 : repl->size) 1264*7c478bd9Sstevel@tonic-gate + sizeof(prefix) 1265*7c478bd9Sstevel@tonic-gate + sizeof(suffix); 1266*7c478bd9Sstevel@tonic-gate if ((ret = __os_malloc(logrec.size, NULL, &logrec.data)) != 0) 1267*7c478bd9Sstevel@tonic-gate return (ret); 1268*7c478bd9Sstevel@tonic-gate 1269*7c478bd9Sstevel@tonic-gate bp = logrec.data; 1270*7c478bd9Sstevel@tonic-gate memcpy(bp, &rectype, sizeof(rectype)); 1271*7c478bd9Sstevel@tonic-gate bp += sizeof(rectype); 1272*7c478bd9Sstevel@tonic-gate memcpy(bp, &txn_num, sizeof(txn_num)); 1273*7c478bd9Sstevel@tonic-gate bp += sizeof(txn_num); 1274*7c478bd9Sstevel@tonic-gate memcpy(bp, lsnp, sizeof(DB_LSN)); 1275*7c478bd9Sstevel@tonic-gate bp += sizeof(DB_LSN); 1276*7c478bd9Sstevel@tonic-gate memcpy(bp, &fileid, sizeof(fileid)); 1277*7c478bd9Sstevel@tonic-gate bp += sizeof(fileid); 1278*7c478bd9Sstevel@tonic-gate memcpy(bp, &pgno, sizeof(pgno)); 1279*7c478bd9Sstevel@tonic-gate bp += sizeof(pgno); 1280*7c478bd9Sstevel@tonic-gate if (lsn != NULL) 1281*7c478bd9Sstevel@tonic-gate memcpy(bp, lsn, sizeof(*lsn)); 1282*7c478bd9Sstevel@tonic-gate else 1283*7c478bd9Sstevel@tonic-gate memset(bp, 0, sizeof(*lsn)); 1284*7c478bd9Sstevel@tonic-gate bp += sizeof(*lsn); 1285*7c478bd9Sstevel@tonic-gate memcpy(bp, &indx, sizeof(indx)); 1286*7c478bd9Sstevel@tonic-gate bp += sizeof(indx); 1287*7c478bd9Sstevel@tonic-gate memcpy(bp, &isdeleted, sizeof(isdeleted)); 1288*7c478bd9Sstevel@tonic-gate bp += sizeof(isdeleted); 1289*7c478bd9Sstevel@tonic-gate if (orig == NULL) { 1290*7c478bd9Sstevel@tonic-gate zero = 0; 1291*7c478bd9Sstevel@tonic-gate memcpy(bp, &zero, sizeof(u_int32_t)); 1292*7c478bd9Sstevel@tonic-gate bp += sizeof(u_int32_t); 1293*7c478bd9Sstevel@tonic-gate } else { 1294*7c478bd9Sstevel@tonic-gate memcpy(bp, &orig->size, sizeof(orig->size)); 1295*7c478bd9Sstevel@tonic-gate bp += sizeof(orig->size); 1296*7c478bd9Sstevel@tonic-gate memcpy(bp, orig->data, orig->size); 1297*7c478bd9Sstevel@tonic-gate bp += orig->size; 1298*7c478bd9Sstevel@tonic-gate } 1299*7c478bd9Sstevel@tonic-gate if (repl == NULL) { 1300*7c478bd9Sstevel@tonic-gate zero = 0; 1301*7c478bd9Sstevel@tonic-gate memcpy(bp, &zero, sizeof(u_int32_t)); 1302*7c478bd9Sstevel@tonic-gate bp += sizeof(u_int32_t); 1303*7c478bd9Sstevel@tonic-gate } else { 1304*7c478bd9Sstevel@tonic-gate memcpy(bp, &repl->size, sizeof(repl->size)); 1305*7c478bd9Sstevel@tonic-gate bp += sizeof(repl->size); 1306*7c478bd9Sstevel@tonic-gate memcpy(bp, repl->data, repl->size); 1307*7c478bd9Sstevel@tonic-gate bp += repl->size; 1308*7c478bd9Sstevel@tonic-gate } 1309*7c478bd9Sstevel@tonic-gate memcpy(bp, &prefix, sizeof(prefix)); 1310*7c478bd9Sstevel@tonic-gate bp += sizeof(prefix); 1311*7c478bd9Sstevel@tonic-gate memcpy(bp, &suffix, sizeof(suffix)); 1312*7c478bd9Sstevel@tonic-gate bp += sizeof(suffix); 1313*7c478bd9Sstevel@tonic-gate #ifdef DIAGNOSTIC 1314*7c478bd9Sstevel@tonic-gate if ((u_int32_t)(bp - (u_int8_t *)logrec.data) != logrec.size) 1315*7c478bd9Sstevel@tonic-gate fprintf(stderr, "Error in log record length"); 1316*7c478bd9Sstevel@tonic-gate #endif 1317*7c478bd9Sstevel@tonic-gate ret = log_put(logp, ret_lsnp, (DBT *)&logrec, flags); 1318*7c478bd9Sstevel@tonic-gate if (txnid != NULL) 1319*7c478bd9Sstevel@tonic-gate txnid->last_lsn = *ret_lsnp; 1320*7c478bd9Sstevel@tonic-gate __os_free(logrec.data, 0); 1321*7c478bd9Sstevel@tonic-gate return (ret); 1322*7c478bd9Sstevel@tonic-gate } 1323*7c478bd9Sstevel@tonic-gate 1324*7c478bd9Sstevel@tonic-gate /* 1325*7c478bd9Sstevel@tonic-gate * PUBLIC: int __bam_repl_print 1326*7c478bd9Sstevel@tonic-gate * PUBLIC: __P((DB_LOG *, DBT *, DB_LSN *, int, void *)); 1327*7c478bd9Sstevel@tonic-gate */ 1328*7c478bd9Sstevel@tonic-gate int 1329*7c478bd9Sstevel@tonic-gate __bam_repl_print(notused1, dbtp, lsnp, notused2, notused3) 1330*7c478bd9Sstevel@tonic-gate DB_LOG *notused1; 1331*7c478bd9Sstevel@tonic-gate DBT *dbtp; 1332*7c478bd9Sstevel@tonic-gate DB_LSN *lsnp; 1333*7c478bd9Sstevel@tonic-gate int notused2; 1334*7c478bd9Sstevel@tonic-gate void *notused3; 1335*7c478bd9Sstevel@tonic-gate { 1336*7c478bd9Sstevel@tonic-gate __bam_repl_args *argp; 1337*7c478bd9Sstevel@tonic-gate u_int32_t i; 1338*7c478bd9Sstevel@tonic-gate u_int ch; 1339*7c478bd9Sstevel@tonic-gate int ret; 1340*7c478bd9Sstevel@tonic-gate 1341*7c478bd9Sstevel@tonic-gate i = 0; 1342*7c478bd9Sstevel@tonic-gate ch = 0; 1343*7c478bd9Sstevel@tonic-gate notused1 = NULL; 1344*7c478bd9Sstevel@tonic-gate notused2 = 0; 1345*7c478bd9Sstevel@tonic-gate notused3 = NULL; 1346*7c478bd9Sstevel@tonic-gate 1347*7c478bd9Sstevel@tonic-gate if ((ret = __bam_repl_read(dbtp->data, &argp)) != 0) 1348*7c478bd9Sstevel@tonic-gate return (ret); 1349*7c478bd9Sstevel@tonic-gate printf("[%lu][%lu]bam_repl: rec: %lu txnid %lx prevlsn [%lu][%lu]\n", 1350*7c478bd9Sstevel@tonic-gate (u_long)lsnp->file, 1351*7c478bd9Sstevel@tonic-gate (u_long)lsnp->offset, 1352*7c478bd9Sstevel@tonic-gate (u_long)argp->type, 1353*7c478bd9Sstevel@tonic-gate (u_long)argp->txnid->txnid, 1354*7c478bd9Sstevel@tonic-gate (u_long)argp->prev_lsn.file, 1355*7c478bd9Sstevel@tonic-gate (u_long)argp->prev_lsn.offset); 1356*7c478bd9Sstevel@tonic-gate printf("\tfileid: %lu\n", (u_long)argp->fileid); 1357*7c478bd9Sstevel@tonic-gate printf("\tpgno: %lu\n", (u_long)argp->pgno); 1358*7c478bd9Sstevel@tonic-gate printf("\tlsn: [%lu][%lu]\n", 1359*7c478bd9Sstevel@tonic-gate (u_long)argp->lsn.file, (u_long)argp->lsn.offset); 1360*7c478bd9Sstevel@tonic-gate printf("\tindx: %lu\n", (u_long)argp->indx); 1361*7c478bd9Sstevel@tonic-gate printf("\tisdeleted: %lu\n", (u_long)argp->isdeleted); 1362*7c478bd9Sstevel@tonic-gate printf("\torig: "); 1363*7c478bd9Sstevel@tonic-gate for (i = 0; i < argp->orig.size; i++) { 1364*7c478bd9Sstevel@tonic-gate ch = ((u_int8_t *)argp->orig.data)[i]; 1365*7c478bd9Sstevel@tonic-gate if (isprint(ch) || ch == 0xa) 1366*7c478bd9Sstevel@tonic-gate putchar(ch); 1367*7c478bd9Sstevel@tonic-gate else 1368*7c478bd9Sstevel@tonic-gate printf("%#x ", ch); 1369*7c478bd9Sstevel@tonic-gate } 1370*7c478bd9Sstevel@tonic-gate printf("\n"); 1371*7c478bd9Sstevel@tonic-gate printf("\trepl: "); 1372*7c478bd9Sstevel@tonic-gate for (i = 0; i < argp->repl.size; i++) { 1373*7c478bd9Sstevel@tonic-gate ch = ((u_int8_t *)argp->repl.data)[i]; 1374*7c478bd9Sstevel@tonic-gate if (isprint(ch) || ch == 0xa) 1375*7c478bd9Sstevel@tonic-gate putchar(ch); 1376*7c478bd9Sstevel@tonic-gate else 1377*7c478bd9Sstevel@tonic-gate printf("%#x ", ch); 1378*7c478bd9Sstevel@tonic-gate } 1379*7c478bd9Sstevel@tonic-gate printf("\n"); 1380*7c478bd9Sstevel@tonic-gate printf("\tprefix: %lu\n", (u_long)argp->prefix); 1381*7c478bd9Sstevel@tonic-gate printf("\tsuffix: %lu\n", (u_long)argp->suffix); 1382*7c478bd9Sstevel@tonic-gate printf("\n"); 1383*7c478bd9Sstevel@tonic-gate __os_free(argp, 0); 1384*7c478bd9Sstevel@tonic-gate return (0); 1385*7c478bd9Sstevel@tonic-gate } 1386*7c478bd9Sstevel@tonic-gate 1387*7c478bd9Sstevel@tonic-gate /* 1388*7c478bd9Sstevel@tonic-gate * PUBLIC: int __bam_repl_read __P((void *, __bam_repl_args **)); 1389*7c478bd9Sstevel@tonic-gate */ 1390*7c478bd9Sstevel@tonic-gate int 1391*7c478bd9Sstevel@tonic-gate __bam_repl_read(recbuf, argpp) 1392*7c478bd9Sstevel@tonic-gate void *recbuf; 1393*7c478bd9Sstevel@tonic-gate __bam_repl_args **argpp; 1394*7c478bd9Sstevel@tonic-gate { 1395*7c478bd9Sstevel@tonic-gate __bam_repl_args *argp; 1396*7c478bd9Sstevel@tonic-gate u_int8_t *bp; 1397*7c478bd9Sstevel@tonic-gate int ret; 1398*7c478bd9Sstevel@tonic-gate 1399*7c478bd9Sstevel@tonic-gate ret = __os_malloc(sizeof(__bam_repl_args) + 1400*7c478bd9Sstevel@tonic-gate sizeof(DB_TXN), NULL, &argp); 1401*7c478bd9Sstevel@tonic-gate if (ret != 0) 1402*7c478bd9Sstevel@tonic-gate return (ret); 1403*7c478bd9Sstevel@tonic-gate argp->txnid = (DB_TXN *)&argp[1]; 1404*7c478bd9Sstevel@tonic-gate bp = recbuf; 1405*7c478bd9Sstevel@tonic-gate memcpy(&argp->type, bp, sizeof(argp->type)); 1406*7c478bd9Sstevel@tonic-gate bp += sizeof(argp->type); 1407*7c478bd9Sstevel@tonic-gate memcpy(&argp->txnid->txnid, bp, sizeof(argp->txnid->txnid)); 1408*7c478bd9Sstevel@tonic-gate bp += sizeof(argp->txnid->txnid); 1409*7c478bd9Sstevel@tonic-gate memcpy(&argp->prev_lsn, bp, sizeof(DB_LSN)); 1410*7c478bd9Sstevel@tonic-gate bp += sizeof(DB_LSN); 1411*7c478bd9Sstevel@tonic-gate memcpy(&argp->fileid, bp, sizeof(argp->fileid)); 1412*7c478bd9Sstevel@tonic-gate bp += sizeof(argp->fileid); 1413*7c478bd9Sstevel@tonic-gate memcpy(&argp->pgno, bp, sizeof(argp->pgno)); 1414*7c478bd9Sstevel@tonic-gate bp += sizeof(argp->pgno); 1415*7c478bd9Sstevel@tonic-gate memcpy(&argp->lsn, bp, sizeof(argp->lsn)); 1416*7c478bd9Sstevel@tonic-gate bp += sizeof(argp->lsn); 1417*7c478bd9Sstevel@tonic-gate memcpy(&argp->indx, bp, sizeof(argp->indx)); 1418*7c478bd9Sstevel@tonic-gate bp += sizeof(argp->indx); 1419*7c478bd9Sstevel@tonic-gate memcpy(&argp->isdeleted, bp, sizeof(argp->isdeleted)); 1420*7c478bd9Sstevel@tonic-gate bp += sizeof(argp->isdeleted); 1421*7c478bd9Sstevel@tonic-gate memcpy(&argp->orig.size, bp, sizeof(u_int32_t)); 1422*7c478bd9Sstevel@tonic-gate bp += sizeof(u_int32_t); 1423*7c478bd9Sstevel@tonic-gate argp->orig.data = bp; 1424*7c478bd9Sstevel@tonic-gate bp += argp->orig.size; 1425*7c478bd9Sstevel@tonic-gate memcpy(&argp->repl.size, bp, sizeof(u_int32_t)); 1426*7c478bd9Sstevel@tonic-gate bp += sizeof(u_int32_t); 1427*7c478bd9Sstevel@tonic-gate argp->repl.data = bp; 1428*7c478bd9Sstevel@tonic-gate bp += argp->repl.size; 1429*7c478bd9Sstevel@tonic-gate memcpy(&argp->prefix, bp, sizeof(argp->prefix)); 1430*7c478bd9Sstevel@tonic-gate bp += sizeof(argp->prefix); 1431*7c478bd9Sstevel@tonic-gate memcpy(&argp->suffix, bp, sizeof(argp->suffix)); 1432*7c478bd9Sstevel@tonic-gate bp += sizeof(argp->suffix); 1433*7c478bd9Sstevel@tonic-gate *argpp = argp; 1434*7c478bd9Sstevel@tonic-gate return (0); 1435*7c478bd9Sstevel@tonic-gate } 1436*7c478bd9Sstevel@tonic-gate 1437*7c478bd9Sstevel@tonic-gate /* 1438*7c478bd9Sstevel@tonic-gate * PUBLIC: int __bam_init_print __P((DB_ENV *)); 1439*7c478bd9Sstevel@tonic-gate */ 1440*7c478bd9Sstevel@tonic-gate int 1441*7c478bd9Sstevel@tonic-gate __bam_init_print(dbenv) 1442*7c478bd9Sstevel@tonic-gate DB_ENV *dbenv; 1443*7c478bd9Sstevel@tonic-gate { 1444*7c478bd9Sstevel@tonic-gate int ret; 1445*7c478bd9Sstevel@tonic-gate 1446*7c478bd9Sstevel@tonic-gate if ((ret = __db_add_recovery(dbenv, 1447*7c478bd9Sstevel@tonic-gate __bam_pg_alloc_print, DB_bam_pg_alloc)) != 0) 1448*7c478bd9Sstevel@tonic-gate return (ret); 1449*7c478bd9Sstevel@tonic-gate if ((ret = __db_add_recovery(dbenv, 1450*7c478bd9Sstevel@tonic-gate __bam_pg_free_print, DB_bam_pg_free)) != 0) 1451*7c478bd9Sstevel@tonic-gate return (ret); 1452*7c478bd9Sstevel@tonic-gate if ((ret = __db_add_recovery(dbenv, 1453*7c478bd9Sstevel@tonic-gate __bam_split_print, DB_bam_split)) != 0) 1454*7c478bd9Sstevel@tonic-gate return (ret); 1455*7c478bd9Sstevel@tonic-gate if ((ret = __db_add_recovery(dbenv, 1456*7c478bd9Sstevel@tonic-gate __bam_rsplit_print, DB_bam_rsplit)) != 0) 1457*7c478bd9Sstevel@tonic-gate return (ret); 1458*7c478bd9Sstevel@tonic-gate if ((ret = __db_add_recovery(dbenv, 1459*7c478bd9Sstevel@tonic-gate __bam_adj_print, DB_bam_adj)) != 0) 1460*7c478bd9Sstevel@tonic-gate return (ret); 1461*7c478bd9Sstevel@tonic-gate if ((ret = __db_add_recovery(dbenv, 1462*7c478bd9Sstevel@tonic-gate __bam_cadjust_print, DB_bam_cadjust)) != 0) 1463*7c478bd9Sstevel@tonic-gate return (ret); 1464*7c478bd9Sstevel@tonic-gate if ((ret = __db_add_recovery(dbenv, 1465*7c478bd9Sstevel@tonic-gate __bam_cdel_print, DB_bam_cdel)) != 0) 1466*7c478bd9Sstevel@tonic-gate return (ret); 1467*7c478bd9Sstevel@tonic-gate if ((ret = __db_add_recovery(dbenv, 1468*7c478bd9Sstevel@tonic-gate __bam_repl_print, DB_bam_repl)) != 0) 1469*7c478bd9Sstevel@tonic-gate return (ret); 1470*7c478bd9Sstevel@tonic-gate return (0); 1471*7c478bd9Sstevel@tonic-gate } 1472*7c478bd9Sstevel@tonic-gate 1473*7c478bd9Sstevel@tonic-gate /* 1474*7c478bd9Sstevel@tonic-gate * PUBLIC: int __bam_init_recover __P((DB_ENV *)); 1475*7c478bd9Sstevel@tonic-gate */ 1476*7c478bd9Sstevel@tonic-gate int 1477*7c478bd9Sstevel@tonic-gate __bam_init_recover(dbenv) 1478*7c478bd9Sstevel@tonic-gate DB_ENV *dbenv; 1479*7c478bd9Sstevel@tonic-gate { 1480*7c478bd9Sstevel@tonic-gate int ret; 1481*7c478bd9Sstevel@tonic-gate 1482*7c478bd9Sstevel@tonic-gate if ((ret = __db_add_recovery(dbenv, 1483*7c478bd9Sstevel@tonic-gate __bam_pg_alloc_recover, DB_bam_pg_alloc)) != 0) 1484*7c478bd9Sstevel@tonic-gate return (ret); 1485*7c478bd9Sstevel@tonic-gate if ((ret = __db_add_recovery(dbenv, 1486*7c478bd9Sstevel@tonic-gate __bam_pg_free_recover, DB_bam_pg_free)) != 0) 1487*7c478bd9Sstevel@tonic-gate return (ret); 1488*7c478bd9Sstevel@tonic-gate if ((ret = __db_add_recovery(dbenv, 1489*7c478bd9Sstevel@tonic-gate __bam_split_recover, DB_bam_split)) != 0) 1490*7c478bd9Sstevel@tonic-gate return (ret); 1491*7c478bd9Sstevel@tonic-gate if ((ret = __db_add_recovery(dbenv, 1492*7c478bd9Sstevel@tonic-gate __bam_rsplit_recover, DB_bam_rsplit)) != 0) 1493*7c478bd9Sstevel@tonic-gate return (ret); 1494*7c478bd9Sstevel@tonic-gate if ((ret = __db_add_recovery(dbenv, 1495*7c478bd9Sstevel@tonic-gate __bam_adj_recover, DB_bam_adj)) != 0) 1496*7c478bd9Sstevel@tonic-gate return (ret); 1497*7c478bd9Sstevel@tonic-gate if ((ret = __db_add_recovery(dbenv, 1498*7c478bd9Sstevel@tonic-gate __bam_cadjust_recover, DB_bam_cadjust)) != 0) 1499*7c478bd9Sstevel@tonic-gate return (ret); 1500*7c478bd9Sstevel@tonic-gate if ((ret = __db_add_recovery(dbenv, 1501*7c478bd9Sstevel@tonic-gate __bam_cdel_recover, DB_bam_cdel)) != 0) 1502*7c478bd9Sstevel@tonic-gate return (ret); 1503*7c478bd9Sstevel@tonic-gate if ((ret = __db_add_recovery(dbenv, 1504*7c478bd9Sstevel@tonic-gate __bam_repl_recover, DB_bam_repl)) != 0) 1505*7c478bd9Sstevel@tonic-gate return (ret); 1506*7c478bd9Sstevel@tonic-gate return (0); 1507*7c478bd9Sstevel@tonic-gate } 1508*7c478bd9Sstevel@tonic-gate 1509