1
/* Do not edit: automatically built by gen_rec.awk. */
4
#ifndef NO_SYSTEM_INCLUDES
12
#include "dbinc/crypto.h"
13
#include "dbinc/db_page.h"
14
#include "dbinc/db_dispatch.h"
15
#include "dbinc/db_am.h"
16
#include "dbinc/btree.h"
17
#include "dbinc/log.h"
18
#include "dbinc/rep.h"
19
#include "dbinc/txn.h"
22
* PUBLIC: int __bam_split_log __P((DB *, DB_TXN *, DB_LSN *,
23
* PUBLIC: u_int32_t, db_pgno_t, DB_LSN *, db_pgno_t, DB_LSN *, u_int32_t,
24
* PUBLIC: db_pgno_t, DB_LSN *, db_pgno_t, const DBT *, u_int32_t));
27
__bam_split_log(dbp, txnid, ret_lsnp, flags, left, llsn, right, rlsn, indx,
28
npgno, nlsn, root_pgno, pg, opflags)
46
DB_LSN *lsnp, null_lsn;
49
u_int32_t npad, rectype, txn_num;
54
rectype = DB___bam_split;
63
if (TAILQ_FIRST(&txnid->kids) != NULL &&
64
(ret = __txn_activekids(dbenv, rectype, txnid)) != 0)
66
txn_num = txnid->txnid;
67
lsnp = &txnid->last_lsn;
70
logrec.size = sizeof(rectype) + sizeof(txn_num) + sizeof(DB_LSN)
80
+ sizeof(u_int32_t) + (pg == NULL ? 0 : pg->size)
82
if (CRYPTO_ON(dbenv)) {
84
((DB_CIPHER *)dbenv->crypto_handle)->adj_size(logrec.size);
88
if ((ret = __os_malloc(dbenv,
89
logrec.size, &logrec.data)) != 0)
93
memset((u_int8_t *)logrec.data + logrec.size - npad, 0, npad);
97
memcpy(bp, &rectype, sizeof(rectype));
98
bp += sizeof(rectype);
100
memcpy(bp, &txn_num, sizeof(txn_num));
101
bp += sizeof(txn_num);
103
memcpy(bp, lsnp, sizeof(DB_LSN));
104
bp += sizeof(DB_LSN);
106
DB_ASSERT(dbp->log_filename != NULL);
107
if (dbp->log_filename->id == DB_LOGFILEID_INVALID &&
108
(ret = __dbreg_lazy_id(dbp)) != 0)
111
uinttmp = (u_int32_t)dbp->log_filename->id;
112
memcpy(bp, &uinttmp, sizeof(uinttmp));
113
bp += sizeof(uinttmp);
115
uinttmp = (u_int32_t)left;
116
memcpy(bp, &uinttmp, sizeof(uinttmp));
117
bp += sizeof(uinttmp);
120
memcpy(bp, llsn, sizeof(*llsn));
122
memset(bp, 0, sizeof(*llsn));
125
uinttmp = (u_int32_t)right;
126
memcpy(bp, &uinttmp, sizeof(uinttmp));
127
bp += sizeof(uinttmp);
130
memcpy(bp, rlsn, sizeof(*rlsn));
132
memset(bp, 0, sizeof(*rlsn));
135
uinttmp = (u_int32_t)indx;
136
memcpy(bp, &uinttmp, sizeof(uinttmp));
137
bp += sizeof(uinttmp);
139
uinttmp = (u_int32_t)npgno;
140
memcpy(bp, &uinttmp, sizeof(uinttmp));
141
bp += sizeof(uinttmp);
144
memcpy(bp, nlsn, sizeof(*nlsn));
146
memset(bp, 0, sizeof(*nlsn));
149
uinttmp = (u_int32_t)root_pgno;
150
memcpy(bp, &uinttmp, sizeof(uinttmp));
151
bp += sizeof(uinttmp);
155
memcpy(bp, &zero, sizeof(u_int32_t));
156
bp += sizeof(u_int32_t);
158
memcpy(bp, &pg->size, sizeof(pg->size));
159
bp += sizeof(pg->size);
160
memcpy(bp, pg->data, pg->size);
164
uinttmp = (u_int32_t)opflags;
165
memcpy(bp, &uinttmp, sizeof(uinttmp));
166
bp += sizeof(uinttmp);
168
DB_ASSERT((u_int32_t)(bp - (u_int8_t *)logrec.data) <= logrec.size);
169
ret = dbenv->log_put(dbenv,
170
ret_lsnp, (DBT *)&logrec, flags | DB_NOCOPY);
171
if (txnid != NULL && ret == 0)
172
txnid->last_lsn = *ret_lsnp;
173
#ifdef LOG_DIAGNOSTIC
175
(void)__bam_split_print(dbenv,
176
(DBT *)&logrec, ret_lsnp, NULL, NULL);
178
__os_free(dbenv, logrec.data);
183
* PUBLIC: int __bam_split_getpgnos __P((DB_ENV *, DBT *, DB_LSN *,
184
* PUBLIC: db_recops, void *));
187
__bam_split_getpgnos(dbenv, rec, lsnp, notused1, summary)
196
__bam_split_args *argp;
199
COMPQUIET(notused1, DB_TXN_ABORT);
202
t = (TXN_RECS *)summary;
204
if ((ret = __bam_split_read(dbenv, rec->data, &argp)) != 0)
207
if ((ret = __dbreg_id_to_db(dbenv,
208
argp->txnid, &dbp, argp->fileid, 0)) != 0)
211
if ((ret = __rep_check_alloc(dbenv, t, 3)) != 0)
214
t->array[t->npages].flags = 0;
215
t->array[t->npages].fid = argp->fileid;
216
t->array[t->npages].lsn = *lsnp;
217
t->array[t->npages].pgdesc.pgno = argp->left;
218
t->array[t->npages].pgdesc.type = DB_PAGE_LOCK;
219
memcpy(t->array[t->npages].pgdesc.fileid, dbp->fileid,
222
t->array[t->npages].flags = 0;
223
t->array[t->npages].fid = argp->fileid;
224
t->array[t->npages].lsn = *lsnp;
225
t->array[t->npages].pgdesc.pgno = argp->right;
226
t->array[t->npages].pgdesc.type = DB_PAGE_LOCK;
227
memcpy(t->array[t->npages].pgdesc.fileid, dbp->fileid,
230
if (argp->root_pgno != PGNO_INVALID) {
231
t->array[t->npages].flags = 0;
232
t->array[t->npages].fid = argp->fileid;
233
t->array[t->npages].lsn = *lsnp;
234
t->array[t->npages].pgdesc.pgno = argp->root_pgno;
235
t->array[t->npages].pgdesc.type = DB_PAGE_LOCK;
236
memcpy(t->array[t->npages].pgdesc.fileid, dbp->fileid,
241
err: if (argp != NULL)
242
__os_free(dbenv, argp);
247
* PUBLIC: int __bam_split_print __P((DB_ENV *, DBT *, DB_LSN *,
248
* PUBLIC: db_recops, void *));
251
__bam_split_print(dbenv, dbtp, lsnp, notused2, notused3)
258
__bam_split_args *argp;
263
notused2 = DB_TXN_ABORT;
266
if ((ret = __bam_split_read(dbenv, dbtp->data, &argp)) != 0)
269
"[%lu][%lu]__bam_split: rec: %lu txnid %lx prevlsn [%lu][%lu]\n",
271
(u_long)lsnp->offset,
273
(u_long)argp->txnid->txnid,
274
(u_long)argp->prev_lsn.file,
275
(u_long)argp->prev_lsn.offset);
276
(void)printf("\tfileid: %ld\n", (long)argp->fileid);
277
(void)printf("\tleft: %lu\n", (u_long)argp->left);
278
(void)printf("\tllsn: [%lu][%lu]\n",
279
(u_long)argp->llsn.file, (u_long)argp->llsn.offset);
280
(void)printf("\tright: %lu\n", (u_long)argp->right);
281
(void)printf("\trlsn: [%lu][%lu]\n",
282
(u_long)argp->rlsn.file, (u_long)argp->rlsn.offset);
283
(void)printf("\tindx: %lu\n", (u_long)argp->indx);
284
(void)printf("\tnpgno: %lu\n", (u_long)argp->npgno);
285
(void)printf("\tnlsn: [%lu][%lu]\n",
286
(u_long)argp->nlsn.file, (u_long)argp->nlsn.offset);
287
(void)printf("\troot_pgno: %lu\n", (u_long)argp->root_pgno);
288
(void)printf("\tpg: ");
289
for (i = 0; i < argp->pg.size; i++) {
290
ch = ((u_int8_t *)argp->pg.data)[i];
291
printf(isprint(ch) || ch == 0x0a ? "%c" : "%#x ", ch);
294
(void)printf("\topflags: %lu\n", (u_long)argp->opflags);
296
__os_free(dbenv, argp);
301
* PUBLIC: int __bam_split_read __P((DB_ENV *, void *, __bam_split_args **));
304
__bam_split_read(dbenv, recbuf, argpp)
307
__bam_split_args **argpp;
309
__bam_split_args *argp;
314
if ((ret = __os_malloc(dbenv,
315
sizeof(__bam_split_args) + sizeof(DB_TXN), &argp)) != 0)
318
argp->txnid = (DB_TXN *)&argp[1];
321
memcpy(&argp->type, bp, sizeof(argp->type));
322
bp += sizeof(argp->type);
324
memcpy(&argp->txnid->txnid, bp, sizeof(argp->txnid->txnid));
325
bp += sizeof(argp->txnid->txnid);
327
memcpy(&argp->prev_lsn, bp, sizeof(DB_LSN));
328
bp += sizeof(DB_LSN);
330
memcpy(&uinttmp, bp, sizeof(uinttmp));
331
argp->fileid = (int32_t)uinttmp;
332
bp += sizeof(uinttmp);
334
memcpy(&uinttmp, bp, sizeof(uinttmp));
335
argp->left = (db_pgno_t)uinttmp;
336
bp += sizeof(uinttmp);
338
memcpy(&argp->llsn, bp, sizeof(argp->llsn));
339
bp += sizeof(argp->llsn);
341
memcpy(&uinttmp, bp, sizeof(uinttmp));
342
argp->right = (db_pgno_t)uinttmp;
343
bp += sizeof(uinttmp);
345
memcpy(&argp->rlsn, bp, sizeof(argp->rlsn));
346
bp += sizeof(argp->rlsn);
348
memcpy(&uinttmp, bp, sizeof(uinttmp));
349
argp->indx = (u_int32_t)uinttmp;
350
bp += sizeof(uinttmp);
352
memcpy(&uinttmp, bp, sizeof(uinttmp));
353
argp->npgno = (db_pgno_t)uinttmp;
354
bp += sizeof(uinttmp);
356
memcpy(&argp->nlsn, bp, sizeof(argp->nlsn));
357
bp += sizeof(argp->nlsn);
359
memcpy(&uinttmp, bp, sizeof(uinttmp));
360
argp->root_pgno = (db_pgno_t)uinttmp;
361
bp += sizeof(uinttmp);
363
memset(&argp->pg, 0, sizeof(argp->pg));
364
memcpy(&argp->pg.size, bp, sizeof(u_int32_t));
365
bp += sizeof(u_int32_t);
369
memcpy(&uinttmp, bp, sizeof(uinttmp));
370
argp->opflags = (u_int32_t)uinttmp;
371
bp += sizeof(uinttmp);
378
* PUBLIC: int __bam_rsplit_log __P((DB *, DB_TXN *, DB_LSN *,
379
* PUBLIC: u_int32_t, db_pgno_t, const DBT *, db_pgno_t, db_pgno_t,
380
* PUBLIC: const DBT *, DB_LSN *));
383
__bam_rsplit_log(dbp, txnid, ret_lsnp, flags, pgno, pgdbt, root_pgno, nrec, rootent,
398
DB_LSN *lsnp, null_lsn;
401
u_int32_t npad, rectype, txn_num;
406
rectype = DB___bam_rsplit;
415
if (TAILQ_FIRST(&txnid->kids) != NULL &&
416
(ret = __txn_activekids(dbenv, rectype, txnid)) != 0)
418
txn_num = txnid->txnid;
419
lsnp = &txnid->last_lsn;
422
logrec.size = sizeof(rectype) + sizeof(txn_num) + sizeof(DB_LSN)
425
+ sizeof(u_int32_t) + (pgdbt == NULL ? 0 : pgdbt->size)
428
+ sizeof(u_int32_t) + (rootent == NULL ? 0 : rootent->size)
430
if (CRYPTO_ON(dbenv)) {
432
((DB_CIPHER *)dbenv->crypto_handle)->adj_size(logrec.size);
436
if ((ret = __os_malloc(dbenv,
437
logrec.size, &logrec.data)) != 0)
441
memset((u_int8_t *)logrec.data + logrec.size - npad, 0, npad);
445
memcpy(bp, &rectype, sizeof(rectype));
446
bp += sizeof(rectype);
448
memcpy(bp, &txn_num, sizeof(txn_num));
449
bp += sizeof(txn_num);
451
memcpy(bp, lsnp, sizeof(DB_LSN));
452
bp += sizeof(DB_LSN);
454
DB_ASSERT(dbp->log_filename != NULL);
455
if (dbp->log_filename->id == DB_LOGFILEID_INVALID &&
456
(ret = __dbreg_lazy_id(dbp)) != 0)
459
uinttmp = (u_int32_t)dbp->log_filename->id;
460
memcpy(bp, &uinttmp, sizeof(uinttmp));
461
bp += sizeof(uinttmp);
463
uinttmp = (u_int32_t)pgno;
464
memcpy(bp, &uinttmp, sizeof(uinttmp));
465
bp += sizeof(uinttmp);
469
memcpy(bp, &zero, sizeof(u_int32_t));
470
bp += sizeof(u_int32_t);
472
memcpy(bp, &pgdbt->size, sizeof(pgdbt->size));
473
bp += sizeof(pgdbt->size);
474
memcpy(bp, pgdbt->data, pgdbt->size);
478
uinttmp = (u_int32_t)root_pgno;
479
memcpy(bp, &uinttmp, sizeof(uinttmp));
480
bp += sizeof(uinttmp);
482
uinttmp = (u_int32_t)nrec;
483
memcpy(bp, &uinttmp, sizeof(uinttmp));
484
bp += sizeof(uinttmp);
486
if (rootent == NULL) {
488
memcpy(bp, &zero, sizeof(u_int32_t));
489
bp += sizeof(u_int32_t);
491
memcpy(bp, &rootent->size, sizeof(rootent->size));
492
bp += sizeof(rootent->size);
493
memcpy(bp, rootent->data, rootent->size);
498
memcpy(bp, rootlsn, sizeof(*rootlsn));
500
memset(bp, 0, sizeof(*rootlsn));
501
bp += sizeof(*rootlsn);
503
DB_ASSERT((u_int32_t)(bp - (u_int8_t *)logrec.data) <= logrec.size);
504
ret = dbenv->log_put(dbenv,
505
ret_lsnp, (DBT *)&logrec, flags | DB_NOCOPY);
506
if (txnid != NULL && ret == 0)
507
txnid->last_lsn = *ret_lsnp;
508
#ifdef LOG_DIAGNOSTIC
510
(void)__bam_rsplit_print(dbenv,
511
(DBT *)&logrec, ret_lsnp, NULL, NULL);
513
__os_free(dbenv, logrec.data);
518
* PUBLIC: int __bam_rsplit_getpgnos __P((DB_ENV *, DBT *, DB_LSN *,
519
* PUBLIC: db_recops, void *));
522
__bam_rsplit_getpgnos(dbenv, rec, lsnp, notused1, summary)
531
__bam_rsplit_args *argp;
534
COMPQUIET(notused1, DB_TXN_ABORT);
537
t = (TXN_RECS *)summary;
539
if ((ret = __bam_rsplit_read(dbenv, rec->data, &argp)) != 0)
542
if ((ret = __dbreg_id_to_db(dbenv,
543
argp->txnid, &dbp, argp->fileid, 0)) != 0)
546
if ((ret = __rep_check_alloc(dbenv, t, 2)) != 0)
549
t->array[t->npages].flags = 0;
550
t->array[t->npages].fid = argp->fileid;
551
t->array[t->npages].lsn = *lsnp;
552
t->array[t->npages].pgdesc.pgno = argp->pgno;
553
t->array[t->npages].pgdesc.type = DB_PAGE_LOCK;
554
memcpy(t->array[t->npages].pgdesc.fileid, dbp->fileid,
557
t->array[t->npages].flags = 0;
558
t->array[t->npages].fid = argp->fileid;
559
t->array[t->npages].lsn = *lsnp;
560
t->array[t->npages].pgdesc.pgno = argp->root_pgno;
561
t->array[t->npages].pgdesc.type = DB_PAGE_LOCK;
562
memcpy(t->array[t->npages].pgdesc.fileid, dbp->fileid,
566
err: if (argp != NULL)
567
__os_free(dbenv, argp);
572
* PUBLIC: int __bam_rsplit_print __P((DB_ENV *, DBT *, DB_LSN *,
573
* PUBLIC: db_recops, void *));
576
__bam_rsplit_print(dbenv, dbtp, lsnp, notused2, notused3)
583
__bam_rsplit_args *argp;
588
notused2 = DB_TXN_ABORT;
591
if ((ret = __bam_rsplit_read(dbenv, dbtp->data, &argp)) != 0)
594
"[%lu][%lu]__bam_rsplit: rec: %lu txnid %lx prevlsn [%lu][%lu]\n",
596
(u_long)lsnp->offset,
598
(u_long)argp->txnid->txnid,
599
(u_long)argp->prev_lsn.file,
600
(u_long)argp->prev_lsn.offset);
601
(void)printf("\tfileid: %ld\n", (long)argp->fileid);
602
(void)printf("\tpgno: %lu\n", (u_long)argp->pgno);
603
(void)printf("\tpgdbt: ");
604
for (i = 0; i < argp->pgdbt.size; i++) {
605
ch = ((u_int8_t *)argp->pgdbt.data)[i];
606
printf(isprint(ch) || ch == 0x0a ? "%c" : "%#x ", ch);
609
(void)printf("\troot_pgno: %lu\n", (u_long)argp->root_pgno);
610
(void)printf("\tnrec: %lu\n", (u_long)argp->nrec);
611
(void)printf("\trootent: ");
612
for (i = 0; i < argp->rootent.size; i++) {
613
ch = ((u_int8_t *)argp->rootent.data)[i];
614
printf(isprint(ch) || ch == 0x0a ? "%c" : "%#x ", ch);
617
(void)printf("\trootlsn: [%lu][%lu]\n",
618
(u_long)argp->rootlsn.file, (u_long)argp->rootlsn.offset);
620
__os_free(dbenv, argp);
625
* PUBLIC: int __bam_rsplit_read __P((DB_ENV *, void *, __bam_rsplit_args **));
628
__bam_rsplit_read(dbenv, recbuf, argpp)
631
__bam_rsplit_args **argpp;
633
__bam_rsplit_args *argp;
638
if ((ret = __os_malloc(dbenv,
639
sizeof(__bam_rsplit_args) + sizeof(DB_TXN), &argp)) != 0)
642
argp->txnid = (DB_TXN *)&argp[1];
645
memcpy(&argp->type, bp, sizeof(argp->type));
646
bp += sizeof(argp->type);
648
memcpy(&argp->txnid->txnid, bp, sizeof(argp->txnid->txnid));
649
bp += sizeof(argp->txnid->txnid);
651
memcpy(&argp->prev_lsn, bp, sizeof(DB_LSN));
652
bp += sizeof(DB_LSN);
654
memcpy(&uinttmp, bp, sizeof(uinttmp));
655
argp->fileid = (int32_t)uinttmp;
656
bp += sizeof(uinttmp);
658
memcpy(&uinttmp, bp, sizeof(uinttmp));
659
argp->pgno = (db_pgno_t)uinttmp;
660
bp += sizeof(uinttmp);
662
memset(&argp->pgdbt, 0, sizeof(argp->pgdbt));
663
memcpy(&argp->pgdbt.size, bp, sizeof(u_int32_t));
664
bp += sizeof(u_int32_t);
665
argp->pgdbt.data = bp;
666
bp += argp->pgdbt.size;
668
memcpy(&uinttmp, bp, sizeof(uinttmp));
669
argp->root_pgno = (db_pgno_t)uinttmp;
670
bp += sizeof(uinttmp);
672
memcpy(&uinttmp, bp, sizeof(uinttmp));
673
argp->nrec = (db_pgno_t)uinttmp;
674
bp += sizeof(uinttmp);
676
memset(&argp->rootent, 0, sizeof(argp->rootent));
677
memcpy(&argp->rootent.size, bp, sizeof(u_int32_t));
678
bp += sizeof(u_int32_t);
679
argp->rootent.data = bp;
680
bp += argp->rootent.size;
682
memcpy(&argp->rootlsn, bp, sizeof(argp->rootlsn));
683
bp += sizeof(argp->rootlsn);
690
* PUBLIC: int __bam_adj_log __P((DB *, DB_TXN *, DB_LSN *,
691
* PUBLIC: u_int32_t, db_pgno_t, DB_LSN *, u_int32_t, u_int32_t,
692
* PUBLIC: u_int32_t));
695
__bam_adj_log(dbp, txnid, ret_lsnp, flags, pgno, lsn, indx, indx_copy, is_insert)
708
DB_LSN *lsnp, null_lsn;
710
u_int32_t npad, rectype, txn_num;
715
rectype = DB___bam_adj;
724
if (TAILQ_FIRST(&txnid->kids) != NULL &&
725
(ret = __txn_activekids(dbenv, rectype, txnid)) != 0)
727
txn_num = txnid->txnid;
728
lsnp = &txnid->last_lsn;
731
logrec.size = sizeof(rectype) + sizeof(txn_num) + sizeof(DB_LSN)
738
if (CRYPTO_ON(dbenv)) {
740
((DB_CIPHER *)dbenv->crypto_handle)->adj_size(logrec.size);
744
if ((ret = __os_malloc(dbenv,
745
logrec.size, &logrec.data)) != 0)
749
memset((u_int8_t *)logrec.data + logrec.size - npad, 0, npad);
753
memcpy(bp, &rectype, sizeof(rectype));
754
bp += sizeof(rectype);
756
memcpy(bp, &txn_num, sizeof(txn_num));
757
bp += sizeof(txn_num);
759
memcpy(bp, lsnp, sizeof(DB_LSN));
760
bp += sizeof(DB_LSN);
762
DB_ASSERT(dbp->log_filename != NULL);
763
if (dbp->log_filename->id == DB_LOGFILEID_INVALID &&
764
(ret = __dbreg_lazy_id(dbp)) != 0)
767
uinttmp = (u_int32_t)dbp->log_filename->id;
768
memcpy(bp, &uinttmp, sizeof(uinttmp));
769
bp += sizeof(uinttmp);
771
uinttmp = (u_int32_t)pgno;
772
memcpy(bp, &uinttmp, sizeof(uinttmp));
773
bp += sizeof(uinttmp);
776
memcpy(bp, lsn, sizeof(*lsn));
778
memset(bp, 0, sizeof(*lsn));
781
uinttmp = (u_int32_t)indx;
782
memcpy(bp, &uinttmp, sizeof(uinttmp));
783
bp += sizeof(uinttmp);
785
uinttmp = (u_int32_t)indx_copy;
786
memcpy(bp, &uinttmp, sizeof(uinttmp));
787
bp += sizeof(uinttmp);
789
uinttmp = (u_int32_t)is_insert;
790
memcpy(bp, &uinttmp, sizeof(uinttmp));
791
bp += sizeof(uinttmp);
793
DB_ASSERT((u_int32_t)(bp - (u_int8_t *)logrec.data) <= logrec.size);
794
ret = dbenv->log_put(dbenv,
795
ret_lsnp, (DBT *)&logrec, flags | DB_NOCOPY);
796
if (txnid != NULL && ret == 0)
797
txnid->last_lsn = *ret_lsnp;
798
#ifdef LOG_DIAGNOSTIC
800
(void)__bam_adj_print(dbenv,
801
(DBT *)&logrec, ret_lsnp, NULL, NULL);
803
__os_free(dbenv, logrec.data);
808
* PUBLIC: int __bam_adj_getpgnos __P((DB_ENV *, DBT *, DB_LSN *,
809
* PUBLIC: db_recops, void *));
812
__bam_adj_getpgnos(dbenv, rec, lsnp, notused1, summary)
821
__bam_adj_args *argp;
824
COMPQUIET(notused1, DB_TXN_ABORT);
827
t = (TXN_RECS *)summary;
829
if ((ret = __bam_adj_read(dbenv, rec->data, &argp)) != 0)
832
if ((ret = __dbreg_id_to_db(dbenv,
833
argp->txnid, &dbp, argp->fileid, 0)) != 0)
836
if ((ret = __rep_check_alloc(dbenv, t, 1)) != 0)
839
t->array[t->npages].flags = 0;
840
t->array[t->npages].fid = argp->fileid;
841
t->array[t->npages].lsn = *lsnp;
842
t->array[t->npages].pgdesc.pgno = argp->pgno;
843
t->array[t->npages].pgdesc.type = DB_PAGE_LOCK;
844
memcpy(t->array[t->npages].pgdesc.fileid, dbp->fileid,
848
err: if (argp != NULL)
849
__os_free(dbenv, argp);
854
* PUBLIC: int __bam_adj_print __P((DB_ENV *, DBT *, DB_LSN *,
855
* PUBLIC: db_recops, void *));
858
__bam_adj_print(dbenv, dbtp, lsnp, notused2, notused3)
865
__bam_adj_args *argp;
868
notused2 = DB_TXN_ABORT;
871
if ((ret = __bam_adj_read(dbenv, dbtp->data, &argp)) != 0)
874
"[%lu][%lu]__bam_adj: rec: %lu txnid %lx prevlsn [%lu][%lu]\n",
876
(u_long)lsnp->offset,
878
(u_long)argp->txnid->txnid,
879
(u_long)argp->prev_lsn.file,
880
(u_long)argp->prev_lsn.offset);
881
(void)printf("\tfileid: %ld\n", (long)argp->fileid);
882
(void)printf("\tpgno: %lu\n", (u_long)argp->pgno);
883
(void)printf("\tlsn: [%lu][%lu]\n",
884
(u_long)argp->lsn.file, (u_long)argp->lsn.offset);
885
(void)printf("\tindx: %lu\n", (u_long)argp->indx);
886
(void)printf("\tindx_copy: %lu\n", (u_long)argp->indx_copy);
887
(void)printf("\tis_insert: %lu\n", (u_long)argp->is_insert);
889
__os_free(dbenv, argp);
894
* PUBLIC: int __bam_adj_read __P((DB_ENV *, void *, __bam_adj_args **));
897
__bam_adj_read(dbenv, recbuf, argpp)
900
__bam_adj_args **argpp;
902
__bam_adj_args *argp;
907
if ((ret = __os_malloc(dbenv,
908
sizeof(__bam_adj_args) + sizeof(DB_TXN), &argp)) != 0)
911
argp->txnid = (DB_TXN *)&argp[1];
914
memcpy(&argp->type, bp, sizeof(argp->type));
915
bp += sizeof(argp->type);
917
memcpy(&argp->txnid->txnid, bp, sizeof(argp->txnid->txnid));
918
bp += sizeof(argp->txnid->txnid);
920
memcpy(&argp->prev_lsn, bp, sizeof(DB_LSN));
921
bp += sizeof(DB_LSN);
923
memcpy(&uinttmp, bp, sizeof(uinttmp));
924
argp->fileid = (int32_t)uinttmp;
925
bp += sizeof(uinttmp);
927
memcpy(&uinttmp, bp, sizeof(uinttmp));
928
argp->pgno = (db_pgno_t)uinttmp;
929
bp += sizeof(uinttmp);
931
memcpy(&argp->lsn, bp, sizeof(argp->lsn));
932
bp += sizeof(argp->lsn);
934
memcpy(&uinttmp, bp, sizeof(uinttmp));
935
argp->indx = (u_int32_t)uinttmp;
936
bp += sizeof(uinttmp);
938
memcpy(&uinttmp, bp, sizeof(uinttmp));
939
argp->indx_copy = (u_int32_t)uinttmp;
940
bp += sizeof(uinttmp);
942
memcpy(&uinttmp, bp, sizeof(uinttmp));
943
argp->is_insert = (u_int32_t)uinttmp;
944
bp += sizeof(uinttmp);
951
* PUBLIC: int __bam_cadjust_log __P((DB *, DB_TXN *, DB_LSN *,
952
* PUBLIC: u_int32_t, db_pgno_t, DB_LSN *, u_int32_t, int32_t, u_int32_t));
955
__bam_cadjust_log(dbp, txnid, ret_lsnp, flags, pgno, lsn, indx, adjust, opflags)
968
DB_LSN *lsnp, null_lsn;
970
u_int32_t npad, rectype, txn_num;
975
rectype = DB___bam_cadjust;
984
if (TAILQ_FIRST(&txnid->kids) != NULL &&
985
(ret = __txn_activekids(dbenv, rectype, txnid)) != 0)
987
txn_num = txnid->txnid;
988
lsnp = &txnid->last_lsn;
991
logrec.size = sizeof(rectype) + sizeof(txn_num) + sizeof(DB_LSN)
998
if (CRYPTO_ON(dbenv)) {
1000
((DB_CIPHER *)dbenv->crypto_handle)->adj_size(logrec.size);
1001
logrec.size += npad;
1004
if ((ret = __os_malloc(dbenv,
1005
logrec.size, &logrec.data)) != 0)
1009
memset((u_int8_t *)logrec.data + logrec.size - npad, 0, npad);
1013
memcpy(bp, &rectype, sizeof(rectype));
1014
bp += sizeof(rectype);
1016
memcpy(bp, &txn_num, sizeof(txn_num));
1017
bp += sizeof(txn_num);
1019
memcpy(bp, lsnp, sizeof(DB_LSN));
1020
bp += sizeof(DB_LSN);
1022
DB_ASSERT(dbp->log_filename != NULL);
1023
if (dbp->log_filename->id == DB_LOGFILEID_INVALID &&
1024
(ret = __dbreg_lazy_id(dbp)) != 0)
1027
uinttmp = (u_int32_t)dbp->log_filename->id;
1028
memcpy(bp, &uinttmp, sizeof(uinttmp));
1029
bp += sizeof(uinttmp);
1031
uinttmp = (u_int32_t)pgno;
1032
memcpy(bp, &uinttmp, sizeof(uinttmp));
1033
bp += sizeof(uinttmp);
1036
memcpy(bp, lsn, sizeof(*lsn));
1038
memset(bp, 0, sizeof(*lsn));
1041
uinttmp = (u_int32_t)indx;
1042
memcpy(bp, &uinttmp, sizeof(uinttmp));
1043
bp += sizeof(uinttmp);
1045
uinttmp = (u_int32_t)adjust;
1046
memcpy(bp, &uinttmp, sizeof(uinttmp));
1047
bp += sizeof(uinttmp);
1049
uinttmp = (u_int32_t)opflags;
1050
memcpy(bp, &uinttmp, sizeof(uinttmp));
1051
bp += sizeof(uinttmp);
1053
DB_ASSERT((u_int32_t)(bp - (u_int8_t *)logrec.data) <= logrec.size);
1054
ret = dbenv->log_put(dbenv,
1055
ret_lsnp, (DBT *)&logrec, flags | DB_NOCOPY);
1056
if (txnid != NULL && ret == 0)
1057
txnid->last_lsn = *ret_lsnp;
1058
#ifdef LOG_DIAGNOSTIC
1060
(void)__bam_cadjust_print(dbenv,
1061
(DBT *)&logrec, ret_lsnp, NULL, NULL);
1063
__os_free(dbenv, logrec.data);
1068
* PUBLIC: int __bam_cadjust_getpgnos __P((DB_ENV *, DBT *, DB_LSN *,
1069
* PUBLIC: db_recops, void *));
1072
__bam_cadjust_getpgnos(dbenv, rec, lsnp, notused1, summary)
1081
__bam_cadjust_args *argp;
1084
COMPQUIET(notused1, DB_TXN_ABORT);
1087
t = (TXN_RECS *)summary;
1089
if ((ret = __bam_cadjust_read(dbenv, rec->data, &argp)) != 0)
1092
if ((ret = __dbreg_id_to_db(dbenv,
1093
argp->txnid, &dbp, argp->fileid, 0)) != 0)
1096
if ((ret = __rep_check_alloc(dbenv, t, 1)) != 0)
1099
t->array[t->npages].flags = 0;
1100
t->array[t->npages].fid = argp->fileid;
1101
t->array[t->npages].lsn = *lsnp;
1102
t->array[t->npages].pgdesc.pgno = argp->pgno;
1103
t->array[t->npages].pgdesc.type = DB_PAGE_LOCK;
1104
memcpy(t->array[t->npages].pgdesc.fileid, dbp->fileid,
1108
err: if (argp != NULL)
1109
__os_free(dbenv, argp);
1114
* PUBLIC: int __bam_cadjust_print __P((DB_ENV *, DBT *, DB_LSN *,
1115
* PUBLIC: db_recops, void *));
1118
__bam_cadjust_print(dbenv, dbtp, lsnp, notused2, notused3)
1125
__bam_cadjust_args *argp;
1128
notused2 = DB_TXN_ABORT;
1131
if ((ret = __bam_cadjust_read(dbenv, dbtp->data, &argp)) != 0)
1134
"[%lu][%lu]__bam_cadjust: rec: %lu txnid %lx prevlsn [%lu][%lu]\n",
1136
(u_long)lsnp->offset,
1138
(u_long)argp->txnid->txnid,
1139
(u_long)argp->prev_lsn.file,
1140
(u_long)argp->prev_lsn.offset);
1141
(void)printf("\tfileid: %ld\n", (long)argp->fileid);
1142
(void)printf("\tpgno: %lu\n", (u_long)argp->pgno);
1143
(void)printf("\tlsn: [%lu][%lu]\n",
1144
(u_long)argp->lsn.file, (u_long)argp->lsn.offset);
1145
(void)printf("\tindx: %lu\n", (u_long)argp->indx);
1146
(void)printf("\tadjust: %ld\n", (long)argp->adjust);
1147
(void)printf("\topflags: %lu\n", (u_long)argp->opflags);
1149
__os_free(dbenv, argp);
1154
* PUBLIC: int __bam_cadjust_read __P((DB_ENV *, void *,
1155
* PUBLIC: __bam_cadjust_args **));
1158
__bam_cadjust_read(dbenv, recbuf, argpp)
1161
__bam_cadjust_args **argpp;
1163
__bam_cadjust_args *argp;
1168
if ((ret = __os_malloc(dbenv,
1169
sizeof(__bam_cadjust_args) + sizeof(DB_TXN), &argp)) != 0)
1172
argp->txnid = (DB_TXN *)&argp[1];
1175
memcpy(&argp->type, bp, sizeof(argp->type));
1176
bp += sizeof(argp->type);
1178
memcpy(&argp->txnid->txnid, bp, sizeof(argp->txnid->txnid));
1179
bp += sizeof(argp->txnid->txnid);
1181
memcpy(&argp->prev_lsn, bp, sizeof(DB_LSN));
1182
bp += sizeof(DB_LSN);
1184
memcpy(&uinttmp, bp, sizeof(uinttmp));
1185
argp->fileid = (int32_t)uinttmp;
1186
bp += sizeof(uinttmp);
1188
memcpy(&uinttmp, bp, sizeof(uinttmp));
1189
argp->pgno = (db_pgno_t)uinttmp;
1190
bp += sizeof(uinttmp);
1192
memcpy(&argp->lsn, bp, sizeof(argp->lsn));
1193
bp += sizeof(argp->lsn);
1195
memcpy(&uinttmp, bp, sizeof(uinttmp));
1196
argp->indx = (u_int32_t)uinttmp;
1197
bp += sizeof(uinttmp);
1199
memcpy(&uinttmp, bp, sizeof(uinttmp));
1200
argp->adjust = (int32_t)uinttmp;
1201
bp += sizeof(uinttmp);
1203
memcpy(&uinttmp, bp, sizeof(uinttmp));
1204
argp->opflags = (u_int32_t)uinttmp;
1205
bp += sizeof(uinttmp);
1212
* PUBLIC: int __bam_cdel_log __P((DB *, DB_TXN *, DB_LSN *,
1213
* PUBLIC: u_int32_t, db_pgno_t, DB_LSN *, u_int32_t));
1216
__bam_cdel_log(dbp, txnid, ret_lsnp, flags, pgno, lsn, indx)
1227
DB_LSN *lsnp, null_lsn;
1229
u_int32_t npad, rectype, txn_num;
1234
rectype = DB___bam_cdel;
1237
if (txnid == NULL) {
1240
null_lsn.offset = 0;
1243
if (TAILQ_FIRST(&txnid->kids) != NULL &&
1244
(ret = __txn_activekids(dbenv, rectype, txnid)) != 0)
1246
txn_num = txnid->txnid;
1247
lsnp = &txnid->last_lsn;
1250
logrec.size = sizeof(rectype) + sizeof(txn_num) + sizeof(DB_LSN)
1254
+ sizeof(u_int32_t);
1255
if (CRYPTO_ON(dbenv)) {
1257
((DB_CIPHER *)dbenv->crypto_handle)->adj_size(logrec.size);
1258
logrec.size += npad;
1261
if ((ret = __os_malloc(dbenv,
1262
logrec.size, &logrec.data)) != 0)
1266
memset((u_int8_t *)logrec.data + logrec.size - npad, 0, npad);
1270
memcpy(bp, &rectype, sizeof(rectype));
1271
bp += sizeof(rectype);
1273
memcpy(bp, &txn_num, sizeof(txn_num));
1274
bp += sizeof(txn_num);
1276
memcpy(bp, lsnp, sizeof(DB_LSN));
1277
bp += sizeof(DB_LSN);
1279
DB_ASSERT(dbp->log_filename != NULL);
1280
if (dbp->log_filename->id == DB_LOGFILEID_INVALID &&
1281
(ret = __dbreg_lazy_id(dbp)) != 0)
1284
uinttmp = (u_int32_t)dbp->log_filename->id;
1285
memcpy(bp, &uinttmp, sizeof(uinttmp));
1286
bp += sizeof(uinttmp);
1288
uinttmp = (u_int32_t)pgno;
1289
memcpy(bp, &uinttmp, sizeof(uinttmp));
1290
bp += sizeof(uinttmp);
1293
memcpy(bp, lsn, sizeof(*lsn));
1295
memset(bp, 0, sizeof(*lsn));
1298
uinttmp = (u_int32_t)indx;
1299
memcpy(bp, &uinttmp, sizeof(uinttmp));
1300
bp += sizeof(uinttmp);
1302
DB_ASSERT((u_int32_t)(bp - (u_int8_t *)logrec.data) <= logrec.size);
1303
ret = dbenv->log_put(dbenv,
1304
ret_lsnp, (DBT *)&logrec, flags | DB_NOCOPY);
1305
if (txnid != NULL && ret == 0)
1306
txnid->last_lsn = *ret_lsnp;
1307
#ifdef LOG_DIAGNOSTIC
1309
(void)__bam_cdel_print(dbenv,
1310
(DBT *)&logrec, ret_lsnp, NULL, NULL);
1312
__os_free(dbenv, logrec.data);
1317
* PUBLIC: int __bam_cdel_getpgnos __P((DB_ENV *, DBT *, DB_LSN *,
1318
* PUBLIC: db_recops, void *));
1321
__bam_cdel_getpgnos(dbenv, rec, lsnp, notused1, summary)
1330
__bam_cdel_args *argp;
1333
COMPQUIET(notused1, DB_TXN_ABORT);
1336
t = (TXN_RECS *)summary;
1338
if ((ret = __bam_cdel_read(dbenv, rec->data, &argp)) != 0)
1341
if ((ret = __dbreg_id_to_db(dbenv,
1342
argp->txnid, &dbp, argp->fileid, 0)) != 0)
1345
if ((ret = __rep_check_alloc(dbenv, t, 1)) != 0)
1348
t->array[t->npages].flags = 0;
1349
t->array[t->npages].fid = argp->fileid;
1350
t->array[t->npages].lsn = *lsnp;
1351
t->array[t->npages].pgdesc.pgno = argp->pgno;
1352
t->array[t->npages].pgdesc.type = DB_PAGE_LOCK;
1353
memcpy(t->array[t->npages].pgdesc.fileid, dbp->fileid,
1357
err: if (argp != NULL)
1358
__os_free(dbenv, argp);
1363
* PUBLIC: int __bam_cdel_print __P((DB_ENV *, DBT *, DB_LSN *,
1364
* PUBLIC: db_recops, void *));
1367
__bam_cdel_print(dbenv, dbtp, lsnp, notused2, notused3)
1374
__bam_cdel_args *argp;
1377
notused2 = DB_TXN_ABORT;
1380
if ((ret = __bam_cdel_read(dbenv, dbtp->data, &argp)) != 0)
1383
"[%lu][%lu]__bam_cdel: rec: %lu txnid %lx prevlsn [%lu][%lu]\n",
1385
(u_long)lsnp->offset,
1387
(u_long)argp->txnid->txnid,
1388
(u_long)argp->prev_lsn.file,
1389
(u_long)argp->prev_lsn.offset);
1390
(void)printf("\tfileid: %ld\n", (long)argp->fileid);
1391
(void)printf("\tpgno: %lu\n", (u_long)argp->pgno);
1392
(void)printf("\tlsn: [%lu][%lu]\n",
1393
(u_long)argp->lsn.file, (u_long)argp->lsn.offset);
1394
(void)printf("\tindx: %lu\n", (u_long)argp->indx);
1396
__os_free(dbenv, argp);
1401
* PUBLIC: int __bam_cdel_read __P((DB_ENV *, void *, __bam_cdel_args **));
1404
__bam_cdel_read(dbenv, recbuf, argpp)
1407
__bam_cdel_args **argpp;
1409
__bam_cdel_args *argp;
1414
if ((ret = __os_malloc(dbenv,
1415
sizeof(__bam_cdel_args) + sizeof(DB_TXN), &argp)) != 0)
1418
argp->txnid = (DB_TXN *)&argp[1];
1421
memcpy(&argp->type, bp, sizeof(argp->type));
1422
bp += sizeof(argp->type);
1424
memcpy(&argp->txnid->txnid, bp, sizeof(argp->txnid->txnid));
1425
bp += sizeof(argp->txnid->txnid);
1427
memcpy(&argp->prev_lsn, bp, sizeof(DB_LSN));
1428
bp += sizeof(DB_LSN);
1430
memcpy(&uinttmp, bp, sizeof(uinttmp));
1431
argp->fileid = (int32_t)uinttmp;
1432
bp += sizeof(uinttmp);
1434
memcpy(&uinttmp, bp, sizeof(uinttmp));
1435
argp->pgno = (db_pgno_t)uinttmp;
1436
bp += sizeof(uinttmp);
1438
memcpy(&argp->lsn, bp, sizeof(argp->lsn));
1439
bp += sizeof(argp->lsn);
1441
memcpy(&uinttmp, bp, sizeof(uinttmp));
1442
argp->indx = (u_int32_t)uinttmp;
1443
bp += sizeof(uinttmp);
1450
* PUBLIC: int __bam_repl_log __P((DB *, DB_TXN *, DB_LSN *,
1451
* PUBLIC: u_int32_t, db_pgno_t, DB_LSN *, u_int32_t, u_int32_t,
1452
* PUBLIC: const DBT *, const DBT *, u_int32_t, u_int32_t));
1455
__bam_repl_log(dbp, txnid, ret_lsnp, flags, pgno, lsn, indx, isdeleted, orig,
1456
repl, prefix, suffix)
1464
u_int32_t isdeleted;
1472
DB_LSN *lsnp, null_lsn;
1475
u_int32_t npad, rectype, txn_num;
1480
rectype = DB___bam_repl;
1483
if (txnid == NULL) {
1486
null_lsn.offset = 0;
1489
if (TAILQ_FIRST(&txnid->kids) != NULL &&
1490
(ret = __txn_activekids(dbenv, rectype, txnid)) != 0)
1492
txn_num = txnid->txnid;
1493
lsnp = &txnid->last_lsn;
1496
logrec.size = sizeof(rectype) + sizeof(txn_num) + sizeof(DB_LSN)
1502
+ sizeof(u_int32_t) + (orig == NULL ? 0 : orig->size)
1503
+ sizeof(u_int32_t) + (repl == NULL ? 0 : repl->size)
1505
+ sizeof(u_int32_t);
1506
if (CRYPTO_ON(dbenv)) {
1508
((DB_CIPHER *)dbenv->crypto_handle)->adj_size(logrec.size);
1509
logrec.size += npad;
1512
if ((ret = __os_malloc(dbenv,
1513
logrec.size, &logrec.data)) != 0)
1517
memset((u_int8_t *)logrec.data + logrec.size - npad, 0, npad);
1521
memcpy(bp, &rectype, sizeof(rectype));
1522
bp += sizeof(rectype);
1524
memcpy(bp, &txn_num, sizeof(txn_num));
1525
bp += sizeof(txn_num);
1527
memcpy(bp, lsnp, sizeof(DB_LSN));
1528
bp += sizeof(DB_LSN);
1530
DB_ASSERT(dbp->log_filename != NULL);
1531
if (dbp->log_filename->id == DB_LOGFILEID_INVALID &&
1532
(ret = __dbreg_lazy_id(dbp)) != 0)
1535
uinttmp = (u_int32_t)dbp->log_filename->id;
1536
memcpy(bp, &uinttmp, sizeof(uinttmp));
1537
bp += sizeof(uinttmp);
1539
uinttmp = (u_int32_t)pgno;
1540
memcpy(bp, &uinttmp, sizeof(uinttmp));
1541
bp += sizeof(uinttmp);
1544
memcpy(bp, lsn, sizeof(*lsn));
1546
memset(bp, 0, sizeof(*lsn));
1549
uinttmp = (u_int32_t)indx;
1550
memcpy(bp, &uinttmp, sizeof(uinttmp));
1551
bp += sizeof(uinttmp);
1553
uinttmp = (u_int32_t)isdeleted;
1554
memcpy(bp, &uinttmp, sizeof(uinttmp));
1555
bp += sizeof(uinttmp);
1559
memcpy(bp, &zero, sizeof(u_int32_t));
1560
bp += sizeof(u_int32_t);
1562
memcpy(bp, &orig->size, sizeof(orig->size));
1563
bp += sizeof(orig->size);
1564
memcpy(bp, orig->data, orig->size);
1570
memcpy(bp, &zero, sizeof(u_int32_t));
1571
bp += sizeof(u_int32_t);
1573
memcpy(bp, &repl->size, sizeof(repl->size));
1574
bp += sizeof(repl->size);
1575
memcpy(bp, repl->data, repl->size);
1579
uinttmp = (u_int32_t)prefix;
1580
memcpy(bp, &uinttmp, sizeof(uinttmp));
1581
bp += sizeof(uinttmp);
1583
uinttmp = (u_int32_t)suffix;
1584
memcpy(bp, &uinttmp, sizeof(uinttmp));
1585
bp += sizeof(uinttmp);
1587
DB_ASSERT((u_int32_t)(bp - (u_int8_t *)logrec.data) <= logrec.size);
1588
ret = dbenv->log_put(dbenv,
1589
ret_lsnp, (DBT *)&logrec, flags | DB_NOCOPY);
1590
if (txnid != NULL && ret == 0)
1591
txnid->last_lsn = *ret_lsnp;
1592
#ifdef LOG_DIAGNOSTIC
1594
(void)__bam_repl_print(dbenv,
1595
(DBT *)&logrec, ret_lsnp, NULL, NULL);
1597
__os_free(dbenv, logrec.data);
1602
* PUBLIC: int __bam_repl_getpgnos __P((DB_ENV *, DBT *, DB_LSN *,
1603
* PUBLIC: db_recops, void *));
1606
__bam_repl_getpgnos(dbenv, rec, lsnp, notused1, summary)
1615
__bam_repl_args *argp;
1618
COMPQUIET(notused1, DB_TXN_ABORT);
1621
t = (TXN_RECS *)summary;
1623
if ((ret = __bam_repl_read(dbenv, rec->data, &argp)) != 0)
1626
if ((ret = __dbreg_id_to_db(dbenv,
1627
argp->txnid, &dbp, argp->fileid, 0)) != 0)
1630
if ((ret = __rep_check_alloc(dbenv, t, 1)) != 0)
1633
t->array[t->npages].flags = 0;
1634
t->array[t->npages].fid = argp->fileid;
1635
t->array[t->npages].lsn = *lsnp;
1636
t->array[t->npages].pgdesc.pgno = argp->pgno;
1637
t->array[t->npages].pgdesc.type = DB_PAGE_LOCK;
1638
memcpy(t->array[t->npages].pgdesc.fileid, dbp->fileid,
1642
err: if (argp != NULL)
1643
__os_free(dbenv, argp);
1648
* PUBLIC: int __bam_repl_print __P((DB_ENV *, DBT *, DB_LSN *,
1649
* PUBLIC: db_recops, void *));
1652
__bam_repl_print(dbenv, dbtp, lsnp, notused2, notused3)
1659
__bam_repl_args *argp;
1664
notused2 = DB_TXN_ABORT;
1667
if ((ret = __bam_repl_read(dbenv, dbtp->data, &argp)) != 0)
1670
"[%lu][%lu]__bam_repl: rec: %lu txnid %lx prevlsn [%lu][%lu]\n",
1672
(u_long)lsnp->offset,
1674
(u_long)argp->txnid->txnid,
1675
(u_long)argp->prev_lsn.file,
1676
(u_long)argp->prev_lsn.offset);
1677
(void)printf("\tfileid: %ld\n", (long)argp->fileid);
1678
(void)printf("\tpgno: %lu\n", (u_long)argp->pgno);
1679
(void)printf("\tlsn: [%lu][%lu]\n",
1680
(u_long)argp->lsn.file, (u_long)argp->lsn.offset);
1681
(void)printf("\tindx: %lu\n", (u_long)argp->indx);
1682
(void)printf("\tisdeleted: %lu\n", (u_long)argp->isdeleted);
1683
(void)printf("\torig: ");
1684
for (i = 0; i < argp->orig.size; i++) {
1685
ch = ((u_int8_t *)argp->orig.data)[i];
1686
printf(isprint(ch) || ch == 0x0a ? "%c" : "%#x ", ch);
1689
(void)printf("\trepl: ");
1690
for (i = 0; i < argp->repl.size; i++) {
1691
ch = ((u_int8_t *)argp->repl.data)[i];
1692
printf(isprint(ch) || ch == 0x0a ? "%c" : "%#x ", ch);
1695
(void)printf("\tprefix: %lu\n", (u_long)argp->prefix);
1696
(void)printf("\tsuffix: %lu\n", (u_long)argp->suffix);
1698
__os_free(dbenv, argp);
1703
* PUBLIC: int __bam_repl_read __P((DB_ENV *, void *, __bam_repl_args **));
1706
__bam_repl_read(dbenv, recbuf, argpp)
1709
__bam_repl_args **argpp;
1711
__bam_repl_args *argp;
1716
if ((ret = __os_malloc(dbenv,
1717
sizeof(__bam_repl_args) + sizeof(DB_TXN), &argp)) != 0)
1720
argp->txnid = (DB_TXN *)&argp[1];
1723
memcpy(&argp->type, bp, sizeof(argp->type));
1724
bp += sizeof(argp->type);
1726
memcpy(&argp->txnid->txnid, bp, sizeof(argp->txnid->txnid));
1727
bp += sizeof(argp->txnid->txnid);
1729
memcpy(&argp->prev_lsn, bp, sizeof(DB_LSN));
1730
bp += sizeof(DB_LSN);
1732
memcpy(&uinttmp, bp, sizeof(uinttmp));
1733
argp->fileid = (int32_t)uinttmp;
1734
bp += sizeof(uinttmp);
1736
memcpy(&uinttmp, bp, sizeof(uinttmp));
1737
argp->pgno = (db_pgno_t)uinttmp;
1738
bp += sizeof(uinttmp);
1740
memcpy(&argp->lsn, bp, sizeof(argp->lsn));
1741
bp += sizeof(argp->lsn);
1743
memcpy(&uinttmp, bp, sizeof(uinttmp));
1744
argp->indx = (u_int32_t)uinttmp;
1745
bp += sizeof(uinttmp);
1747
memcpy(&uinttmp, bp, sizeof(uinttmp));
1748
argp->isdeleted = (u_int32_t)uinttmp;
1749
bp += sizeof(uinttmp);
1751
memset(&argp->orig, 0, sizeof(argp->orig));
1752
memcpy(&argp->orig.size, bp, sizeof(u_int32_t));
1753
bp += sizeof(u_int32_t);
1754
argp->orig.data = bp;
1755
bp += argp->orig.size;
1757
memset(&argp->repl, 0, sizeof(argp->repl));
1758
memcpy(&argp->repl.size, bp, sizeof(u_int32_t));
1759
bp += sizeof(u_int32_t);
1760
argp->repl.data = bp;
1761
bp += argp->repl.size;
1763
memcpy(&uinttmp, bp, sizeof(uinttmp));
1764
argp->prefix = (u_int32_t)uinttmp;
1765
bp += sizeof(uinttmp);
1767
memcpy(&uinttmp, bp, sizeof(uinttmp));
1768
argp->suffix = (u_int32_t)uinttmp;
1769
bp += sizeof(uinttmp);
1776
* PUBLIC: int __bam_root_log __P((DB *, DB_TXN *, DB_LSN *,
1777
* PUBLIC: u_int32_t, db_pgno_t, db_pgno_t, DB_LSN *));
1780
__bam_root_log(dbp, txnid, ret_lsnp, flags, meta_pgno, root_pgno, meta_lsn)
1785
db_pgno_t meta_pgno;
1786
db_pgno_t root_pgno;
1791
DB_LSN *lsnp, null_lsn;
1793
u_int32_t npad, rectype, txn_num;
1798
rectype = DB___bam_root;
1801
if (txnid == NULL) {
1804
null_lsn.offset = 0;
1807
if (TAILQ_FIRST(&txnid->kids) != NULL &&
1808
(ret = __txn_activekids(dbenv, rectype, txnid)) != 0)
1810
txn_num = txnid->txnid;
1811
lsnp = &txnid->last_lsn;
1814
logrec.size = sizeof(rectype) + sizeof(txn_num) + sizeof(DB_LSN)
1818
+ sizeof(*meta_lsn);
1819
if (CRYPTO_ON(dbenv)) {
1821
((DB_CIPHER *)dbenv->crypto_handle)->adj_size(logrec.size);
1822
logrec.size += npad;
1825
if ((ret = __os_malloc(dbenv,
1826
logrec.size, &logrec.data)) != 0)
1830
memset((u_int8_t *)logrec.data + logrec.size - npad, 0, npad);
1834
memcpy(bp, &rectype, sizeof(rectype));
1835
bp += sizeof(rectype);
1837
memcpy(bp, &txn_num, sizeof(txn_num));
1838
bp += sizeof(txn_num);
1840
memcpy(bp, lsnp, sizeof(DB_LSN));
1841
bp += sizeof(DB_LSN);
1843
DB_ASSERT(dbp->log_filename != NULL);
1844
if (dbp->log_filename->id == DB_LOGFILEID_INVALID &&
1845
(ret = __dbreg_lazy_id(dbp)) != 0)
1848
uinttmp = (u_int32_t)dbp->log_filename->id;
1849
memcpy(bp, &uinttmp, sizeof(uinttmp));
1850
bp += sizeof(uinttmp);
1852
uinttmp = (u_int32_t)meta_pgno;
1853
memcpy(bp, &uinttmp, sizeof(uinttmp));
1854
bp += sizeof(uinttmp);
1856
uinttmp = (u_int32_t)root_pgno;
1857
memcpy(bp, &uinttmp, sizeof(uinttmp));
1858
bp += sizeof(uinttmp);
1860
if (meta_lsn != NULL)
1861
memcpy(bp, meta_lsn, sizeof(*meta_lsn));
1863
memset(bp, 0, sizeof(*meta_lsn));
1864
bp += sizeof(*meta_lsn);
1866
DB_ASSERT((u_int32_t)(bp - (u_int8_t *)logrec.data) <= logrec.size);
1867
ret = dbenv->log_put(dbenv,
1868
ret_lsnp, (DBT *)&logrec, flags | DB_NOCOPY);
1869
if (txnid != NULL && ret == 0)
1870
txnid->last_lsn = *ret_lsnp;
1871
#ifdef LOG_DIAGNOSTIC
1873
(void)__bam_root_print(dbenv,
1874
(DBT *)&logrec, ret_lsnp, NULL, NULL);
1876
__os_free(dbenv, logrec.data);
1881
* PUBLIC: int __bam_root_getpgnos __P((DB_ENV *, DBT *, DB_LSN *,
1882
* PUBLIC: db_recops, void *));
1885
__bam_root_getpgnos(dbenv, rec, lsnp, notused1, summary)
1894
__bam_root_args *argp;
1897
COMPQUIET(notused1, DB_TXN_ABORT);
1900
t = (TXN_RECS *)summary;
1902
if ((ret = __bam_root_read(dbenv, rec->data, &argp)) != 0)
1905
if ((ret = __dbreg_id_to_db(dbenv,
1906
argp->txnid, &dbp, argp->fileid, 0)) != 0)
1909
if ((ret = __rep_check_alloc(dbenv, t, 2)) != 0)
1912
t->array[t->npages].flags = 0;
1913
t->array[t->npages].fid = argp->fileid;
1914
t->array[t->npages].lsn = *lsnp;
1915
t->array[t->npages].pgdesc.pgno = argp->meta_pgno;
1916
t->array[t->npages].pgdesc.type = DB_PAGE_LOCK;
1917
memcpy(t->array[t->npages].pgdesc.fileid, dbp->fileid,
1920
t->array[t->npages].flags = 0;
1921
t->array[t->npages].fid = argp->fileid;
1922
t->array[t->npages].lsn = *lsnp;
1923
t->array[t->npages].pgdesc.pgno = argp->root_pgno;
1924
t->array[t->npages].pgdesc.type = DB_PAGE_LOCK;
1925
memcpy(t->array[t->npages].pgdesc.fileid, dbp->fileid,
1929
err: if (argp != NULL)
1930
__os_free(dbenv, argp);
1935
* PUBLIC: int __bam_root_print __P((DB_ENV *, DBT *, DB_LSN *,
1936
* PUBLIC: db_recops, void *));
1939
__bam_root_print(dbenv, dbtp, lsnp, notused2, notused3)
1946
__bam_root_args *argp;
1949
notused2 = DB_TXN_ABORT;
1952
if ((ret = __bam_root_read(dbenv, dbtp->data, &argp)) != 0)
1955
"[%lu][%lu]__bam_root: rec: %lu txnid %lx prevlsn [%lu][%lu]\n",
1957
(u_long)lsnp->offset,
1959
(u_long)argp->txnid->txnid,
1960
(u_long)argp->prev_lsn.file,
1961
(u_long)argp->prev_lsn.offset);
1962
(void)printf("\tfileid: %ld\n", (long)argp->fileid);
1963
(void)printf("\tmeta_pgno: %lu\n", (u_long)argp->meta_pgno);
1964
(void)printf("\troot_pgno: %lu\n", (u_long)argp->root_pgno);
1965
(void)printf("\tmeta_lsn: [%lu][%lu]\n",
1966
(u_long)argp->meta_lsn.file, (u_long)argp->meta_lsn.offset);
1968
__os_free(dbenv, argp);
1973
* PUBLIC: int __bam_root_read __P((DB_ENV *, void *, __bam_root_args **));
1976
__bam_root_read(dbenv, recbuf, argpp)
1979
__bam_root_args **argpp;
1981
__bam_root_args *argp;
1986
if ((ret = __os_malloc(dbenv,
1987
sizeof(__bam_root_args) + sizeof(DB_TXN), &argp)) != 0)
1990
argp->txnid = (DB_TXN *)&argp[1];
1993
memcpy(&argp->type, bp, sizeof(argp->type));
1994
bp += sizeof(argp->type);
1996
memcpy(&argp->txnid->txnid, bp, sizeof(argp->txnid->txnid));
1997
bp += sizeof(argp->txnid->txnid);
1999
memcpy(&argp->prev_lsn, bp, sizeof(DB_LSN));
2000
bp += sizeof(DB_LSN);
2002
memcpy(&uinttmp, bp, sizeof(uinttmp));
2003
argp->fileid = (int32_t)uinttmp;
2004
bp += sizeof(uinttmp);
2006
memcpy(&uinttmp, bp, sizeof(uinttmp));
2007
argp->meta_pgno = (db_pgno_t)uinttmp;
2008
bp += sizeof(uinttmp);
2010
memcpy(&uinttmp, bp, sizeof(uinttmp));
2011
argp->root_pgno = (db_pgno_t)uinttmp;
2012
bp += sizeof(uinttmp);
2014
memcpy(&argp->meta_lsn, bp, sizeof(argp->meta_lsn));
2015
bp += sizeof(argp->meta_lsn);
2022
* PUBLIC: int __bam_curadj_log __P((DB *, DB_TXN *, DB_LSN *,
2023
* PUBLIC: u_int32_t, db_ca_mode, db_pgno_t, db_pgno_t, db_pgno_t,
2024
* PUBLIC: u_int32_t, u_int32_t, u_int32_t));
2027
__bam_curadj_log(dbp, txnid, ret_lsnp, flags, mode, from_pgno, to_pgno, left_pgno, first_indx,
2034
db_pgno_t from_pgno;
2036
db_pgno_t left_pgno;
2037
u_int32_t first_indx;
2038
u_int32_t from_indx;
2043
DB_LSN *lsnp, null_lsn;
2045
u_int32_t npad, rectype, txn_num;
2050
rectype = DB___bam_curadj;
2053
if (txnid == NULL) {
2056
null_lsn.offset = 0;
2059
if (TAILQ_FIRST(&txnid->kids) != NULL &&
2060
(ret = __txn_activekids(dbenv, rectype, txnid)) != 0)
2062
txn_num = txnid->txnid;
2063
lsnp = &txnid->last_lsn;
2066
logrec.size = sizeof(rectype) + sizeof(txn_num) + sizeof(DB_LSN)
2074
+ sizeof(u_int32_t);
2075
if (CRYPTO_ON(dbenv)) {
2077
((DB_CIPHER *)dbenv->crypto_handle)->adj_size(logrec.size);
2078
logrec.size += npad;
2081
if ((ret = __os_malloc(dbenv,
2082
logrec.size, &logrec.data)) != 0)
2086
memset((u_int8_t *)logrec.data + logrec.size - npad, 0, npad);
2090
memcpy(bp, &rectype, sizeof(rectype));
2091
bp += sizeof(rectype);
2093
memcpy(bp, &txn_num, sizeof(txn_num));
2094
bp += sizeof(txn_num);
2096
memcpy(bp, lsnp, sizeof(DB_LSN));
2097
bp += sizeof(DB_LSN);
2099
DB_ASSERT(dbp->log_filename != NULL);
2100
if (dbp->log_filename->id == DB_LOGFILEID_INVALID &&
2101
(ret = __dbreg_lazy_id(dbp)) != 0)
2104
uinttmp = (u_int32_t)dbp->log_filename->id;
2105
memcpy(bp, &uinttmp, sizeof(uinttmp));
2106
bp += sizeof(uinttmp);
2108
uinttmp = (u_int32_t)mode;
2109
memcpy(bp, &uinttmp, sizeof(uinttmp));
2110
bp += sizeof(uinttmp);
2112
uinttmp = (u_int32_t)from_pgno;
2113
memcpy(bp, &uinttmp, sizeof(uinttmp));
2114
bp += sizeof(uinttmp);
2116
uinttmp = (u_int32_t)to_pgno;
2117
memcpy(bp, &uinttmp, sizeof(uinttmp));
2118
bp += sizeof(uinttmp);
2120
uinttmp = (u_int32_t)left_pgno;
2121
memcpy(bp, &uinttmp, sizeof(uinttmp));
2122
bp += sizeof(uinttmp);
2124
uinttmp = (u_int32_t)first_indx;
2125
memcpy(bp, &uinttmp, sizeof(uinttmp));
2126
bp += sizeof(uinttmp);
2128
uinttmp = (u_int32_t)from_indx;
2129
memcpy(bp, &uinttmp, sizeof(uinttmp));
2130
bp += sizeof(uinttmp);
2132
uinttmp = (u_int32_t)to_indx;
2133
memcpy(bp, &uinttmp, sizeof(uinttmp));
2134
bp += sizeof(uinttmp);
2136
DB_ASSERT((u_int32_t)(bp - (u_int8_t *)logrec.data) <= logrec.size);
2137
ret = dbenv->log_put(dbenv,
2138
ret_lsnp, (DBT *)&logrec, flags | DB_NOCOPY);
2139
if (txnid != NULL && ret == 0)
2140
txnid->last_lsn = *ret_lsnp;
2141
#ifdef LOG_DIAGNOSTIC
2143
(void)__bam_curadj_print(dbenv,
2144
(DBT *)&logrec, ret_lsnp, NULL, NULL);
2146
__os_free(dbenv, logrec.data);
2151
* PUBLIC: int __bam_curadj_getpgnos __P((DB_ENV *, DBT *, DB_LSN *,
2152
* PUBLIC: db_recops, void *));
2155
__bam_curadj_getpgnos(dbenv, rec, lsnp, notused1, summary)
2164
COMPQUIET(rec, NULL);
2165
COMPQUIET(notused1, DB_TXN_ABORT);
2167
t = (TXN_RECS *)summary;
2169
if ((ret = __rep_check_alloc(dbenv, t, 1)) != 0)
2172
t->array[t->npages].flags = LSN_PAGE_NOLOCK;
2173
t->array[t->npages].lsn = *lsnp;
2174
t->array[t->npages].fid = DB_LOGFILEID_INVALID;
2175
memset(&t->array[t->npages].pgdesc, 0,
2176
sizeof(t->array[t->npages].pgdesc));
2184
* PUBLIC: int __bam_curadj_print __P((DB_ENV *, DBT *, DB_LSN *,
2185
* PUBLIC: db_recops, void *));
2188
__bam_curadj_print(dbenv, dbtp, lsnp, notused2, notused3)
2195
__bam_curadj_args *argp;
2198
notused2 = DB_TXN_ABORT;
2201
if ((ret = __bam_curadj_read(dbenv, dbtp->data, &argp)) != 0)
2204
"[%lu][%lu]__bam_curadj: rec: %lu txnid %lx prevlsn [%lu][%lu]\n",
2206
(u_long)lsnp->offset,
2208
(u_long)argp->txnid->txnid,
2209
(u_long)argp->prev_lsn.file,
2210
(u_long)argp->prev_lsn.offset);
2211
(void)printf("\tfileid: %ld\n", (long)argp->fileid);
2212
(void)printf("\tmode: %ld\n", (long)argp->mode);
2213
(void)printf("\tfrom_pgno: %lu\n", (u_long)argp->from_pgno);
2214
(void)printf("\tto_pgno: %lu\n", (u_long)argp->to_pgno);
2215
(void)printf("\tleft_pgno: %lu\n", (u_long)argp->left_pgno);
2216
(void)printf("\tfirst_indx: %lu\n", (u_long)argp->first_indx);
2217
(void)printf("\tfrom_indx: %lu\n", (u_long)argp->from_indx);
2218
(void)printf("\tto_indx: %lu\n", (u_long)argp->to_indx);
2220
__os_free(dbenv, argp);
2225
* PUBLIC: int __bam_curadj_read __P((DB_ENV *, void *, __bam_curadj_args **));
2228
__bam_curadj_read(dbenv, recbuf, argpp)
2231
__bam_curadj_args **argpp;
2233
__bam_curadj_args *argp;
2238
if ((ret = __os_malloc(dbenv,
2239
sizeof(__bam_curadj_args) + sizeof(DB_TXN), &argp)) != 0)
2242
argp->txnid = (DB_TXN *)&argp[1];
2245
memcpy(&argp->type, bp, sizeof(argp->type));
2246
bp += sizeof(argp->type);
2248
memcpy(&argp->txnid->txnid, bp, sizeof(argp->txnid->txnid));
2249
bp += sizeof(argp->txnid->txnid);
2251
memcpy(&argp->prev_lsn, bp, sizeof(DB_LSN));
2252
bp += sizeof(DB_LSN);
2254
memcpy(&uinttmp, bp, sizeof(uinttmp));
2255
argp->fileid = (int32_t)uinttmp;
2256
bp += sizeof(uinttmp);
2258
memcpy(&uinttmp, bp, sizeof(uinttmp));
2259
argp->mode = (db_ca_mode)uinttmp;
2260
bp += sizeof(uinttmp);
2262
memcpy(&uinttmp, bp, sizeof(uinttmp));
2263
argp->from_pgno = (db_pgno_t)uinttmp;
2264
bp += sizeof(uinttmp);
2266
memcpy(&uinttmp, bp, sizeof(uinttmp));
2267
argp->to_pgno = (db_pgno_t)uinttmp;
2268
bp += sizeof(uinttmp);
2270
memcpy(&uinttmp, bp, sizeof(uinttmp));
2271
argp->left_pgno = (db_pgno_t)uinttmp;
2272
bp += sizeof(uinttmp);
2274
memcpy(&uinttmp, bp, sizeof(uinttmp));
2275
argp->first_indx = (u_int32_t)uinttmp;
2276
bp += sizeof(uinttmp);
2278
memcpy(&uinttmp, bp, sizeof(uinttmp));
2279
argp->from_indx = (u_int32_t)uinttmp;
2280
bp += sizeof(uinttmp);
2282
memcpy(&uinttmp, bp, sizeof(uinttmp));
2283
argp->to_indx = (u_int32_t)uinttmp;
2284
bp += sizeof(uinttmp);
2291
* PUBLIC: int __bam_rcuradj_log __P((DB *, DB_TXN *, DB_LSN *,
2292
* PUBLIC: u_int32_t, ca_recno_arg, db_pgno_t, db_recno_t, u_int32_t));
2295
__bam_rcuradj_log(dbp, txnid, ret_lsnp, flags, mode, root, recno, order)
2307
DB_LSN *lsnp, null_lsn;
2309
u_int32_t npad, rectype, txn_num;
2314
rectype = DB___bam_rcuradj;
2317
if (txnid == NULL) {
2320
null_lsn.offset = 0;
2323
if (TAILQ_FIRST(&txnid->kids) != NULL &&
2324
(ret = __txn_activekids(dbenv, rectype, txnid)) != 0)
2326
txn_num = txnid->txnid;
2327
lsnp = &txnid->last_lsn;
2330
logrec.size = sizeof(rectype) + sizeof(txn_num) + sizeof(DB_LSN)
2335
+ sizeof(u_int32_t);
2336
if (CRYPTO_ON(dbenv)) {
2338
((DB_CIPHER *)dbenv->crypto_handle)->adj_size(logrec.size);
2339
logrec.size += npad;
2342
if ((ret = __os_malloc(dbenv,
2343
logrec.size, &logrec.data)) != 0)
2347
memset((u_int8_t *)logrec.data + logrec.size - npad, 0, npad);
2351
memcpy(bp, &rectype, sizeof(rectype));
2352
bp += sizeof(rectype);
2354
memcpy(bp, &txn_num, sizeof(txn_num));
2355
bp += sizeof(txn_num);
2357
memcpy(bp, lsnp, sizeof(DB_LSN));
2358
bp += sizeof(DB_LSN);
2360
DB_ASSERT(dbp->log_filename != NULL);
2361
if (dbp->log_filename->id == DB_LOGFILEID_INVALID &&
2362
(ret = __dbreg_lazy_id(dbp)) != 0)
2365
uinttmp = (u_int32_t)dbp->log_filename->id;
2366
memcpy(bp, &uinttmp, sizeof(uinttmp));
2367
bp += sizeof(uinttmp);
2369
uinttmp = (u_int32_t)mode;
2370
memcpy(bp, &uinttmp, sizeof(uinttmp));
2371
bp += sizeof(uinttmp);
2373
uinttmp = (u_int32_t)root;
2374
memcpy(bp, &uinttmp, sizeof(uinttmp));
2375
bp += sizeof(uinttmp);
2377
uinttmp = (u_int32_t)recno;
2378
memcpy(bp, &uinttmp, sizeof(uinttmp));
2379
bp += sizeof(uinttmp);
2381
uinttmp = (u_int32_t)order;
2382
memcpy(bp, &uinttmp, sizeof(uinttmp));
2383
bp += sizeof(uinttmp);
2385
DB_ASSERT((u_int32_t)(bp - (u_int8_t *)logrec.data) <= logrec.size);
2386
ret = dbenv->log_put(dbenv,
2387
ret_lsnp, (DBT *)&logrec, flags | DB_NOCOPY);
2388
if (txnid != NULL && ret == 0)
2389
txnid->last_lsn = *ret_lsnp;
2390
#ifdef LOG_DIAGNOSTIC
2392
(void)__bam_rcuradj_print(dbenv,
2393
(DBT *)&logrec, ret_lsnp, NULL, NULL);
2395
__os_free(dbenv, logrec.data);
2400
* PUBLIC: int __bam_rcuradj_getpgnos __P((DB_ENV *, DBT *, DB_LSN *,
2401
* PUBLIC: db_recops, void *));
2404
__bam_rcuradj_getpgnos(dbenv, rec, lsnp, notused1, summary)
2413
COMPQUIET(rec, NULL);
2414
COMPQUIET(notused1, DB_TXN_ABORT);
2416
t = (TXN_RECS *)summary;
2418
if ((ret = __rep_check_alloc(dbenv, t, 1)) != 0)
2421
t->array[t->npages].flags = LSN_PAGE_NOLOCK;
2422
t->array[t->npages].lsn = *lsnp;
2423
t->array[t->npages].fid = DB_LOGFILEID_INVALID;
2424
memset(&t->array[t->npages].pgdesc, 0,
2425
sizeof(t->array[t->npages].pgdesc));
2433
* PUBLIC: int __bam_rcuradj_print __P((DB_ENV *, DBT *, DB_LSN *,
2434
* PUBLIC: db_recops, void *));
2437
__bam_rcuradj_print(dbenv, dbtp, lsnp, notused2, notused3)
2444
__bam_rcuradj_args *argp;
2447
notused2 = DB_TXN_ABORT;
2450
if ((ret = __bam_rcuradj_read(dbenv, dbtp->data, &argp)) != 0)
2453
"[%lu][%lu]__bam_rcuradj: rec: %lu txnid %lx prevlsn [%lu][%lu]\n",
2455
(u_long)lsnp->offset,
2457
(u_long)argp->txnid->txnid,
2458
(u_long)argp->prev_lsn.file,
2459
(u_long)argp->prev_lsn.offset);
2460
(void)printf("\tfileid: %ld\n", (long)argp->fileid);
2461
(void)printf("\tmode: %ld\n", (long)argp->mode);
2462
(void)printf("\troot: %ld\n", (long)argp->root);
2463
(void)printf("\trecno: %ld\n", (long)argp->recno);
2464
(void)printf("\torder: %ld\n", (long)argp->order);
2466
__os_free(dbenv, argp);
2471
* PUBLIC: int __bam_rcuradj_read __P((DB_ENV *, void *,
2472
* PUBLIC: __bam_rcuradj_args **));
2475
__bam_rcuradj_read(dbenv, recbuf, argpp)
2478
__bam_rcuradj_args **argpp;
2480
__bam_rcuradj_args *argp;
2485
if ((ret = __os_malloc(dbenv,
2486
sizeof(__bam_rcuradj_args) + sizeof(DB_TXN), &argp)) != 0)
2489
argp->txnid = (DB_TXN *)&argp[1];
2492
memcpy(&argp->type, bp, sizeof(argp->type));
2493
bp += sizeof(argp->type);
2495
memcpy(&argp->txnid->txnid, bp, sizeof(argp->txnid->txnid));
2496
bp += sizeof(argp->txnid->txnid);
2498
memcpy(&argp->prev_lsn, bp, sizeof(DB_LSN));
2499
bp += sizeof(DB_LSN);
2501
memcpy(&uinttmp, bp, sizeof(uinttmp));
2502
argp->fileid = (int32_t)uinttmp;
2503
bp += sizeof(uinttmp);
2505
memcpy(&uinttmp, bp, sizeof(uinttmp));
2506
argp->mode = (ca_recno_arg)uinttmp;
2507
bp += sizeof(uinttmp);
2509
memcpy(&uinttmp, bp, sizeof(uinttmp));
2510
argp->root = (db_pgno_t)uinttmp;
2511
bp += sizeof(uinttmp);
2513
memcpy(&uinttmp, bp, sizeof(uinttmp));
2514
argp->recno = (db_recno_t)uinttmp;
2515
bp += sizeof(uinttmp);
2517
memcpy(&uinttmp, bp, sizeof(uinttmp));
2518
argp->order = (u_int32_t)uinttmp;
2519
bp += sizeof(uinttmp);
2526
* PUBLIC: int __bam_init_print __P((DB_ENV *, int (***)(DB_ENV *,
2527
* PUBLIC: DBT *, DB_LSN *, db_recops, void *), size_t *));
2530
__bam_init_print(dbenv, dtabp, dtabsizep)
2532
int (***dtabp)__P((DB_ENV *, DBT *, DB_LSN *, db_recops, void *));
2537
if ((ret = __db_add_recovery(dbenv, dtabp, dtabsizep,
2538
__bam_split_print, DB___bam_split)) != 0)
2540
if ((ret = __db_add_recovery(dbenv, dtabp, dtabsizep,
2541
__bam_rsplit_print, DB___bam_rsplit)) != 0)
2543
if ((ret = __db_add_recovery(dbenv, dtabp, dtabsizep,
2544
__bam_adj_print, DB___bam_adj)) != 0)
2546
if ((ret = __db_add_recovery(dbenv, dtabp, dtabsizep,
2547
__bam_cadjust_print, DB___bam_cadjust)) != 0)
2549
if ((ret = __db_add_recovery(dbenv, dtabp, dtabsizep,
2550
__bam_cdel_print, DB___bam_cdel)) != 0)
2552
if ((ret = __db_add_recovery(dbenv, dtabp, dtabsizep,
2553
__bam_repl_print, DB___bam_repl)) != 0)
2555
if ((ret = __db_add_recovery(dbenv, dtabp, dtabsizep,
2556
__bam_root_print, DB___bam_root)) != 0)
2558
if ((ret = __db_add_recovery(dbenv, dtabp, dtabsizep,
2559
__bam_curadj_print, DB___bam_curadj)) != 0)
2561
if ((ret = __db_add_recovery(dbenv, dtabp, dtabsizep,
2562
__bam_rcuradj_print, DB___bam_rcuradj)) != 0)
2568
* PUBLIC: int __bam_init_getpgnos __P((DB_ENV *, int (***)(DB_ENV *,
2569
* PUBLIC: DBT *, DB_LSN *, db_recops, void *), size_t *));
2572
__bam_init_getpgnos(dbenv, dtabp, dtabsizep)
2574
int (***dtabp)__P((DB_ENV *, DBT *, DB_LSN *, db_recops, void *));
2579
if ((ret = __db_add_recovery(dbenv, dtabp, dtabsizep,
2580
__bam_split_getpgnos, DB___bam_split)) != 0)
2582
if ((ret = __db_add_recovery(dbenv, dtabp, dtabsizep,
2583
__bam_rsplit_getpgnos, DB___bam_rsplit)) != 0)
2585
if ((ret = __db_add_recovery(dbenv, dtabp, dtabsizep,
2586
__bam_adj_getpgnos, DB___bam_adj)) != 0)
2588
if ((ret = __db_add_recovery(dbenv, dtabp, dtabsizep,
2589
__bam_cadjust_getpgnos, DB___bam_cadjust)) != 0)
2591
if ((ret = __db_add_recovery(dbenv, dtabp, dtabsizep,
2592
__bam_cdel_getpgnos, DB___bam_cdel)) != 0)
2594
if ((ret = __db_add_recovery(dbenv, dtabp, dtabsizep,
2595
__bam_repl_getpgnos, DB___bam_repl)) != 0)
2597
if ((ret = __db_add_recovery(dbenv, dtabp, dtabsizep,
2598
__bam_root_getpgnos, DB___bam_root)) != 0)
2600
if ((ret = __db_add_recovery(dbenv, dtabp, dtabsizep,
2601
__bam_curadj_getpgnos, DB___bam_curadj)) != 0)
2603
if ((ret = __db_add_recovery(dbenv, dtabp, dtabsizep,
2604
__bam_rcuradj_getpgnos, DB___bam_rcuradj)) != 0)
2610
* PUBLIC: int __bam_init_recover __P((DB_ENV *, int (***)(DB_ENV *,
2611
* PUBLIC: DBT *, DB_LSN *, db_recops, void *), size_t *));
2614
__bam_init_recover(dbenv, dtabp, dtabsizep)
2616
int (***dtabp)__P((DB_ENV *, DBT *, DB_LSN *, db_recops, void *));
2621
if ((ret = __db_add_recovery(dbenv, dtabp, dtabsizep,
2622
__bam_split_recover, DB___bam_split)) != 0)
2624
if ((ret = __db_add_recovery(dbenv, dtabp, dtabsizep,
2625
__bam_rsplit_recover, DB___bam_rsplit)) != 0)
2627
if ((ret = __db_add_recovery(dbenv, dtabp, dtabsizep,
2628
__bam_adj_recover, DB___bam_adj)) != 0)
2630
if ((ret = __db_add_recovery(dbenv, dtabp, dtabsizep,
2631
__bam_cadjust_recover, DB___bam_cadjust)) != 0)
2633
if ((ret = __db_add_recovery(dbenv, dtabp, dtabsizep,
2634
__bam_cdel_recover, DB___bam_cdel)) != 0)
2636
if ((ret = __db_add_recovery(dbenv, dtabp, dtabsizep,
2637
__bam_repl_recover, DB___bam_repl)) != 0)
2639
if ((ret = __db_add_recovery(dbenv, dtabp, dtabsizep,
2640
__bam_root_recover, DB___bam_root)) != 0)
2642
if ((ret = __db_add_recovery(dbenv, dtabp, dtabsizep,
2643
__bam_curadj_recover, DB___bam_curadj)) != 0)
2645
if ((ret = __db_add_recovery(dbenv, dtabp, dtabsizep,
2646
__bam_rcuradj_recover, DB___bam_rcuradj)) != 0)