1
/* Do not edit: automatically built by gen_rec.awk. */
4
#ifndef NO_SYSTEM_INCLUDES
13
#include "db_dispatch.h"
19
* PUBLIC: int __bam_pg_alloc_log __P((DB_ENV *, DB_TXN *, DB_LSN *, u_int32_t,
20
* PUBLIC: int32_t, DB_LSN *, DB_LSN *, db_pgno_t, u_int32_t, db_pgno_t));
23
__bam_pg_alloc_log(dbenv, txnid, ret_lsnp, flags,
24
fileid, meta_lsn, page_lsn, pgno, ptype, next)
37
DB_LSN *lsnp, null_lsn;
38
u_int32_t rectype, txn_num;
42
rectype = DB_bam_pg_alloc;
44
TAILQ_FIRST(&txnid->kids) != NULL &&
45
(ret = __txn_activekids(dbenv, rectype, txnid)) != 0)
47
txn_num = txnid == NULL ? 0 : txnid->txnid;
52
lsnp = &txnid->last_lsn;
53
logrec.size = sizeof(rectype) + sizeof(txn_num) + sizeof(DB_LSN)
60
if ((ret = __os_malloc(dbenv, logrec.size, &logrec.data)) != 0)
64
memcpy(bp, &rectype, sizeof(rectype));
65
bp += sizeof(rectype);
66
memcpy(bp, &txn_num, sizeof(txn_num));
67
bp += sizeof(txn_num);
68
memcpy(bp, lsnp, sizeof(DB_LSN));
70
memcpy(bp, &fileid, sizeof(fileid));
73
memcpy(bp, meta_lsn, sizeof(*meta_lsn));
75
memset(bp, 0, sizeof(*meta_lsn));
76
bp += sizeof(*meta_lsn);
78
memcpy(bp, page_lsn, sizeof(*page_lsn));
80
memset(bp, 0, sizeof(*page_lsn));
81
bp += sizeof(*page_lsn);
82
memcpy(bp, &pgno, sizeof(pgno));
84
memcpy(bp, &ptype, sizeof(ptype));
86
memcpy(bp, &next, sizeof(next));
88
DB_ASSERT((u_int32_t)(bp - (u_int8_t *)logrec.data) == logrec.size);
89
ret = log_put(dbenv, ret_lsnp, (DBT *)&logrec, flags);
90
if (txnid != NULL && ret == 0)
91
txnid->last_lsn = *ret_lsnp;
94
(void)__bam_pg_alloc_print(dbenv,
95
(DBT *)&logrec, ret_lsnp, NULL, NULL);
97
__os_free(dbenv, logrec.data, logrec.size);
102
* PUBLIC: int __bam_pg_alloc_print __P((DB_ENV *, DBT *, DB_LSN *, db_recops,
106
__bam_pg_alloc_print(dbenv, dbtp, lsnp, notused2, notused3)
113
__bam_pg_alloc_args *argp;
120
notused2 = DB_TXN_ABORT;
123
if ((ret = __bam_pg_alloc_read(dbenv, dbtp->data, &argp)) != 0)
126
"[%lu][%lu]bam_pg_alloc: rec: %lu txnid %lx prevlsn [%lu][%lu]\n",
128
(u_long)lsnp->offset,
130
(u_long)argp->txnid->txnid,
131
(u_long)argp->prev_lsn.file,
132
(u_long)argp->prev_lsn.offset);
133
(void)printf("\tfileid: %ld\n", (long)argp->fileid);
134
(void)printf("\tmeta_lsn: [%lu][%lu]\n",
135
(u_long)argp->meta_lsn.file, (u_long)argp->meta_lsn.offset);
136
(void)printf("\tpage_lsn: [%lu][%lu]\n",
137
(u_long)argp->page_lsn.file, (u_long)argp->page_lsn.offset);
138
(void)printf("\tpgno: %lu\n", (u_long)argp->pgno);
139
(void)printf("\tptype: %lu\n", (u_long)argp->ptype);
140
(void)printf("\tnext: %lu\n", (u_long)argp->next);
142
__os_free(dbenv, argp, 0);
147
* PUBLIC: int __bam_pg_alloc_read __P((DB_ENV *, void *,
148
* PUBLIC: __bam_pg_alloc_args **));
151
__bam_pg_alloc_read(dbenv, recbuf, argpp)
154
__bam_pg_alloc_args **argpp;
156
__bam_pg_alloc_args *argp;
160
ret = __os_malloc(dbenv, sizeof(__bam_pg_alloc_args) +
161
sizeof(DB_TXN), &argp);
164
argp->txnid = (DB_TXN *)&argp[1];
166
memcpy(&argp->type, bp, sizeof(argp->type));
167
bp += sizeof(argp->type);
168
memcpy(&argp->txnid->txnid, bp, sizeof(argp->txnid->txnid));
169
bp += sizeof(argp->txnid->txnid);
170
memcpy(&argp->prev_lsn, bp, sizeof(DB_LSN));
171
bp += sizeof(DB_LSN);
172
memcpy(&argp->fileid, bp, sizeof(argp->fileid));
173
bp += sizeof(argp->fileid);
174
memcpy(&argp->meta_lsn, bp, sizeof(argp->meta_lsn));
175
bp += sizeof(argp->meta_lsn);
176
memcpy(&argp->page_lsn, bp, sizeof(argp->page_lsn));
177
bp += sizeof(argp->page_lsn);
178
memcpy(&argp->pgno, bp, sizeof(argp->pgno));
179
bp += sizeof(argp->pgno);
180
memcpy(&argp->ptype, bp, sizeof(argp->ptype));
181
bp += sizeof(argp->ptype);
182
memcpy(&argp->next, bp, sizeof(argp->next));
183
bp += sizeof(argp->next);
189
* PUBLIC: int __bam_pg_alloc1_print __P((DB_ENV *, DBT *, DB_LSN *, db_recops,
193
__bam_pg_alloc1_print(dbenv, dbtp, lsnp, notused2, notused3)
200
__bam_pg_alloc1_args *argp;
207
notused2 = DB_TXN_ABORT;
210
if ((ret = __bam_pg_alloc1_read(dbenv, dbtp->data, &argp)) != 0)
213
"[%lu][%lu]bam_pg_alloc1: rec: %lu txnid %lx prevlsn [%lu][%lu]\n",
215
(u_long)lsnp->offset,
217
(u_long)argp->txnid->txnid,
218
(u_long)argp->prev_lsn.file,
219
(u_long)argp->prev_lsn.offset);
220
(void)printf("\tfileid: %ld\n", (long)argp->fileid);
221
(void)printf("\tmeta_lsn: [%lu][%lu]\n",
222
(u_long)argp->meta_lsn.file, (u_long)argp->meta_lsn.offset);
223
(void)printf("\talloc_lsn: [%lu][%lu]\n",
224
(u_long)argp->alloc_lsn.file, (u_long)argp->alloc_lsn.offset);
225
(void)printf("\tpage_lsn: [%lu][%lu]\n",
226
(u_long)argp->page_lsn.file, (u_long)argp->page_lsn.offset);
227
(void)printf("\tpgno: %lu\n", (u_long)argp->pgno);
228
(void)printf("\tptype: %lu\n", (u_long)argp->ptype);
229
(void)printf("\tnext: %lu\n", (u_long)argp->next);
231
__os_free(dbenv, argp, 0);
236
* PUBLIC: int __bam_pg_alloc1_read __P((DB_ENV *, void *,
237
* PUBLIC: __bam_pg_alloc1_args **));
240
__bam_pg_alloc1_read(dbenv, recbuf, argpp)
243
__bam_pg_alloc1_args **argpp;
245
__bam_pg_alloc1_args *argp;
249
ret = __os_malloc(dbenv, sizeof(__bam_pg_alloc1_args) +
250
sizeof(DB_TXN), &argp);
253
argp->txnid = (DB_TXN *)&argp[1];
255
memcpy(&argp->type, bp, sizeof(argp->type));
256
bp += sizeof(argp->type);
257
memcpy(&argp->txnid->txnid, bp, sizeof(argp->txnid->txnid));
258
bp += sizeof(argp->txnid->txnid);
259
memcpy(&argp->prev_lsn, bp, sizeof(DB_LSN));
260
bp += sizeof(DB_LSN);
261
memcpy(&argp->fileid, bp, sizeof(argp->fileid));
262
bp += sizeof(argp->fileid);
263
memcpy(&argp->meta_lsn, bp, sizeof(argp->meta_lsn));
264
bp += sizeof(argp->meta_lsn);
265
memcpy(&argp->alloc_lsn, bp, sizeof(argp->alloc_lsn));
266
bp += sizeof(argp->alloc_lsn);
267
memcpy(&argp->page_lsn, bp, sizeof(argp->page_lsn));
268
bp += sizeof(argp->page_lsn);
269
memcpy(&argp->pgno, bp, sizeof(argp->pgno));
270
bp += sizeof(argp->pgno);
271
memcpy(&argp->ptype, bp, sizeof(argp->ptype));
272
bp += sizeof(argp->ptype);
273
memcpy(&argp->next, bp, sizeof(argp->next));
274
bp += sizeof(argp->next);
280
* PUBLIC: int __bam_pg_free_log __P((DB_ENV *, DB_TXN *, DB_LSN *, u_int32_t,
281
* PUBLIC: int32_t, db_pgno_t, DB_LSN *, const DBT *, db_pgno_t));
284
__bam_pg_free_log(dbenv, txnid, ret_lsnp, flags,
285
fileid, pgno, meta_lsn, header, next)
297
DB_LSN *lsnp, null_lsn;
299
u_int32_t rectype, txn_num;
303
rectype = DB_bam_pg_free;
305
TAILQ_FIRST(&txnid->kids) != NULL &&
306
(ret = __txn_activekids(dbenv, rectype, txnid)) != 0)
308
txn_num = txnid == NULL ? 0 : txnid->txnid;
313
lsnp = &txnid->last_lsn;
314
logrec.size = sizeof(rectype) + sizeof(txn_num) + sizeof(DB_LSN)
318
+ sizeof(u_int32_t) + (header == NULL ? 0 : header->size)
320
if ((ret = __os_malloc(dbenv, logrec.size, &logrec.data)) != 0)
324
memcpy(bp, &rectype, sizeof(rectype));
325
bp += sizeof(rectype);
326
memcpy(bp, &txn_num, sizeof(txn_num));
327
bp += sizeof(txn_num);
328
memcpy(bp, lsnp, sizeof(DB_LSN));
329
bp += sizeof(DB_LSN);
330
memcpy(bp, &fileid, sizeof(fileid));
331
bp += sizeof(fileid);
332
memcpy(bp, &pgno, sizeof(pgno));
334
if (meta_lsn != NULL)
335
memcpy(bp, meta_lsn, sizeof(*meta_lsn));
337
memset(bp, 0, sizeof(*meta_lsn));
338
bp += sizeof(*meta_lsn);
339
if (header == NULL) {
341
memcpy(bp, &zero, sizeof(u_int32_t));
342
bp += sizeof(u_int32_t);
344
memcpy(bp, &header->size, sizeof(header->size));
345
bp += sizeof(header->size);
346
memcpy(bp, header->data, header->size);
349
memcpy(bp, &next, sizeof(next));
351
DB_ASSERT((u_int32_t)(bp - (u_int8_t *)logrec.data) == logrec.size);
352
ret = log_put(dbenv, ret_lsnp, (DBT *)&logrec, flags);
353
if (txnid != NULL && ret == 0)
354
txnid->last_lsn = *ret_lsnp;
355
#ifdef LOG_DIAGNOSTIC
357
(void)__bam_pg_free_print(dbenv,
358
(DBT *)&logrec, ret_lsnp, NULL, NULL);
360
__os_free(dbenv, logrec.data, logrec.size);
365
* PUBLIC: int __bam_pg_free_print __P((DB_ENV *, DBT *, DB_LSN *, db_recops,
369
__bam_pg_free_print(dbenv, dbtp, lsnp, notused2, notused3)
376
__bam_pg_free_args *argp;
383
notused2 = DB_TXN_ABORT;
386
if ((ret = __bam_pg_free_read(dbenv, dbtp->data, &argp)) != 0)
389
"[%lu][%lu]bam_pg_free: rec: %lu txnid %lx prevlsn [%lu][%lu]\n",
391
(u_long)lsnp->offset,
393
(u_long)argp->txnid->txnid,
394
(u_long)argp->prev_lsn.file,
395
(u_long)argp->prev_lsn.offset);
396
(void)printf("\tfileid: %ld\n", (long)argp->fileid);
397
(void)printf("\tpgno: %lu\n", (u_long)argp->pgno);
398
(void)printf("\tmeta_lsn: [%lu][%lu]\n",
399
(u_long)argp->meta_lsn.file, (u_long)argp->meta_lsn.offset);
400
(void)printf("\theader: ");
401
for (i = 0; i < argp->header.size; i++) {
402
ch = ((u_int8_t *)argp->header.data)[i];
403
if (isprint(ch) || ch == 0xa)
406
(void)printf("%#x ", ch);
409
(void)printf("\tnext: %lu\n", (u_long)argp->next);
411
__os_free(dbenv, argp, 0);
416
* PUBLIC: int __bam_pg_free_read __P((DB_ENV *, void *,
417
* PUBLIC: __bam_pg_free_args **));
420
__bam_pg_free_read(dbenv, recbuf, argpp)
423
__bam_pg_free_args **argpp;
425
__bam_pg_free_args *argp;
429
ret = __os_malloc(dbenv, sizeof(__bam_pg_free_args) +
430
sizeof(DB_TXN), &argp);
433
argp->txnid = (DB_TXN *)&argp[1];
435
memcpy(&argp->type, bp, sizeof(argp->type));
436
bp += sizeof(argp->type);
437
memcpy(&argp->txnid->txnid, bp, sizeof(argp->txnid->txnid));
438
bp += sizeof(argp->txnid->txnid);
439
memcpy(&argp->prev_lsn, bp, sizeof(DB_LSN));
440
bp += sizeof(DB_LSN);
441
memcpy(&argp->fileid, bp, sizeof(argp->fileid));
442
bp += sizeof(argp->fileid);
443
memcpy(&argp->pgno, bp, sizeof(argp->pgno));
444
bp += sizeof(argp->pgno);
445
memcpy(&argp->meta_lsn, bp, sizeof(argp->meta_lsn));
446
bp += sizeof(argp->meta_lsn);
447
memset(&argp->header, 0, sizeof(argp->header));
448
memcpy(&argp->header.size, bp, sizeof(u_int32_t));
449
bp += sizeof(u_int32_t);
450
argp->header.data = bp;
451
bp += argp->header.size;
452
memcpy(&argp->next, bp, sizeof(argp->next));
453
bp += sizeof(argp->next);
459
* PUBLIC: int __bam_pg_free1_print __P((DB_ENV *, DBT *, DB_LSN *, db_recops,
463
__bam_pg_free1_print(dbenv, dbtp, lsnp, notused2, notused3)
470
__bam_pg_free1_args *argp;
477
notused2 = DB_TXN_ABORT;
480
if ((ret = __bam_pg_free1_read(dbenv, dbtp->data, &argp)) != 0)
483
"[%lu][%lu]bam_pg_free1: rec: %lu txnid %lx prevlsn [%lu][%lu]\n",
485
(u_long)lsnp->offset,
487
(u_long)argp->txnid->txnid,
488
(u_long)argp->prev_lsn.file,
489
(u_long)argp->prev_lsn.offset);
490
(void)printf("\tfileid: %ld\n", (long)argp->fileid);
491
(void)printf("\tpgno: %lu\n", (u_long)argp->pgno);
492
(void)printf("\tmeta_lsn: [%lu][%lu]\n",
493
(u_long)argp->meta_lsn.file, (u_long)argp->meta_lsn.offset);
494
(void)printf("\talloc_lsn: [%lu][%lu]\n",
495
(u_long)argp->alloc_lsn.file, (u_long)argp->alloc_lsn.offset);
496
(void)printf("\theader: ");
497
for (i = 0; i < argp->header.size; i++) {
498
ch = ((u_int8_t *)argp->header.data)[i];
499
if (isprint(ch) || ch == 0xa)
502
(void)printf("%#x ", ch);
505
(void)printf("\tnext: %lu\n", (u_long)argp->next);
507
__os_free(dbenv, argp, 0);
512
* PUBLIC: int __bam_pg_free1_read __P((DB_ENV *, void *,
513
* PUBLIC: __bam_pg_free1_args **));
516
__bam_pg_free1_read(dbenv, recbuf, argpp)
519
__bam_pg_free1_args **argpp;
521
__bam_pg_free1_args *argp;
525
ret = __os_malloc(dbenv, sizeof(__bam_pg_free1_args) +
526
sizeof(DB_TXN), &argp);
529
argp->txnid = (DB_TXN *)&argp[1];
531
memcpy(&argp->type, bp, sizeof(argp->type));
532
bp += sizeof(argp->type);
533
memcpy(&argp->txnid->txnid, bp, sizeof(argp->txnid->txnid));
534
bp += sizeof(argp->txnid->txnid);
535
memcpy(&argp->prev_lsn, bp, sizeof(DB_LSN));
536
bp += sizeof(DB_LSN);
537
memcpy(&argp->fileid, bp, sizeof(argp->fileid));
538
bp += sizeof(argp->fileid);
539
memcpy(&argp->pgno, bp, sizeof(argp->pgno));
540
bp += sizeof(argp->pgno);
541
memcpy(&argp->meta_lsn, bp, sizeof(argp->meta_lsn));
542
bp += sizeof(argp->meta_lsn);
543
memcpy(&argp->alloc_lsn, bp, sizeof(argp->alloc_lsn));
544
bp += sizeof(argp->alloc_lsn);
545
memset(&argp->header, 0, sizeof(argp->header));
546
memcpy(&argp->header.size, bp, sizeof(u_int32_t));
547
bp += sizeof(u_int32_t);
548
argp->header.data = bp;
549
bp += argp->header.size;
550
memcpy(&argp->next, bp, sizeof(argp->next));
551
bp += sizeof(argp->next);
557
* PUBLIC: int __bam_split1_print __P((DB_ENV *, DBT *, DB_LSN *, db_recops,
561
__bam_split1_print(dbenv, dbtp, lsnp, notused2, notused3)
568
__bam_split1_args *argp;
575
notused2 = DB_TXN_ABORT;
578
if ((ret = __bam_split1_read(dbenv, dbtp->data, &argp)) != 0)
581
"[%lu][%lu]bam_split1: rec: %lu txnid %lx prevlsn [%lu][%lu]\n",
583
(u_long)lsnp->offset,
585
(u_long)argp->txnid->txnid,
586
(u_long)argp->prev_lsn.file,
587
(u_long)argp->prev_lsn.offset);
588
(void)printf("\tfileid: %ld\n", (long)argp->fileid);
589
(void)printf("\tleft: %lu\n", (u_long)argp->left);
590
(void)printf("\tllsn: [%lu][%lu]\n",
591
(u_long)argp->llsn.file, (u_long)argp->llsn.offset);
592
(void)printf("\tright: %lu\n", (u_long)argp->right);
593
(void)printf("\trlsn: [%lu][%lu]\n",
594
(u_long)argp->rlsn.file, (u_long)argp->rlsn.offset);
595
(void)printf("\tindx: %lu\n", (u_long)argp->indx);
596
(void)printf("\tnpgno: %lu\n", (u_long)argp->npgno);
597
(void)printf("\tnlsn: [%lu][%lu]\n",
598
(u_long)argp->nlsn.file, (u_long)argp->nlsn.offset);
599
(void)printf("\tpg: ");
600
for (i = 0; i < argp->pg.size; i++) {
601
ch = ((u_int8_t *)argp->pg.data)[i];
602
if (isprint(ch) || ch == 0xa)
605
(void)printf("%#x ", ch);
609
__os_free(dbenv, argp, 0);
614
* PUBLIC: int __bam_split1_read __P((DB_ENV *, void *, __bam_split1_args **));
617
__bam_split1_read(dbenv, recbuf, argpp)
620
__bam_split1_args **argpp;
622
__bam_split1_args *argp;
626
ret = __os_malloc(dbenv, sizeof(__bam_split1_args) +
627
sizeof(DB_TXN), &argp);
630
argp->txnid = (DB_TXN *)&argp[1];
632
memcpy(&argp->type, bp, sizeof(argp->type));
633
bp += sizeof(argp->type);
634
memcpy(&argp->txnid->txnid, bp, sizeof(argp->txnid->txnid));
635
bp += sizeof(argp->txnid->txnid);
636
memcpy(&argp->prev_lsn, bp, sizeof(DB_LSN));
637
bp += sizeof(DB_LSN);
638
memcpy(&argp->fileid, bp, sizeof(argp->fileid));
639
bp += sizeof(argp->fileid);
640
memcpy(&argp->left, bp, sizeof(argp->left));
641
bp += sizeof(argp->left);
642
memcpy(&argp->llsn, bp, sizeof(argp->llsn));
643
bp += sizeof(argp->llsn);
644
memcpy(&argp->right, bp, sizeof(argp->right));
645
bp += sizeof(argp->right);
646
memcpy(&argp->rlsn, bp, sizeof(argp->rlsn));
647
bp += sizeof(argp->rlsn);
648
memcpy(&argp->indx, bp, sizeof(argp->indx));
649
bp += sizeof(argp->indx);
650
memcpy(&argp->npgno, bp, sizeof(argp->npgno));
651
bp += sizeof(argp->npgno);
652
memcpy(&argp->nlsn, bp, sizeof(argp->nlsn));
653
bp += sizeof(argp->nlsn);
654
memset(&argp->pg, 0, sizeof(argp->pg));
655
memcpy(&argp->pg.size, bp, sizeof(u_int32_t));
656
bp += sizeof(u_int32_t);
664
* PUBLIC: int __bam_split_log __P((DB_ENV *, DB_TXN *, DB_LSN *, u_int32_t,
665
* PUBLIC: int32_t, db_pgno_t, DB_LSN *, db_pgno_t, DB_LSN *, u_int32_t, db_pgno_t, DB_LSN *,
666
* PUBLIC: db_pgno_t, const DBT *, u_int32_t));
669
__bam_split_log(dbenv, txnid, ret_lsnp, flags,
670
fileid, left, llsn, right, rlsn, indx,
671
npgno, nlsn, root_pgno, pg, opflags)
689
DB_LSN *lsnp, null_lsn;
691
u_int32_t rectype, txn_num;
695
rectype = DB_bam_split;
697
TAILQ_FIRST(&txnid->kids) != NULL &&
698
(ret = __txn_activekids(dbenv, rectype, txnid)) != 0)
700
txn_num = txnid == NULL ? 0 : txnid->txnid;
705
lsnp = &txnid->last_lsn;
706
logrec.size = sizeof(rectype) + sizeof(txn_num) + sizeof(DB_LSN)
716
+ sizeof(u_int32_t) + (pg == NULL ? 0 : pg->size)
718
if ((ret = __os_malloc(dbenv, logrec.size, &logrec.data)) != 0)
722
memcpy(bp, &rectype, sizeof(rectype));
723
bp += sizeof(rectype);
724
memcpy(bp, &txn_num, sizeof(txn_num));
725
bp += sizeof(txn_num);
726
memcpy(bp, lsnp, sizeof(DB_LSN));
727
bp += sizeof(DB_LSN);
728
memcpy(bp, &fileid, sizeof(fileid));
729
bp += sizeof(fileid);
730
memcpy(bp, &left, sizeof(left));
733
memcpy(bp, llsn, sizeof(*llsn));
735
memset(bp, 0, sizeof(*llsn));
737
memcpy(bp, &right, sizeof(right));
740
memcpy(bp, rlsn, sizeof(*rlsn));
742
memset(bp, 0, sizeof(*rlsn));
744
memcpy(bp, &indx, sizeof(indx));
746
memcpy(bp, &npgno, sizeof(npgno));
749
memcpy(bp, nlsn, sizeof(*nlsn));
751
memset(bp, 0, sizeof(*nlsn));
753
memcpy(bp, &root_pgno, sizeof(root_pgno));
754
bp += sizeof(root_pgno);
757
memcpy(bp, &zero, sizeof(u_int32_t));
758
bp += sizeof(u_int32_t);
760
memcpy(bp, &pg->size, sizeof(pg->size));
761
bp += sizeof(pg->size);
762
memcpy(bp, pg->data, pg->size);
765
memcpy(bp, &opflags, sizeof(opflags));
766
bp += sizeof(opflags);
767
DB_ASSERT((u_int32_t)(bp - (u_int8_t *)logrec.data) == logrec.size);
768
ret = log_put(dbenv, ret_lsnp, (DBT *)&logrec, flags);
769
if (txnid != NULL && ret == 0)
770
txnid->last_lsn = *ret_lsnp;
771
#ifdef LOG_DIAGNOSTIC
773
(void)__bam_split_print(dbenv,
774
(DBT *)&logrec, ret_lsnp, NULL, NULL);
776
__os_free(dbenv, logrec.data, logrec.size);
781
* PUBLIC: int __bam_split_print __P((DB_ENV *, DBT *, DB_LSN *, db_recops,
785
__bam_split_print(dbenv, dbtp, lsnp, notused2, notused3)
792
__bam_split_args *argp;
799
notused2 = DB_TXN_ABORT;
802
if ((ret = __bam_split_read(dbenv, dbtp->data, &argp)) != 0)
805
"[%lu][%lu]bam_split: rec: %lu txnid %lx prevlsn [%lu][%lu]\n",
807
(u_long)lsnp->offset,
809
(u_long)argp->txnid->txnid,
810
(u_long)argp->prev_lsn.file,
811
(u_long)argp->prev_lsn.offset);
812
(void)printf("\tfileid: %ld\n", (long)argp->fileid);
813
(void)printf("\tleft: %lu\n", (u_long)argp->left);
814
(void)printf("\tllsn: [%lu][%lu]\n",
815
(u_long)argp->llsn.file, (u_long)argp->llsn.offset);
816
(void)printf("\tright: %lu\n", (u_long)argp->right);
817
(void)printf("\trlsn: [%lu][%lu]\n",
818
(u_long)argp->rlsn.file, (u_long)argp->rlsn.offset);
819
(void)printf("\tindx: %lu\n", (u_long)argp->indx);
820
(void)printf("\tnpgno: %lu\n", (u_long)argp->npgno);
821
(void)printf("\tnlsn: [%lu][%lu]\n",
822
(u_long)argp->nlsn.file, (u_long)argp->nlsn.offset);
823
(void)printf("\troot_pgno: %lu\n", (u_long)argp->root_pgno);
824
(void)printf("\tpg: ");
825
for (i = 0; i < argp->pg.size; i++) {
826
ch = ((u_int8_t *)argp->pg.data)[i];
827
if (isprint(ch) || ch == 0xa)
830
(void)printf("%#x ", ch);
833
(void)printf("\topflags: %lu\n", (u_long)argp->opflags);
835
__os_free(dbenv, argp, 0);
840
* PUBLIC: int __bam_split_read __P((DB_ENV *, void *, __bam_split_args **));
843
__bam_split_read(dbenv, recbuf, argpp)
846
__bam_split_args **argpp;
848
__bam_split_args *argp;
852
ret = __os_malloc(dbenv, sizeof(__bam_split_args) +
853
sizeof(DB_TXN), &argp);
856
argp->txnid = (DB_TXN *)&argp[1];
858
memcpy(&argp->type, bp, sizeof(argp->type));
859
bp += sizeof(argp->type);
860
memcpy(&argp->txnid->txnid, bp, sizeof(argp->txnid->txnid));
861
bp += sizeof(argp->txnid->txnid);
862
memcpy(&argp->prev_lsn, bp, sizeof(DB_LSN));
863
bp += sizeof(DB_LSN);
864
memcpy(&argp->fileid, bp, sizeof(argp->fileid));
865
bp += sizeof(argp->fileid);
866
memcpy(&argp->left, bp, sizeof(argp->left));
867
bp += sizeof(argp->left);
868
memcpy(&argp->llsn, bp, sizeof(argp->llsn));
869
bp += sizeof(argp->llsn);
870
memcpy(&argp->right, bp, sizeof(argp->right));
871
bp += sizeof(argp->right);
872
memcpy(&argp->rlsn, bp, sizeof(argp->rlsn));
873
bp += sizeof(argp->rlsn);
874
memcpy(&argp->indx, bp, sizeof(argp->indx));
875
bp += sizeof(argp->indx);
876
memcpy(&argp->npgno, bp, sizeof(argp->npgno));
877
bp += sizeof(argp->npgno);
878
memcpy(&argp->nlsn, bp, sizeof(argp->nlsn));
879
bp += sizeof(argp->nlsn);
880
memcpy(&argp->root_pgno, bp, sizeof(argp->root_pgno));
881
bp += sizeof(argp->root_pgno);
882
memset(&argp->pg, 0, sizeof(argp->pg));
883
memcpy(&argp->pg.size, bp, sizeof(u_int32_t));
884
bp += sizeof(u_int32_t);
887
memcpy(&argp->opflags, bp, sizeof(argp->opflags));
888
bp += sizeof(argp->opflags);
894
* PUBLIC: int __bam_rsplit1_print __P((DB_ENV *, DBT *, DB_LSN *, db_recops,
898
__bam_rsplit1_print(dbenv, dbtp, lsnp, notused2, notused3)
905
__bam_rsplit1_args *argp;
912
notused2 = DB_TXN_ABORT;
915
if ((ret = __bam_rsplit1_read(dbenv, dbtp->data, &argp)) != 0)
918
"[%lu][%lu]bam_rsplit1: rec: %lu txnid %lx prevlsn [%lu][%lu]\n",
920
(u_long)lsnp->offset,
922
(u_long)argp->txnid->txnid,
923
(u_long)argp->prev_lsn.file,
924
(u_long)argp->prev_lsn.offset);
925
(void)printf("\tfileid: %ld\n", (long)argp->fileid);
926
(void)printf("\tpgno: %lu\n", (u_long)argp->pgno);
927
(void)printf("\tpgdbt: ");
928
for (i = 0; i < argp->pgdbt.size; i++) {
929
ch = ((u_int8_t *)argp->pgdbt.data)[i];
930
if (isprint(ch) || ch == 0xa)
933
(void)printf("%#x ", ch);
936
(void)printf("\tnrec: %lu\n", (u_long)argp->nrec);
937
(void)printf("\trootent: ");
938
for (i = 0; i < argp->rootent.size; i++) {
939
ch = ((u_int8_t *)argp->rootent.data)[i];
940
if (isprint(ch) || ch == 0xa)
943
(void)printf("%#x ", ch);
946
(void)printf("\trootlsn: [%lu][%lu]\n",
947
(u_long)argp->rootlsn.file, (u_long)argp->rootlsn.offset);
949
__os_free(dbenv, argp, 0);
954
* PUBLIC: int __bam_rsplit1_read __P((DB_ENV *, void *,
955
* PUBLIC: __bam_rsplit1_args **));
958
__bam_rsplit1_read(dbenv, recbuf, argpp)
961
__bam_rsplit1_args **argpp;
963
__bam_rsplit1_args *argp;
967
ret = __os_malloc(dbenv, sizeof(__bam_rsplit1_args) +
968
sizeof(DB_TXN), &argp);
971
argp->txnid = (DB_TXN *)&argp[1];
973
memcpy(&argp->type, bp, sizeof(argp->type));
974
bp += sizeof(argp->type);
975
memcpy(&argp->txnid->txnid, bp, sizeof(argp->txnid->txnid));
976
bp += sizeof(argp->txnid->txnid);
977
memcpy(&argp->prev_lsn, bp, sizeof(DB_LSN));
978
bp += sizeof(DB_LSN);
979
memcpy(&argp->fileid, bp, sizeof(argp->fileid));
980
bp += sizeof(argp->fileid);
981
memcpy(&argp->pgno, bp, sizeof(argp->pgno));
982
bp += sizeof(argp->pgno);
983
memset(&argp->pgdbt, 0, sizeof(argp->pgdbt));
984
memcpy(&argp->pgdbt.size, bp, sizeof(u_int32_t));
985
bp += sizeof(u_int32_t);
986
argp->pgdbt.data = bp;
987
bp += argp->pgdbt.size;
988
memcpy(&argp->nrec, bp, sizeof(argp->nrec));
989
bp += sizeof(argp->nrec);
990
memset(&argp->rootent, 0, sizeof(argp->rootent));
991
memcpy(&argp->rootent.size, bp, sizeof(u_int32_t));
992
bp += sizeof(u_int32_t);
993
argp->rootent.data = bp;
994
bp += argp->rootent.size;
995
memcpy(&argp->rootlsn, bp, sizeof(argp->rootlsn));
996
bp += sizeof(argp->rootlsn);
1002
* PUBLIC: int __bam_rsplit_log __P((DB_ENV *, DB_TXN *, DB_LSN *, u_int32_t,
1003
* PUBLIC: int32_t, db_pgno_t, const DBT *, db_pgno_t, db_pgno_t, const DBT *, DB_LSN *));
1006
__bam_rsplit_log(dbenv, txnid, ret_lsnp, flags,
1007
fileid, pgno, pgdbt, root_pgno, nrec, rootent,
1016
db_pgno_t root_pgno;
1022
DB_LSN *lsnp, null_lsn;
1024
u_int32_t rectype, txn_num;
1028
rectype = DB_bam_rsplit;
1029
if (txnid != NULL &&
1030
TAILQ_FIRST(&txnid->kids) != NULL &&
1031
(ret = __txn_activekids(dbenv, rectype, txnid)) != 0)
1033
txn_num = txnid == NULL ? 0 : txnid->txnid;
1034
if (txnid == NULL) {
1038
lsnp = &txnid->last_lsn;
1039
logrec.size = sizeof(rectype) + sizeof(txn_num) + sizeof(DB_LSN)
1042
+ sizeof(u_int32_t) + (pgdbt == NULL ? 0 : pgdbt->size)
1045
+ sizeof(u_int32_t) + (rootent == NULL ? 0 : rootent->size)
1047
if ((ret = __os_malloc(dbenv, logrec.size, &logrec.data)) != 0)
1051
memcpy(bp, &rectype, sizeof(rectype));
1052
bp += sizeof(rectype);
1053
memcpy(bp, &txn_num, sizeof(txn_num));
1054
bp += sizeof(txn_num);
1055
memcpy(bp, lsnp, sizeof(DB_LSN));
1056
bp += sizeof(DB_LSN);
1057
memcpy(bp, &fileid, sizeof(fileid));
1058
bp += sizeof(fileid);
1059
memcpy(bp, &pgno, sizeof(pgno));
1061
if (pgdbt == NULL) {
1063
memcpy(bp, &zero, sizeof(u_int32_t));
1064
bp += sizeof(u_int32_t);
1066
memcpy(bp, &pgdbt->size, sizeof(pgdbt->size));
1067
bp += sizeof(pgdbt->size);
1068
memcpy(bp, pgdbt->data, pgdbt->size);
1071
memcpy(bp, &root_pgno, sizeof(root_pgno));
1072
bp += sizeof(root_pgno);
1073
memcpy(bp, &nrec, sizeof(nrec));
1075
if (rootent == NULL) {
1077
memcpy(bp, &zero, sizeof(u_int32_t));
1078
bp += sizeof(u_int32_t);
1080
memcpy(bp, &rootent->size, sizeof(rootent->size));
1081
bp += sizeof(rootent->size);
1082
memcpy(bp, rootent->data, rootent->size);
1083
bp += rootent->size;
1085
if (rootlsn != NULL)
1086
memcpy(bp, rootlsn, sizeof(*rootlsn));
1088
memset(bp, 0, sizeof(*rootlsn));
1089
bp += sizeof(*rootlsn);
1090
DB_ASSERT((u_int32_t)(bp - (u_int8_t *)logrec.data) == logrec.size);
1091
ret = log_put(dbenv, ret_lsnp, (DBT *)&logrec, flags);
1092
if (txnid != NULL && ret == 0)
1093
txnid->last_lsn = *ret_lsnp;
1094
#ifdef LOG_DIAGNOSTIC
1096
(void)__bam_rsplit_print(dbenv,
1097
(DBT *)&logrec, ret_lsnp, NULL, NULL);
1099
__os_free(dbenv, logrec.data, logrec.size);
1104
* PUBLIC: int __bam_rsplit_print __P((DB_ENV *, DBT *, DB_LSN *, db_recops,
1108
__bam_rsplit_print(dbenv, dbtp, lsnp, notused2, notused3)
1115
__bam_rsplit_args *argp;
1122
notused2 = DB_TXN_ABORT;
1125
if ((ret = __bam_rsplit_read(dbenv, dbtp->data, &argp)) != 0)
1128
"[%lu][%lu]bam_rsplit: rec: %lu txnid %lx prevlsn [%lu][%lu]\n",
1130
(u_long)lsnp->offset,
1132
(u_long)argp->txnid->txnid,
1133
(u_long)argp->prev_lsn.file,
1134
(u_long)argp->prev_lsn.offset);
1135
(void)printf("\tfileid: %ld\n", (long)argp->fileid);
1136
(void)printf("\tpgno: %lu\n", (u_long)argp->pgno);
1137
(void)printf("\tpgdbt: ");
1138
for (i = 0; i < argp->pgdbt.size; i++) {
1139
ch = ((u_int8_t *)argp->pgdbt.data)[i];
1140
if (isprint(ch) || ch == 0xa)
1143
(void)printf("%#x ", ch);
1146
(void)printf("\troot_pgno: %lu\n", (u_long)argp->root_pgno);
1147
(void)printf("\tnrec: %lu\n", (u_long)argp->nrec);
1148
(void)printf("\trootent: ");
1149
for (i = 0; i < argp->rootent.size; i++) {
1150
ch = ((u_int8_t *)argp->rootent.data)[i];
1151
if (isprint(ch) || ch == 0xa)
1154
(void)printf("%#x ", ch);
1157
(void)printf("\trootlsn: [%lu][%lu]\n",
1158
(u_long)argp->rootlsn.file, (u_long)argp->rootlsn.offset);
1160
__os_free(dbenv, argp, 0);
1165
* PUBLIC: int __bam_rsplit_read __P((DB_ENV *, void *, __bam_rsplit_args **));
1168
__bam_rsplit_read(dbenv, recbuf, argpp)
1171
__bam_rsplit_args **argpp;
1173
__bam_rsplit_args *argp;
1177
ret = __os_malloc(dbenv, sizeof(__bam_rsplit_args) +
1178
sizeof(DB_TXN), &argp);
1181
argp->txnid = (DB_TXN *)&argp[1];
1183
memcpy(&argp->type, bp, sizeof(argp->type));
1184
bp += sizeof(argp->type);
1185
memcpy(&argp->txnid->txnid, bp, sizeof(argp->txnid->txnid));
1186
bp += sizeof(argp->txnid->txnid);
1187
memcpy(&argp->prev_lsn, bp, sizeof(DB_LSN));
1188
bp += sizeof(DB_LSN);
1189
memcpy(&argp->fileid, bp, sizeof(argp->fileid));
1190
bp += sizeof(argp->fileid);
1191
memcpy(&argp->pgno, bp, sizeof(argp->pgno));
1192
bp += sizeof(argp->pgno);
1193
memset(&argp->pgdbt, 0, sizeof(argp->pgdbt));
1194
memcpy(&argp->pgdbt.size, bp, sizeof(u_int32_t));
1195
bp += sizeof(u_int32_t);
1196
argp->pgdbt.data = bp;
1197
bp += argp->pgdbt.size;
1198
memcpy(&argp->root_pgno, bp, sizeof(argp->root_pgno));
1199
bp += sizeof(argp->root_pgno);
1200
memcpy(&argp->nrec, bp, sizeof(argp->nrec));
1201
bp += sizeof(argp->nrec);
1202
memset(&argp->rootent, 0, sizeof(argp->rootent));
1203
memcpy(&argp->rootent.size, bp, sizeof(u_int32_t));
1204
bp += sizeof(u_int32_t);
1205
argp->rootent.data = bp;
1206
bp += argp->rootent.size;
1207
memcpy(&argp->rootlsn, bp, sizeof(argp->rootlsn));
1208
bp += sizeof(argp->rootlsn);
1214
* PUBLIC: int __bam_adj_log __P((DB_ENV *, DB_TXN *, DB_LSN *, u_int32_t,
1215
* PUBLIC: int32_t, db_pgno_t, DB_LSN *, u_int32_t, u_int32_t, u_int32_t));
1218
__bam_adj_log(dbenv, txnid, ret_lsnp, flags,
1219
fileid, pgno, lsn, indx, indx_copy, is_insert)
1228
u_int32_t indx_copy;
1229
u_int32_t is_insert;
1232
DB_LSN *lsnp, null_lsn;
1233
u_int32_t rectype, txn_num;
1237
rectype = DB_bam_adj;
1238
if (txnid != NULL &&
1239
TAILQ_FIRST(&txnid->kids) != NULL &&
1240
(ret = __txn_activekids(dbenv, rectype, txnid)) != 0)
1242
txn_num = txnid == NULL ? 0 : txnid->txnid;
1243
if (txnid == NULL) {
1247
lsnp = &txnid->last_lsn;
1248
logrec.size = sizeof(rectype) + sizeof(txn_num) + sizeof(DB_LSN)
1254
+ sizeof(is_insert);
1255
if ((ret = __os_malloc(dbenv, logrec.size, &logrec.data)) != 0)
1259
memcpy(bp, &rectype, sizeof(rectype));
1260
bp += sizeof(rectype);
1261
memcpy(bp, &txn_num, sizeof(txn_num));
1262
bp += sizeof(txn_num);
1263
memcpy(bp, lsnp, sizeof(DB_LSN));
1264
bp += sizeof(DB_LSN);
1265
memcpy(bp, &fileid, sizeof(fileid));
1266
bp += sizeof(fileid);
1267
memcpy(bp, &pgno, sizeof(pgno));
1270
memcpy(bp, lsn, sizeof(*lsn));
1272
memset(bp, 0, sizeof(*lsn));
1274
memcpy(bp, &indx, sizeof(indx));
1276
memcpy(bp, &indx_copy, sizeof(indx_copy));
1277
bp += sizeof(indx_copy);
1278
memcpy(bp, &is_insert, sizeof(is_insert));
1279
bp += sizeof(is_insert);
1280
DB_ASSERT((u_int32_t)(bp - (u_int8_t *)logrec.data) == logrec.size);
1281
ret = log_put(dbenv, ret_lsnp, (DBT *)&logrec, flags);
1282
if (txnid != NULL && ret == 0)
1283
txnid->last_lsn = *ret_lsnp;
1284
#ifdef LOG_DIAGNOSTIC
1286
(void)__bam_adj_print(dbenv,
1287
(DBT *)&logrec, ret_lsnp, NULL, NULL);
1289
__os_free(dbenv, logrec.data, logrec.size);
1294
* PUBLIC: int __bam_adj_print __P((DB_ENV *, DBT *, DB_LSN *, db_recops,
1298
__bam_adj_print(dbenv, dbtp, lsnp, notused2, notused3)
1305
__bam_adj_args *argp;
1312
notused2 = DB_TXN_ABORT;
1315
if ((ret = __bam_adj_read(dbenv, dbtp->data, &argp)) != 0)
1318
"[%lu][%lu]bam_adj: rec: %lu txnid %lx prevlsn [%lu][%lu]\n",
1320
(u_long)lsnp->offset,
1322
(u_long)argp->txnid->txnid,
1323
(u_long)argp->prev_lsn.file,
1324
(u_long)argp->prev_lsn.offset);
1325
(void)printf("\tfileid: %ld\n", (long)argp->fileid);
1326
(void)printf("\tpgno: %lu\n", (u_long)argp->pgno);
1327
(void)printf("\tlsn: [%lu][%lu]\n",
1328
(u_long)argp->lsn.file, (u_long)argp->lsn.offset);
1329
(void)printf("\tindx: %lu\n", (u_long)argp->indx);
1330
(void)printf("\tindx_copy: %lu\n", (u_long)argp->indx_copy);
1331
(void)printf("\tis_insert: %lu\n", (u_long)argp->is_insert);
1333
__os_free(dbenv, argp, 0);
1338
* PUBLIC: int __bam_adj_read __P((DB_ENV *, void *, __bam_adj_args **));
1341
__bam_adj_read(dbenv, recbuf, argpp)
1344
__bam_adj_args **argpp;
1346
__bam_adj_args *argp;
1350
ret = __os_malloc(dbenv, sizeof(__bam_adj_args) +
1351
sizeof(DB_TXN), &argp);
1354
argp->txnid = (DB_TXN *)&argp[1];
1356
memcpy(&argp->type, bp, sizeof(argp->type));
1357
bp += sizeof(argp->type);
1358
memcpy(&argp->txnid->txnid, bp, sizeof(argp->txnid->txnid));
1359
bp += sizeof(argp->txnid->txnid);
1360
memcpy(&argp->prev_lsn, bp, sizeof(DB_LSN));
1361
bp += sizeof(DB_LSN);
1362
memcpy(&argp->fileid, bp, sizeof(argp->fileid));
1363
bp += sizeof(argp->fileid);
1364
memcpy(&argp->pgno, bp, sizeof(argp->pgno));
1365
bp += sizeof(argp->pgno);
1366
memcpy(&argp->lsn, bp, sizeof(argp->lsn));
1367
bp += sizeof(argp->lsn);
1368
memcpy(&argp->indx, bp, sizeof(argp->indx));
1369
bp += sizeof(argp->indx);
1370
memcpy(&argp->indx_copy, bp, sizeof(argp->indx_copy));
1371
bp += sizeof(argp->indx_copy);
1372
memcpy(&argp->is_insert, bp, sizeof(argp->is_insert));
1373
bp += sizeof(argp->is_insert);
1379
* PUBLIC: int __bam_cadjust_log __P((DB_ENV *, DB_TXN *, DB_LSN *, u_int32_t,
1380
* PUBLIC: int32_t, db_pgno_t, DB_LSN *, u_int32_t, int32_t, u_int32_t));
1383
__bam_cadjust_log(dbenv, txnid, ret_lsnp, flags,
1384
fileid, pgno, lsn, indx, adjust, opflags)
1397
DB_LSN *lsnp, null_lsn;
1398
u_int32_t rectype, txn_num;
1402
rectype = DB_bam_cadjust;
1403
if (txnid != NULL &&
1404
TAILQ_FIRST(&txnid->kids) != NULL &&
1405
(ret = __txn_activekids(dbenv, rectype, txnid)) != 0)
1407
txn_num = txnid == NULL ? 0 : txnid->txnid;
1408
if (txnid == NULL) {
1412
lsnp = &txnid->last_lsn;
1413
logrec.size = sizeof(rectype) + sizeof(txn_num) + sizeof(DB_LSN)
1420
if ((ret = __os_malloc(dbenv, logrec.size, &logrec.data)) != 0)
1424
memcpy(bp, &rectype, sizeof(rectype));
1425
bp += sizeof(rectype);
1426
memcpy(bp, &txn_num, sizeof(txn_num));
1427
bp += sizeof(txn_num);
1428
memcpy(bp, lsnp, sizeof(DB_LSN));
1429
bp += sizeof(DB_LSN);
1430
memcpy(bp, &fileid, sizeof(fileid));
1431
bp += sizeof(fileid);
1432
memcpy(bp, &pgno, sizeof(pgno));
1435
memcpy(bp, lsn, sizeof(*lsn));
1437
memset(bp, 0, sizeof(*lsn));
1439
memcpy(bp, &indx, sizeof(indx));
1441
memcpy(bp, &adjust, sizeof(adjust));
1442
bp += sizeof(adjust);
1443
memcpy(bp, &opflags, sizeof(opflags));
1444
bp += sizeof(opflags);
1445
DB_ASSERT((u_int32_t)(bp - (u_int8_t *)logrec.data) == logrec.size);
1446
ret = log_put(dbenv, ret_lsnp, (DBT *)&logrec, flags);
1447
if (txnid != NULL && ret == 0)
1448
txnid->last_lsn = *ret_lsnp;
1449
#ifdef LOG_DIAGNOSTIC
1451
(void)__bam_cadjust_print(dbenv,
1452
(DBT *)&logrec, ret_lsnp, NULL, NULL);
1454
__os_free(dbenv, logrec.data, logrec.size);
1459
* PUBLIC: int __bam_cadjust_print __P((DB_ENV *, DBT *, DB_LSN *, db_recops,
1463
__bam_cadjust_print(dbenv, dbtp, lsnp, notused2, notused3)
1470
__bam_cadjust_args *argp;
1477
notused2 = DB_TXN_ABORT;
1480
if ((ret = __bam_cadjust_read(dbenv, dbtp->data, &argp)) != 0)
1483
"[%lu][%lu]bam_cadjust: rec: %lu txnid %lx prevlsn [%lu][%lu]\n",
1485
(u_long)lsnp->offset,
1487
(u_long)argp->txnid->txnid,
1488
(u_long)argp->prev_lsn.file,
1489
(u_long)argp->prev_lsn.offset);
1490
(void)printf("\tfileid: %ld\n", (long)argp->fileid);
1491
(void)printf("\tpgno: %lu\n", (u_long)argp->pgno);
1492
(void)printf("\tlsn: [%lu][%lu]\n",
1493
(u_long)argp->lsn.file, (u_long)argp->lsn.offset);
1494
(void)printf("\tindx: %lu\n", (u_long)argp->indx);
1495
(void)printf("\tadjust: %ld\n", (long)argp->adjust);
1496
(void)printf("\topflags: %lu\n", (u_long)argp->opflags);
1498
__os_free(dbenv, argp, 0);
1503
* PUBLIC: int __bam_cadjust_read __P((DB_ENV *, void *,
1504
* PUBLIC: __bam_cadjust_args **));
1507
__bam_cadjust_read(dbenv, recbuf, argpp)
1510
__bam_cadjust_args **argpp;
1512
__bam_cadjust_args *argp;
1516
ret = __os_malloc(dbenv, sizeof(__bam_cadjust_args) +
1517
sizeof(DB_TXN), &argp);
1520
argp->txnid = (DB_TXN *)&argp[1];
1522
memcpy(&argp->type, bp, sizeof(argp->type));
1523
bp += sizeof(argp->type);
1524
memcpy(&argp->txnid->txnid, bp, sizeof(argp->txnid->txnid));
1525
bp += sizeof(argp->txnid->txnid);
1526
memcpy(&argp->prev_lsn, bp, sizeof(DB_LSN));
1527
bp += sizeof(DB_LSN);
1528
memcpy(&argp->fileid, bp, sizeof(argp->fileid));
1529
bp += sizeof(argp->fileid);
1530
memcpy(&argp->pgno, bp, sizeof(argp->pgno));
1531
bp += sizeof(argp->pgno);
1532
memcpy(&argp->lsn, bp, sizeof(argp->lsn));
1533
bp += sizeof(argp->lsn);
1534
memcpy(&argp->indx, bp, sizeof(argp->indx));
1535
bp += sizeof(argp->indx);
1536
memcpy(&argp->adjust, bp, sizeof(argp->adjust));
1537
bp += sizeof(argp->adjust);
1538
memcpy(&argp->opflags, bp, sizeof(argp->opflags));
1539
bp += sizeof(argp->opflags);
1545
* PUBLIC: int __bam_cdel_log __P((DB_ENV *, DB_TXN *, DB_LSN *, u_int32_t,
1546
* PUBLIC: int32_t, db_pgno_t, DB_LSN *, u_int32_t));
1549
__bam_cdel_log(dbenv, txnid, ret_lsnp, flags,
1550
fileid, pgno, lsn, indx)
1561
DB_LSN *lsnp, null_lsn;
1562
u_int32_t rectype, txn_num;
1566
rectype = DB_bam_cdel;
1567
if (txnid != NULL &&
1568
TAILQ_FIRST(&txnid->kids) != NULL &&
1569
(ret = __txn_activekids(dbenv, rectype, txnid)) != 0)
1571
txn_num = txnid == NULL ? 0 : txnid->txnid;
1572
if (txnid == NULL) {
1576
lsnp = &txnid->last_lsn;
1577
logrec.size = sizeof(rectype) + sizeof(txn_num) + sizeof(DB_LSN)
1582
if ((ret = __os_malloc(dbenv, logrec.size, &logrec.data)) != 0)
1586
memcpy(bp, &rectype, sizeof(rectype));
1587
bp += sizeof(rectype);
1588
memcpy(bp, &txn_num, sizeof(txn_num));
1589
bp += sizeof(txn_num);
1590
memcpy(bp, lsnp, sizeof(DB_LSN));
1591
bp += sizeof(DB_LSN);
1592
memcpy(bp, &fileid, sizeof(fileid));
1593
bp += sizeof(fileid);
1594
memcpy(bp, &pgno, sizeof(pgno));
1597
memcpy(bp, lsn, sizeof(*lsn));
1599
memset(bp, 0, sizeof(*lsn));
1601
memcpy(bp, &indx, sizeof(indx));
1603
DB_ASSERT((u_int32_t)(bp - (u_int8_t *)logrec.data) == logrec.size);
1604
ret = log_put(dbenv, ret_lsnp, (DBT *)&logrec, flags);
1605
if (txnid != NULL && ret == 0)
1606
txnid->last_lsn = *ret_lsnp;
1607
#ifdef LOG_DIAGNOSTIC
1609
(void)__bam_cdel_print(dbenv,
1610
(DBT *)&logrec, ret_lsnp, NULL, NULL);
1612
__os_free(dbenv, logrec.data, logrec.size);
1617
* PUBLIC: int __bam_cdel_print __P((DB_ENV *, DBT *, DB_LSN *, db_recops,
1621
__bam_cdel_print(dbenv, dbtp, lsnp, notused2, notused3)
1628
__bam_cdel_args *argp;
1635
notused2 = DB_TXN_ABORT;
1638
if ((ret = __bam_cdel_read(dbenv, dbtp->data, &argp)) != 0)
1641
"[%lu][%lu]bam_cdel: rec: %lu txnid %lx prevlsn [%lu][%lu]\n",
1643
(u_long)lsnp->offset,
1645
(u_long)argp->txnid->txnid,
1646
(u_long)argp->prev_lsn.file,
1647
(u_long)argp->prev_lsn.offset);
1648
(void)printf("\tfileid: %ld\n", (long)argp->fileid);
1649
(void)printf("\tpgno: %lu\n", (u_long)argp->pgno);
1650
(void)printf("\tlsn: [%lu][%lu]\n",
1651
(u_long)argp->lsn.file, (u_long)argp->lsn.offset);
1652
(void)printf("\tindx: %lu\n", (u_long)argp->indx);
1654
__os_free(dbenv, argp, 0);
1659
* PUBLIC: int __bam_cdel_read __P((DB_ENV *, void *, __bam_cdel_args **));
1662
__bam_cdel_read(dbenv, recbuf, argpp)
1665
__bam_cdel_args **argpp;
1667
__bam_cdel_args *argp;
1671
ret = __os_malloc(dbenv, sizeof(__bam_cdel_args) +
1672
sizeof(DB_TXN), &argp);
1675
argp->txnid = (DB_TXN *)&argp[1];
1677
memcpy(&argp->type, bp, sizeof(argp->type));
1678
bp += sizeof(argp->type);
1679
memcpy(&argp->txnid->txnid, bp, sizeof(argp->txnid->txnid));
1680
bp += sizeof(argp->txnid->txnid);
1681
memcpy(&argp->prev_lsn, bp, sizeof(DB_LSN));
1682
bp += sizeof(DB_LSN);
1683
memcpy(&argp->fileid, bp, sizeof(argp->fileid));
1684
bp += sizeof(argp->fileid);
1685
memcpy(&argp->pgno, bp, sizeof(argp->pgno));
1686
bp += sizeof(argp->pgno);
1687
memcpy(&argp->lsn, bp, sizeof(argp->lsn));
1688
bp += sizeof(argp->lsn);
1689
memcpy(&argp->indx, bp, sizeof(argp->indx));
1690
bp += sizeof(argp->indx);
1696
* PUBLIC: int __bam_repl_log __P((DB_ENV *, DB_TXN *, DB_LSN *, u_int32_t,
1697
* PUBLIC: int32_t, db_pgno_t, DB_LSN *, u_int32_t, u_int32_t, const DBT *, const DBT *,
1698
* PUBLIC: u_int32_t, u_int32_t));
1701
__bam_repl_log(dbenv, txnid, ret_lsnp, flags,
1702
fileid, pgno, lsn, indx, isdeleted, orig,
1703
repl, prefix, suffix)
1712
u_int32_t isdeleted;
1719
DB_LSN *lsnp, null_lsn;
1721
u_int32_t rectype, txn_num;
1725
rectype = DB_bam_repl;
1726
if (txnid != NULL &&
1727
TAILQ_FIRST(&txnid->kids) != NULL &&
1728
(ret = __txn_activekids(dbenv, rectype, txnid)) != 0)
1730
txn_num = txnid == NULL ? 0 : txnid->txnid;
1731
if (txnid == NULL) {
1735
lsnp = &txnid->last_lsn;
1736
logrec.size = sizeof(rectype) + sizeof(txn_num) + sizeof(DB_LSN)
1742
+ sizeof(u_int32_t) + (orig == NULL ? 0 : orig->size)
1743
+ sizeof(u_int32_t) + (repl == NULL ? 0 : repl->size)
1746
if ((ret = __os_malloc(dbenv, logrec.size, &logrec.data)) != 0)
1750
memcpy(bp, &rectype, sizeof(rectype));
1751
bp += sizeof(rectype);
1752
memcpy(bp, &txn_num, sizeof(txn_num));
1753
bp += sizeof(txn_num);
1754
memcpy(bp, lsnp, sizeof(DB_LSN));
1755
bp += sizeof(DB_LSN);
1756
memcpy(bp, &fileid, sizeof(fileid));
1757
bp += sizeof(fileid);
1758
memcpy(bp, &pgno, sizeof(pgno));
1761
memcpy(bp, lsn, sizeof(*lsn));
1763
memset(bp, 0, sizeof(*lsn));
1765
memcpy(bp, &indx, sizeof(indx));
1767
memcpy(bp, &isdeleted, sizeof(isdeleted));
1768
bp += sizeof(isdeleted);
1771
memcpy(bp, &zero, sizeof(u_int32_t));
1772
bp += sizeof(u_int32_t);
1774
memcpy(bp, &orig->size, sizeof(orig->size));
1775
bp += sizeof(orig->size);
1776
memcpy(bp, orig->data, orig->size);
1781
memcpy(bp, &zero, sizeof(u_int32_t));
1782
bp += sizeof(u_int32_t);
1784
memcpy(bp, &repl->size, sizeof(repl->size));
1785
bp += sizeof(repl->size);
1786
memcpy(bp, repl->data, repl->size);
1789
memcpy(bp, &prefix, sizeof(prefix));
1790
bp += sizeof(prefix);
1791
memcpy(bp, &suffix, sizeof(suffix));
1792
bp += sizeof(suffix);
1793
DB_ASSERT((u_int32_t)(bp - (u_int8_t *)logrec.data) == logrec.size);
1794
ret = log_put(dbenv, ret_lsnp, (DBT *)&logrec, flags);
1795
if (txnid != NULL && ret == 0)
1796
txnid->last_lsn = *ret_lsnp;
1797
#ifdef LOG_DIAGNOSTIC
1799
(void)__bam_repl_print(dbenv,
1800
(DBT *)&logrec, ret_lsnp, NULL, NULL);
1802
__os_free(dbenv, logrec.data, logrec.size);
1807
* PUBLIC: int __bam_repl_print __P((DB_ENV *, DBT *, DB_LSN *, db_recops,
1811
__bam_repl_print(dbenv, dbtp, lsnp, notused2, notused3)
1818
__bam_repl_args *argp;
1825
notused2 = DB_TXN_ABORT;
1828
if ((ret = __bam_repl_read(dbenv, dbtp->data, &argp)) != 0)
1831
"[%lu][%lu]bam_repl: rec: %lu txnid %lx prevlsn [%lu][%lu]\n",
1833
(u_long)lsnp->offset,
1835
(u_long)argp->txnid->txnid,
1836
(u_long)argp->prev_lsn.file,
1837
(u_long)argp->prev_lsn.offset);
1838
(void)printf("\tfileid: %ld\n", (long)argp->fileid);
1839
(void)printf("\tpgno: %lu\n", (u_long)argp->pgno);
1840
(void)printf("\tlsn: [%lu][%lu]\n",
1841
(u_long)argp->lsn.file, (u_long)argp->lsn.offset);
1842
(void)printf("\tindx: %lu\n", (u_long)argp->indx);
1843
(void)printf("\tisdeleted: %lu\n", (u_long)argp->isdeleted);
1844
(void)printf("\torig: ");
1845
for (i = 0; i < argp->orig.size; i++) {
1846
ch = ((u_int8_t *)argp->orig.data)[i];
1847
if (isprint(ch) || ch == 0xa)
1850
(void)printf("%#x ", ch);
1853
(void)printf("\trepl: ");
1854
for (i = 0; i < argp->repl.size; i++) {
1855
ch = ((u_int8_t *)argp->repl.data)[i];
1856
if (isprint(ch) || ch == 0xa)
1859
(void)printf("%#x ", ch);
1862
(void)printf("\tprefix: %lu\n", (u_long)argp->prefix);
1863
(void)printf("\tsuffix: %lu\n", (u_long)argp->suffix);
1865
__os_free(dbenv, argp, 0);
1870
* PUBLIC: int __bam_repl_read __P((DB_ENV *, void *, __bam_repl_args **));
1873
__bam_repl_read(dbenv, recbuf, argpp)
1876
__bam_repl_args **argpp;
1878
__bam_repl_args *argp;
1882
ret = __os_malloc(dbenv, sizeof(__bam_repl_args) +
1883
sizeof(DB_TXN), &argp);
1886
argp->txnid = (DB_TXN *)&argp[1];
1888
memcpy(&argp->type, bp, sizeof(argp->type));
1889
bp += sizeof(argp->type);
1890
memcpy(&argp->txnid->txnid, bp, sizeof(argp->txnid->txnid));
1891
bp += sizeof(argp->txnid->txnid);
1892
memcpy(&argp->prev_lsn, bp, sizeof(DB_LSN));
1893
bp += sizeof(DB_LSN);
1894
memcpy(&argp->fileid, bp, sizeof(argp->fileid));
1895
bp += sizeof(argp->fileid);
1896
memcpy(&argp->pgno, bp, sizeof(argp->pgno));
1897
bp += sizeof(argp->pgno);
1898
memcpy(&argp->lsn, bp, sizeof(argp->lsn));
1899
bp += sizeof(argp->lsn);
1900
memcpy(&argp->indx, bp, sizeof(argp->indx));
1901
bp += sizeof(argp->indx);
1902
memcpy(&argp->isdeleted, bp, sizeof(argp->isdeleted));
1903
bp += sizeof(argp->isdeleted);
1904
memset(&argp->orig, 0, sizeof(argp->orig));
1905
memcpy(&argp->orig.size, bp, sizeof(u_int32_t));
1906
bp += sizeof(u_int32_t);
1907
argp->orig.data = bp;
1908
bp += argp->orig.size;
1909
memset(&argp->repl, 0, sizeof(argp->repl));
1910
memcpy(&argp->repl.size, bp, sizeof(u_int32_t));
1911
bp += sizeof(u_int32_t);
1912
argp->repl.data = bp;
1913
bp += argp->repl.size;
1914
memcpy(&argp->prefix, bp, sizeof(argp->prefix));
1915
bp += sizeof(argp->prefix);
1916
memcpy(&argp->suffix, bp, sizeof(argp->suffix));
1917
bp += sizeof(argp->suffix);
1923
* PUBLIC: int __bam_root_log __P((DB_ENV *, DB_TXN *, DB_LSN *, u_int32_t,
1924
* PUBLIC: int32_t, db_pgno_t, db_pgno_t, DB_LSN *));
1927
__bam_root_log(dbenv, txnid, ret_lsnp, flags,
1928
fileid, meta_pgno, root_pgno, meta_lsn)
1934
db_pgno_t meta_pgno;
1935
db_pgno_t root_pgno;
1939
DB_LSN *lsnp, null_lsn;
1940
u_int32_t rectype, txn_num;
1944
rectype = DB_bam_root;
1945
if (txnid != NULL &&
1946
TAILQ_FIRST(&txnid->kids) != NULL &&
1947
(ret = __txn_activekids(dbenv, rectype, txnid)) != 0)
1949
txn_num = txnid == NULL ? 0 : txnid->txnid;
1950
if (txnid == NULL) {
1954
lsnp = &txnid->last_lsn;
1955
logrec.size = sizeof(rectype) + sizeof(txn_num) + sizeof(DB_LSN)
1959
+ sizeof(*meta_lsn);
1960
if ((ret = __os_malloc(dbenv, logrec.size, &logrec.data)) != 0)
1964
memcpy(bp, &rectype, sizeof(rectype));
1965
bp += sizeof(rectype);
1966
memcpy(bp, &txn_num, sizeof(txn_num));
1967
bp += sizeof(txn_num);
1968
memcpy(bp, lsnp, sizeof(DB_LSN));
1969
bp += sizeof(DB_LSN);
1970
memcpy(bp, &fileid, sizeof(fileid));
1971
bp += sizeof(fileid);
1972
memcpy(bp, &meta_pgno, sizeof(meta_pgno));
1973
bp += sizeof(meta_pgno);
1974
memcpy(bp, &root_pgno, sizeof(root_pgno));
1975
bp += sizeof(root_pgno);
1976
if (meta_lsn != NULL)
1977
memcpy(bp, meta_lsn, sizeof(*meta_lsn));
1979
memset(bp, 0, sizeof(*meta_lsn));
1980
bp += sizeof(*meta_lsn);
1981
DB_ASSERT((u_int32_t)(bp - (u_int8_t *)logrec.data) == logrec.size);
1982
ret = log_put(dbenv, ret_lsnp, (DBT *)&logrec, flags);
1983
if (txnid != NULL && ret == 0)
1984
txnid->last_lsn = *ret_lsnp;
1985
#ifdef LOG_DIAGNOSTIC
1987
(void)__bam_root_print(dbenv,
1988
(DBT *)&logrec, ret_lsnp, NULL, NULL);
1990
__os_free(dbenv, logrec.data, logrec.size);
1995
* PUBLIC: int __bam_root_print __P((DB_ENV *, DBT *, DB_LSN *, db_recops,
1999
__bam_root_print(dbenv, dbtp, lsnp, notused2, notused3)
2006
__bam_root_args *argp;
2013
notused2 = DB_TXN_ABORT;
2016
if ((ret = __bam_root_read(dbenv, dbtp->data, &argp)) != 0)
2019
"[%lu][%lu]bam_root: rec: %lu txnid %lx prevlsn [%lu][%lu]\n",
2021
(u_long)lsnp->offset,
2023
(u_long)argp->txnid->txnid,
2024
(u_long)argp->prev_lsn.file,
2025
(u_long)argp->prev_lsn.offset);
2026
(void)printf("\tfileid: %ld\n", (long)argp->fileid);
2027
(void)printf("\tmeta_pgno: %lu\n", (u_long)argp->meta_pgno);
2028
(void)printf("\troot_pgno: %lu\n", (u_long)argp->root_pgno);
2029
(void)printf("\tmeta_lsn: [%lu][%lu]\n",
2030
(u_long)argp->meta_lsn.file, (u_long)argp->meta_lsn.offset);
2032
__os_free(dbenv, argp, 0);
2037
* PUBLIC: int __bam_root_read __P((DB_ENV *, void *, __bam_root_args **));
2040
__bam_root_read(dbenv, recbuf, argpp)
2043
__bam_root_args **argpp;
2045
__bam_root_args *argp;
2049
ret = __os_malloc(dbenv, sizeof(__bam_root_args) +
2050
sizeof(DB_TXN), &argp);
2053
argp->txnid = (DB_TXN *)&argp[1];
2055
memcpy(&argp->type, bp, sizeof(argp->type));
2056
bp += sizeof(argp->type);
2057
memcpy(&argp->txnid->txnid, bp, sizeof(argp->txnid->txnid));
2058
bp += sizeof(argp->txnid->txnid);
2059
memcpy(&argp->prev_lsn, bp, sizeof(DB_LSN));
2060
bp += sizeof(DB_LSN);
2061
memcpy(&argp->fileid, bp, sizeof(argp->fileid));
2062
bp += sizeof(argp->fileid);
2063
memcpy(&argp->meta_pgno, bp, sizeof(argp->meta_pgno));
2064
bp += sizeof(argp->meta_pgno);
2065
memcpy(&argp->root_pgno, bp, sizeof(argp->root_pgno));
2066
bp += sizeof(argp->root_pgno);
2067
memcpy(&argp->meta_lsn, bp, sizeof(argp->meta_lsn));
2068
bp += sizeof(argp->meta_lsn);
2074
* PUBLIC: int __bam_curadj_log __P((DB_ENV *, DB_TXN *, DB_LSN *, u_int32_t,
2075
* PUBLIC: int32_t, db_ca_mode, db_pgno_t, db_pgno_t, db_pgno_t, u_int32_t, u_int32_t,
2076
* PUBLIC: u_int32_t));
2079
__bam_curadj_log(dbenv, txnid, ret_lsnp, flags,
2080
fileid, mode, from_pgno, to_pgno, left_pgno, first_indx,
2088
db_pgno_t from_pgno;
2090
db_pgno_t left_pgno;
2091
u_int32_t first_indx;
2092
u_int32_t from_indx;
2096
DB_LSN *lsnp, null_lsn;
2097
u_int32_t rectype, txn_num;
2101
rectype = DB_bam_curadj;
2102
if (txnid != NULL &&
2103
TAILQ_FIRST(&txnid->kids) != NULL &&
2104
(ret = __txn_activekids(dbenv, rectype, txnid)) != 0)
2106
txn_num = txnid == NULL ? 0 : txnid->txnid;
2107
if (txnid == NULL) {
2111
lsnp = &txnid->last_lsn;
2112
logrec.size = sizeof(rectype) + sizeof(txn_num) + sizeof(DB_LSN)
2118
+ sizeof(first_indx)
2121
if ((ret = __os_malloc(dbenv, logrec.size, &logrec.data)) != 0)
2125
memcpy(bp, &rectype, sizeof(rectype));
2126
bp += sizeof(rectype);
2127
memcpy(bp, &txn_num, sizeof(txn_num));
2128
bp += sizeof(txn_num);
2129
memcpy(bp, lsnp, sizeof(DB_LSN));
2130
bp += sizeof(DB_LSN);
2131
memcpy(bp, &fileid, sizeof(fileid));
2132
bp += sizeof(fileid);
2133
memcpy(bp, &mode, sizeof(mode));
2135
memcpy(bp, &from_pgno, sizeof(from_pgno));
2136
bp += sizeof(from_pgno);
2137
memcpy(bp, &to_pgno, sizeof(to_pgno));
2138
bp += sizeof(to_pgno);
2139
memcpy(bp, &left_pgno, sizeof(left_pgno));
2140
bp += sizeof(left_pgno);
2141
memcpy(bp, &first_indx, sizeof(first_indx));
2142
bp += sizeof(first_indx);
2143
memcpy(bp, &from_indx, sizeof(from_indx));
2144
bp += sizeof(from_indx);
2145
memcpy(bp, &to_indx, sizeof(to_indx));
2146
bp += sizeof(to_indx);
2147
DB_ASSERT((u_int32_t)(bp - (u_int8_t *)logrec.data) == logrec.size);
2148
ret = log_put(dbenv, ret_lsnp, (DBT *)&logrec, flags);
2149
if (txnid != NULL && ret == 0)
2150
txnid->last_lsn = *ret_lsnp;
2151
#ifdef LOG_DIAGNOSTIC
2153
(void)__bam_curadj_print(dbenv,
2154
(DBT *)&logrec, ret_lsnp, NULL, NULL);
2156
__os_free(dbenv, logrec.data, logrec.size);
2161
* PUBLIC: int __bam_curadj_print __P((DB_ENV *, DBT *, DB_LSN *, db_recops,
2165
__bam_curadj_print(dbenv, dbtp, lsnp, notused2, notused3)
2172
__bam_curadj_args *argp;
2179
notused2 = DB_TXN_ABORT;
2182
if ((ret = __bam_curadj_read(dbenv, dbtp->data, &argp)) != 0)
2185
"[%lu][%lu]bam_curadj: rec: %lu txnid %lx prevlsn [%lu][%lu]\n",
2187
(u_long)lsnp->offset,
2189
(u_long)argp->txnid->txnid,
2190
(u_long)argp->prev_lsn.file,
2191
(u_long)argp->prev_lsn.offset);
2192
(void)printf("\tfileid: %ld\n", (long)argp->fileid);
2193
(void)printf("\tmode: %ld\n", (long)argp->mode);
2194
(void)printf("\tfrom_pgno: %lu\n", (u_long)argp->from_pgno);
2195
(void)printf("\tto_pgno: %lu\n", (u_long)argp->to_pgno);
2196
(void)printf("\tleft_pgno: %lu\n", (u_long)argp->left_pgno);
2197
(void)printf("\tfirst_indx: %lu\n", (u_long)argp->first_indx);
2198
(void)printf("\tfrom_indx: %lu\n", (u_long)argp->from_indx);
2199
(void)printf("\tto_indx: %lu\n", (u_long)argp->to_indx);
2201
__os_free(dbenv, argp, 0);
2206
* PUBLIC: int __bam_curadj_read __P((DB_ENV *, void *, __bam_curadj_args **));
2209
__bam_curadj_read(dbenv, recbuf, argpp)
2212
__bam_curadj_args **argpp;
2214
__bam_curadj_args *argp;
2218
ret = __os_malloc(dbenv, sizeof(__bam_curadj_args) +
2219
sizeof(DB_TXN), &argp);
2222
argp->txnid = (DB_TXN *)&argp[1];
2224
memcpy(&argp->type, bp, sizeof(argp->type));
2225
bp += sizeof(argp->type);
2226
memcpy(&argp->txnid->txnid, bp, sizeof(argp->txnid->txnid));
2227
bp += sizeof(argp->txnid->txnid);
2228
memcpy(&argp->prev_lsn, bp, sizeof(DB_LSN));
2229
bp += sizeof(DB_LSN);
2230
memcpy(&argp->fileid, bp, sizeof(argp->fileid));
2231
bp += sizeof(argp->fileid);
2232
memcpy(&argp->mode, bp, sizeof(argp->mode));
2233
bp += sizeof(argp->mode);
2234
memcpy(&argp->from_pgno, bp, sizeof(argp->from_pgno));
2235
bp += sizeof(argp->from_pgno);
2236
memcpy(&argp->to_pgno, bp, sizeof(argp->to_pgno));
2237
bp += sizeof(argp->to_pgno);
2238
memcpy(&argp->left_pgno, bp, sizeof(argp->left_pgno));
2239
bp += sizeof(argp->left_pgno);
2240
memcpy(&argp->first_indx, bp, sizeof(argp->first_indx));
2241
bp += sizeof(argp->first_indx);
2242
memcpy(&argp->from_indx, bp, sizeof(argp->from_indx));
2243
bp += sizeof(argp->from_indx);
2244
memcpy(&argp->to_indx, bp, sizeof(argp->to_indx));
2245
bp += sizeof(argp->to_indx);
2251
* PUBLIC: int __bam_rcuradj_log __P((DB_ENV *, DB_TXN *, DB_LSN *, u_int32_t,
2252
* PUBLIC: int32_t, ca_recno_arg, db_pgno_t, db_recno_t, u_int32_t));
2255
__bam_rcuradj_log(dbenv, txnid, ret_lsnp, flags,
2256
fileid, mode, root, recno, order)
2268
DB_LSN *lsnp, null_lsn;
2269
u_int32_t rectype, txn_num;
2273
rectype = DB_bam_rcuradj;
2274
if (txnid != NULL &&
2275
TAILQ_FIRST(&txnid->kids) != NULL &&
2276
(ret = __txn_activekids(dbenv, rectype, txnid)) != 0)
2278
txn_num = txnid == NULL ? 0 : txnid->txnid;
2279
if (txnid == NULL) {
2283
lsnp = &txnid->last_lsn;
2284
logrec.size = sizeof(rectype) + sizeof(txn_num) + sizeof(DB_LSN)
2290
if ((ret = __os_malloc(dbenv, logrec.size, &logrec.data)) != 0)
2294
memcpy(bp, &rectype, sizeof(rectype));
2295
bp += sizeof(rectype);
2296
memcpy(bp, &txn_num, sizeof(txn_num));
2297
bp += sizeof(txn_num);
2298
memcpy(bp, lsnp, sizeof(DB_LSN));
2299
bp += sizeof(DB_LSN);
2300
memcpy(bp, &fileid, sizeof(fileid));
2301
bp += sizeof(fileid);
2302
memcpy(bp, &mode, sizeof(mode));
2304
memcpy(bp, &root, sizeof(root));
2306
memcpy(bp, &recno, sizeof(recno));
2307
bp += sizeof(recno);
2308
memcpy(bp, &order, sizeof(order));
2309
bp += sizeof(order);
2310
DB_ASSERT((u_int32_t)(bp - (u_int8_t *)logrec.data) == logrec.size);
2311
ret = log_put(dbenv, ret_lsnp, (DBT *)&logrec, flags);
2312
if (txnid != NULL && ret == 0)
2313
txnid->last_lsn = *ret_lsnp;
2314
#ifdef LOG_DIAGNOSTIC
2316
(void)__bam_rcuradj_print(dbenv,
2317
(DBT *)&logrec, ret_lsnp, NULL, NULL);
2319
__os_free(dbenv, logrec.data, logrec.size);
2324
* PUBLIC: int __bam_rcuradj_print __P((DB_ENV *, DBT *, DB_LSN *, db_recops,
2328
__bam_rcuradj_print(dbenv, dbtp, lsnp, notused2, notused3)
2335
__bam_rcuradj_args *argp;
2342
notused2 = DB_TXN_ABORT;
2345
if ((ret = __bam_rcuradj_read(dbenv, dbtp->data, &argp)) != 0)
2348
"[%lu][%lu]bam_rcuradj: rec: %lu txnid %lx prevlsn [%lu][%lu]\n",
2350
(u_long)lsnp->offset,
2352
(u_long)argp->txnid->txnid,
2353
(u_long)argp->prev_lsn.file,
2354
(u_long)argp->prev_lsn.offset);
2355
(void)printf("\tfileid: %ld\n", (long)argp->fileid);
2356
(void)printf("\tmode: %ld\n", (long)argp->mode);
2357
(void)printf("\troot: %ld\n", (long)argp->root);
2358
(void)printf("\trecno: %ld\n", (long)argp->recno);
2359
(void)printf("\torder: %ld\n", (long)argp->order);
2361
__os_free(dbenv, argp, 0);
2366
* PUBLIC: int __bam_rcuradj_read __P((DB_ENV *, void *,
2367
* PUBLIC: __bam_rcuradj_args **));
2370
__bam_rcuradj_read(dbenv, recbuf, argpp)
2373
__bam_rcuradj_args **argpp;
2375
__bam_rcuradj_args *argp;
2379
ret = __os_malloc(dbenv, sizeof(__bam_rcuradj_args) +
2380
sizeof(DB_TXN), &argp);
2383
argp->txnid = (DB_TXN *)&argp[1];
2385
memcpy(&argp->type, bp, sizeof(argp->type));
2386
bp += sizeof(argp->type);
2387
memcpy(&argp->txnid->txnid, bp, sizeof(argp->txnid->txnid));
2388
bp += sizeof(argp->txnid->txnid);
2389
memcpy(&argp->prev_lsn, bp, sizeof(DB_LSN));
2390
bp += sizeof(DB_LSN);
2391
memcpy(&argp->fileid, bp, sizeof(argp->fileid));
2392
bp += sizeof(argp->fileid);
2393
memcpy(&argp->mode, bp, sizeof(argp->mode));
2394
bp += sizeof(argp->mode);
2395
memcpy(&argp->root, bp, sizeof(argp->root));
2396
bp += sizeof(argp->root);
2397
memcpy(&argp->recno, bp, sizeof(argp->recno));
2398
bp += sizeof(argp->recno);
2399
memcpy(&argp->order, bp, sizeof(argp->order));
2400
bp += sizeof(argp->order);
2406
* PUBLIC: int __bam_init_print __P((DB_ENV *));
2409
__bam_init_print(dbenv)
2414
if ((ret = __db_add_recovery(dbenv,
2415
__bam_pg_alloc_print, DB_bam_pg_alloc)) != 0)
2417
if ((ret = __db_add_recovery(dbenv,
2418
__bam_pg_alloc1_print, DB_bam_pg_alloc1)) != 0)
2420
if ((ret = __db_add_recovery(dbenv,
2421
__bam_pg_free_print, DB_bam_pg_free)) != 0)
2423
if ((ret = __db_add_recovery(dbenv,
2424
__bam_pg_free1_print, DB_bam_pg_free1)) != 0)
2426
if ((ret = __db_add_recovery(dbenv,
2427
__bam_split1_print, DB_bam_split1)) != 0)
2429
if ((ret = __db_add_recovery(dbenv,
2430
__bam_split_print, DB_bam_split)) != 0)
2432
if ((ret = __db_add_recovery(dbenv,
2433
__bam_rsplit1_print, DB_bam_rsplit1)) != 0)
2435
if ((ret = __db_add_recovery(dbenv,
2436
__bam_rsplit_print, DB_bam_rsplit)) != 0)
2438
if ((ret = __db_add_recovery(dbenv,
2439
__bam_adj_print, DB_bam_adj)) != 0)
2441
if ((ret = __db_add_recovery(dbenv,
2442
__bam_cadjust_print, DB_bam_cadjust)) != 0)
2444
if ((ret = __db_add_recovery(dbenv,
2445
__bam_cdel_print, DB_bam_cdel)) != 0)
2447
if ((ret = __db_add_recovery(dbenv,
2448
__bam_repl_print, DB_bam_repl)) != 0)
2450
if ((ret = __db_add_recovery(dbenv,
2451
__bam_root_print, DB_bam_root)) != 0)
2453
if ((ret = __db_add_recovery(dbenv,
2454
__bam_curadj_print, DB_bam_curadj)) != 0)
2456
if ((ret = __db_add_recovery(dbenv,
2457
__bam_rcuradj_print, DB_bam_rcuradj)) != 0)
2463
* PUBLIC: int __bam_init_recover __P((DB_ENV *));
2466
__bam_init_recover(dbenv)
2471
if ((ret = __db_add_recovery(dbenv,
2472
__bam_pg_alloc_recover, DB_bam_pg_alloc)) != 0)
2474
if ((ret = __db_add_recovery(dbenv,
2475
__deprecated_recover, DB_bam_pg_alloc1)) != 0)
2477
if ((ret = __db_add_recovery(dbenv,
2478
__bam_pg_free_recover, DB_bam_pg_free)) != 0)
2480
if ((ret = __db_add_recovery(dbenv,
2481
__deprecated_recover, DB_bam_pg_free1)) != 0)
2483
if ((ret = __db_add_recovery(dbenv,
2484
__deprecated_recover, DB_bam_split1)) != 0)
2486
if ((ret = __db_add_recovery(dbenv,
2487
__bam_split_recover, DB_bam_split)) != 0)
2489
if ((ret = __db_add_recovery(dbenv,
2490
__deprecated_recover, DB_bam_rsplit1)) != 0)
2492
if ((ret = __db_add_recovery(dbenv,
2493
__bam_rsplit_recover, DB_bam_rsplit)) != 0)
2495
if ((ret = __db_add_recovery(dbenv,
2496
__bam_adj_recover, DB_bam_adj)) != 0)
2498
if ((ret = __db_add_recovery(dbenv,
2499
__bam_cadjust_recover, DB_bam_cadjust)) != 0)
2501
if ((ret = __db_add_recovery(dbenv,
2502
__bam_cdel_recover, DB_bam_cdel)) != 0)
2504
if ((ret = __db_add_recovery(dbenv,
2505
__bam_repl_recover, DB_bam_repl)) != 0)
2507
if ((ret = __db_add_recovery(dbenv,
2508
__bam_root_recover, DB_bam_root)) != 0)
2510
if ((ret = __db_add_recovery(dbenv,
2511
__bam_curadj_recover, DB_bam_curadj)) != 0)
2513
if ((ret = __db_add_recovery(dbenv,
2514
__bam_rcuradj_recover, DB_bam_rcuradj)) != 0)