Initial db4 logging.
[nvi.git] / common / vi_auto.c
blob0f1c80276fdc983c6e65d82649d20b2d845dffda
1 /* Do not edit: automatically built by gen_rec.awk. */
2 #include <sys/types.h>
3 #include <sys/queue.h>
4 #include <sys/stat.h>
5 #include <bitstring.h>
6 #include <errno.h>
7 #include <fcntl.h>
8 #include <limits.h>
9 #include <stdio.h>
10 #include <stdlib.h>
11 #include <string.h>
12 #include "common.h"
13 #include <db_int.h>
14 #include "db_page.h"
15 #include "db_am.h"
16 #include "rep.h"
17 #include "txn.h"
19 * PUBLIC: int __vi_marker_log __P((DB_ENV *, DB_TXN *, DB_LSN *, u_int32_t,
20 * PUBLIC: u_int32_t));
22 int
23 __vi_marker_log(dbenv, txnid, ret_lsnp, flags,
24 opcode)
25 DB_ENV *dbenv;
26 DB_TXN *txnid;
27 DB_LSN *ret_lsnp;
28 u_int32_t flags;
29 u_int32_t opcode;
31 DBT logrec;
32 DB_LSN *lsnp, null_lsn;
33 u_int32_t uinttmp;
34 u_int32_t rectype, txn_num;
35 int ret;
36 u_int8_t *bp;
38 rectype = DB_vi_marker;
39 if (txnid != NULL &&
40 TAILQ_FIRST(&txnid->kids) != NULL &&
41 (ret = __txn_activekids(dbenv, rectype, txnid)) != 0)
42 return (ret);
43 txn_num = txnid == NULL ? 0 : txnid->txnid;
44 if (txnid == NULL) {
45 ZERO_LSN(null_lsn);
46 lsnp = &null_lsn;
47 } else
48 lsnp = &txnid->last_lsn;
49 logrec.size = sizeof(rectype) + sizeof(txn_num) + sizeof(DB_LSN)
50 + sizeof(u_int32_t);
51 if ((ret = __os_malloc(dbenv, logrec.size, &logrec.data)) != 0)
52 return (ret);
54 bp = logrec.data;
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));
63 bp += 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;
73 #ifdef LOG_DIAGNOSTIC
74 if (ret != 0)
75 (void)__vi_marker_print(dbenv,
76 (DBT *)&logrec, ret_lsnp, NULL, NULL);
77 #endif
78 __os_free(dbenv, logrec.data, logrec.size);
79 return (ret);
83 * PUBLIC: int __vi_marker_getpgnos __P((DB_ENV *, DBT *, DB_LSN *, db_recops,
84 * PUBLIC: void *));
86 int
87 __vi_marker_getpgnos(dbenv, rec, lsnp, notused1, summary)
88 DB_ENV *dbenv;
89 DBT *rec;
90 DB_LSN *lsnp;
91 db_recops notused1;
92 void *summary;
94 TXN_RECS *t;
95 int ret;
96 COMPQUIET(rec, NULL);
97 COMPQUIET(notused1, DB_TXN_ABORT);
99 t = (TXN_RECS *)summary;
101 if ((ret = __rep_check_alloc(dbenv, t, 1)) != 0)
102 return (ret);
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));
110 t->npages++;
112 return (0);
116 * PUBLIC: int __vi_marker_print __P((DB_ENV *, DBT *, DB_LSN *, db_recops,
117 * PUBLIC: void *));
120 __vi_marker_print(dbenv, dbtp, lsnp, notused2, notused3)
121 DB_ENV *dbenv;
122 DBT *dbtp;
123 DB_LSN *lsnp;
124 db_recops notused2;
125 void *notused3;
127 __vi_marker_args *argp;
128 int ret;
130 notused2 = DB_TXN_ABORT;
131 notused3 = NULL;
133 if ((ret = __vi_marker_read(dbenv, dbtp->data, &argp)) != 0)
134 return (ret);
135 (void)printf(
136 "[%lu][%lu]vi_marker: rec: %lu txnid %lx prevlsn [%lu][%lu]\n",
137 (u_long)lsnp->file,
138 (u_long)lsnp->offset,
139 (u_long)argp->type,
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);
144 (void)printf("\n");
145 __os_free(dbenv, argp, 0);
146 return (0);
150 * PUBLIC: int __vi_marker_read __P((DB_ENV *, void *, __vi_marker_args **));
153 __vi_marker_read(dbenv, recbuf, argpp)
154 DB_ENV *dbenv;
155 void *recbuf;
156 __vi_marker_args **argpp;
158 __vi_marker_args *argp;
159 int ret;
160 u_int32_t uinttmp;
161 u_int8_t *bp;
163 ret = __os_malloc(dbenv, sizeof(__vi_marker_args) +
164 sizeof(DB_TXN), &argp);
165 if (ret != 0)
166 return (ret);
167 argp->txnid = (DB_TXN *)&argp[1];
169 bp = recbuf;
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);
183 *argpp = argp;
184 return (0);
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,
193 opcode, lno, cno)
194 DB_ENV *dbenv;
195 DB_TXN *txnid;
196 DB_LSN *ret_lsnp;
197 u_int32_t flags;
198 u_int32_t opcode;
199 db_recno_t lno;
200 size_t cno;
202 DBT logrec;
203 DB_LSN *lsnp, null_lsn;
204 u_int32_t uinttmp;
205 u_int32_t rectype, txn_num;
206 int ret;
207 u_int8_t *bp;
209 rectype = DB_vi_cursor;
210 if (txnid != NULL &&
211 TAILQ_FIRST(&txnid->kids) != NULL &&
212 (ret = __txn_activekids(dbenv, rectype, txnid)) != 0)
213 return (ret);
214 txn_num = txnid == NULL ? 0 : txnid->txnid;
215 if (txnid == NULL) {
216 ZERO_LSN(null_lsn);
217 lsnp = &null_lsn;
218 } else
219 lsnp = &txnid->last_lsn;
220 logrec.size = sizeof(rectype) + sizeof(txn_num) + sizeof(DB_LSN)
221 + sizeof(u_int32_t)
222 + sizeof(u_int32_t)
223 + sizeof(u_int32_t);
224 if ((ret = __os_malloc(dbenv, logrec.size, &logrec.data)) != 0)
225 return (ret);
227 bp = logrec.data;
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
255 if (ret != 0)
256 (void)__vi_cursor_print(dbenv,
257 (DBT *)&logrec, ret_lsnp, NULL, NULL);
258 #endif
259 __os_free(dbenv, logrec.data, logrec.size);
260 return (ret);
264 * PUBLIC: int __vi_cursor_getpgnos __P((DB_ENV *, DBT *, DB_LSN *, db_recops,
265 * PUBLIC: void *));
268 __vi_cursor_getpgnos(dbenv, rec, lsnp, notused1, summary)
269 DB_ENV *dbenv;
270 DBT *rec;
271 DB_LSN *lsnp;
272 db_recops notused1;
273 void *summary;
275 TXN_RECS *t;
276 int ret;
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)
283 return (ret);
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));
291 t->npages++;
293 return (0);
297 * PUBLIC: int __vi_cursor_print __P((DB_ENV *, DBT *, DB_LSN *, db_recops,
298 * PUBLIC: void *));
301 __vi_cursor_print(dbenv, dbtp, lsnp, notused2, notused3)
302 DB_ENV *dbenv;
303 DBT *dbtp;
304 DB_LSN *lsnp;
305 db_recops notused2;
306 void *notused3;
308 __vi_cursor_args *argp;
309 int ret;
311 notused2 = DB_TXN_ABORT;
312 notused3 = NULL;
314 if ((ret = __vi_cursor_read(dbenv, dbtp->data, &argp)) != 0)
315 return (ret);
316 (void)printf(
317 "[%lu][%lu]vi_cursor: rec: %lu txnid %lx prevlsn [%lu][%lu]\n",
318 (u_long)lsnp->file,
319 (u_long)lsnp->offset,
320 (u_long)argp->type,
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);
327 (void)printf("\n");
328 __os_free(dbenv, argp, 0);
329 return (0);
333 * PUBLIC: int __vi_cursor_read __P((DB_ENV *, void *, __vi_cursor_args **));
336 __vi_cursor_read(dbenv, recbuf, argpp)
337 DB_ENV *dbenv;
338 void *recbuf;
339 __vi_cursor_args **argpp;
341 __vi_cursor_args *argp;
342 int ret;
343 u_int32_t uinttmp;
344 u_int8_t *bp;
346 ret = __os_malloc(dbenv, sizeof(__vi_cursor_args) +
347 sizeof(DB_TXN), &argp);
348 if (ret != 0)
349 return (ret);
350 argp->txnid = (DB_TXN *)&argp[1];
352 bp = recbuf;
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);
374 *argpp = argp;
375 return (0);
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)
383 DB_ENV *dbenv;
384 DB_TXN *txnid;
385 DB_LSN *ret_lsnp;
386 u_int32_t flags;
388 DBT logrec;
389 DB_LSN *lsnp, null_lsn;
390 u_int32_t rectype, txn_num;
391 int ret;
392 u_int8_t *bp;
394 rectype = DB_vi_mark;
395 if (txnid != NULL &&
396 TAILQ_FIRST(&txnid->kids) != NULL &&
397 (ret = __txn_activekids(dbenv, rectype, txnid)) != 0)
398 return (ret);
399 txn_num = txnid == NULL ? 0 : txnid->txnid;
400 if (txnid == NULL) {
401 ZERO_LSN(null_lsn);
402 lsnp = &null_lsn;
403 } else
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)
407 return (ret);
409 bp = logrec.data;
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
425 if (ret != 0)
426 (void)__vi_mark_print(dbenv,
427 (DBT *)&logrec, ret_lsnp, NULL, NULL);
428 #endif
429 __os_free(dbenv, logrec.data, logrec.size);
430 return (ret);
434 * PUBLIC: int __vi_mark_getpgnos __P((DB_ENV *, DBT *, DB_LSN *, db_recops,
435 * PUBLIC: void *));
438 __vi_mark_getpgnos(dbenv, rec, lsnp, notused1, summary)
439 DB_ENV *dbenv;
440 DBT *rec;
441 DB_LSN *lsnp;
442 db_recops notused1;
443 void *summary;
445 TXN_RECS *t;
446 int ret;
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)
453 return (ret);
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));
461 t->npages++;
463 return (0);
467 * PUBLIC: int __vi_mark_print __P((DB_ENV *, DBT *, DB_LSN *, db_recops,
468 * PUBLIC: void *));
471 __vi_mark_print(dbenv, dbtp, lsnp, notused2, notused3)
472 DB_ENV *dbenv;
473 DBT *dbtp;
474 DB_LSN *lsnp;
475 db_recops notused2;
476 void *notused3;
478 __vi_mark_args *argp;
479 int ret;
481 notused2 = DB_TXN_ABORT;
482 notused3 = NULL;
484 if ((ret = __vi_mark_read(dbenv, dbtp->data, &argp)) != 0)
485 return (ret);
486 (void)printf(
487 "[%lu][%lu]vi_mark: rec: %lu txnid %lx prevlsn [%lu][%lu]\n",
488 (u_long)lsnp->file,
489 (u_long)lsnp->offset,
490 (u_long)argp->type,
491 (u_long)argp->txnid->txnid,
492 (u_long)argp->prev_lsn.file,
493 (u_long)argp->prev_lsn.offset);
494 (void)printf("\n");
495 __os_free(dbenv, argp, 0);
496 return (0);
500 * PUBLIC: int __vi_mark_read __P((DB_ENV *, void *, __vi_mark_args **));
503 __vi_mark_read(dbenv, recbuf, argpp)
504 DB_ENV *dbenv;
505 void *recbuf;
506 __vi_mark_args **argpp;
508 __vi_mark_args *argp;
509 int ret;
510 u_int8_t *bp;
512 ret = __os_malloc(dbenv, sizeof(__vi_mark_args) +
513 sizeof(DB_TXN), &argp);
514 if (ret != 0)
515 return (ret);
516 argp->txnid = (DB_TXN *)&argp[1];
518 bp = recbuf;
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);
528 *argpp = argp;
529 return (0);
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,
538 opcode, lno)
539 DB_ENV *dbenv;
540 DB_TXN *txnid;
541 DB_LSN *ret_lsnp;
542 u_int32_t flags;
543 u_int32_t opcode;
544 db_recno_t lno;
546 DBT logrec;
547 DB_LSN *lsnp, null_lsn;
548 u_int32_t uinttmp;
549 u_int32_t rectype, txn_num;
550 int ret;
551 u_int8_t *bp;
553 rectype = DB_vi_change;
554 if (txnid != NULL &&
555 TAILQ_FIRST(&txnid->kids) != NULL &&
556 (ret = __txn_activekids(dbenv, rectype, txnid)) != 0)
557 return (ret);
558 txn_num = txnid == NULL ? 0 : txnid->txnid;
559 if (txnid == NULL) {
560 ZERO_LSN(null_lsn);
561 lsnp = &null_lsn;
562 } else
563 lsnp = &txnid->last_lsn;
564 logrec.size = sizeof(rectype) + sizeof(txn_num) + sizeof(DB_LSN)
565 + sizeof(u_int32_t)
566 + sizeof(u_int32_t);
567 if ((ret = __os_malloc(dbenv, logrec.size, &logrec.data)) != 0)
568 return (ret);
570 bp = logrec.data;
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
594 if (ret != 0)
595 (void)__vi_change_print(dbenv,
596 (DBT *)&logrec, ret_lsnp, NULL, NULL);
597 #endif
598 __os_free(dbenv, logrec.data, logrec.size);
599 return (ret);
603 * PUBLIC: int __vi_change_getpgnos __P((DB_ENV *, DBT *, DB_LSN *, db_recops,
604 * PUBLIC: void *));
607 __vi_change_getpgnos(dbenv, rec, lsnp, notused1, summary)
608 DB_ENV *dbenv;
609 DBT *rec;
610 DB_LSN *lsnp;
611 db_recops notused1;
612 void *summary;
614 TXN_RECS *t;
615 int ret;
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)
622 return (ret);
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));
630 t->npages++;
632 return (0);
636 * PUBLIC: int __vi_change_print __P((DB_ENV *, DBT *, DB_LSN *, db_recops,
637 * PUBLIC: void *));
640 __vi_change_print(dbenv, dbtp, lsnp, notused2, notused3)
641 DB_ENV *dbenv;
642 DBT *dbtp;
643 DB_LSN *lsnp;
644 db_recops notused2;
645 void *notused3;
647 __vi_change_args *argp;
648 int ret;
650 notused2 = DB_TXN_ABORT;
651 notused3 = NULL;
653 if ((ret = __vi_change_read(dbenv, dbtp->data, &argp)) != 0)
654 return (ret);
655 (void)printf(
656 "[%lu][%lu]vi_change: rec: %lu txnid %lx prevlsn [%lu][%lu]\n",
657 (u_long)lsnp->file,
658 (u_long)lsnp->offset,
659 (u_long)argp->type,
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);
665 (void)printf("\n");
666 __os_free(dbenv, argp, 0);
667 return (0);
671 * PUBLIC: int __vi_change_read __P((DB_ENV *, void *, __vi_change_args **));
674 __vi_change_read(dbenv, recbuf, argpp)
675 DB_ENV *dbenv;
676 void *recbuf;
677 __vi_change_args **argpp;
679 __vi_change_args *argp;
680 int ret;
681 u_int32_t uinttmp;
682 u_int8_t *bp;
684 ret = __os_malloc(dbenv, sizeof(__vi_change_args) +
685 sizeof(DB_TXN), &argp);
686 if (ret != 0)
687 return (ret);
688 argp->txnid = (DB_TXN *)&argp[1];
690 bp = recbuf;
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);
708 *argpp = argp;
709 return (0);
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)
718 DB_ENV *dbenv;
719 int (***dtabp)__P((DB_ENV *, DBT *, DB_LSN *, db_recops, void *));
720 size_t *dtabsizep;
722 int ret;
724 if ((ret = __db_add_recovery(dbenv, dtabp, dtabsizep,
725 __vi_marker_print, DB_vi_marker)) != 0)
726 return (ret);
727 if ((ret = __db_add_recovery(dbenv, dtabp, dtabsizep,
728 __vi_cursor_print, DB_vi_cursor)) != 0)
729 return (ret);
730 if ((ret = __db_add_recovery(dbenv, dtabp, dtabsizep,
731 __vi_mark_print, DB_vi_mark)) != 0)
732 return (ret);
733 if ((ret = __db_add_recovery(dbenv, dtabp, dtabsizep,
734 __vi_change_print, DB_vi_change)) != 0)
735 return (ret);
736 return (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)
745 DB_ENV *dbenv;
746 int (***dtabp)__P((DB_ENV *, DBT *, DB_LSN *, db_recops, void *));
747 size_t *dtabsizep;
749 int ret;
751 if ((ret = __db_add_recovery(dbenv, dtabp, dtabsizep,
752 __vi_marker_getpgnos, DB_vi_marker)) != 0)
753 return (ret);
754 if ((ret = __db_add_recovery(dbenv, dtabp, dtabsizep,
755 __vi_cursor_getpgnos, DB_vi_cursor)) != 0)
756 return (ret);
757 if ((ret = __db_add_recovery(dbenv, dtabp, dtabsizep,
758 __vi_mark_getpgnos, DB_vi_mark)) != 0)
759 return (ret);
760 if ((ret = __db_add_recovery(dbenv, dtabp, dtabsizep,
761 __vi_change_getpgnos, DB_vi_change)) != 0)
762 return (ret);
763 return (0);
767 * PUBLIC: int __vi_init_recover __P((DB_ENV *));
770 __vi_init_recover(dbenv)
771 DB_ENV *dbenv;
773 int ret;
775 if ((ret = __db_add_recovery(dbenv, &dbenv->dtab, &dbenv->dtab_size,
776 __vi_marker_recover, DB_vi_marker)) != 0)
777 return (ret);
778 if ((ret = __db_add_recovery(dbenv, &dbenv->dtab, &dbenv->dtab_size,
779 __vi_cursor_recover, DB_vi_cursor)) != 0)
780 return (ret);
781 if ((ret = __db_add_recovery(dbenv, &dbenv->dtab, &dbenv->dtab_size,
782 __vi_mark_recover, DB_vi_mark)) != 0)
783 return (ret);
784 if ((ret = __db_add_recovery(dbenv, &dbenv->dtab, &dbenv->dtab_size,
785 __vi_change_recover, DB_vi_change)) != 0)
786 return (ret);
787 return (0);