1 /* Do not edit: automatically built by dist/db_gen.sh. */
4 #ifndef NO_SYSTEM_INCLUDES
15 #include "db_dispatch.h"
18 #include "common_ext.h"
21 * PUBLIC: int __bam_pg_alloc_log
22 * PUBLIC: __P((DB_LOG *, DB_TXN *, DB_LSN *, u_int32_t,
23 * PUBLIC: u_int32_t, DB_LSN *, DB_LSN *, db_pgno_t,
24 * PUBLIC: u_int32_t, db_pgno_t));
26 int __bam_pg_alloc_log(logp, txnid, ret_lsnp, flags,
27 fileid, meta_lsn, page_lsn, pgno, ptype, next)
40 DB_LSN *lsnp, null_lsn;
41 u_int32_t rectype, txn_num;
45 rectype = DB_bam_pg_alloc;
46 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 ((logrec.data = (void *)malloc(logrec.size)) == NULL)
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));
89 if ((u_int32_t)(bp - (u_int8_t *)logrec.data) != logrec.size)
90 fprintf(stderr, "Error in log record length");
92 ret = log_put(logp, ret_lsnp, (DBT *)&logrec, flags);
94 txnid->last_lsn = *ret_lsnp;
100 * PUBLIC: int __bam_pg_alloc_print
101 * PUBLIC: __P((DB_LOG *, DBT *, DB_LSN *, int, void *));
105 __bam_pg_alloc_print(notused1, dbtp, lsnp, notused3, notused4)
112 __bam_pg_alloc_args *argp;
122 if ((ret = __bam_pg_alloc_read(dbtp->data, &argp)) != 0)
124 printf("[%lu][%lu]bam_pg_alloc: rec: %lu txnid %lx prevlsn [%lu][%lu]\n",
126 (u_long)lsnp->offset,
128 (u_long)argp->txnid->txnid,
129 (u_long)argp->prev_lsn.file,
130 (u_long)argp->prev_lsn.offset);
131 printf("\tfileid: %lu\n", (u_long)argp->fileid);
132 printf("\tmeta_lsn: [%lu][%lu]\n",
133 (u_long)argp->meta_lsn.file, (u_long)argp->meta_lsn.offset);
134 printf("\tpage_lsn: [%lu][%lu]\n",
135 (u_long)argp->page_lsn.file, (u_long)argp->page_lsn.offset);
136 printf("\tpgno: %lu\n", (u_long)argp->pgno);
137 printf("\tptype: %lu\n", (u_long)argp->ptype);
138 printf("\tnext: %lu\n", (u_long)argp->next);
145 * PUBLIC: int __bam_pg_alloc_read __P((void *, __bam_pg_alloc_args **));
148 __bam_pg_alloc_read(recbuf, argpp)
150 __bam_pg_alloc_args **argpp;
152 __bam_pg_alloc_args *argp;
155 argp = (__bam_pg_alloc_args *)malloc(sizeof(__bam_pg_alloc_args) +
159 argp->txnid = (DB_TXN *)&argp[1];
161 memcpy(&argp->type, bp, sizeof(argp->type));
162 bp += sizeof(argp->type);
163 memcpy(&argp->txnid->txnid, bp, sizeof(argp->txnid->txnid));
164 bp += sizeof(argp->txnid->txnid);
165 memcpy(&argp->prev_lsn, bp, sizeof(DB_LSN));
166 bp += sizeof(DB_LSN);
167 memcpy(&argp->fileid, bp, sizeof(argp->fileid));
168 bp += sizeof(argp->fileid);
169 memcpy(&argp->meta_lsn, bp, sizeof(argp->meta_lsn));
170 bp += sizeof(argp->meta_lsn);
171 memcpy(&argp->page_lsn, bp, sizeof(argp->page_lsn));
172 bp += sizeof(argp->page_lsn);
173 memcpy(&argp->pgno, bp, sizeof(argp->pgno));
174 bp += sizeof(argp->pgno);
175 memcpy(&argp->ptype, bp, sizeof(argp->ptype));
176 bp += sizeof(argp->ptype);
177 memcpy(&argp->next, bp, sizeof(argp->next));
178 bp += sizeof(argp->next);
184 * PUBLIC: int __bam_pg_free_log
185 * PUBLIC: __P((DB_LOG *, DB_TXN *, DB_LSN *, u_int32_t,
186 * PUBLIC: u_int32_t, db_pgno_t, DB_LSN *, DBT *,
187 * PUBLIC: db_pgno_t));
189 int __bam_pg_free_log(logp, txnid, ret_lsnp, flags,
190 fileid, pgno, meta_lsn, header, next)
202 DB_LSN *lsnp, null_lsn;
204 u_int32_t rectype, txn_num;
208 rectype = DB_bam_pg_free;
209 txn_num = txnid == NULL ? 0 : txnid->txnid;
215 lsnp = &txnid->last_lsn;
216 logrec.size = sizeof(rectype) + sizeof(txn_num) + sizeof(DB_LSN)
220 + sizeof(u_int32_t) + (header == NULL ? 0 : header->size)
222 if ((logrec.data = (void *)malloc(logrec.size)) == NULL)
226 memcpy(bp, &rectype, sizeof(rectype));
227 bp += sizeof(rectype);
228 memcpy(bp, &txn_num, sizeof(txn_num));
229 bp += sizeof(txn_num);
230 memcpy(bp, lsnp, sizeof(DB_LSN));
231 bp += sizeof(DB_LSN);
232 memcpy(bp, &fileid, sizeof(fileid));
233 bp += sizeof(fileid);
234 memcpy(bp, &pgno, sizeof(pgno));
236 if (meta_lsn != NULL)
237 memcpy(bp, meta_lsn, sizeof(*meta_lsn));
239 memset(bp, 0, sizeof(*meta_lsn));
240 bp += sizeof(*meta_lsn);
241 if (header == NULL) {
243 memcpy(bp, &zero, sizeof(u_int32_t));
244 bp += sizeof(u_int32_t);
246 memcpy(bp, &header->size, sizeof(header->size));
247 bp += sizeof(header->size);
248 memcpy(bp, header->data, header->size);
251 memcpy(bp, &next, sizeof(next));
254 if ((u_int32_t)(bp - (u_int8_t *)logrec.data) != logrec.size)
255 fprintf(stderr, "Error in log record length");
257 ret = log_put(logp, ret_lsnp, (DBT *)&logrec, flags);
259 txnid->last_lsn = *ret_lsnp;
265 * PUBLIC: int __bam_pg_free_print
266 * PUBLIC: __P((DB_LOG *, DBT *, DB_LSN *, int, void *));
270 __bam_pg_free_print(notused1, dbtp, lsnp, notused3, notused4)
277 __bam_pg_free_args *argp;
287 if ((ret = __bam_pg_free_read(dbtp->data, &argp)) != 0)
289 printf("[%lu][%lu]bam_pg_free: rec: %lu txnid %lx prevlsn [%lu][%lu]\n",
291 (u_long)lsnp->offset,
293 (u_long)argp->txnid->txnid,
294 (u_long)argp->prev_lsn.file,
295 (u_long)argp->prev_lsn.offset);
296 printf("\tfileid: %lu\n", (u_long)argp->fileid);
297 printf("\tpgno: %lu\n", (u_long)argp->pgno);
298 printf("\tmeta_lsn: [%lu][%lu]\n",
299 (u_long)argp->meta_lsn.file, (u_long)argp->meta_lsn.offset);
300 printf("\theader: ");
301 for (i = 0; i < argp->header.size; i++) {
302 c = ((char *)argp->header.data)[i];
303 if (isprint(c) || c == 0xa)
309 printf("\tnext: %lu\n", (u_long)argp->next);
316 * PUBLIC: int __bam_pg_free_read __P((void *, __bam_pg_free_args **));
319 __bam_pg_free_read(recbuf, argpp)
321 __bam_pg_free_args **argpp;
323 __bam_pg_free_args *argp;
326 argp = (__bam_pg_free_args *)malloc(sizeof(__bam_pg_free_args) +
330 argp->txnid = (DB_TXN *)&argp[1];
332 memcpy(&argp->type, bp, sizeof(argp->type));
333 bp += sizeof(argp->type);
334 memcpy(&argp->txnid->txnid, bp, sizeof(argp->txnid->txnid));
335 bp += sizeof(argp->txnid->txnid);
336 memcpy(&argp->prev_lsn, bp, sizeof(DB_LSN));
337 bp += sizeof(DB_LSN);
338 memcpy(&argp->fileid, bp, sizeof(argp->fileid));
339 bp += sizeof(argp->fileid);
340 memcpy(&argp->pgno, bp, sizeof(argp->pgno));
341 bp += sizeof(argp->pgno);
342 memcpy(&argp->meta_lsn, bp, sizeof(argp->meta_lsn));
343 bp += sizeof(argp->meta_lsn);
344 memcpy(&argp->header.size, bp, sizeof(u_int32_t));
345 bp += sizeof(u_int32_t);
346 argp->header.data = bp;
347 bp += argp->header.size;
348 memcpy(&argp->next, bp, sizeof(argp->next));
349 bp += sizeof(argp->next);
355 * PUBLIC: int __bam_split_log
356 * PUBLIC: __P((DB_LOG *, DB_TXN *, DB_LSN *, u_int32_t,
357 * PUBLIC: u_int32_t, db_pgno_t, DB_LSN *, db_pgno_t,
358 * PUBLIC: DB_LSN *, u_int32_t, db_pgno_t, DB_LSN *,
361 int __bam_split_log(logp, txnid, ret_lsnp, flags,
362 fileid, left, llsn, right, rlsn, indx,
379 DB_LSN *lsnp, null_lsn;
381 u_int32_t rectype, txn_num;
385 rectype = DB_bam_split;
386 txn_num = txnid == NULL ? 0 : txnid->txnid;
392 lsnp = &txnid->last_lsn;
393 logrec.size = sizeof(rectype) + sizeof(txn_num) + sizeof(DB_LSN)
402 + sizeof(u_int32_t) + (pg == NULL ? 0 : pg->size);
403 if ((logrec.data = (void *)malloc(logrec.size)) == NULL)
407 memcpy(bp, &rectype, sizeof(rectype));
408 bp += sizeof(rectype);
409 memcpy(bp, &txn_num, sizeof(txn_num));
410 bp += sizeof(txn_num);
411 memcpy(bp, lsnp, sizeof(DB_LSN));
412 bp += sizeof(DB_LSN);
413 memcpy(bp, &fileid, sizeof(fileid));
414 bp += sizeof(fileid);
415 memcpy(bp, &left, sizeof(left));
418 memcpy(bp, llsn, sizeof(*llsn));
420 memset(bp, 0, sizeof(*llsn));
422 memcpy(bp, &right, sizeof(right));
425 memcpy(bp, rlsn, sizeof(*rlsn));
427 memset(bp, 0, sizeof(*rlsn));
429 memcpy(bp, &indx, sizeof(indx));
431 memcpy(bp, &npgno, sizeof(npgno));
434 memcpy(bp, nlsn, sizeof(*nlsn));
436 memset(bp, 0, sizeof(*nlsn));
440 memcpy(bp, &zero, sizeof(u_int32_t));
441 bp += sizeof(u_int32_t);
443 memcpy(bp, &pg->size, sizeof(pg->size));
444 bp += sizeof(pg->size);
445 memcpy(bp, pg->data, pg->size);
449 if ((u_int32_t)(bp - (u_int8_t *)logrec.data) != logrec.size)
450 fprintf(stderr, "Error in log record length");
452 ret = log_put(logp, ret_lsnp, (DBT *)&logrec, flags);
454 txnid->last_lsn = *ret_lsnp;
460 * PUBLIC: int __bam_split_print
461 * PUBLIC: __P((DB_LOG *, DBT *, DB_LSN *, int, void *));
465 __bam_split_print(notused1, dbtp, lsnp, notused3, notused4)
472 __bam_split_args *argp;
482 if ((ret = __bam_split_read(dbtp->data, &argp)) != 0)
484 printf("[%lu][%lu]bam_split: rec: %lu txnid %lx prevlsn [%lu][%lu]\n",
486 (u_long)lsnp->offset,
488 (u_long)argp->txnid->txnid,
489 (u_long)argp->prev_lsn.file,
490 (u_long)argp->prev_lsn.offset);
491 printf("\tfileid: %lu\n", (u_long)argp->fileid);
492 printf("\tleft: %lu\n", (u_long)argp->left);
493 printf("\tllsn: [%lu][%lu]\n",
494 (u_long)argp->llsn.file, (u_long)argp->llsn.offset);
495 printf("\tright: %lu\n", (u_long)argp->right);
496 printf("\trlsn: [%lu][%lu]\n",
497 (u_long)argp->rlsn.file, (u_long)argp->rlsn.offset);
498 printf("\tindx: %lu\n", (u_long)argp->indx);
499 printf("\tnpgno: %lu\n", (u_long)argp->npgno);
500 printf("\tnlsn: [%lu][%lu]\n",
501 (u_long)argp->nlsn.file, (u_long)argp->nlsn.offset);
503 for (i = 0; i < argp->pg.size; i++) {
504 c = ((char *)argp->pg.data)[i];
505 if (isprint(c) || c == 0xa)
517 * PUBLIC: int __bam_split_read __P((void *, __bam_split_args **));
520 __bam_split_read(recbuf, argpp)
522 __bam_split_args **argpp;
524 __bam_split_args *argp;
527 argp = (__bam_split_args *)malloc(sizeof(__bam_split_args) +
531 argp->txnid = (DB_TXN *)&argp[1];
533 memcpy(&argp->type, bp, sizeof(argp->type));
534 bp += sizeof(argp->type);
535 memcpy(&argp->txnid->txnid, bp, sizeof(argp->txnid->txnid));
536 bp += sizeof(argp->txnid->txnid);
537 memcpy(&argp->prev_lsn, bp, sizeof(DB_LSN));
538 bp += sizeof(DB_LSN);
539 memcpy(&argp->fileid, bp, sizeof(argp->fileid));
540 bp += sizeof(argp->fileid);
541 memcpy(&argp->left, bp, sizeof(argp->left));
542 bp += sizeof(argp->left);
543 memcpy(&argp->llsn, bp, sizeof(argp->llsn));
544 bp += sizeof(argp->llsn);
545 memcpy(&argp->right, bp, sizeof(argp->right));
546 bp += sizeof(argp->right);
547 memcpy(&argp->rlsn, bp, sizeof(argp->rlsn));
548 bp += sizeof(argp->rlsn);
549 memcpy(&argp->indx, bp, sizeof(argp->indx));
550 bp += sizeof(argp->indx);
551 memcpy(&argp->npgno, bp, sizeof(argp->npgno));
552 bp += sizeof(argp->npgno);
553 memcpy(&argp->nlsn, bp, sizeof(argp->nlsn));
554 bp += sizeof(argp->nlsn);
555 memcpy(&argp->pg.size, bp, sizeof(u_int32_t));
556 bp += sizeof(u_int32_t);
564 * PUBLIC: int __bam_rsplit_log
565 * PUBLIC: __P((DB_LOG *, DB_TXN *, DB_LSN *, u_int32_t,
566 * PUBLIC: u_int32_t, db_pgno_t, DBT *, DBT *,
567 * PUBLIC: DB_LSN *));
569 int __bam_rsplit_log(logp, txnid, ret_lsnp, flags,
570 fileid, pgno, pgdbt, rootent, rootlsn)
582 DB_LSN *lsnp, null_lsn;
584 u_int32_t rectype, txn_num;
588 rectype = DB_bam_rsplit;
589 txn_num = txnid == NULL ? 0 : txnid->txnid;
595 lsnp = &txnid->last_lsn;
596 logrec.size = sizeof(rectype) + sizeof(txn_num) + sizeof(DB_LSN)
599 + sizeof(u_int32_t) + (pgdbt == NULL ? 0 : pgdbt->size)
600 + sizeof(u_int32_t) + (rootent == NULL ? 0 : rootent->size)
602 if ((logrec.data = (void *)malloc(logrec.size)) == NULL)
606 memcpy(bp, &rectype, sizeof(rectype));
607 bp += sizeof(rectype);
608 memcpy(bp, &txn_num, sizeof(txn_num));
609 bp += sizeof(txn_num);
610 memcpy(bp, lsnp, sizeof(DB_LSN));
611 bp += sizeof(DB_LSN);
612 memcpy(bp, &fileid, sizeof(fileid));
613 bp += sizeof(fileid);
614 memcpy(bp, &pgno, sizeof(pgno));
618 memcpy(bp, &zero, sizeof(u_int32_t));
619 bp += sizeof(u_int32_t);
621 memcpy(bp, &pgdbt->size, sizeof(pgdbt->size));
622 bp += sizeof(pgdbt->size);
623 memcpy(bp, pgdbt->data, pgdbt->size);
626 if (rootent == NULL) {
628 memcpy(bp, &zero, sizeof(u_int32_t));
629 bp += sizeof(u_int32_t);
631 memcpy(bp, &rootent->size, sizeof(rootent->size));
632 bp += sizeof(rootent->size);
633 memcpy(bp, rootent->data, rootent->size);
637 memcpy(bp, rootlsn, sizeof(*rootlsn));
639 memset(bp, 0, sizeof(*rootlsn));
640 bp += sizeof(*rootlsn);
642 if ((u_int32_t)(bp - (u_int8_t *)logrec.data) != logrec.size)
643 fprintf(stderr, "Error in log record length");
645 ret = log_put(logp, ret_lsnp, (DBT *)&logrec, flags);
647 txnid->last_lsn = *ret_lsnp;
653 * PUBLIC: int __bam_rsplit_print
654 * PUBLIC: __P((DB_LOG *, DBT *, DB_LSN *, int, void *));
658 __bam_rsplit_print(notused1, dbtp, lsnp, notused3, notused4)
665 __bam_rsplit_args *argp;
675 if ((ret = __bam_rsplit_read(dbtp->data, &argp)) != 0)
677 printf("[%lu][%lu]bam_rsplit: rec: %lu txnid %lx prevlsn [%lu][%lu]\n",
679 (u_long)lsnp->offset,
681 (u_long)argp->txnid->txnid,
682 (u_long)argp->prev_lsn.file,
683 (u_long)argp->prev_lsn.offset);
684 printf("\tfileid: %lu\n", (u_long)argp->fileid);
685 printf("\tpgno: %lu\n", (u_long)argp->pgno);
687 for (i = 0; i < argp->pgdbt.size; i++) {
688 c = ((char *)argp->pgdbt.data)[i];
689 if (isprint(c) || c == 0xa)
695 printf("\trootent: ");
696 for (i = 0; i < argp->rootent.size; i++) {
697 c = ((char *)argp->rootent.data)[i];
698 if (isprint(c) || c == 0xa)
704 printf("\trootlsn: [%lu][%lu]\n",
705 (u_long)argp->rootlsn.file, (u_long)argp->rootlsn.offset);
712 * PUBLIC: int __bam_rsplit_read __P((void *, __bam_rsplit_args **));
715 __bam_rsplit_read(recbuf, argpp)
717 __bam_rsplit_args **argpp;
719 __bam_rsplit_args *argp;
722 argp = (__bam_rsplit_args *)malloc(sizeof(__bam_rsplit_args) +
726 argp->txnid = (DB_TXN *)&argp[1];
728 memcpy(&argp->type, bp, sizeof(argp->type));
729 bp += sizeof(argp->type);
730 memcpy(&argp->txnid->txnid, bp, sizeof(argp->txnid->txnid));
731 bp += sizeof(argp->txnid->txnid);
732 memcpy(&argp->prev_lsn, bp, sizeof(DB_LSN));
733 bp += sizeof(DB_LSN);
734 memcpy(&argp->fileid, bp, sizeof(argp->fileid));
735 bp += sizeof(argp->fileid);
736 memcpy(&argp->pgno, bp, sizeof(argp->pgno));
737 bp += sizeof(argp->pgno);
738 memcpy(&argp->pgdbt.size, bp, sizeof(u_int32_t));
739 bp += sizeof(u_int32_t);
740 argp->pgdbt.data = bp;
741 bp += argp->pgdbt.size;
742 memcpy(&argp->rootent.size, bp, sizeof(u_int32_t));
743 bp += sizeof(u_int32_t);
744 argp->rootent.data = bp;
745 bp += argp->rootent.size;
746 memcpy(&argp->rootlsn, bp, sizeof(argp->rootlsn));
747 bp += sizeof(argp->rootlsn);
753 * PUBLIC: int __bam_adj_log
754 * PUBLIC: __P((DB_LOG *, DB_TXN *, DB_LSN *, u_int32_t,
755 * PUBLIC: u_int32_t, db_pgno_t, DB_LSN *, u_int32_t,
756 * PUBLIC: u_int32_t, u_int32_t));
758 int __bam_adj_log(logp, txnid, ret_lsnp, flags,
759 fileid, pgno, lsn, indx, indx_copy, is_insert)
772 DB_LSN *lsnp, null_lsn;
773 u_int32_t rectype, txn_num;
777 rectype = DB_bam_adj;
778 txn_num = txnid == NULL ? 0 : txnid->txnid;
784 lsnp = &txnid->last_lsn;
785 logrec.size = sizeof(rectype) + sizeof(txn_num) + sizeof(DB_LSN)
792 if ((logrec.data = (void *)malloc(logrec.size)) == NULL)
796 memcpy(bp, &rectype, sizeof(rectype));
797 bp += sizeof(rectype);
798 memcpy(bp, &txn_num, sizeof(txn_num));
799 bp += sizeof(txn_num);
800 memcpy(bp, lsnp, sizeof(DB_LSN));
801 bp += sizeof(DB_LSN);
802 memcpy(bp, &fileid, sizeof(fileid));
803 bp += sizeof(fileid);
804 memcpy(bp, &pgno, sizeof(pgno));
807 memcpy(bp, lsn, sizeof(*lsn));
809 memset(bp, 0, sizeof(*lsn));
811 memcpy(bp, &indx, sizeof(indx));
813 memcpy(bp, &indx_copy, sizeof(indx_copy));
814 bp += sizeof(indx_copy);
815 memcpy(bp, &is_insert, sizeof(is_insert));
816 bp += sizeof(is_insert);
818 if ((u_int32_t)(bp - (u_int8_t *)logrec.data) != logrec.size)
819 fprintf(stderr, "Error in log record length");
821 ret = log_put(logp, ret_lsnp, (DBT *)&logrec, flags);
823 txnid->last_lsn = *ret_lsnp;
829 * PUBLIC: int __bam_adj_print
830 * PUBLIC: __P((DB_LOG *, DBT *, DB_LSN *, int, void *));
834 __bam_adj_print(notused1, dbtp, lsnp, notused3, notused4)
841 __bam_adj_args *argp;
851 if ((ret = __bam_adj_read(dbtp->data, &argp)) != 0)
853 printf("[%lu][%lu]bam_adj: rec: %lu txnid %lx prevlsn [%lu][%lu]\n",
855 (u_long)lsnp->offset,
857 (u_long)argp->txnid->txnid,
858 (u_long)argp->prev_lsn.file,
859 (u_long)argp->prev_lsn.offset);
860 printf("\tfileid: %lu\n", (u_long)argp->fileid);
861 printf("\tpgno: %lu\n", (u_long)argp->pgno);
862 printf("\tlsn: [%lu][%lu]\n",
863 (u_long)argp->lsn.file, (u_long)argp->lsn.offset);
864 printf("\tindx: %lu\n", (u_long)argp->indx);
865 printf("\tindx_copy: %lu\n", (u_long)argp->indx_copy);
866 printf("\tis_insert: %lu\n", (u_long)argp->is_insert);
873 * PUBLIC: int __bam_adj_read __P((void *, __bam_adj_args **));
876 __bam_adj_read(recbuf, argpp)
878 __bam_adj_args **argpp;
880 __bam_adj_args *argp;
883 argp = (__bam_adj_args *)malloc(sizeof(__bam_adj_args) +
887 argp->txnid = (DB_TXN *)&argp[1];
889 memcpy(&argp->type, bp, sizeof(argp->type));
890 bp += sizeof(argp->type);
891 memcpy(&argp->txnid->txnid, bp, sizeof(argp->txnid->txnid));
892 bp += sizeof(argp->txnid->txnid);
893 memcpy(&argp->prev_lsn, bp, sizeof(DB_LSN));
894 bp += sizeof(DB_LSN);
895 memcpy(&argp->fileid, bp, sizeof(argp->fileid));
896 bp += sizeof(argp->fileid);
897 memcpy(&argp->pgno, bp, sizeof(argp->pgno));
898 bp += sizeof(argp->pgno);
899 memcpy(&argp->lsn, bp, sizeof(argp->lsn));
900 bp += sizeof(argp->lsn);
901 memcpy(&argp->indx, bp, sizeof(argp->indx));
902 bp += sizeof(argp->indx);
903 memcpy(&argp->indx_copy, bp, sizeof(argp->indx_copy));
904 bp += sizeof(argp->indx_copy);
905 memcpy(&argp->is_insert, bp, sizeof(argp->is_insert));
906 bp += sizeof(argp->is_insert);
912 * PUBLIC: int __bam_cadjust_log
913 * PUBLIC: __P((DB_LOG *, DB_TXN *, DB_LSN *, u_int32_t,
914 * PUBLIC: u_int32_t, db_pgno_t, DB_LSN *, u_int32_t,
915 * PUBLIC: int32_t, int32_t));
917 int __bam_cadjust_log(logp, txnid, ret_lsnp, flags,
918 fileid, pgno, lsn, indx, adjust, total)
931 DB_LSN *lsnp, null_lsn;
932 u_int32_t rectype, txn_num;
936 rectype = DB_bam_cadjust;
937 txn_num = txnid == NULL ? 0 : txnid->txnid;
943 lsnp = &txnid->last_lsn;
944 logrec.size = sizeof(rectype) + sizeof(txn_num) + sizeof(DB_LSN)
951 if ((logrec.data = (void *)malloc(logrec.size)) == NULL)
955 memcpy(bp, &rectype, sizeof(rectype));
956 bp += sizeof(rectype);
957 memcpy(bp, &txn_num, sizeof(txn_num));
958 bp += sizeof(txn_num);
959 memcpy(bp, lsnp, sizeof(DB_LSN));
960 bp += sizeof(DB_LSN);
961 memcpy(bp, &fileid, sizeof(fileid));
962 bp += sizeof(fileid);
963 memcpy(bp, &pgno, sizeof(pgno));
966 memcpy(bp, lsn, sizeof(*lsn));
968 memset(bp, 0, sizeof(*lsn));
970 memcpy(bp, &indx, sizeof(indx));
972 memcpy(bp, &adjust, sizeof(adjust));
973 bp += sizeof(adjust);
974 memcpy(bp, &total, sizeof(total));
977 if ((u_int32_t)(bp - (u_int8_t *)logrec.data) != logrec.size)
978 fprintf(stderr, "Error in log record length");
980 ret = log_put(logp, ret_lsnp, (DBT *)&logrec, flags);
982 txnid->last_lsn = *ret_lsnp;
988 * PUBLIC: int __bam_cadjust_print
989 * PUBLIC: __P((DB_LOG *, DBT *, DB_LSN *, int, void *));
993 __bam_cadjust_print(notused1, dbtp, lsnp, notused3, notused4)
1000 __bam_cadjust_args *argp;
1010 if ((ret = __bam_cadjust_read(dbtp->data, &argp)) != 0)
1012 printf("[%lu][%lu]bam_cadjust: rec: %lu txnid %lx prevlsn [%lu][%lu]\n",
1014 (u_long)lsnp->offset,
1016 (u_long)argp->txnid->txnid,
1017 (u_long)argp->prev_lsn.file,
1018 (u_long)argp->prev_lsn.offset);
1019 printf("\tfileid: %lu\n", (u_long)argp->fileid);
1020 printf("\tpgno: %lu\n", (u_long)argp->pgno);
1021 printf("\tlsn: [%lu][%lu]\n",
1022 (u_long)argp->lsn.file, (u_long)argp->lsn.offset);
1023 printf("\tindx: %lu\n", (u_long)argp->indx);
1024 printf("\tadjust: %ld\n", (long)argp->adjust);
1025 printf("\ttotal: %ld\n", (long)argp->total);
1032 * PUBLIC: int __bam_cadjust_read __P((void *, __bam_cadjust_args **));
1035 __bam_cadjust_read(recbuf, argpp)
1037 __bam_cadjust_args **argpp;
1039 __bam_cadjust_args *argp;
1042 argp = (__bam_cadjust_args *)malloc(sizeof(__bam_cadjust_args) +
1046 argp->txnid = (DB_TXN *)&argp[1];
1048 memcpy(&argp->type, bp, sizeof(argp->type));
1049 bp += sizeof(argp->type);
1050 memcpy(&argp->txnid->txnid, bp, sizeof(argp->txnid->txnid));
1051 bp += sizeof(argp->txnid->txnid);
1052 memcpy(&argp->prev_lsn, bp, sizeof(DB_LSN));
1053 bp += sizeof(DB_LSN);
1054 memcpy(&argp->fileid, bp, sizeof(argp->fileid));
1055 bp += sizeof(argp->fileid);
1056 memcpy(&argp->pgno, bp, sizeof(argp->pgno));
1057 bp += sizeof(argp->pgno);
1058 memcpy(&argp->lsn, bp, sizeof(argp->lsn));
1059 bp += sizeof(argp->lsn);
1060 memcpy(&argp->indx, bp, sizeof(argp->indx));
1061 bp += sizeof(argp->indx);
1062 memcpy(&argp->adjust, bp, sizeof(argp->adjust));
1063 bp += sizeof(argp->adjust);
1064 memcpy(&argp->total, bp, sizeof(argp->total));
1065 bp += sizeof(argp->total);
1071 * PUBLIC: int __bam_cdel_log
1072 * PUBLIC: __P((DB_LOG *, DB_TXN *, DB_LSN *, u_int32_t,
1073 * PUBLIC: u_int32_t, db_pgno_t, DB_LSN *, u_int32_t));
1075 int __bam_cdel_log(logp, txnid, ret_lsnp, flags,
1076 fileid, pgno, lsn, indx)
1087 DB_LSN *lsnp, null_lsn;
1088 u_int32_t rectype, txn_num;
1092 rectype = DB_bam_cdel;
1093 txn_num = txnid == NULL ? 0 : txnid->txnid;
1094 if (txnid == NULL) {
1096 null_lsn.offset = 0;
1099 lsnp = &txnid->last_lsn;
1100 logrec.size = sizeof(rectype) + sizeof(txn_num) + sizeof(DB_LSN)
1105 if ((logrec.data = (void *)malloc(logrec.size)) == NULL)
1109 memcpy(bp, &rectype, sizeof(rectype));
1110 bp += sizeof(rectype);
1111 memcpy(bp, &txn_num, sizeof(txn_num));
1112 bp += sizeof(txn_num);
1113 memcpy(bp, lsnp, sizeof(DB_LSN));
1114 bp += sizeof(DB_LSN);
1115 memcpy(bp, &fileid, sizeof(fileid));
1116 bp += sizeof(fileid);
1117 memcpy(bp, &pgno, sizeof(pgno));
1120 memcpy(bp, lsn, sizeof(*lsn));
1122 memset(bp, 0, sizeof(*lsn));
1124 memcpy(bp, &indx, sizeof(indx));
1127 if ((u_int32_t)(bp - (u_int8_t *)logrec.data) != logrec.size)
1128 fprintf(stderr, "Error in log record length");
1130 ret = log_put(logp, ret_lsnp, (DBT *)&logrec, flags);
1132 txnid->last_lsn = *ret_lsnp;
1138 * PUBLIC: int __bam_cdel_print
1139 * PUBLIC: __P((DB_LOG *, DBT *, DB_LSN *, int, void *));
1143 __bam_cdel_print(notused1, dbtp, lsnp, notused3, notused4)
1150 __bam_cdel_args *argp;
1160 if ((ret = __bam_cdel_read(dbtp->data, &argp)) != 0)
1162 printf("[%lu][%lu]bam_cdel: rec: %lu txnid %lx prevlsn [%lu][%lu]\n",
1164 (u_long)lsnp->offset,
1166 (u_long)argp->txnid->txnid,
1167 (u_long)argp->prev_lsn.file,
1168 (u_long)argp->prev_lsn.offset);
1169 printf("\tfileid: %lu\n", (u_long)argp->fileid);
1170 printf("\tpgno: %lu\n", (u_long)argp->pgno);
1171 printf("\tlsn: [%lu][%lu]\n",
1172 (u_long)argp->lsn.file, (u_long)argp->lsn.offset);
1173 printf("\tindx: %lu\n", (u_long)argp->indx);
1180 * PUBLIC: int __bam_cdel_read __P((void *, __bam_cdel_args **));
1183 __bam_cdel_read(recbuf, argpp)
1185 __bam_cdel_args **argpp;
1187 __bam_cdel_args *argp;
1190 argp = (__bam_cdel_args *)malloc(sizeof(__bam_cdel_args) +
1194 argp->txnid = (DB_TXN *)&argp[1];
1196 memcpy(&argp->type, bp, sizeof(argp->type));
1197 bp += sizeof(argp->type);
1198 memcpy(&argp->txnid->txnid, bp, sizeof(argp->txnid->txnid));
1199 bp += sizeof(argp->txnid->txnid);
1200 memcpy(&argp->prev_lsn, bp, sizeof(DB_LSN));
1201 bp += sizeof(DB_LSN);
1202 memcpy(&argp->fileid, bp, sizeof(argp->fileid));
1203 bp += sizeof(argp->fileid);
1204 memcpy(&argp->pgno, bp, sizeof(argp->pgno));
1205 bp += sizeof(argp->pgno);
1206 memcpy(&argp->lsn, bp, sizeof(argp->lsn));
1207 bp += sizeof(argp->lsn);
1208 memcpy(&argp->indx, bp, sizeof(argp->indx));
1209 bp += sizeof(argp->indx);
1215 * PUBLIC: int __bam_init_print __P((DB_ENV *));
1218 __bam_init_print(dbenv)
1223 if ((ret = __db_add_recovery(dbenv,
1224 __bam_pg_alloc_print, DB_bam_pg_alloc)) != 0)
1226 if ((ret = __db_add_recovery(dbenv,
1227 __bam_pg_free_print, DB_bam_pg_free)) != 0)
1229 if ((ret = __db_add_recovery(dbenv,
1230 __bam_split_print, DB_bam_split)) != 0)
1232 if ((ret = __db_add_recovery(dbenv,
1233 __bam_rsplit_print, DB_bam_rsplit)) != 0)
1235 if ((ret = __db_add_recovery(dbenv,
1236 __bam_adj_print, DB_bam_adj)) != 0)
1238 if ((ret = __db_add_recovery(dbenv,
1239 __bam_cadjust_print, DB_bam_cadjust)) != 0)
1241 if ((ret = __db_add_recovery(dbenv,
1242 __bam_cdel_print, DB_bam_cdel)) != 0)
1248 * PUBLIC: int __bam_init_recover __P((DB_ENV *));
1251 __bam_init_recover(dbenv)
1256 if ((ret = __db_add_recovery(dbenv,
1257 __bam_pg_alloc_recover, DB_bam_pg_alloc)) != 0)
1259 if ((ret = __db_add_recovery(dbenv,
1260 __bam_pg_free_recover, DB_bam_pg_free)) != 0)
1262 if ((ret = __db_add_recovery(dbenv,
1263 __bam_split_recover, DB_bam_split)) != 0)
1265 if ((ret = __db_add_recovery(dbenv,
1266 __bam_rsplit_recover, DB_bam_rsplit)) != 0)
1268 if ((ret = __db_add_recovery(dbenv,
1269 __bam_adj_recover, DB_bam_adj)) != 0)
1271 if ((ret = __db_add_recovery(dbenv,
1272 __bam_cadjust_recover, DB_bam_cadjust)) != 0)
1274 if ((ret = __db_add_recovery(dbenv,
1275 __bam_cdel_recover, DB_bam_cdel)) != 0)