1 /* Do not edit: automatically built by gen_rec.awk. */
19 * PUBLIC: #ifdef USE_DB4_LOGGING
22 * PUBLIC: int __vi_marker_log __P((DB_ENV *, DB_TXN *, DB_LSN *, u_int32_t,
23 * PUBLIC: u_int32_t));
26 __vi_marker_log(dbenv
, txnid
, ret_lsnp
, flags
,
35 DB_LSN
*lsnp
, null_lsn
;
37 u_int32_t rectype
, txn_num
;
41 rectype
= DB_vi_marker
;
43 TAILQ_FIRST(&txnid
->kids
) != NULL
&&
44 (ret
= __txn_activekids(dbenv
, rectype
, txnid
)) != 0)
46 txn_num
= txnid
== NULL
? 0 : txnid
->txnid
;
51 lsnp
= &txnid
->last_lsn
;
52 logrec
.size
= sizeof(rectype
) + sizeof(txn_num
) + sizeof(DB_LSN
)
54 if ((ret
= __os_malloc(dbenv
, logrec
.size
, &logrec
.data
)) != 0)
59 memcpy(bp
, &rectype
, sizeof(rectype
));
60 bp
+= sizeof(rectype
);
62 memcpy(bp
, &txn_num
, sizeof(txn_num
));
63 bp
+= sizeof(txn_num
);
65 memcpy(bp
, lsnp
, sizeof(DB_LSN
));
68 uinttmp
= (u_int32_t
)opcode
;
69 memcpy(bp
, &uinttmp
, sizeof(uinttmp
));
70 bp
+= sizeof(uinttmp
);
72 DB_ASSERT((u_int32_t
)(bp
- (u_int8_t
*)logrec
.data
) == logrec
.size
);
73 ret
= dbenv
->log_put(dbenv
, ret_lsnp
, (DBT
*)&logrec
, flags
);
74 if (txnid
!= NULL
&& ret
== 0)
75 txnid
->last_lsn
= *ret_lsnp
;
78 (void)__vi_marker_print(dbenv
,
79 (DBT
*)&logrec
, ret_lsnp
, NULL
, NULL
);
81 __os_free(dbenv
, logrec
.data
, logrec
.size
);
86 * PUBLIC: int __vi_marker_getpgnos __P((DB_ENV *, DBT *, DB_LSN *, db_recops,
90 __vi_marker_getpgnos(dbenv
, rec
, lsnp
, notused1
, summary
)
100 COMPQUIET(notused1
, DB_TXN_ABORT
);
102 t
= (TXN_RECS
*)summary
;
104 if ((ret
= __rep_check_alloc(dbenv
, t
, 1)) != 0)
107 t
->array
[t
->npages
].flags
= LSN_PAGE_NOLOCK
;
108 t
->array
[t
->npages
].lsn
= *lsnp
;
109 t
->array
[t
->npages
].fid
= DB_LOGFILEID_INVALID
;
110 memset(&t
->array
[t
->npages
].pgdesc
, 0,
111 sizeof(t
->array
[t
->npages
].pgdesc
));
119 * PUBLIC: int __vi_marker_print __P((DB_ENV *, DBT *, DB_LSN *, db_recops,
123 __vi_marker_print(dbenv
, dbtp
, lsnp
, notused2
, notused3
)
130 __vi_marker_args
*argp
;
133 notused2
= DB_TXN_ABORT
;
136 if ((ret
= __vi_marker_read(dbenv
, dbtp
->data
, &argp
)) != 0)
139 "[%lu][%lu]vi_marker: rec: %lu txnid %lx prevlsn [%lu][%lu]\n",
141 (u_long
)lsnp
->offset
,
143 (u_long
)argp
->txnid
->txnid
,
144 (u_long
)argp
->prev_lsn
.file
,
145 (u_long
)argp
->prev_lsn
.offset
);
146 (void)printf("\topcode: %lu\n", (u_long
)argp
->opcode
);
148 __os_free(dbenv
, argp
, 0);
153 * PUBLIC: int __vi_marker_read __P((DB_ENV *, void *, __vi_marker_args **));
156 __vi_marker_read(dbenv
, recbuf
, argpp
)
159 __vi_marker_args
**argpp
;
161 __vi_marker_args
*argp
;
166 ret
= __os_malloc(dbenv
, sizeof(__vi_marker_args
) +
167 sizeof(DB_TXN
), &argp
);
170 argp
->txnid
= (DB_TXN
*)&argp
[1];
173 memcpy(&argp
->type
, bp
, sizeof(argp
->type
));
174 bp
+= sizeof(argp
->type
);
176 memcpy(&argp
->txnid
->txnid
, bp
, sizeof(argp
->txnid
->txnid
));
177 bp
+= sizeof(argp
->txnid
->txnid
);
179 memcpy(&argp
->prev_lsn
, bp
, sizeof(DB_LSN
));
180 bp
+= sizeof(DB_LSN
);
182 memcpy(&uinttmp
, bp
, sizeof(uinttmp
));
183 argp
->opcode
= (u_int32_t
)uinttmp
;
184 bp
+= sizeof(uinttmp
);
191 * PUBLIC: int __vi_cursor_log __P((DB_ENV *, DB_TXN *, DB_LSN *, u_int32_t,
192 * PUBLIC: u_int32_t, db_recno_t, size_t));
195 __vi_cursor_log(dbenv
, txnid
, ret_lsnp
, flags
,
206 DB_LSN
*lsnp
, null_lsn
;
208 u_int32_t rectype
, txn_num
;
212 rectype
= DB_vi_cursor
;
214 TAILQ_FIRST(&txnid
->kids
) != NULL
&&
215 (ret
= __txn_activekids(dbenv
, rectype
, txnid
)) != 0)
217 txn_num
= txnid
== NULL
? 0 : txnid
->txnid
;
222 lsnp
= &txnid
->last_lsn
;
223 logrec
.size
= sizeof(rectype
) + sizeof(txn_num
) + sizeof(DB_LSN
)
227 if ((ret
= __os_malloc(dbenv
, logrec
.size
, &logrec
.data
)) != 0)
232 memcpy(bp
, &rectype
, sizeof(rectype
));
233 bp
+= sizeof(rectype
);
235 memcpy(bp
, &txn_num
, sizeof(txn_num
));
236 bp
+= sizeof(txn_num
);
238 memcpy(bp
, lsnp
, sizeof(DB_LSN
));
239 bp
+= sizeof(DB_LSN
);
241 uinttmp
= (u_int32_t
)opcode
;
242 memcpy(bp
, &uinttmp
, sizeof(uinttmp
));
243 bp
+= sizeof(uinttmp
);
245 uinttmp
= (u_int32_t
)lno
;
246 memcpy(bp
, &uinttmp
, sizeof(uinttmp
));
247 bp
+= sizeof(uinttmp
);
249 uinttmp
= (u_int32_t
)cno
;
250 memcpy(bp
, &uinttmp
, sizeof(uinttmp
));
251 bp
+= sizeof(uinttmp
);
253 DB_ASSERT((u_int32_t
)(bp
- (u_int8_t
*)logrec
.data
) == logrec
.size
);
254 ret
= dbenv
->log_put(dbenv
, ret_lsnp
, (DBT
*)&logrec
, flags
);
255 if (txnid
!= NULL
&& ret
== 0)
256 txnid
->last_lsn
= *ret_lsnp
;
257 #ifdef LOG_DIAGNOSTIC
259 (void)__vi_cursor_print(dbenv
,
260 (DBT
*)&logrec
, ret_lsnp
, NULL
, NULL
);
262 __os_free(dbenv
, logrec
.data
, logrec
.size
);
267 * PUBLIC: int __vi_cursor_getpgnos __P((DB_ENV *, DBT *, DB_LSN *, db_recops,
271 __vi_cursor_getpgnos(dbenv
, rec
, lsnp
, notused1
, summary
)
280 COMPQUIET(rec
, NULL
);
281 COMPQUIET(notused1
, DB_TXN_ABORT
);
283 t
= (TXN_RECS
*)summary
;
285 if ((ret
= __rep_check_alloc(dbenv
, t
, 1)) != 0)
288 t
->array
[t
->npages
].flags
= LSN_PAGE_NOLOCK
;
289 t
->array
[t
->npages
].lsn
= *lsnp
;
290 t
->array
[t
->npages
].fid
= DB_LOGFILEID_INVALID
;
291 memset(&t
->array
[t
->npages
].pgdesc
, 0,
292 sizeof(t
->array
[t
->npages
].pgdesc
));
300 * PUBLIC: int __vi_cursor_print __P((DB_ENV *, DBT *, DB_LSN *, db_recops,
304 __vi_cursor_print(dbenv
, dbtp
, lsnp
, notused2
, notused3
)
311 __vi_cursor_args
*argp
;
314 notused2
= DB_TXN_ABORT
;
317 if ((ret
= __vi_cursor_read(dbenv
, dbtp
->data
, &argp
)) != 0)
320 "[%lu][%lu]vi_cursor: rec: %lu txnid %lx prevlsn [%lu][%lu]\n",
322 (u_long
)lsnp
->offset
,
324 (u_long
)argp
->txnid
->txnid
,
325 (u_long
)argp
->prev_lsn
.file
,
326 (u_long
)argp
->prev_lsn
.offset
);
327 (void)printf("\topcode: %lu\n", (u_long
)argp
->opcode
);
328 (void)printf("\tlno: %lu\n", (u_long
)argp
->lno
);
329 (void)printf("\tcno: %d\n", argp
->cno
);
331 __os_free(dbenv
, argp
, 0);
336 * PUBLIC: int __vi_cursor_read __P((DB_ENV *, void *, __vi_cursor_args **));
339 __vi_cursor_read(dbenv
, recbuf
, argpp
)
342 __vi_cursor_args
**argpp
;
344 __vi_cursor_args
*argp
;
349 ret
= __os_malloc(dbenv
, sizeof(__vi_cursor_args
) +
350 sizeof(DB_TXN
), &argp
);
353 argp
->txnid
= (DB_TXN
*)&argp
[1];
356 memcpy(&argp
->type
, bp
, sizeof(argp
->type
));
357 bp
+= sizeof(argp
->type
);
359 memcpy(&argp
->txnid
->txnid
, bp
, sizeof(argp
->txnid
->txnid
));
360 bp
+= sizeof(argp
->txnid
->txnid
);
362 memcpy(&argp
->prev_lsn
, bp
, sizeof(DB_LSN
));
363 bp
+= sizeof(DB_LSN
);
365 memcpy(&uinttmp
, bp
, sizeof(uinttmp
));
366 argp
->opcode
= (u_int32_t
)uinttmp
;
367 bp
+= sizeof(uinttmp
);
369 memcpy(&uinttmp
, bp
, sizeof(uinttmp
));
370 argp
->lno
= (db_recno_t
)uinttmp
;
371 bp
+= sizeof(uinttmp
);
373 memcpy(&uinttmp
, bp
, sizeof(uinttmp
));
374 argp
->cno
= (size_t)uinttmp
;
375 bp
+= sizeof(uinttmp
);
382 * PUBLIC: int __vi_mark_log __P((DB_ENV *, DB_TXN *, DB_LSN *, u_int32_t,
386 __vi_mark_log(dbenv
, txnid
, ret_lsnp
, flags
,
395 DB_LSN
*lsnp
, null_lsn
;
396 u_int32_t rectype
, txn_num
;
400 rectype
= DB_vi_mark
;
402 TAILQ_FIRST(&txnid
->kids
) != NULL
&&
403 (ret
= __txn_activekids(dbenv
, rectype
, txnid
)) != 0)
405 txn_num
= txnid
== NULL
? 0 : txnid
->txnid
;
410 lsnp
= &txnid
->last_lsn
;
411 logrec
.size
= sizeof(rectype
) + sizeof(txn_num
) + sizeof(DB_LSN
)
413 if ((ret
= __os_malloc(dbenv
, logrec
.size
, &logrec
.data
)) != 0)
418 memcpy(bp
, &rectype
, sizeof(rectype
));
419 bp
+= sizeof(rectype
);
421 memcpy(bp
, &txn_num
, sizeof(txn_num
));
422 bp
+= sizeof(txn_num
);
424 memcpy(bp
, lsnp
, sizeof(DB_LSN
));
425 bp
+= sizeof(DB_LSN
);
428 memcpy(bp
, lmp
, sizeof(*lmp
));
430 memset(bp
, 0, sizeof(*lmp
));
433 DB_ASSERT((u_int32_t
)(bp
- (u_int8_t
*)logrec
.data
) == logrec
.size
);
434 ret
= dbenv
->log_put(dbenv
, ret_lsnp
, (DBT
*)&logrec
, flags
);
435 if (txnid
!= NULL
&& ret
== 0)
436 txnid
->last_lsn
= *ret_lsnp
;
437 #ifdef LOG_DIAGNOSTIC
439 (void)__vi_mark_print(dbenv
,
440 (DBT
*)&logrec
, ret_lsnp
, NULL
, NULL
);
442 __os_free(dbenv
, logrec
.data
, logrec
.size
);
447 * PUBLIC: int __vi_mark_getpgnos __P((DB_ENV *, DBT *, DB_LSN *, db_recops,
451 __vi_mark_getpgnos(dbenv
, rec
, lsnp
, notused1
, summary
)
460 COMPQUIET(rec
, NULL
);
461 COMPQUIET(notused1
, DB_TXN_ABORT
);
463 t
= (TXN_RECS
*)summary
;
465 if ((ret
= __rep_check_alloc(dbenv
, t
, 1)) != 0)
468 t
->array
[t
->npages
].flags
= LSN_PAGE_NOLOCK
;
469 t
->array
[t
->npages
].lsn
= *lsnp
;
470 t
->array
[t
->npages
].fid
= DB_LOGFILEID_INVALID
;
471 memset(&t
->array
[t
->npages
].pgdesc
, 0,
472 sizeof(t
->array
[t
->npages
].pgdesc
));
480 * PUBLIC: int __vi_mark_print __P((DB_ENV *, DBT *, DB_LSN *, db_recops,
484 __vi_mark_print(dbenv
, dbtp
, lsnp
, notused2
, notused3
)
491 __vi_mark_args
*argp
;
494 notused2
= DB_TXN_ABORT
;
497 if ((ret
= __vi_mark_read(dbenv
, dbtp
->data
, &argp
)) != 0)
500 "[%lu][%lu]vi_mark: rec: %lu txnid %lx prevlsn [%lu][%lu]\n",
502 (u_long
)lsnp
->offset
,
504 (u_long
)argp
->txnid
->txnid
,
505 (u_long
)argp
->prev_lsn
.file
,
506 (u_long
)argp
->prev_lsn
.offset
);
507 (void)printf("\tlmp: %%\n", argp
->lmp
);
509 __os_free(dbenv
, argp
, 0);
514 * PUBLIC: int __vi_mark_read __P((DB_ENV *, void *, __vi_mark_args **));
517 __vi_mark_read(dbenv
, recbuf
, argpp
)
520 __vi_mark_args
**argpp
;
522 __vi_mark_args
*argp
;
526 ret
= __os_malloc(dbenv
, sizeof(__vi_mark_args
) +
527 sizeof(DB_TXN
), &argp
);
530 argp
->txnid
= (DB_TXN
*)&argp
[1];
533 memcpy(&argp
->type
, bp
, sizeof(argp
->type
));
534 bp
+= sizeof(argp
->type
);
536 memcpy(&argp
->txnid
->txnid
, bp
, sizeof(argp
->txnid
->txnid
));
537 bp
+= sizeof(argp
->txnid
->txnid
);
539 memcpy(&argp
->prev_lsn
, bp
, sizeof(DB_LSN
));
540 bp
+= sizeof(DB_LSN
);
542 memcpy(&argp
->lmp
, bp
, sizeof(argp
->lmp
));
543 bp
+= sizeof(argp
->lmp
);
550 * PUBLIC: int __vi_change_log __P((DB_ENV *, DB_TXN *, DB_LSN *, u_int32_t,
551 * PUBLIC: u_int32_t, db_recno_t));
554 __vi_change_log(dbenv
, txnid
, ret_lsnp
, flags
,
564 DB_LSN
*lsnp
, null_lsn
;
566 u_int32_t rectype
, txn_num
;
570 rectype
= DB_vi_change
;
572 TAILQ_FIRST(&txnid
->kids
) != NULL
&&
573 (ret
= __txn_activekids(dbenv
, rectype
, txnid
)) != 0)
575 txn_num
= txnid
== NULL
? 0 : txnid
->txnid
;
580 lsnp
= &txnid
->last_lsn
;
581 logrec
.size
= sizeof(rectype
) + sizeof(txn_num
) + sizeof(DB_LSN
)
584 if ((ret
= __os_malloc(dbenv
, logrec
.size
, &logrec
.data
)) != 0)
589 memcpy(bp
, &rectype
, sizeof(rectype
));
590 bp
+= sizeof(rectype
);
592 memcpy(bp
, &txn_num
, sizeof(txn_num
));
593 bp
+= sizeof(txn_num
);
595 memcpy(bp
, lsnp
, sizeof(DB_LSN
));
596 bp
+= sizeof(DB_LSN
);
598 uinttmp
= (u_int32_t
)opcode
;
599 memcpy(bp
, &uinttmp
, sizeof(uinttmp
));
600 bp
+= sizeof(uinttmp
);
602 uinttmp
= (u_int32_t
)lno
;
603 memcpy(bp
, &uinttmp
, sizeof(uinttmp
));
604 bp
+= sizeof(uinttmp
);
606 DB_ASSERT((u_int32_t
)(bp
- (u_int8_t
*)logrec
.data
) == logrec
.size
);
607 ret
= dbenv
->log_put(dbenv
, ret_lsnp
, (DBT
*)&logrec
, flags
);
608 if (txnid
!= NULL
&& ret
== 0)
609 txnid
->last_lsn
= *ret_lsnp
;
610 #ifdef LOG_DIAGNOSTIC
612 (void)__vi_change_print(dbenv
,
613 (DBT
*)&logrec
, ret_lsnp
, NULL
, NULL
);
615 __os_free(dbenv
, logrec
.data
, logrec
.size
);
620 * PUBLIC: int __vi_change_getpgnos __P((DB_ENV *, DBT *, DB_LSN *, db_recops,
624 __vi_change_getpgnos(dbenv
, rec
, lsnp
, notused1
, summary
)
633 COMPQUIET(rec
, NULL
);
634 COMPQUIET(notused1
, DB_TXN_ABORT
);
636 t
= (TXN_RECS
*)summary
;
638 if ((ret
= __rep_check_alloc(dbenv
, t
, 1)) != 0)
641 t
->array
[t
->npages
].flags
= LSN_PAGE_NOLOCK
;
642 t
->array
[t
->npages
].lsn
= *lsnp
;
643 t
->array
[t
->npages
].fid
= DB_LOGFILEID_INVALID
;
644 memset(&t
->array
[t
->npages
].pgdesc
, 0,
645 sizeof(t
->array
[t
->npages
].pgdesc
));
653 * PUBLIC: int __vi_change_print __P((DB_ENV *, DBT *, DB_LSN *, db_recops,
657 __vi_change_print(dbenv
, dbtp
, lsnp
, notused2
, notused3
)
664 __vi_change_args
*argp
;
667 notused2
= DB_TXN_ABORT
;
670 if ((ret
= __vi_change_read(dbenv
, dbtp
->data
, &argp
)) != 0)
673 "[%lu][%lu]vi_change: rec: %lu txnid %lx prevlsn [%lu][%lu]\n",
675 (u_long
)lsnp
->offset
,
677 (u_long
)argp
->txnid
->txnid
,
678 (u_long
)argp
->prev_lsn
.file
,
679 (u_long
)argp
->prev_lsn
.offset
);
680 (void)printf("\topcode: %lu\n", (u_long
)argp
->opcode
);
681 (void)printf("\tlno: %lu\n", (u_long
)argp
->lno
);
683 __os_free(dbenv
, argp
, 0);
688 * PUBLIC: int __vi_change_read __P((DB_ENV *, void *, __vi_change_args **));
691 __vi_change_read(dbenv
, recbuf
, argpp
)
694 __vi_change_args
**argpp
;
696 __vi_change_args
*argp
;
701 ret
= __os_malloc(dbenv
, sizeof(__vi_change_args
) +
702 sizeof(DB_TXN
), &argp
);
705 argp
->txnid
= (DB_TXN
*)&argp
[1];
708 memcpy(&argp
->type
, bp
, sizeof(argp
->type
));
709 bp
+= sizeof(argp
->type
);
711 memcpy(&argp
->txnid
->txnid
, bp
, sizeof(argp
->txnid
->txnid
));
712 bp
+= sizeof(argp
->txnid
->txnid
);
714 memcpy(&argp
->prev_lsn
, bp
, sizeof(DB_LSN
));
715 bp
+= sizeof(DB_LSN
);
717 memcpy(&uinttmp
, bp
, sizeof(uinttmp
));
718 argp
->opcode
= (u_int32_t
)uinttmp
;
719 bp
+= sizeof(uinttmp
);
721 memcpy(&uinttmp
, bp
, sizeof(uinttmp
));
722 argp
->lno
= (db_recno_t
)uinttmp
;
723 bp
+= sizeof(uinttmp
);
730 * PUBLIC: int __vi_init_print __P((DB_ENV *, int (***)(DB_ENV *, DBT *,
731 * PUBLIC: DB_LSN *, db_recops, void *), size_t *));
734 __vi_init_print(dbenv
, dtabp
, dtabsizep
)
736 int (***dtabp
)__P((DB_ENV
*, DBT
*, DB_LSN
*, db_recops
, void *));
741 if ((ret
= __db_add_recovery(dbenv
, dtabp
, dtabsizep
,
742 __vi_marker_print
, DB_vi_marker
)) != 0)
744 if ((ret
= __db_add_recovery(dbenv
, dtabp
, dtabsizep
,
745 __vi_cursor_print
, DB_vi_cursor
)) != 0)
747 if ((ret
= __db_add_recovery(dbenv
, dtabp
, dtabsizep
,
748 __vi_mark_print
, DB_vi_mark
)) != 0)
750 if ((ret
= __db_add_recovery(dbenv
, dtabp
, dtabsizep
,
751 __vi_change_print
, DB_vi_change
)) != 0)
757 * PUBLIC: int __vi_init_getpgnos __P((DB_ENV *, int (***)(DB_ENV *, DBT *,
758 * PUBLIC: DB_LSN *, db_recops, void *), size_t *));
761 __vi_init_getpgnos(dbenv
, dtabp
, dtabsizep
)
763 int (***dtabp
)__P((DB_ENV
*, DBT
*, DB_LSN
*, db_recops
, void *));
768 if ((ret
= __db_add_recovery(dbenv
, dtabp
, dtabsizep
,
769 __vi_marker_getpgnos
, DB_vi_marker
)) != 0)
771 if ((ret
= __db_add_recovery(dbenv
, dtabp
, dtabsizep
,
772 __vi_cursor_getpgnos
, DB_vi_cursor
)) != 0)
774 if ((ret
= __db_add_recovery(dbenv
, dtabp
, dtabsizep
,
775 __vi_mark_getpgnos
, DB_vi_mark
)) != 0)
777 if ((ret
= __db_add_recovery(dbenv
, dtabp
, dtabsizep
,
778 __vi_change_getpgnos
, DB_vi_change
)) != 0)
784 * PUBLIC: int __vi_init_recover __P((DB_ENV *));
787 __vi_init_recover(dbenv
)
792 if ((ret
= __db_add_recovery(dbenv
, &dbenv
->dtab
, &dbenv
->dtab_size
,
793 __vi_marker_recover
, DB_vi_marker
)) != 0)
795 if ((ret
= __db_add_recovery(dbenv
, &dbenv
->dtab
, &dbenv
->dtab_size
,
796 __vi_cursor_recover
, DB_vi_cursor
)) != 0)
798 if ((ret
= __db_add_recovery(dbenv
, &dbenv
->dtab
, &dbenv
->dtab_size
,
799 __vi_mark_recover
, DB_vi_mark
)) != 0)
801 if ((ret
= __db_add_recovery(dbenv
, &dbenv
->dtab
, &dbenv
->dtab_size
,
802 __vi_change_recover
, DB_vi_change
)) != 0)