1 /* Do not edit: automatically built by gen_rec.awk. */
19 * PUBLIC: int __vi_marker_log __P((DB_ENV *, DB_TXN *, DB_LSN *, u_int32_t,
20 * PUBLIC: u_int32_t));
23 __vi_marker_log(dbenv
, txnid
, ret_lsnp
, flags
,
32 DB_LSN
*lsnp
, null_lsn
;
34 u_int32_t rectype
, txn_num
;
38 rectype
= DB_vi_marker
;
40 TAILQ_FIRST(&txnid
->kids
) != NULL
&&
41 (ret
= __txn_activekids(dbenv
, rectype
, txnid
)) != 0)
43 txn_num
= txnid
== NULL
? 0 : txnid
->txnid
;
48 lsnp
= &txnid
->last_lsn
;
49 logrec
.size
= sizeof(rectype
) + sizeof(txn_num
) + sizeof(DB_LSN
)
51 if ((ret
= __os_malloc(dbenv
, logrec
.size
, &logrec
.data
)) != 0)
56 memcpy(bp
, &rectype
, sizeof(rectype
));
57 bp
+= sizeof(rectype
);
59 memcpy(bp
, &txn_num
, sizeof(txn_num
));
60 bp
+= sizeof(txn_num
);
62 memcpy(bp
, lsnp
, sizeof(DB_LSN
));
65 uinttmp
= (u_int32_t
)opcode
;
66 memcpy(bp
, &uinttmp
, sizeof(uinttmp
));
67 bp
+= sizeof(uinttmp
);
69 DB_ASSERT((u_int32_t
)(bp
- (u_int8_t
*)logrec
.data
) == logrec
.size
);
70 ret
= dbenv
->log_put(dbenv
, ret_lsnp
, (DBT
*)&logrec
, flags
);
71 if (txnid
!= NULL
&& ret
== 0)
72 txnid
->last_lsn
= *ret_lsnp
;
75 (void)__vi_marker_print(dbenv
,
76 (DBT
*)&logrec
, ret_lsnp
, NULL
, NULL
);
78 __os_free(dbenv
, logrec
.data
, logrec
.size
);
83 * PUBLIC: int __vi_marker_getpgnos __P((DB_ENV *, DBT *, DB_LSN *, db_recops,
87 __vi_marker_getpgnos(dbenv
, rec
, lsnp
, notused1
, summary
)
97 COMPQUIET(notused1
, DB_TXN_ABORT
);
99 t
= (TXN_RECS
*)summary
;
101 if ((ret
= __rep_check_alloc(dbenv
, t
, 1)) != 0)
104 t
->array
[t
->npages
].flags
= LSN_PAGE_NOLOCK
;
105 t
->array
[t
->npages
].lsn
= *lsnp
;
106 t
->array
[t
->npages
].fid
= DB_LOGFILEID_INVALID
;
107 memset(&t
->array
[t
->npages
].pgdesc
, 0,
108 sizeof(t
->array
[t
->npages
].pgdesc
));
116 * PUBLIC: int __vi_marker_print __P((DB_ENV *, DBT *, DB_LSN *, db_recops,
120 __vi_marker_print(dbenv
, dbtp
, lsnp
, notused2
, notused3
)
127 __vi_marker_args
*argp
;
130 notused2
= DB_TXN_ABORT
;
133 if ((ret
= __vi_marker_read(dbenv
, dbtp
->data
, &argp
)) != 0)
136 "[%lu][%lu]vi_marker: rec: %lu txnid %lx prevlsn [%lu][%lu]\n",
138 (u_long
)lsnp
->offset
,
140 (u_long
)argp
->txnid
->txnid
,
141 (u_long
)argp
->prev_lsn
.file
,
142 (u_long
)argp
->prev_lsn
.offset
);
143 (void)printf("\topcode: %lu\n", (u_long
)argp
->opcode
);
145 __os_free(dbenv
, argp
, 0);
150 * PUBLIC: int __vi_marker_read __P((DB_ENV *, void *, __vi_marker_args **));
153 __vi_marker_read(dbenv
, recbuf
, argpp
)
156 __vi_marker_args
**argpp
;
158 __vi_marker_args
*argp
;
163 ret
= __os_malloc(dbenv
, sizeof(__vi_marker_args
) +
164 sizeof(DB_TXN
), &argp
);
167 argp
->txnid
= (DB_TXN
*)&argp
[1];
170 memcpy(&argp
->type
, bp
, sizeof(argp
->type
));
171 bp
+= sizeof(argp
->type
);
173 memcpy(&argp
->txnid
->txnid
, bp
, sizeof(argp
->txnid
->txnid
));
174 bp
+= sizeof(argp
->txnid
->txnid
);
176 memcpy(&argp
->prev_lsn
, bp
, sizeof(DB_LSN
));
177 bp
+= sizeof(DB_LSN
);
179 memcpy(&uinttmp
, bp
, sizeof(uinttmp
));
180 argp
->opcode
= (u_int32_t
)uinttmp
;
181 bp
+= sizeof(uinttmp
);
188 * PUBLIC: int __vi_cursor_log __P((DB_ENV *, DB_TXN *, DB_LSN *, u_int32_t,
189 * PUBLIC: u_int32_t, db_recno_t, size_t));
192 __vi_cursor_log(dbenv
, txnid
, ret_lsnp
, flags
,
203 DB_LSN
*lsnp
, null_lsn
;
205 u_int32_t rectype
, txn_num
;
209 rectype
= DB_vi_cursor
;
211 TAILQ_FIRST(&txnid
->kids
) != NULL
&&
212 (ret
= __txn_activekids(dbenv
, rectype
, txnid
)) != 0)
214 txn_num
= txnid
== NULL
? 0 : txnid
->txnid
;
219 lsnp
= &txnid
->last_lsn
;
220 logrec
.size
= sizeof(rectype
) + sizeof(txn_num
) + sizeof(DB_LSN
)
224 if ((ret
= __os_malloc(dbenv
, logrec
.size
, &logrec
.data
)) != 0)
229 memcpy(bp
, &rectype
, sizeof(rectype
));
230 bp
+= sizeof(rectype
);
232 memcpy(bp
, &txn_num
, sizeof(txn_num
));
233 bp
+= sizeof(txn_num
);
235 memcpy(bp
, lsnp
, sizeof(DB_LSN
));
236 bp
+= sizeof(DB_LSN
);
238 uinttmp
= (u_int32_t
)opcode
;
239 memcpy(bp
, &uinttmp
, sizeof(uinttmp
));
240 bp
+= sizeof(uinttmp
);
242 uinttmp
= (u_int32_t
)lno
;
243 memcpy(bp
, &uinttmp
, sizeof(uinttmp
));
244 bp
+= sizeof(uinttmp
);
246 uinttmp
= (u_int32_t
)cno
;
247 memcpy(bp
, &uinttmp
, sizeof(uinttmp
));
248 bp
+= sizeof(uinttmp
);
250 DB_ASSERT((u_int32_t
)(bp
- (u_int8_t
*)logrec
.data
) == logrec
.size
);
251 ret
= dbenv
->log_put(dbenv
, ret_lsnp
, (DBT
*)&logrec
, flags
);
252 if (txnid
!= NULL
&& ret
== 0)
253 txnid
->last_lsn
= *ret_lsnp
;
254 #ifdef LOG_DIAGNOSTIC
256 (void)__vi_cursor_print(dbenv
,
257 (DBT
*)&logrec
, ret_lsnp
, NULL
, NULL
);
259 __os_free(dbenv
, logrec
.data
, logrec
.size
);
264 * PUBLIC: int __vi_cursor_getpgnos __P((DB_ENV *, DBT *, DB_LSN *, db_recops,
268 __vi_cursor_getpgnos(dbenv
, rec
, lsnp
, notused1
, summary
)
277 COMPQUIET(rec
, NULL
);
278 COMPQUIET(notused1
, DB_TXN_ABORT
);
280 t
= (TXN_RECS
*)summary
;
282 if ((ret
= __rep_check_alloc(dbenv
, t
, 1)) != 0)
285 t
->array
[t
->npages
].flags
= LSN_PAGE_NOLOCK
;
286 t
->array
[t
->npages
].lsn
= *lsnp
;
287 t
->array
[t
->npages
].fid
= DB_LOGFILEID_INVALID
;
288 memset(&t
->array
[t
->npages
].pgdesc
, 0,
289 sizeof(t
->array
[t
->npages
].pgdesc
));
297 * PUBLIC: int __vi_cursor_print __P((DB_ENV *, DBT *, DB_LSN *, db_recops,
301 __vi_cursor_print(dbenv
, dbtp
, lsnp
, notused2
, notused3
)
308 __vi_cursor_args
*argp
;
311 notused2
= DB_TXN_ABORT
;
314 if ((ret
= __vi_cursor_read(dbenv
, dbtp
->data
, &argp
)) != 0)
317 "[%lu][%lu]vi_cursor: rec: %lu txnid %lx prevlsn [%lu][%lu]\n",
319 (u_long
)lsnp
->offset
,
321 (u_long
)argp
->txnid
->txnid
,
322 (u_long
)argp
->prev_lsn
.file
,
323 (u_long
)argp
->prev_lsn
.offset
);
324 (void)printf("\topcode: %lu\n", (u_long
)argp
->opcode
);
325 (void)printf("\tlno: %lu\n", (u_long
)argp
->lno
);
326 (void)printf("\tcno: %d\n", argp
->cno
);
328 __os_free(dbenv
, argp
, 0);
333 * PUBLIC: int __vi_cursor_read __P((DB_ENV *, void *, __vi_cursor_args **));
336 __vi_cursor_read(dbenv
, recbuf
, argpp
)
339 __vi_cursor_args
**argpp
;
341 __vi_cursor_args
*argp
;
346 ret
= __os_malloc(dbenv
, sizeof(__vi_cursor_args
) +
347 sizeof(DB_TXN
), &argp
);
350 argp
->txnid
= (DB_TXN
*)&argp
[1];
353 memcpy(&argp
->type
, bp
, sizeof(argp
->type
));
354 bp
+= sizeof(argp
->type
);
356 memcpy(&argp
->txnid
->txnid
, bp
, sizeof(argp
->txnid
->txnid
));
357 bp
+= sizeof(argp
->txnid
->txnid
);
359 memcpy(&argp
->prev_lsn
, bp
, sizeof(DB_LSN
));
360 bp
+= sizeof(DB_LSN
);
362 memcpy(&uinttmp
, bp
, sizeof(uinttmp
));
363 argp
->opcode
= (u_int32_t
)uinttmp
;
364 bp
+= sizeof(uinttmp
);
366 memcpy(&uinttmp
, bp
, sizeof(uinttmp
));
367 argp
->lno
= (db_recno_t
)uinttmp
;
368 bp
+= sizeof(uinttmp
);
370 memcpy(&uinttmp
, bp
, sizeof(uinttmp
));
371 argp
->cno
= (size_t)uinttmp
;
372 bp
+= sizeof(uinttmp
);
379 * PUBLIC: int __vi_mark_log __P((DB_ENV *, DB_TXN *, DB_LSN *, u_int32_t));
382 __vi_mark_log(dbenv
, txnid
, ret_lsnp
, flags
)
389 DB_LSN
*lsnp
, null_lsn
;
390 u_int32_t rectype
, txn_num
;
394 rectype
= DB_vi_mark
;
396 TAILQ_FIRST(&txnid
->kids
) != NULL
&&
397 (ret
= __txn_activekids(dbenv
, rectype
, txnid
)) != 0)
399 txn_num
= txnid
== NULL
? 0 : txnid
->txnid
;
404 lsnp
= &txnid
->last_lsn
;
405 logrec
.size
= sizeof(rectype
) + sizeof(txn_num
) + sizeof(DB_LSN
);
406 if ((ret
= __os_malloc(dbenv
, logrec
.size
, &logrec
.data
)) != 0)
411 memcpy(bp
, &rectype
, sizeof(rectype
));
412 bp
+= sizeof(rectype
);
414 memcpy(bp
, &txn_num
, sizeof(txn_num
));
415 bp
+= sizeof(txn_num
);
417 memcpy(bp
, lsnp
, sizeof(DB_LSN
));
418 bp
+= sizeof(DB_LSN
);
420 DB_ASSERT((u_int32_t
)(bp
- (u_int8_t
*)logrec
.data
) == logrec
.size
);
421 ret
= dbenv
->log_put(dbenv
, ret_lsnp
, (DBT
*)&logrec
, flags
);
422 if (txnid
!= NULL
&& ret
== 0)
423 txnid
->last_lsn
= *ret_lsnp
;
424 #ifdef LOG_DIAGNOSTIC
426 (void)__vi_mark_print(dbenv
,
427 (DBT
*)&logrec
, ret_lsnp
, NULL
, NULL
);
429 __os_free(dbenv
, logrec
.data
, logrec
.size
);
434 * PUBLIC: int __vi_mark_getpgnos __P((DB_ENV *, DBT *, DB_LSN *, db_recops,
438 __vi_mark_getpgnos(dbenv
, rec
, lsnp
, notused1
, summary
)
447 COMPQUIET(rec
, NULL
);
448 COMPQUIET(notused1
, DB_TXN_ABORT
);
450 t
= (TXN_RECS
*)summary
;
452 if ((ret
= __rep_check_alloc(dbenv
, t
, 1)) != 0)
455 t
->array
[t
->npages
].flags
= LSN_PAGE_NOLOCK
;
456 t
->array
[t
->npages
].lsn
= *lsnp
;
457 t
->array
[t
->npages
].fid
= DB_LOGFILEID_INVALID
;
458 memset(&t
->array
[t
->npages
].pgdesc
, 0,
459 sizeof(t
->array
[t
->npages
].pgdesc
));
467 * PUBLIC: int __vi_mark_print __P((DB_ENV *, DBT *, DB_LSN *, db_recops,
471 __vi_mark_print(dbenv
, dbtp
, lsnp
, notused2
, notused3
)
478 __vi_mark_args
*argp
;
481 notused2
= DB_TXN_ABORT
;
484 if ((ret
= __vi_mark_read(dbenv
, dbtp
->data
, &argp
)) != 0)
487 "[%lu][%lu]vi_mark: rec: %lu txnid %lx prevlsn [%lu][%lu]\n",
489 (u_long
)lsnp
->offset
,
491 (u_long
)argp
->txnid
->txnid
,
492 (u_long
)argp
->prev_lsn
.file
,
493 (u_long
)argp
->prev_lsn
.offset
);
495 __os_free(dbenv
, argp
, 0);
500 * PUBLIC: int __vi_mark_read __P((DB_ENV *, void *, __vi_mark_args **));
503 __vi_mark_read(dbenv
, recbuf
, argpp
)
506 __vi_mark_args
**argpp
;
508 __vi_mark_args
*argp
;
512 ret
= __os_malloc(dbenv
, sizeof(__vi_mark_args
) +
513 sizeof(DB_TXN
), &argp
);
516 argp
->txnid
= (DB_TXN
*)&argp
[1];
519 memcpy(&argp
->type
, bp
, sizeof(argp
->type
));
520 bp
+= sizeof(argp
->type
);
522 memcpy(&argp
->txnid
->txnid
, bp
, sizeof(argp
->txnid
->txnid
));
523 bp
+= sizeof(argp
->txnid
->txnid
);
525 memcpy(&argp
->prev_lsn
, bp
, sizeof(DB_LSN
));
526 bp
+= sizeof(DB_LSN
);
533 * PUBLIC: int __vi_change_log __P((DB_ENV *, DB_TXN *, DB_LSN *, u_int32_t,
534 * PUBLIC: u_int32_t, db_recno_t));
537 __vi_change_log(dbenv
, txnid
, ret_lsnp
, flags
,
547 DB_LSN
*lsnp
, null_lsn
;
549 u_int32_t rectype
, txn_num
;
553 rectype
= DB_vi_change
;
555 TAILQ_FIRST(&txnid
->kids
) != NULL
&&
556 (ret
= __txn_activekids(dbenv
, rectype
, txnid
)) != 0)
558 txn_num
= txnid
== NULL
? 0 : txnid
->txnid
;
563 lsnp
= &txnid
->last_lsn
;
564 logrec
.size
= sizeof(rectype
) + sizeof(txn_num
) + sizeof(DB_LSN
)
567 if ((ret
= __os_malloc(dbenv
, logrec
.size
, &logrec
.data
)) != 0)
572 memcpy(bp
, &rectype
, sizeof(rectype
));
573 bp
+= sizeof(rectype
);
575 memcpy(bp
, &txn_num
, sizeof(txn_num
));
576 bp
+= sizeof(txn_num
);
578 memcpy(bp
, lsnp
, sizeof(DB_LSN
));
579 bp
+= sizeof(DB_LSN
);
581 uinttmp
= (u_int32_t
)opcode
;
582 memcpy(bp
, &uinttmp
, sizeof(uinttmp
));
583 bp
+= sizeof(uinttmp
);
585 uinttmp
= (u_int32_t
)lno
;
586 memcpy(bp
, &uinttmp
, sizeof(uinttmp
));
587 bp
+= sizeof(uinttmp
);
589 DB_ASSERT((u_int32_t
)(bp
- (u_int8_t
*)logrec
.data
) == logrec
.size
);
590 ret
= dbenv
->log_put(dbenv
, ret_lsnp
, (DBT
*)&logrec
, flags
);
591 if (txnid
!= NULL
&& ret
== 0)
592 txnid
->last_lsn
= *ret_lsnp
;
593 #ifdef LOG_DIAGNOSTIC
595 (void)__vi_change_print(dbenv
,
596 (DBT
*)&logrec
, ret_lsnp
, NULL
, NULL
);
598 __os_free(dbenv
, logrec
.data
, logrec
.size
);
603 * PUBLIC: int __vi_change_getpgnos __P((DB_ENV *, DBT *, DB_LSN *, db_recops,
607 __vi_change_getpgnos(dbenv
, rec
, lsnp
, notused1
, summary
)
616 COMPQUIET(rec
, NULL
);
617 COMPQUIET(notused1
, DB_TXN_ABORT
);
619 t
= (TXN_RECS
*)summary
;
621 if ((ret
= __rep_check_alloc(dbenv
, t
, 1)) != 0)
624 t
->array
[t
->npages
].flags
= LSN_PAGE_NOLOCK
;
625 t
->array
[t
->npages
].lsn
= *lsnp
;
626 t
->array
[t
->npages
].fid
= DB_LOGFILEID_INVALID
;
627 memset(&t
->array
[t
->npages
].pgdesc
, 0,
628 sizeof(t
->array
[t
->npages
].pgdesc
));
636 * PUBLIC: int __vi_change_print __P((DB_ENV *, DBT *, DB_LSN *, db_recops,
640 __vi_change_print(dbenv
, dbtp
, lsnp
, notused2
, notused3
)
647 __vi_change_args
*argp
;
650 notused2
= DB_TXN_ABORT
;
653 if ((ret
= __vi_change_read(dbenv
, dbtp
->data
, &argp
)) != 0)
656 "[%lu][%lu]vi_change: rec: %lu txnid %lx prevlsn [%lu][%lu]\n",
658 (u_long
)lsnp
->offset
,
660 (u_long
)argp
->txnid
->txnid
,
661 (u_long
)argp
->prev_lsn
.file
,
662 (u_long
)argp
->prev_lsn
.offset
);
663 (void)printf("\topcode: %lu\n", (u_long
)argp
->opcode
);
664 (void)printf("\tlno: %lu\n", (u_long
)argp
->lno
);
666 __os_free(dbenv
, argp
, 0);
671 * PUBLIC: int __vi_change_read __P((DB_ENV *, void *, __vi_change_args **));
674 __vi_change_read(dbenv
, recbuf
, argpp
)
677 __vi_change_args
**argpp
;
679 __vi_change_args
*argp
;
684 ret
= __os_malloc(dbenv
, sizeof(__vi_change_args
) +
685 sizeof(DB_TXN
), &argp
);
688 argp
->txnid
= (DB_TXN
*)&argp
[1];
691 memcpy(&argp
->type
, bp
, sizeof(argp
->type
));
692 bp
+= sizeof(argp
->type
);
694 memcpy(&argp
->txnid
->txnid
, bp
, sizeof(argp
->txnid
->txnid
));
695 bp
+= sizeof(argp
->txnid
->txnid
);
697 memcpy(&argp
->prev_lsn
, bp
, sizeof(DB_LSN
));
698 bp
+= sizeof(DB_LSN
);
700 memcpy(&uinttmp
, bp
, sizeof(uinttmp
));
701 argp
->opcode
= (u_int32_t
)uinttmp
;
702 bp
+= sizeof(uinttmp
);
704 memcpy(&uinttmp
, bp
, sizeof(uinttmp
));
705 argp
->lno
= (db_recno_t
)uinttmp
;
706 bp
+= sizeof(uinttmp
);
713 * PUBLIC: int __vi_init_print __P((DB_ENV *, int (***)(DB_ENV *, DBT *,
714 * PUBLIC: DB_LSN *, db_recops, void *), size_t *));
717 __vi_init_print(dbenv
, dtabp
, dtabsizep
)
719 int (***dtabp
)__P((DB_ENV
*, DBT
*, DB_LSN
*, db_recops
, void *));
724 if ((ret
= __db_add_recovery(dbenv
, dtabp
, dtabsizep
,
725 __vi_marker_print
, DB_vi_marker
)) != 0)
727 if ((ret
= __db_add_recovery(dbenv
, dtabp
, dtabsizep
,
728 __vi_cursor_print
, DB_vi_cursor
)) != 0)
730 if ((ret
= __db_add_recovery(dbenv
, dtabp
, dtabsizep
,
731 __vi_mark_print
, DB_vi_mark
)) != 0)
733 if ((ret
= __db_add_recovery(dbenv
, dtabp
, dtabsizep
,
734 __vi_change_print
, DB_vi_change
)) != 0)
740 * PUBLIC: int __vi_init_getpgnos __P((DB_ENV *, int (***)(DB_ENV *, DBT *,
741 * PUBLIC: DB_LSN *, db_recops, void *), size_t *));
744 __vi_init_getpgnos(dbenv
, dtabp
, dtabsizep
)
746 int (***dtabp
)__P((DB_ENV
*, DBT
*, DB_LSN
*, db_recops
, void *));
751 if ((ret
= __db_add_recovery(dbenv
, dtabp
, dtabsizep
,
752 __vi_marker_getpgnos
, DB_vi_marker
)) != 0)
754 if ((ret
= __db_add_recovery(dbenv
, dtabp
, dtabsizep
,
755 __vi_cursor_getpgnos
, DB_vi_cursor
)) != 0)
757 if ((ret
= __db_add_recovery(dbenv
, dtabp
, dtabsizep
,
758 __vi_mark_getpgnos
, DB_vi_mark
)) != 0)
760 if ((ret
= __db_add_recovery(dbenv
, dtabp
, dtabsizep
,
761 __vi_change_getpgnos
, DB_vi_change
)) != 0)
767 * PUBLIC: int __vi_init_recover __P((DB_ENV *));
770 __vi_init_recover(dbenv
)
775 if ((ret
= __db_add_recovery(dbenv
, &dbenv
->dtab
, &dbenv
->dtab_size
,
776 __vi_marker_recover
, DB_vi_marker
)) != 0)
778 if ((ret
= __db_add_recovery(dbenv
, &dbenv
->dtab
, &dbenv
->dtab_size
,
779 __vi_cursor_recover
, DB_vi_cursor
)) != 0)
781 if ((ret
= __db_add_recovery(dbenv
, &dbenv
->dtab
, &dbenv
->dtab_size
,
782 __vi_mark_recover
, DB_vi_mark
)) != 0)
784 if ((ret
= __db_add_recovery(dbenv
, &dbenv
->dtab
, &dbenv
->dtab_size
,
785 __vi_change_recover
, DB_vi_change
)) != 0)