3 /* Do not edit: automatically built by gen_rec.awk. */
21 * PUBLIC: #ifdef USE_DB4_LOGGING
24 * PUBLIC: int __vi_marker_log __P((DB_ENV *, DB_TXN *, DB_LSN *, u_int32_t,
25 * PUBLIC: u_int32_t));
28 __vi_marker_log(dbenv
, txnid
, ret_lsnp
, flags
,
37 DB_LSN
*lsnp
, null_lsn
;
39 u_int32_t rectype
, txn_num
;
43 rectype
= DB_vi_marker
;
45 TAILQ_FIRST(&txnid
->kids
) != NULL
&&
46 (ret
= __txn_activekids(dbenv
, rectype
, txnid
)) != 0)
48 txn_num
= txnid
== NULL
? 0 : txnid
->txnid
;
53 lsnp
= &txnid
->last_lsn
;
54 logrec
.size
= sizeof(rectype
) + sizeof(txn_num
) + sizeof(DB_LSN
)
56 if ((ret
= __os_malloc(dbenv
, logrec
.size
, &logrec
.data
)) != 0)
61 memcpy(bp
, &rectype
, sizeof(rectype
));
62 bp
+= sizeof(rectype
);
64 memcpy(bp
, &txn_num
, sizeof(txn_num
));
65 bp
+= sizeof(txn_num
);
67 memcpy(bp
, lsnp
, sizeof(DB_LSN
));
70 uinttmp
= (u_int32_t
)opcode
;
71 memcpy(bp
, &uinttmp
, sizeof(uinttmp
));
72 bp
+= sizeof(uinttmp
);
74 DB_ASSERT((u_int32_t
)(bp
- (u_int8_t
*)logrec
.data
) == logrec
.size
);
75 ret
= dbenv
->log_put(dbenv
, ret_lsnp
, (DBT
*)&logrec
, flags
);
76 if (txnid
!= NULL
&& ret
== 0)
77 txnid
->last_lsn
= *ret_lsnp
;
80 (void)__vi_marker_print(dbenv
,
81 (DBT
*)&logrec
, ret_lsnp
, NULL
, NULL
);
83 __os_free(dbenv
, logrec
.data
, logrec
.size
);
88 * PUBLIC: int __vi_marker_getpgnos __P((DB_ENV *, DBT *, DB_LSN *, db_recops,
92 __vi_marker_getpgnos(dbenv
, rec
, lsnp
, notused1
, summary
)
101 COMPQUIET(rec
, NULL
);
102 COMPQUIET(notused1
, DB_TXN_ABORT
);
104 t
= (TXN_RECS
*)summary
;
106 if ((ret
= __rep_check_alloc(dbenv
, t
, 1)) != 0)
109 t
->array
[t
->npages
].flags
= LSN_PAGE_NOLOCK
;
110 t
->array
[t
->npages
].lsn
= *lsnp
;
111 t
->array
[t
->npages
].fid
= DB_LOGFILEID_INVALID
;
112 memset(&t
->array
[t
->npages
].pgdesc
, 0,
113 sizeof(t
->array
[t
->npages
].pgdesc
));
121 * PUBLIC: int __vi_marker_print __P((DB_ENV *, DBT *, DB_LSN *, db_recops,
125 __vi_marker_print(dbenv
, dbtp
, lsnp
, notused2
, notused3
)
132 __vi_marker_args
*argp
;
135 notused2
= DB_TXN_ABORT
;
138 if ((ret
= __vi_marker_read(dbenv
, dbtp
->data
, &argp
)) != 0)
141 "[%lu][%lu]vi_marker: rec: %lu txnid %lx prevlsn [%lu][%lu]\n",
143 (u_long
)lsnp
->offset
,
145 (u_long
)argp
->txnid
->txnid
,
146 (u_long
)argp
->prev_lsn
.file
,
147 (u_long
)argp
->prev_lsn
.offset
);
148 (void)printf("\topcode: %lu\n", (u_long
)argp
->opcode
);
150 __os_free(dbenv
, argp
, 0);
155 * PUBLIC: int __vi_marker_read __P((DB_ENV *, void *, __vi_marker_args **));
158 __vi_marker_read(dbenv
, recbuf
, argpp
)
161 __vi_marker_args
**argpp
;
163 __vi_marker_args
*argp
;
168 ret
= __os_malloc(dbenv
, sizeof(__vi_marker_args
) +
169 sizeof(DB_TXN
), &argp
);
172 argp
->txnid
= (DB_TXN
*)&argp
[1];
175 memcpy(&argp
->type
, bp
, sizeof(argp
->type
));
176 bp
+= sizeof(argp
->type
);
178 memcpy(&argp
->txnid
->txnid
, bp
, sizeof(argp
->txnid
->txnid
));
179 bp
+= sizeof(argp
->txnid
->txnid
);
181 memcpy(&argp
->prev_lsn
, bp
, sizeof(DB_LSN
));
182 bp
+= sizeof(DB_LSN
);
184 memcpy(&uinttmp
, bp
, sizeof(uinttmp
));
185 argp
->opcode
= (u_int32_t
)uinttmp
;
186 bp
+= sizeof(uinttmp
);
193 * PUBLIC: int __vi_cursor_log __P((DB_ENV *, DB_TXN *, DB_LSN *, u_int32_t,
194 * PUBLIC: u_int32_t, db_recno_t, size_t));
197 __vi_cursor_log(dbenv
, txnid
, ret_lsnp
, flags
,
208 DB_LSN
*lsnp
, null_lsn
;
210 u_int32_t rectype
, txn_num
;
214 rectype
= DB_vi_cursor
;
216 TAILQ_FIRST(&txnid
->kids
) != NULL
&&
217 (ret
= __txn_activekids(dbenv
, rectype
, txnid
)) != 0)
219 txn_num
= txnid
== NULL
? 0 : txnid
->txnid
;
224 lsnp
= &txnid
->last_lsn
;
225 logrec
.size
= sizeof(rectype
) + sizeof(txn_num
) + sizeof(DB_LSN
)
229 if ((ret
= __os_malloc(dbenv
, logrec
.size
, &logrec
.data
)) != 0)
234 memcpy(bp
, &rectype
, sizeof(rectype
));
235 bp
+= sizeof(rectype
);
237 memcpy(bp
, &txn_num
, sizeof(txn_num
));
238 bp
+= sizeof(txn_num
);
240 memcpy(bp
, lsnp
, sizeof(DB_LSN
));
241 bp
+= sizeof(DB_LSN
);
243 uinttmp
= (u_int32_t
)opcode
;
244 memcpy(bp
, &uinttmp
, sizeof(uinttmp
));
245 bp
+= sizeof(uinttmp
);
247 uinttmp
= (u_int32_t
)lno
;
248 memcpy(bp
, &uinttmp
, sizeof(uinttmp
));
249 bp
+= sizeof(uinttmp
);
251 uinttmp
= (u_int32_t
)cno
;
252 memcpy(bp
, &uinttmp
, sizeof(uinttmp
));
253 bp
+= sizeof(uinttmp
);
255 DB_ASSERT((u_int32_t
)(bp
- (u_int8_t
*)logrec
.data
) == logrec
.size
);
256 ret
= dbenv
->log_put(dbenv
, ret_lsnp
, (DBT
*)&logrec
, flags
);
257 if (txnid
!= NULL
&& ret
== 0)
258 txnid
->last_lsn
= *ret_lsnp
;
259 #ifdef LOG_DIAGNOSTIC
261 (void)__vi_cursor_print(dbenv
,
262 (DBT
*)&logrec
, ret_lsnp
, NULL
, NULL
);
264 __os_free(dbenv
, logrec
.data
, logrec
.size
);
269 * PUBLIC: int __vi_cursor_getpgnos __P((DB_ENV *, DBT *, DB_LSN *, db_recops,
273 __vi_cursor_getpgnos(dbenv
, rec
, lsnp
, notused1
, summary
)
282 COMPQUIET(rec
, NULL
);
283 COMPQUIET(notused1
, DB_TXN_ABORT
);
285 t
= (TXN_RECS
*)summary
;
287 if ((ret
= __rep_check_alloc(dbenv
, t
, 1)) != 0)
290 t
->array
[t
->npages
].flags
= LSN_PAGE_NOLOCK
;
291 t
->array
[t
->npages
].lsn
= *lsnp
;
292 t
->array
[t
->npages
].fid
= DB_LOGFILEID_INVALID
;
293 memset(&t
->array
[t
->npages
].pgdesc
, 0,
294 sizeof(t
->array
[t
->npages
].pgdesc
));
302 * PUBLIC: int __vi_cursor_print __P((DB_ENV *, DBT *, DB_LSN *, db_recops,
306 __vi_cursor_print(dbenv
, dbtp
, lsnp
, notused2
, notused3
)
313 __vi_cursor_args
*argp
;
316 notused2
= DB_TXN_ABORT
;
319 if ((ret
= __vi_cursor_read(dbenv
, dbtp
->data
, &argp
)) != 0)
322 "[%lu][%lu]vi_cursor: rec: %lu txnid %lx prevlsn [%lu][%lu]\n",
324 (u_long
)lsnp
->offset
,
326 (u_long
)argp
->txnid
->txnid
,
327 (u_long
)argp
->prev_lsn
.file
,
328 (u_long
)argp
->prev_lsn
.offset
);
329 (void)printf("\topcode: %lu\n", (u_long
)argp
->opcode
);
330 (void)printf("\tlno: %lu\n", (u_long
)argp
->lno
);
331 (void)printf("\tcno: %d\n", argp
->cno
);
333 __os_free(dbenv
, argp
, 0);
338 * PUBLIC: int __vi_cursor_read __P((DB_ENV *, void *, __vi_cursor_args **));
341 __vi_cursor_read(dbenv
, recbuf
, argpp
)
344 __vi_cursor_args
**argpp
;
346 __vi_cursor_args
*argp
;
351 ret
= __os_malloc(dbenv
, sizeof(__vi_cursor_args
) +
352 sizeof(DB_TXN
), &argp
);
355 argp
->txnid
= (DB_TXN
*)&argp
[1];
358 memcpy(&argp
->type
, bp
, sizeof(argp
->type
));
359 bp
+= sizeof(argp
->type
);
361 memcpy(&argp
->txnid
->txnid
, bp
, sizeof(argp
->txnid
->txnid
));
362 bp
+= sizeof(argp
->txnid
->txnid
);
364 memcpy(&argp
->prev_lsn
, bp
, sizeof(DB_LSN
));
365 bp
+= sizeof(DB_LSN
);
367 memcpy(&uinttmp
, bp
, sizeof(uinttmp
));
368 argp
->opcode
= (u_int32_t
)uinttmp
;
369 bp
+= sizeof(uinttmp
);
371 memcpy(&uinttmp
, bp
, sizeof(uinttmp
));
372 argp
->lno
= (db_recno_t
)uinttmp
;
373 bp
+= sizeof(uinttmp
);
375 memcpy(&uinttmp
, bp
, sizeof(uinttmp
));
376 argp
->cno
= (size_t)uinttmp
;
377 bp
+= sizeof(uinttmp
);
384 * PUBLIC: int __vi_mark_log __P((DB_ENV *, DB_TXN *, DB_LSN *, u_int32_t,
388 __vi_mark_log(dbenv
, txnid
, ret_lsnp
, flags
,
397 DB_LSN
*lsnp
, null_lsn
;
398 u_int32_t rectype
, txn_num
;
402 rectype
= DB_vi_mark
;
404 TAILQ_FIRST(&txnid
->kids
) != NULL
&&
405 (ret
= __txn_activekids(dbenv
, rectype
, txnid
)) != 0)
407 txn_num
= txnid
== NULL
? 0 : txnid
->txnid
;
412 lsnp
= &txnid
->last_lsn
;
413 logrec
.size
= sizeof(rectype
) + sizeof(txn_num
) + sizeof(DB_LSN
)
415 if ((ret
= __os_malloc(dbenv
, logrec
.size
, &logrec
.data
)) != 0)
420 memcpy(bp
, &rectype
, sizeof(rectype
));
421 bp
+= sizeof(rectype
);
423 memcpy(bp
, &txn_num
, sizeof(txn_num
));
424 bp
+= sizeof(txn_num
);
426 memcpy(bp
, lsnp
, sizeof(DB_LSN
));
427 bp
+= sizeof(DB_LSN
);
430 memcpy(bp
, lmp
, sizeof(*lmp
));
432 memset(bp
, 0, sizeof(*lmp
));
435 DB_ASSERT((u_int32_t
)(bp
- (u_int8_t
*)logrec
.data
) == logrec
.size
);
436 ret
= dbenv
->log_put(dbenv
, ret_lsnp
, (DBT
*)&logrec
, flags
);
437 if (txnid
!= NULL
&& ret
== 0)
438 txnid
->last_lsn
= *ret_lsnp
;
439 #ifdef LOG_DIAGNOSTIC
441 (void)__vi_mark_print(dbenv
,
442 (DBT
*)&logrec
, ret_lsnp
, NULL
, NULL
);
444 __os_free(dbenv
, logrec
.data
, logrec
.size
);
449 * PUBLIC: int __vi_mark_getpgnos __P((DB_ENV *, DBT *, DB_LSN *, db_recops,
453 __vi_mark_getpgnos(dbenv
, rec
, lsnp
, notused1
, summary
)
462 COMPQUIET(rec
, NULL
);
463 COMPQUIET(notused1
, DB_TXN_ABORT
);
465 t
= (TXN_RECS
*)summary
;
467 if ((ret
= __rep_check_alloc(dbenv
, t
, 1)) != 0)
470 t
->array
[t
->npages
].flags
= LSN_PAGE_NOLOCK
;
471 t
->array
[t
->npages
].lsn
= *lsnp
;
472 t
->array
[t
->npages
].fid
= DB_LOGFILEID_INVALID
;
473 memset(&t
->array
[t
->npages
].pgdesc
, 0,
474 sizeof(t
->array
[t
->npages
].pgdesc
));
482 * PUBLIC: int __vi_mark_print __P((DB_ENV *, DBT *, DB_LSN *, db_recops,
486 __vi_mark_print(dbenv
, dbtp
, lsnp
, notused2
, notused3
)
493 __vi_mark_args
*argp
;
496 notused2
= DB_TXN_ABORT
;
499 if ((ret
= __vi_mark_read(dbenv
, dbtp
->data
, &argp
)) != 0)
502 "[%lu][%lu]vi_mark: rec: %lu txnid %lx prevlsn [%lu][%lu]\n",
504 (u_long
)lsnp
->offset
,
506 (u_long
)argp
->txnid
->txnid
,
507 (u_long
)argp
->prev_lsn
.file
,
508 (u_long
)argp
->prev_lsn
.offset
);
509 (void)printf("\tlmp: %%\n", argp
->lmp
);
511 __os_free(dbenv
, argp
, 0);
516 * PUBLIC: int __vi_mark_read __P((DB_ENV *, void *, __vi_mark_args **));
519 __vi_mark_read(dbenv
, recbuf
, argpp
)
522 __vi_mark_args
**argpp
;
524 __vi_mark_args
*argp
;
528 ret
= __os_malloc(dbenv
, sizeof(__vi_mark_args
) +
529 sizeof(DB_TXN
), &argp
);
532 argp
->txnid
= (DB_TXN
*)&argp
[1];
535 memcpy(&argp
->type
, bp
, sizeof(argp
->type
));
536 bp
+= sizeof(argp
->type
);
538 memcpy(&argp
->txnid
->txnid
, bp
, sizeof(argp
->txnid
->txnid
));
539 bp
+= sizeof(argp
->txnid
->txnid
);
541 memcpy(&argp
->prev_lsn
, bp
, sizeof(DB_LSN
));
542 bp
+= sizeof(DB_LSN
);
544 memcpy(&argp
->lmp
, bp
, sizeof(argp
->lmp
));
545 bp
+= sizeof(argp
->lmp
);
552 * PUBLIC: int __vi_change_log __P((DB_ENV *, DB_TXN *, DB_LSN *, u_int32_t,
553 * PUBLIC: u_int32_t, db_recno_t));
556 __vi_change_log(dbenv
, txnid
, ret_lsnp
, flags
,
566 DB_LSN
*lsnp
, null_lsn
;
568 u_int32_t rectype
, txn_num
;
572 rectype
= DB_vi_change
;
574 TAILQ_FIRST(&txnid
->kids
) != NULL
&&
575 (ret
= __txn_activekids(dbenv
, rectype
, txnid
)) != 0)
577 txn_num
= txnid
== NULL
? 0 : txnid
->txnid
;
582 lsnp
= &txnid
->last_lsn
;
583 logrec
.size
= sizeof(rectype
) + sizeof(txn_num
) + sizeof(DB_LSN
)
586 if ((ret
= __os_malloc(dbenv
, logrec
.size
, &logrec
.data
)) != 0)
591 memcpy(bp
, &rectype
, sizeof(rectype
));
592 bp
+= sizeof(rectype
);
594 memcpy(bp
, &txn_num
, sizeof(txn_num
));
595 bp
+= sizeof(txn_num
);
597 memcpy(bp
, lsnp
, sizeof(DB_LSN
));
598 bp
+= sizeof(DB_LSN
);
600 uinttmp
= (u_int32_t
)opcode
;
601 memcpy(bp
, &uinttmp
, sizeof(uinttmp
));
602 bp
+= sizeof(uinttmp
);
604 uinttmp
= (u_int32_t
)lno
;
605 memcpy(bp
, &uinttmp
, sizeof(uinttmp
));
606 bp
+= sizeof(uinttmp
);
608 DB_ASSERT((u_int32_t
)(bp
- (u_int8_t
*)logrec
.data
) == logrec
.size
);
609 ret
= dbenv
->log_put(dbenv
, ret_lsnp
, (DBT
*)&logrec
, flags
);
610 if (txnid
!= NULL
&& ret
== 0)
611 txnid
->last_lsn
= *ret_lsnp
;
612 #ifdef LOG_DIAGNOSTIC
614 (void)__vi_change_print(dbenv
,
615 (DBT
*)&logrec
, ret_lsnp
, NULL
, NULL
);
617 __os_free(dbenv
, logrec
.data
, logrec
.size
);
622 * PUBLIC: int __vi_change_getpgnos __P((DB_ENV *, DBT *, DB_LSN *, db_recops,
626 __vi_change_getpgnos(dbenv
, rec
, lsnp
, notused1
, summary
)
635 COMPQUIET(rec
, NULL
);
636 COMPQUIET(notused1
, DB_TXN_ABORT
);
638 t
= (TXN_RECS
*)summary
;
640 if ((ret
= __rep_check_alloc(dbenv
, t
, 1)) != 0)
643 t
->array
[t
->npages
].flags
= LSN_PAGE_NOLOCK
;
644 t
->array
[t
->npages
].lsn
= *lsnp
;
645 t
->array
[t
->npages
].fid
= DB_LOGFILEID_INVALID
;
646 memset(&t
->array
[t
->npages
].pgdesc
, 0,
647 sizeof(t
->array
[t
->npages
].pgdesc
));
655 * PUBLIC: int __vi_change_print __P((DB_ENV *, DBT *, DB_LSN *, db_recops,
659 __vi_change_print(dbenv
, dbtp
, lsnp
, notused2
, notused3
)
666 __vi_change_args
*argp
;
669 notused2
= DB_TXN_ABORT
;
672 if ((ret
= __vi_change_read(dbenv
, dbtp
->data
, &argp
)) != 0)
675 "[%lu][%lu]vi_change: rec: %lu txnid %lx prevlsn [%lu][%lu]\n",
677 (u_long
)lsnp
->offset
,
679 (u_long
)argp
->txnid
->txnid
,
680 (u_long
)argp
->prev_lsn
.file
,
681 (u_long
)argp
->prev_lsn
.offset
);
682 (void)printf("\topcode: %lu\n", (u_long
)argp
->opcode
);
683 (void)printf("\tlno: %lu\n", (u_long
)argp
->lno
);
685 __os_free(dbenv
, argp
, 0);
690 * PUBLIC: int __vi_change_read __P((DB_ENV *, void *, __vi_change_args **));
693 __vi_change_read(dbenv
, recbuf
, argpp
)
696 __vi_change_args
**argpp
;
698 __vi_change_args
*argp
;
703 ret
= __os_malloc(dbenv
, sizeof(__vi_change_args
) +
704 sizeof(DB_TXN
), &argp
);
707 argp
->txnid
= (DB_TXN
*)&argp
[1];
710 memcpy(&argp
->type
, bp
, sizeof(argp
->type
));
711 bp
+= sizeof(argp
->type
);
713 memcpy(&argp
->txnid
->txnid
, bp
, sizeof(argp
->txnid
->txnid
));
714 bp
+= sizeof(argp
->txnid
->txnid
);
716 memcpy(&argp
->prev_lsn
, bp
, sizeof(DB_LSN
));
717 bp
+= sizeof(DB_LSN
);
719 memcpy(&uinttmp
, bp
, sizeof(uinttmp
));
720 argp
->opcode
= (u_int32_t
)uinttmp
;
721 bp
+= sizeof(uinttmp
);
723 memcpy(&uinttmp
, bp
, sizeof(uinttmp
));
724 argp
->lno
= (db_recno_t
)uinttmp
;
725 bp
+= sizeof(uinttmp
);
732 * PUBLIC: int __vi_init_print __P((DB_ENV *, int (***)(DB_ENV *, DBT *,
733 * PUBLIC: DB_LSN *, db_recops, void *), size_t *));
736 __vi_init_print(dbenv
, dtabp
, dtabsizep
)
738 int (***dtabp
)__P((DB_ENV
*, DBT
*, DB_LSN
*, db_recops
, void *));
743 if ((ret
= __db_add_recovery(dbenv
, dtabp
, dtabsizep
,
744 __vi_marker_print
, DB_vi_marker
)) != 0)
746 if ((ret
= __db_add_recovery(dbenv
, dtabp
, dtabsizep
,
747 __vi_cursor_print
, DB_vi_cursor
)) != 0)
749 if ((ret
= __db_add_recovery(dbenv
, dtabp
, dtabsizep
,
750 __vi_mark_print
, DB_vi_mark
)) != 0)
752 if ((ret
= __db_add_recovery(dbenv
, dtabp
, dtabsizep
,
753 __vi_change_print
, DB_vi_change
)) != 0)
759 * PUBLIC: int __vi_init_getpgnos __P((DB_ENV *, int (***)(DB_ENV *, DBT *,
760 * PUBLIC: DB_LSN *, db_recops, void *), size_t *));
763 __vi_init_getpgnos(dbenv
, dtabp
, dtabsizep
)
765 int (***dtabp
)__P((DB_ENV
*, DBT
*, DB_LSN
*, db_recops
, void *));
770 if ((ret
= __db_add_recovery(dbenv
, dtabp
, dtabsizep
,
771 __vi_marker_getpgnos
, DB_vi_marker
)) != 0)
773 if ((ret
= __db_add_recovery(dbenv
, dtabp
, dtabsizep
,
774 __vi_cursor_getpgnos
, DB_vi_cursor
)) != 0)
776 if ((ret
= __db_add_recovery(dbenv
, dtabp
, dtabsizep
,
777 __vi_mark_getpgnos
, DB_vi_mark
)) != 0)
779 if ((ret
= __db_add_recovery(dbenv
, dtabp
, dtabsizep
,
780 __vi_change_getpgnos
, DB_vi_change
)) != 0)
786 * PUBLIC: int __vi_init_recover __P((DB_ENV *));
789 __vi_init_recover(dbenv
)
794 if ((ret
= __db_add_recovery(dbenv
, &dbenv
->dtab
, &dbenv
->dtab_size
,
795 __vi_marker_recover
, DB_vi_marker
)) != 0)
797 if ((ret
= __db_add_recovery(dbenv
, &dbenv
->dtab
, &dbenv
->dtab_size
,
798 __vi_cursor_recover
, DB_vi_cursor
)) != 0)
800 if ((ret
= __db_add_recovery(dbenv
, &dbenv
->dtab
, &dbenv
->dtab_size
,
801 __vi_mark_recover
, DB_vi_mark
)) != 0)
803 if ((ret
= __db_add_recovery(dbenv
, &dbenv
->dtab
, &dbenv
->dtab_size
,
804 __vi_change_recover
, DB_vi_change
)) != 0)