1 /* Do not edit: automatically built by dist/db_gen.sh. */
4 #ifndef NO_SYSTEM_INCLUDES
15 #include "db_dispatch.h"
19 * PUBLIC: int __ham_insdel_log
20 * PUBLIC: __P((DB_LOG *, DB_TXN *, DB_LSN *, u_int32_t,
21 * PUBLIC: u_int32_t, u_int32_t, db_pgno_t, u_int32_t,
22 * PUBLIC: DB_LSN *, const DBT *, const DBT *));
24 int __ham_insdel_log(logp
, txnid
, ret_lsnp
, flags
,
25 opcode
, fileid
, pgno
, ndx
, pagelsn
, key
,
40 DB_LSN
*lsnp
, null_lsn
;
42 u_int32_t rectype
, txn_num
;
46 rectype
= DB_ham_insdel
;
47 txn_num
= txnid
== NULL
? 0 : txnid
->txnid
;
53 lsnp
= &txnid
->last_lsn
;
54 logrec
.size
= sizeof(rectype
) + sizeof(txn_num
) + sizeof(DB_LSN
)
60 + sizeof(u_int32_t
) + (key
== NULL
? 0 : key
->size
)
61 + sizeof(u_int32_t
) + (data
== NULL
? 0 : data
->size
);
62 if ((logrec
.data
= (void *)__db_malloc(logrec
.size
)) == NULL
)
66 memcpy(bp
, &rectype
, sizeof(rectype
));
67 bp
+= sizeof(rectype
);
68 memcpy(bp
, &txn_num
, sizeof(txn_num
));
69 bp
+= sizeof(txn_num
);
70 memcpy(bp
, lsnp
, sizeof(DB_LSN
));
72 memcpy(bp
, &opcode
, sizeof(opcode
));
74 memcpy(bp
, &fileid
, sizeof(fileid
));
76 memcpy(bp
, &pgno
, sizeof(pgno
));
78 memcpy(bp
, &ndx
, sizeof(ndx
));
81 memcpy(bp
, pagelsn
, sizeof(*pagelsn
));
83 memset(bp
, 0, sizeof(*pagelsn
));
84 bp
+= sizeof(*pagelsn
);
87 memcpy(bp
, &zero
, sizeof(u_int32_t
));
88 bp
+= sizeof(u_int32_t
);
90 memcpy(bp
, &key
->size
, sizeof(key
->size
));
91 bp
+= sizeof(key
->size
);
92 memcpy(bp
, key
->data
, key
->size
);
97 memcpy(bp
, &zero
, sizeof(u_int32_t
));
98 bp
+= sizeof(u_int32_t
);
100 memcpy(bp
, &data
->size
, sizeof(data
->size
));
101 bp
+= sizeof(data
->size
);
102 memcpy(bp
, data
->data
, data
->size
);
106 if ((u_int32_t
)(bp
- (u_int8_t
*)logrec
.data
) != logrec
.size
)
107 fprintf(stderr
, "Error in log record length");
109 ret
= log_put(logp
, ret_lsnp
, (DBT
*)&logrec
, flags
);
111 txnid
->last_lsn
= *ret_lsnp
;
112 __db_free(logrec
.data
);
117 * PUBLIC: int __ham_insdel_print
118 * PUBLIC: __P((DB_LOG *, DBT *, DB_LSN *, int, void *));
121 __ham_insdel_print(notused1
, dbtp
, lsnp
, notused2
, notused3
)
128 __ham_insdel_args
*argp
;
139 if ((ret
= __ham_insdel_read(dbtp
->data
, &argp
)) != 0)
141 printf("[%lu][%lu]ham_insdel: 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 printf("\topcode: %lu\n", (u_long
)argp
->opcode
);
149 printf("\tfileid: %lu\n", (u_long
)argp
->fileid
);
150 printf("\tpgno: %lu\n", (u_long
)argp
->pgno
);
151 printf("\tndx: %lu\n", (u_long
)argp
->ndx
);
152 printf("\tpagelsn: [%lu][%lu]\n",
153 (u_long
)argp
->pagelsn
.file
, (u_long
)argp
->pagelsn
.offset
);
155 for (i
= 0; i
< argp
->key
.size
; i
++) {
156 ch
= ((u_int8_t
*)argp
->key
.data
)[i
];
157 if (isprint(ch
) || ch
== 0xa)
164 for (i
= 0; i
< argp
->data
.size
; i
++) {
165 ch
= ((u_int8_t
*)argp
->data
.data
)[i
];
166 if (isprint(ch
) || ch
== 0xa)
178 * PUBLIC: int __ham_insdel_read __P((void *, __ham_insdel_args **));
181 __ham_insdel_read(recbuf
, argpp
)
183 __ham_insdel_args
**argpp
;
185 __ham_insdel_args
*argp
;
188 argp
= (__ham_insdel_args
*)__db_malloc(sizeof(__ham_insdel_args
) +
192 argp
->txnid
= (DB_TXN
*)&argp
[1];
194 memcpy(&argp
->type
, bp
, sizeof(argp
->type
));
195 bp
+= sizeof(argp
->type
);
196 memcpy(&argp
->txnid
->txnid
, bp
, sizeof(argp
->txnid
->txnid
));
197 bp
+= sizeof(argp
->txnid
->txnid
);
198 memcpy(&argp
->prev_lsn
, bp
, sizeof(DB_LSN
));
199 bp
+= sizeof(DB_LSN
);
200 memcpy(&argp
->opcode
, bp
, sizeof(argp
->opcode
));
201 bp
+= sizeof(argp
->opcode
);
202 memcpy(&argp
->fileid
, bp
, sizeof(argp
->fileid
));
203 bp
+= sizeof(argp
->fileid
);
204 memcpy(&argp
->pgno
, bp
, sizeof(argp
->pgno
));
205 bp
+= sizeof(argp
->pgno
);
206 memcpy(&argp
->ndx
, bp
, sizeof(argp
->ndx
));
207 bp
+= sizeof(argp
->ndx
);
208 memcpy(&argp
->pagelsn
, bp
, sizeof(argp
->pagelsn
));
209 bp
+= sizeof(argp
->pagelsn
);
210 memcpy(&argp
->key
.size
, bp
, sizeof(u_int32_t
));
211 bp
+= sizeof(u_int32_t
);
213 bp
+= argp
->key
.size
;
214 memcpy(&argp
->data
.size
, bp
, sizeof(u_int32_t
));
215 bp
+= sizeof(u_int32_t
);
216 argp
->data
.data
= bp
;
217 bp
+= argp
->data
.size
;
223 * PUBLIC: int __ham_newpage_log
224 * PUBLIC: __P((DB_LOG *, DB_TXN *, DB_LSN *, u_int32_t,
225 * PUBLIC: u_int32_t, u_int32_t, db_pgno_t, DB_LSN *,
226 * PUBLIC: db_pgno_t, DB_LSN *, db_pgno_t, DB_LSN *));
228 int __ham_newpage_log(logp
, txnid
, ret_lsnp
, flags
,
229 opcode
, fileid
, prev_pgno
, prevlsn
, new_pgno
, pagelsn
,
245 DB_LSN
*lsnp
, null_lsn
;
246 u_int32_t rectype
, txn_num
;
250 rectype
= DB_ham_newpage
;
251 txn_num
= txnid
== NULL
? 0 : txnid
->txnid
;
257 lsnp
= &txnid
->last_lsn
;
258 logrec
.size
= sizeof(rectype
) + sizeof(txn_num
) + sizeof(DB_LSN
)
267 if ((logrec
.data
= (void *)__db_malloc(logrec
.size
)) == NULL
)
271 memcpy(bp
, &rectype
, sizeof(rectype
));
272 bp
+= sizeof(rectype
);
273 memcpy(bp
, &txn_num
, sizeof(txn_num
));
274 bp
+= sizeof(txn_num
);
275 memcpy(bp
, lsnp
, sizeof(DB_LSN
));
276 bp
+= sizeof(DB_LSN
);
277 memcpy(bp
, &opcode
, sizeof(opcode
));
278 bp
+= sizeof(opcode
);
279 memcpy(bp
, &fileid
, sizeof(fileid
));
280 bp
+= sizeof(fileid
);
281 memcpy(bp
, &prev_pgno
, sizeof(prev_pgno
));
282 bp
+= sizeof(prev_pgno
);
284 memcpy(bp
, prevlsn
, sizeof(*prevlsn
));
286 memset(bp
, 0, sizeof(*prevlsn
));
287 bp
+= sizeof(*prevlsn
);
288 memcpy(bp
, &new_pgno
, sizeof(new_pgno
));
289 bp
+= sizeof(new_pgno
);
291 memcpy(bp
, pagelsn
, sizeof(*pagelsn
));
293 memset(bp
, 0, sizeof(*pagelsn
));
294 bp
+= sizeof(*pagelsn
);
295 memcpy(bp
, &next_pgno
, sizeof(next_pgno
));
296 bp
+= sizeof(next_pgno
);
298 memcpy(bp
, nextlsn
, sizeof(*nextlsn
));
300 memset(bp
, 0, sizeof(*nextlsn
));
301 bp
+= sizeof(*nextlsn
);
303 if ((u_int32_t
)(bp
- (u_int8_t
*)logrec
.data
) != logrec
.size
)
304 fprintf(stderr
, "Error in log record length");
306 ret
= log_put(logp
, ret_lsnp
, (DBT
*)&logrec
, flags
);
308 txnid
->last_lsn
= *ret_lsnp
;
309 __db_free(logrec
.data
);
314 * PUBLIC: int __ham_newpage_print
315 * PUBLIC: __P((DB_LOG *, DBT *, DB_LSN *, int, void *));
318 __ham_newpage_print(notused1
, dbtp
, lsnp
, notused2
, notused3
)
325 __ham_newpage_args
*argp
;
336 if ((ret
= __ham_newpage_read(dbtp
->data
, &argp
)) != 0)
338 printf("[%lu][%lu]ham_newpage: rec: %lu txnid %lx prevlsn [%lu][%lu]\n",
340 (u_long
)lsnp
->offset
,
342 (u_long
)argp
->txnid
->txnid
,
343 (u_long
)argp
->prev_lsn
.file
,
344 (u_long
)argp
->prev_lsn
.offset
);
345 printf("\topcode: %lu\n", (u_long
)argp
->opcode
);
346 printf("\tfileid: %lu\n", (u_long
)argp
->fileid
);
347 printf("\tprev_pgno: %lu\n", (u_long
)argp
->prev_pgno
);
348 printf("\tprevlsn: [%lu][%lu]\n",
349 (u_long
)argp
->prevlsn
.file
, (u_long
)argp
->prevlsn
.offset
);
350 printf("\tnew_pgno: %lu\n", (u_long
)argp
->new_pgno
);
351 printf("\tpagelsn: [%lu][%lu]\n",
352 (u_long
)argp
->pagelsn
.file
, (u_long
)argp
->pagelsn
.offset
);
353 printf("\tnext_pgno: %lu\n", (u_long
)argp
->next_pgno
);
354 printf("\tnextlsn: [%lu][%lu]\n",
355 (u_long
)argp
->nextlsn
.file
, (u_long
)argp
->nextlsn
.offset
);
362 * PUBLIC: int __ham_newpage_read __P((void *, __ham_newpage_args **));
365 __ham_newpage_read(recbuf
, argpp
)
367 __ham_newpage_args
**argpp
;
369 __ham_newpage_args
*argp
;
372 argp
= (__ham_newpage_args
*)__db_malloc(sizeof(__ham_newpage_args
) +
376 argp
->txnid
= (DB_TXN
*)&argp
[1];
378 memcpy(&argp
->type
, bp
, sizeof(argp
->type
));
379 bp
+= sizeof(argp
->type
);
380 memcpy(&argp
->txnid
->txnid
, bp
, sizeof(argp
->txnid
->txnid
));
381 bp
+= sizeof(argp
->txnid
->txnid
);
382 memcpy(&argp
->prev_lsn
, bp
, sizeof(DB_LSN
));
383 bp
+= sizeof(DB_LSN
);
384 memcpy(&argp
->opcode
, bp
, sizeof(argp
->opcode
));
385 bp
+= sizeof(argp
->opcode
);
386 memcpy(&argp
->fileid
, bp
, sizeof(argp
->fileid
));
387 bp
+= sizeof(argp
->fileid
);
388 memcpy(&argp
->prev_pgno
, bp
, sizeof(argp
->prev_pgno
));
389 bp
+= sizeof(argp
->prev_pgno
);
390 memcpy(&argp
->prevlsn
, bp
, sizeof(argp
->prevlsn
));
391 bp
+= sizeof(argp
->prevlsn
);
392 memcpy(&argp
->new_pgno
, bp
, sizeof(argp
->new_pgno
));
393 bp
+= sizeof(argp
->new_pgno
);
394 memcpy(&argp
->pagelsn
, bp
, sizeof(argp
->pagelsn
));
395 bp
+= sizeof(argp
->pagelsn
);
396 memcpy(&argp
->next_pgno
, bp
, sizeof(argp
->next_pgno
));
397 bp
+= sizeof(argp
->next_pgno
);
398 memcpy(&argp
->nextlsn
, bp
, sizeof(argp
->nextlsn
));
399 bp
+= sizeof(argp
->nextlsn
);
405 * PUBLIC: int __ham_splitmeta_log
406 * PUBLIC: __P((DB_LOG *, DB_TXN *, DB_LSN *, u_int32_t,
407 * PUBLIC: u_int32_t, u_int32_t, u_int32_t, u_int32_t,
408 * PUBLIC: DB_LSN *));
410 int __ham_splitmeta_log(logp
, txnid
, ret_lsnp
, flags
,
411 fileid
, bucket
, ovflpoint
, spares
, metalsn
)
423 DB_LSN
*lsnp
, null_lsn
;
424 u_int32_t rectype
, txn_num
;
428 rectype
= DB_ham_splitmeta
;
429 txn_num
= txnid
== NULL
? 0 : txnid
->txnid
;
435 lsnp
= &txnid
->last_lsn
;
436 logrec
.size
= sizeof(rectype
) + sizeof(txn_num
) + sizeof(DB_LSN
)
442 if ((logrec
.data
= (void *)__db_malloc(logrec
.size
)) == NULL
)
446 memcpy(bp
, &rectype
, sizeof(rectype
));
447 bp
+= sizeof(rectype
);
448 memcpy(bp
, &txn_num
, sizeof(txn_num
));
449 bp
+= sizeof(txn_num
);
450 memcpy(bp
, lsnp
, sizeof(DB_LSN
));
451 bp
+= sizeof(DB_LSN
);
452 memcpy(bp
, &fileid
, sizeof(fileid
));
453 bp
+= sizeof(fileid
);
454 memcpy(bp
, &bucket
, sizeof(bucket
));
455 bp
+= sizeof(bucket
);
456 memcpy(bp
, &ovflpoint
, sizeof(ovflpoint
));
457 bp
+= sizeof(ovflpoint
);
458 memcpy(bp
, &spares
, sizeof(spares
));
459 bp
+= sizeof(spares
);
461 memcpy(bp
, metalsn
, sizeof(*metalsn
));
463 memset(bp
, 0, sizeof(*metalsn
));
464 bp
+= sizeof(*metalsn
);
466 if ((u_int32_t
)(bp
- (u_int8_t
*)logrec
.data
) != logrec
.size
)
467 fprintf(stderr
, "Error in log record length");
469 ret
= log_put(logp
, ret_lsnp
, (DBT
*)&logrec
, flags
);
471 txnid
->last_lsn
= *ret_lsnp
;
472 __db_free(logrec
.data
);
477 * PUBLIC: int __ham_splitmeta_print
478 * PUBLIC: __P((DB_LOG *, DBT *, DB_LSN *, int, void *));
481 __ham_splitmeta_print(notused1
, dbtp
, lsnp
, notused2
, notused3
)
488 __ham_splitmeta_args
*argp
;
499 if ((ret
= __ham_splitmeta_read(dbtp
->data
, &argp
)) != 0)
501 printf("[%lu][%lu]ham_splitmeta: rec: %lu txnid %lx prevlsn [%lu][%lu]\n",
503 (u_long
)lsnp
->offset
,
505 (u_long
)argp
->txnid
->txnid
,
506 (u_long
)argp
->prev_lsn
.file
,
507 (u_long
)argp
->prev_lsn
.offset
);
508 printf("\tfileid: %lu\n", (u_long
)argp
->fileid
);
509 printf("\tbucket: %lu\n", (u_long
)argp
->bucket
);
510 printf("\tovflpoint: %lu\n", (u_long
)argp
->ovflpoint
);
511 printf("\tspares: %lu\n", (u_long
)argp
->spares
);
512 printf("\tmetalsn: [%lu][%lu]\n",
513 (u_long
)argp
->metalsn
.file
, (u_long
)argp
->metalsn
.offset
);
520 * PUBLIC: int __ham_splitmeta_read __P((void *, __ham_splitmeta_args **));
523 __ham_splitmeta_read(recbuf
, argpp
)
525 __ham_splitmeta_args
**argpp
;
527 __ham_splitmeta_args
*argp
;
530 argp
= (__ham_splitmeta_args
*)__db_malloc(sizeof(__ham_splitmeta_args
) +
534 argp
->txnid
= (DB_TXN
*)&argp
[1];
536 memcpy(&argp
->type
, bp
, sizeof(argp
->type
));
537 bp
+= sizeof(argp
->type
);
538 memcpy(&argp
->txnid
->txnid
, bp
, sizeof(argp
->txnid
->txnid
));
539 bp
+= sizeof(argp
->txnid
->txnid
);
540 memcpy(&argp
->prev_lsn
, bp
, sizeof(DB_LSN
));
541 bp
+= sizeof(DB_LSN
);
542 memcpy(&argp
->fileid
, bp
, sizeof(argp
->fileid
));
543 bp
+= sizeof(argp
->fileid
);
544 memcpy(&argp
->bucket
, bp
, sizeof(argp
->bucket
));
545 bp
+= sizeof(argp
->bucket
);
546 memcpy(&argp
->ovflpoint
, bp
, sizeof(argp
->ovflpoint
));
547 bp
+= sizeof(argp
->ovflpoint
);
548 memcpy(&argp
->spares
, bp
, sizeof(argp
->spares
));
549 bp
+= sizeof(argp
->spares
);
550 memcpy(&argp
->metalsn
, bp
, sizeof(argp
->metalsn
));
551 bp
+= sizeof(argp
->metalsn
);
557 * PUBLIC: int __ham_splitdata_log
558 * PUBLIC: __P((DB_LOG *, DB_TXN *, DB_LSN *, u_int32_t,
559 * PUBLIC: u_int32_t, u_int32_t, db_pgno_t, const DBT *,
560 * PUBLIC: DB_LSN *));
562 int __ham_splitdata_log(logp
, txnid
, ret_lsnp
, flags
,
563 fileid
, opcode
, pgno
, pageimage
, pagelsn
)
571 const DBT
*pageimage
;
575 DB_LSN
*lsnp
, null_lsn
;
577 u_int32_t rectype
, txn_num
;
581 rectype
= DB_ham_splitdata
;
582 txn_num
= txnid
== NULL
? 0 : txnid
->txnid
;
588 lsnp
= &txnid
->last_lsn
;
589 logrec
.size
= sizeof(rectype
) + sizeof(txn_num
) + sizeof(DB_LSN
)
593 + sizeof(u_int32_t
) + (pageimage
== NULL
? 0 : pageimage
->size
)
595 if ((logrec
.data
= (void *)__db_malloc(logrec
.size
)) == NULL
)
599 memcpy(bp
, &rectype
, sizeof(rectype
));
600 bp
+= sizeof(rectype
);
601 memcpy(bp
, &txn_num
, sizeof(txn_num
));
602 bp
+= sizeof(txn_num
);
603 memcpy(bp
, lsnp
, sizeof(DB_LSN
));
604 bp
+= sizeof(DB_LSN
);
605 memcpy(bp
, &fileid
, sizeof(fileid
));
606 bp
+= sizeof(fileid
);
607 memcpy(bp
, &opcode
, sizeof(opcode
));
608 bp
+= sizeof(opcode
);
609 memcpy(bp
, &pgno
, sizeof(pgno
));
611 if (pageimage
== NULL
) {
613 memcpy(bp
, &zero
, sizeof(u_int32_t
));
614 bp
+= sizeof(u_int32_t
);
616 memcpy(bp
, &pageimage
->size
, sizeof(pageimage
->size
));
617 bp
+= sizeof(pageimage
->size
);
618 memcpy(bp
, pageimage
->data
, pageimage
->size
);
619 bp
+= pageimage
->size
;
622 memcpy(bp
, pagelsn
, sizeof(*pagelsn
));
624 memset(bp
, 0, sizeof(*pagelsn
));
625 bp
+= sizeof(*pagelsn
);
627 if ((u_int32_t
)(bp
- (u_int8_t
*)logrec
.data
) != logrec
.size
)
628 fprintf(stderr
, "Error in log record length");
630 ret
= log_put(logp
, ret_lsnp
, (DBT
*)&logrec
, flags
);
632 txnid
->last_lsn
= *ret_lsnp
;
633 __db_free(logrec
.data
);
638 * PUBLIC: int __ham_splitdata_print
639 * PUBLIC: __P((DB_LOG *, DBT *, DB_LSN *, int, void *));
642 __ham_splitdata_print(notused1
, dbtp
, lsnp
, notused2
, notused3
)
649 __ham_splitdata_args
*argp
;
660 if ((ret
= __ham_splitdata_read(dbtp
->data
, &argp
)) != 0)
662 printf("[%lu][%lu]ham_splitdata: rec: %lu txnid %lx prevlsn [%lu][%lu]\n",
664 (u_long
)lsnp
->offset
,
666 (u_long
)argp
->txnid
->txnid
,
667 (u_long
)argp
->prev_lsn
.file
,
668 (u_long
)argp
->prev_lsn
.offset
);
669 printf("\tfileid: %lu\n", (u_long
)argp
->fileid
);
670 printf("\topcode: %lu\n", (u_long
)argp
->opcode
);
671 printf("\tpgno: %lu\n", (u_long
)argp
->pgno
);
672 printf("\tpageimage: ");
673 for (i
= 0; i
< argp
->pageimage
.size
; i
++) {
674 ch
= ((u_int8_t
*)argp
->pageimage
.data
)[i
];
675 if (isprint(ch
) || ch
== 0xa)
681 printf("\tpagelsn: [%lu][%lu]\n",
682 (u_long
)argp
->pagelsn
.file
, (u_long
)argp
->pagelsn
.offset
);
689 * PUBLIC: int __ham_splitdata_read __P((void *, __ham_splitdata_args **));
692 __ham_splitdata_read(recbuf
, argpp
)
694 __ham_splitdata_args
**argpp
;
696 __ham_splitdata_args
*argp
;
699 argp
= (__ham_splitdata_args
*)__db_malloc(sizeof(__ham_splitdata_args
) +
703 argp
->txnid
= (DB_TXN
*)&argp
[1];
705 memcpy(&argp
->type
, bp
, sizeof(argp
->type
));
706 bp
+= sizeof(argp
->type
);
707 memcpy(&argp
->txnid
->txnid
, bp
, sizeof(argp
->txnid
->txnid
));
708 bp
+= sizeof(argp
->txnid
->txnid
);
709 memcpy(&argp
->prev_lsn
, bp
, sizeof(DB_LSN
));
710 bp
+= sizeof(DB_LSN
);
711 memcpy(&argp
->fileid
, bp
, sizeof(argp
->fileid
));
712 bp
+= sizeof(argp
->fileid
);
713 memcpy(&argp
->opcode
, bp
, sizeof(argp
->opcode
));
714 bp
+= sizeof(argp
->opcode
);
715 memcpy(&argp
->pgno
, bp
, sizeof(argp
->pgno
));
716 bp
+= sizeof(argp
->pgno
);
717 memcpy(&argp
->pageimage
.size
, bp
, sizeof(u_int32_t
));
718 bp
+= sizeof(u_int32_t
);
719 argp
->pageimage
.data
= bp
;
720 bp
+= argp
->pageimage
.size
;
721 memcpy(&argp
->pagelsn
, bp
, sizeof(argp
->pagelsn
));
722 bp
+= sizeof(argp
->pagelsn
);
728 * PUBLIC: int __ham_replace_log
729 * PUBLIC: __P((DB_LOG *, DB_TXN *, DB_LSN *, u_int32_t,
730 * PUBLIC: u_int32_t, db_pgno_t, u_int32_t, DB_LSN *,
731 * PUBLIC: int32_t, const DBT *, const DBT *, u_int32_t));
733 int __ham_replace_log(logp
, txnid
, ret_lsnp
, flags
,
734 fileid
, pgno
, ndx
, pagelsn
, off
, olditem
,
750 DB_LSN
*lsnp
, null_lsn
;
752 u_int32_t rectype
, txn_num
;
756 rectype
= DB_ham_replace
;
757 txn_num
= txnid
== NULL
? 0 : txnid
->txnid
;
763 lsnp
= &txnid
->last_lsn
;
764 logrec
.size
= sizeof(rectype
) + sizeof(txn_num
) + sizeof(DB_LSN
)
770 + sizeof(u_int32_t
) + (olditem
== NULL
? 0 : olditem
->size
)
771 + sizeof(u_int32_t
) + (newitem
== NULL
? 0 : newitem
->size
)
773 if ((logrec
.data
= (void *)__db_malloc(logrec
.size
)) == NULL
)
777 memcpy(bp
, &rectype
, sizeof(rectype
));
778 bp
+= sizeof(rectype
);
779 memcpy(bp
, &txn_num
, sizeof(txn_num
));
780 bp
+= sizeof(txn_num
);
781 memcpy(bp
, lsnp
, sizeof(DB_LSN
));
782 bp
+= sizeof(DB_LSN
);
783 memcpy(bp
, &fileid
, sizeof(fileid
));
784 bp
+= sizeof(fileid
);
785 memcpy(bp
, &pgno
, sizeof(pgno
));
787 memcpy(bp
, &ndx
, sizeof(ndx
));
790 memcpy(bp
, pagelsn
, sizeof(*pagelsn
));
792 memset(bp
, 0, sizeof(*pagelsn
));
793 bp
+= sizeof(*pagelsn
);
794 memcpy(bp
, &off
, sizeof(off
));
796 if (olditem
== NULL
) {
798 memcpy(bp
, &zero
, sizeof(u_int32_t
));
799 bp
+= sizeof(u_int32_t
);
801 memcpy(bp
, &olditem
->size
, sizeof(olditem
->size
));
802 bp
+= sizeof(olditem
->size
);
803 memcpy(bp
, olditem
->data
, olditem
->size
);
806 if (newitem
== NULL
) {
808 memcpy(bp
, &zero
, sizeof(u_int32_t
));
809 bp
+= sizeof(u_int32_t
);
811 memcpy(bp
, &newitem
->size
, sizeof(newitem
->size
));
812 bp
+= sizeof(newitem
->size
);
813 memcpy(bp
, newitem
->data
, newitem
->size
);
816 memcpy(bp
, &makedup
, sizeof(makedup
));
817 bp
+= sizeof(makedup
);
819 if ((u_int32_t
)(bp
- (u_int8_t
*)logrec
.data
) != logrec
.size
)
820 fprintf(stderr
, "Error in log record length");
822 ret
= log_put(logp
, ret_lsnp
, (DBT
*)&logrec
, flags
);
824 txnid
->last_lsn
= *ret_lsnp
;
825 __db_free(logrec
.data
);
830 * PUBLIC: int __ham_replace_print
831 * PUBLIC: __P((DB_LOG *, DBT *, DB_LSN *, int, void *));
834 __ham_replace_print(notused1
, dbtp
, lsnp
, notused2
, notused3
)
841 __ham_replace_args
*argp
;
852 if ((ret
= __ham_replace_read(dbtp
->data
, &argp
)) != 0)
854 printf("[%lu][%lu]ham_replace: rec: %lu txnid %lx prevlsn [%lu][%lu]\n",
856 (u_long
)lsnp
->offset
,
858 (u_long
)argp
->txnid
->txnid
,
859 (u_long
)argp
->prev_lsn
.file
,
860 (u_long
)argp
->prev_lsn
.offset
);
861 printf("\tfileid: %lu\n", (u_long
)argp
->fileid
);
862 printf("\tpgno: %lu\n", (u_long
)argp
->pgno
);
863 printf("\tndx: %lu\n", (u_long
)argp
->ndx
);
864 printf("\tpagelsn: [%lu][%lu]\n",
865 (u_long
)argp
->pagelsn
.file
, (u_long
)argp
->pagelsn
.offset
);
866 printf("\toff: %ld\n", (long)argp
->off
);
867 printf("\tolditem: ");
868 for (i
= 0; i
< argp
->olditem
.size
; i
++) {
869 ch
= ((u_int8_t
*)argp
->olditem
.data
)[i
];
870 if (isprint(ch
) || ch
== 0xa)
876 printf("\tnewitem: ");
877 for (i
= 0; i
< argp
->newitem
.size
; i
++) {
878 ch
= ((u_int8_t
*)argp
->newitem
.data
)[i
];
879 if (isprint(ch
) || ch
== 0xa)
885 printf("\tmakedup: %lu\n", (u_long
)argp
->makedup
);
892 * PUBLIC: int __ham_replace_read __P((void *, __ham_replace_args **));
895 __ham_replace_read(recbuf
, argpp
)
897 __ham_replace_args
**argpp
;
899 __ham_replace_args
*argp
;
902 argp
= (__ham_replace_args
*)__db_malloc(sizeof(__ham_replace_args
) +
906 argp
->txnid
= (DB_TXN
*)&argp
[1];
908 memcpy(&argp
->type
, bp
, sizeof(argp
->type
));
909 bp
+= sizeof(argp
->type
);
910 memcpy(&argp
->txnid
->txnid
, bp
, sizeof(argp
->txnid
->txnid
));
911 bp
+= sizeof(argp
->txnid
->txnid
);
912 memcpy(&argp
->prev_lsn
, bp
, sizeof(DB_LSN
));
913 bp
+= sizeof(DB_LSN
);
914 memcpy(&argp
->fileid
, bp
, sizeof(argp
->fileid
));
915 bp
+= sizeof(argp
->fileid
);
916 memcpy(&argp
->pgno
, bp
, sizeof(argp
->pgno
));
917 bp
+= sizeof(argp
->pgno
);
918 memcpy(&argp
->ndx
, bp
, sizeof(argp
->ndx
));
919 bp
+= sizeof(argp
->ndx
);
920 memcpy(&argp
->pagelsn
, bp
, sizeof(argp
->pagelsn
));
921 bp
+= sizeof(argp
->pagelsn
);
922 memcpy(&argp
->off
, bp
, sizeof(argp
->off
));
923 bp
+= sizeof(argp
->off
);
924 memcpy(&argp
->olditem
.size
, bp
, sizeof(u_int32_t
));
925 bp
+= sizeof(u_int32_t
);
926 argp
->olditem
.data
= bp
;
927 bp
+= argp
->olditem
.size
;
928 memcpy(&argp
->newitem
.size
, bp
, sizeof(u_int32_t
));
929 bp
+= sizeof(u_int32_t
);
930 argp
->newitem
.data
= bp
;
931 bp
+= argp
->newitem
.size
;
932 memcpy(&argp
->makedup
, bp
, sizeof(argp
->makedup
));
933 bp
+= sizeof(argp
->makedup
);
939 * PUBLIC: int __ham_newpgno_log
940 * PUBLIC: __P((DB_LOG *, DB_TXN *, DB_LSN *, u_int32_t,
941 * PUBLIC: u_int32_t, u_int32_t, db_pgno_t, db_pgno_t,
942 * PUBLIC: u_int32_t, db_pgno_t, u_int32_t, DB_LSN *,
943 * PUBLIC: DB_LSN *));
945 int __ham_newpgno_log(logp
, txnid
, ret_lsnp
, flags
,
946 opcode
, fileid
, pgno
, free_pgno
, old_type
, old_pgno
,
947 new_type
, pagelsn
, metalsn
)
963 DB_LSN
*lsnp
, null_lsn
;
964 u_int32_t rectype
, txn_num
;
968 rectype
= DB_ham_newpgno
;
969 txn_num
= txnid
== NULL
? 0 : txnid
->txnid
;
975 lsnp
= &txnid
->last_lsn
;
976 logrec
.size
= sizeof(rectype
) + sizeof(txn_num
) + sizeof(DB_LSN
)
986 if ((logrec
.data
= (void *)__db_malloc(logrec
.size
)) == NULL
)
990 memcpy(bp
, &rectype
, sizeof(rectype
));
991 bp
+= sizeof(rectype
);
992 memcpy(bp
, &txn_num
, sizeof(txn_num
));
993 bp
+= sizeof(txn_num
);
994 memcpy(bp
, lsnp
, sizeof(DB_LSN
));
995 bp
+= sizeof(DB_LSN
);
996 memcpy(bp
, &opcode
, sizeof(opcode
));
997 bp
+= sizeof(opcode
);
998 memcpy(bp
, &fileid
, sizeof(fileid
));
999 bp
+= sizeof(fileid
);
1000 memcpy(bp
, &pgno
, sizeof(pgno
));
1002 memcpy(bp
, &free_pgno
, sizeof(free_pgno
));
1003 bp
+= sizeof(free_pgno
);
1004 memcpy(bp
, &old_type
, sizeof(old_type
));
1005 bp
+= sizeof(old_type
);
1006 memcpy(bp
, &old_pgno
, sizeof(old_pgno
));
1007 bp
+= sizeof(old_pgno
);
1008 memcpy(bp
, &new_type
, sizeof(new_type
));
1009 bp
+= sizeof(new_type
);
1010 if (pagelsn
!= NULL
)
1011 memcpy(bp
, pagelsn
, sizeof(*pagelsn
));
1013 memset(bp
, 0, sizeof(*pagelsn
));
1014 bp
+= sizeof(*pagelsn
);
1015 if (metalsn
!= NULL
)
1016 memcpy(bp
, metalsn
, sizeof(*metalsn
));
1018 memset(bp
, 0, sizeof(*metalsn
));
1019 bp
+= sizeof(*metalsn
);
1021 if ((u_int32_t
)(bp
- (u_int8_t
*)logrec
.data
) != logrec
.size
)
1022 fprintf(stderr
, "Error in log record length");
1024 ret
= log_put(logp
, ret_lsnp
, (DBT
*)&logrec
, flags
);
1026 txnid
->last_lsn
= *ret_lsnp
;
1027 __db_free(logrec
.data
);
1032 * PUBLIC: int __ham_newpgno_print
1033 * PUBLIC: __P((DB_LOG *, DBT *, DB_LSN *, int, void *));
1036 __ham_newpgno_print(notused1
, dbtp
, lsnp
, notused2
, notused3
)
1043 __ham_newpgno_args
*argp
;
1054 if ((ret
= __ham_newpgno_read(dbtp
->data
, &argp
)) != 0)
1056 printf("[%lu][%lu]ham_newpgno: rec: %lu txnid %lx prevlsn [%lu][%lu]\n",
1058 (u_long
)lsnp
->offset
,
1060 (u_long
)argp
->txnid
->txnid
,
1061 (u_long
)argp
->prev_lsn
.file
,
1062 (u_long
)argp
->prev_lsn
.offset
);
1063 printf("\topcode: %lu\n", (u_long
)argp
->opcode
);
1064 printf("\tfileid: %lu\n", (u_long
)argp
->fileid
);
1065 printf("\tpgno: %lu\n", (u_long
)argp
->pgno
);
1066 printf("\tfree_pgno: %lu\n", (u_long
)argp
->free_pgno
);
1067 printf("\told_type: %lu\n", (u_long
)argp
->old_type
);
1068 printf("\told_pgno: %lu\n", (u_long
)argp
->old_pgno
);
1069 printf("\tnew_type: %lu\n", (u_long
)argp
->new_type
);
1070 printf("\tpagelsn: [%lu][%lu]\n",
1071 (u_long
)argp
->pagelsn
.file
, (u_long
)argp
->pagelsn
.offset
);
1072 printf("\tmetalsn: [%lu][%lu]\n",
1073 (u_long
)argp
->metalsn
.file
, (u_long
)argp
->metalsn
.offset
);
1080 * PUBLIC: int __ham_newpgno_read __P((void *, __ham_newpgno_args **));
1083 __ham_newpgno_read(recbuf
, argpp
)
1085 __ham_newpgno_args
**argpp
;
1087 __ham_newpgno_args
*argp
;
1090 argp
= (__ham_newpgno_args
*)__db_malloc(sizeof(__ham_newpgno_args
) +
1094 argp
->txnid
= (DB_TXN
*)&argp
[1];
1096 memcpy(&argp
->type
, bp
, sizeof(argp
->type
));
1097 bp
+= sizeof(argp
->type
);
1098 memcpy(&argp
->txnid
->txnid
, bp
, sizeof(argp
->txnid
->txnid
));
1099 bp
+= sizeof(argp
->txnid
->txnid
);
1100 memcpy(&argp
->prev_lsn
, bp
, sizeof(DB_LSN
));
1101 bp
+= sizeof(DB_LSN
);
1102 memcpy(&argp
->opcode
, bp
, sizeof(argp
->opcode
));
1103 bp
+= sizeof(argp
->opcode
);
1104 memcpy(&argp
->fileid
, bp
, sizeof(argp
->fileid
));
1105 bp
+= sizeof(argp
->fileid
);
1106 memcpy(&argp
->pgno
, bp
, sizeof(argp
->pgno
));
1107 bp
+= sizeof(argp
->pgno
);
1108 memcpy(&argp
->free_pgno
, bp
, sizeof(argp
->free_pgno
));
1109 bp
+= sizeof(argp
->free_pgno
);
1110 memcpy(&argp
->old_type
, bp
, sizeof(argp
->old_type
));
1111 bp
+= sizeof(argp
->old_type
);
1112 memcpy(&argp
->old_pgno
, bp
, sizeof(argp
->old_pgno
));
1113 bp
+= sizeof(argp
->old_pgno
);
1114 memcpy(&argp
->new_type
, bp
, sizeof(argp
->new_type
));
1115 bp
+= sizeof(argp
->new_type
);
1116 memcpy(&argp
->pagelsn
, bp
, sizeof(argp
->pagelsn
));
1117 bp
+= sizeof(argp
->pagelsn
);
1118 memcpy(&argp
->metalsn
, bp
, sizeof(argp
->metalsn
));
1119 bp
+= sizeof(argp
->metalsn
);
1125 * PUBLIC: int __ham_ovfl_log
1126 * PUBLIC: __P((DB_LOG *, DB_TXN *, DB_LSN *, u_int32_t,
1127 * PUBLIC: u_int32_t, db_pgno_t, u_int32_t, db_pgno_t,
1128 * PUBLIC: u_int32_t, DB_LSN *));
1130 int __ham_ovfl_log(logp
, txnid
, ret_lsnp
, flags
,
1131 fileid
, start_pgno
, npages
, free_pgno
, ovflpoint
, metalsn
)
1137 db_pgno_t start_pgno
;
1139 db_pgno_t free_pgno
;
1140 u_int32_t ovflpoint
;
1144 DB_LSN
*lsnp
, null_lsn
;
1145 u_int32_t rectype
, txn_num
;
1149 rectype
= DB_ham_ovfl
;
1150 txn_num
= txnid
== NULL
? 0 : txnid
->txnid
;
1151 if (txnid
== NULL
) {
1153 null_lsn
.offset
= 0;
1156 lsnp
= &txnid
->last_lsn
;
1157 logrec
.size
= sizeof(rectype
) + sizeof(txn_num
) + sizeof(DB_LSN
)
1159 + sizeof(start_pgno
)
1164 if ((logrec
.data
= (void *)__db_malloc(logrec
.size
)) == NULL
)
1168 memcpy(bp
, &rectype
, sizeof(rectype
));
1169 bp
+= sizeof(rectype
);
1170 memcpy(bp
, &txn_num
, sizeof(txn_num
));
1171 bp
+= sizeof(txn_num
);
1172 memcpy(bp
, lsnp
, sizeof(DB_LSN
));
1173 bp
+= sizeof(DB_LSN
);
1174 memcpy(bp
, &fileid
, sizeof(fileid
));
1175 bp
+= sizeof(fileid
);
1176 memcpy(bp
, &start_pgno
, sizeof(start_pgno
));
1177 bp
+= sizeof(start_pgno
);
1178 memcpy(bp
, &npages
, sizeof(npages
));
1179 bp
+= sizeof(npages
);
1180 memcpy(bp
, &free_pgno
, sizeof(free_pgno
));
1181 bp
+= sizeof(free_pgno
);
1182 memcpy(bp
, &ovflpoint
, sizeof(ovflpoint
));
1183 bp
+= sizeof(ovflpoint
);
1184 if (metalsn
!= NULL
)
1185 memcpy(bp
, metalsn
, sizeof(*metalsn
));
1187 memset(bp
, 0, sizeof(*metalsn
));
1188 bp
+= sizeof(*metalsn
);
1190 if ((u_int32_t
)(bp
- (u_int8_t
*)logrec
.data
) != logrec
.size
)
1191 fprintf(stderr
, "Error in log record length");
1193 ret
= log_put(logp
, ret_lsnp
, (DBT
*)&logrec
, flags
);
1195 txnid
->last_lsn
= *ret_lsnp
;
1196 __db_free(logrec
.data
);
1201 * PUBLIC: int __ham_ovfl_print
1202 * PUBLIC: __P((DB_LOG *, DBT *, DB_LSN *, int, void *));
1205 __ham_ovfl_print(notused1
, dbtp
, lsnp
, notused2
, notused3
)
1212 __ham_ovfl_args
*argp
;
1223 if ((ret
= __ham_ovfl_read(dbtp
->data
, &argp
)) != 0)
1225 printf("[%lu][%lu]ham_ovfl: rec: %lu txnid %lx prevlsn [%lu][%lu]\n",
1227 (u_long
)lsnp
->offset
,
1229 (u_long
)argp
->txnid
->txnid
,
1230 (u_long
)argp
->prev_lsn
.file
,
1231 (u_long
)argp
->prev_lsn
.offset
);
1232 printf("\tfileid: %lu\n", (u_long
)argp
->fileid
);
1233 printf("\tstart_pgno: %lu\n", (u_long
)argp
->start_pgno
);
1234 printf("\tnpages: %lu\n", (u_long
)argp
->npages
);
1235 printf("\tfree_pgno: %lu\n", (u_long
)argp
->free_pgno
);
1236 printf("\tovflpoint: %lu\n", (u_long
)argp
->ovflpoint
);
1237 printf("\tmetalsn: [%lu][%lu]\n",
1238 (u_long
)argp
->metalsn
.file
, (u_long
)argp
->metalsn
.offset
);
1245 * PUBLIC: int __ham_ovfl_read __P((void *, __ham_ovfl_args **));
1248 __ham_ovfl_read(recbuf
, argpp
)
1250 __ham_ovfl_args
**argpp
;
1252 __ham_ovfl_args
*argp
;
1255 argp
= (__ham_ovfl_args
*)__db_malloc(sizeof(__ham_ovfl_args
) +
1259 argp
->txnid
= (DB_TXN
*)&argp
[1];
1261 memcpy(&argp
->type
, bp
, sizeof(argp
->type
));
1262 bp
+= sizeof(argp
->type
);
1263 memcpy(&argp
->txnid
->txnid
, bp
, sizeof(argp
->txnid
->txnid
));
1264 bp
+= sizeof(argp
->txnid
->txnid
);
1265 memcpy(&argp
->prev_lsn
, bp
, sizeof(DB_LSN
));
1266 bp
+= sizeof(DB_LSN
);
1267 memcpy(&argp
->fileid
, bp
, sizeof(argp
->fileid
));
1268 bp
+= sizeof(argp
->fileid
);
1269 memcpy(&argp
->start_pgno
, bp
, sizeof(argp
->start_pgno
));
1270 bp
+= sizeof(argp
->start_pgno
);
1271 memcpy(&argp
->npages
, bp
, sizeof(argp
->npages
));
1272 bp
+= sizeof(argp
->npages
);
1273 memcpy(&argp
->free_pgno
, bp
, sizeof(argp
->free_pgno
));
1274 bp
+= sizeof(argp
->free_pgno
);
1275 memcpy(&argp
->ovflpoint
, bp
, sizeof(argp
->ovflpoint
));
1276 bp
+= sizeof(argp
->ovflpoint
);
1277 memcpy(&argp
->metalsn
, bp
, sizeof(argp
->metalsn
));
1278 bp
+= sizeof(argp
->metalsn
);
1284 * PUBLIC: int __ham_copypage_log
1285 * PUBLIC: __P((DB_LOG *, DB_TXN *, DB_LSN *, u_int32_t,
1286 * PUBLIC: u_int32_t, db_pgno_t, DB_LSN *, db_pgno_t,
1287 * PUBLIC: DB_LSN *, db_pgno_t, DB_LSN *, const DBT *));
1289 int __ham_copypage_log(logp
, txnid
, ret_lsnp
, flags
,
1290 fileid
, pgno
, pagelsn
, next_pgno
, nextlsn
, nnext_pgno
,
1299 db_pgno_t next_pgno
;
1301 db_pgno_t nnext_pgno
;
1306 DB_LSN
*lsnp
, null_lsn
;
1308 u_int32_t rectype
, txn_num
;
1312 rectype
= DB_ham_copypage
;
1313 txn_num
= txnid
== NULL
? 0 : txnid
->txnid
;
1314 if (txnid
== NULL
) {
1316 null_lsn
.offset
= 0;
1319 lsnp
= &txnid
->last_lsn
;
1320 logrec
.size
= sizeof(rectype
) + sizeof(txn_num
) + sizeof(DB_LSN
)
1326 + sizeof(nnext_pgno
)
1328 + sizeof(u_int32_t
) + (page
== NULL
? 0 : page
->size
);
1329 if ((logrec
.data
= (void *)__db_malloc(logrec
.size
)) == NULL
)
1333 memcpy(bp
, &rectype
, sizeof(rectype
));
1334 bp
+= sizeof(rectype
);
1335 memcpy(bp
, &txn_num
, sizeof(txn_num
));
1336 bp
+= sizeof(txn_num
);
1337 memcpy(bp
, lsnp
, sizeof(DB_LSN
));
1338 bp
+= sizeof(DB_LSN
);
1339 memcpy(bp
, &fileid
, sizeof(fileid
));
1340 bp
+= sizeof(fileid
);
1341 memcpy(bp
, &pgno
, sizeof(pgno
));
1343 if (pagelsn
!= NULL
)
1344 memcpy(bp
, pagelsn
, sizeof(*pagelsn
));
1346 memset(bp
, 0, sizeof(*pagelsn
));
1347 bp
+= sizeof(*pagelsn
);
1348 memcpy(bp
, &next_pgno
, sizeof(next_pgno
));
1349 bp
+= sizeof(next_pgno
);
1350 if (nextlsn
!= NULL
)
1351 memcpy(bp
, nextlsn
, sizeof(*nextlsn
));
1353 memset(bp
, 0, sizeof(*nextlsn
));
1354 bp
+= sizeof(*nextlsn
);
1355 memcpy(bp
, &nnext_pgno
, sizeof(nnext_pgno
));
1356 bp
+= sizeof(nnext_pgno
);
1357 if (nnextlsn
!= NULL
)
1358 memcpy(bp
, nnextlsn
, sizeof(*nnextlsn
));
1360 memset(bp
, 0, sizeof(*nnextlsn
));
1361 bp
+= sizeof(*nnextlsn
);
1364 memcpy(bp
, &zero
, sizeof(u_int32_t
));
1365 bp
+= sizeof(u_int32_t
);
1367 memcpy(bp
, &page
->size
, sizeof(page
->size
));
1368 bp
+= sizeof(page
->size
);
1369 memcpy(bp
, page
->data
, page
->size
);
1373 if ((u_int32_t
)(bp
- (u_int8_t
*)logrec
.data
) != logrec
.size
)
1374 fprintf(stderr
, "Error in log record length");
1376 ret
= log_put(logp
, ret_lsnp
, (DBT
*)&logrec
, flags
);
1378 txnid
->last_lsn
= *ret_lsnp
;
1379 __db_free(logrec
.data
);
1384 * PUBLIC: int __ham_copypage_print
1385 * PUBLIC: __P((DB_LOG *, DBT *, DB_LSN *, int, void *));
1388 __ham_copypage_print(notused1
, dbtp
, lsnp
, notused2
, notused3
)
1395 __ham_copypage_args
*argp
;
1406 if ((ret
= __ham_copypage_read(dbtp
->data
, &argp
)) != 0)
1408 printf("[%lu][%lu]ham_copypage: rec: %lu txnid %lx prevlsn [%lu][%lu]\n",
1410 (u_long
)lsnp
->offset
,
1412 (u_long
)argp
->txnid
->txnid
,
1413 (u_long
)argp
->prev_lsn
.file
,
1414 (u_long
)argp
->prev_lsn
.offset
);
1415 printf("\tfileid: %lu\n", (u_long
)argp
->fileid
);
1416 printf("\tpgno: %lu\n", (u_long
)argp
->pgno
);
1417 printf("\tpagelsn: [%lu][%lu]\n",
1418 (u_long
)argp
->pagelsn
.file
, (u_long
)argp
->pagelsn
.offset
);
1419 printf("\tnext_pgno: %lu\n", (u_long
)argp
->next_pgno
);
1420 printf("\tnextlsn: [%lu][%lu]\n",
1421 (u_long
)argp
->nextlsn
.file
, (u_long
)argp
->nextlsn
.offset
);
1422 printf("\tnnext_pgno: %lu\n", (u_long
)argp
->nnext_pgno
);
1423 printf("\tnnextlsn: [%lu][%lu]\n",
1424 (u_long
)argp
->nnextlsn
.file
, (u_long
)argp
->nnextlsn
.offset
);
1426 for (i
= 0; i
< argp
->page
.size
; i
++) {
1427 ch
= ((u_int8_t
*)argp
->page
.data
)[i
];
1428 if (isprint(ch
) || ch
== 0xa)
1440 * PUBLIC: int __ham_copypage_read __P((void *, __ham_copypage_args **));
1443 __ham_copypage_read(recbuf
, argpp
)
1445 __ham_copypage_args
**argpp
;
1447 __ham_copypage_args
*argp
;
1450 argp
= (__ham_copypage_args
*)__db_malloc(sizeof(__ham_copypage_args
) +
1454 argp
->txnid
= (DB_TXN
*)&argp
[1];
1456 memcpy(&argp
->type
, bp
, sizeof(argp
->type
));
1457 bp
+= sizeof(argp
->type
);
1458 memcpy(&argp
->txnid
->txnid
, bp
, sizeof(argp
->txnid
->txnid
));
1459 bp
+= sizeof(argp
->txnid
->txnid
);
1460 memcpy(&argp
->prev_lsn
, bp
, sizeof(DB_LSN
));
1461 bp
+= sizeof(DB_LSN
);
1462 memcpy(&argp
->fileid
, bp
, sizeof(argp
->fileid
));
1463 bp
+= sizeof(argp
->fileid
);
1464 memcpy(&argp
->pgno
, bp
, sizeof(argp
->pgno
));
1465 bp
+= sizeof(argp
->pgno
);
1466 memcpy(&argp
->pagelsn
, bp
, sizeof(argp
->pagelsn
));
1467 bp
+= sizeof(argp
->pagelsn
);
1468 memcpy(&argp
->next_pgno
, bp
, sizeof(argp
->next_pgno
));
1469 bp
+= sizeof(argp
->next_pgno
);
1470 memcpy(&argp
->nextlsn
, bp
, sizeof(argp
->nextlsn
));
1471 bp
+= sizeof(argp
->nextlsn
);
1472 memcpy(&argp
->nnext_pgno
, bp
, sizeof(argp
->nnext_pgno
));
1473 bp
+= sizeof(argp
->nnext_pgno
);
1474 memcpy(&argp
->nnextlsn
, bp
, sizeof(argp
->nnextlsn
));
1475 bp
+= sizeof(argp
->nnextlsn
);
1476 memcpy(&argp
->page
.size
, bp
, sizeof(u_int32_t
));
1477 bp
+= sizeof(u_int32_t
);
1478 argp
->page
.data
= bp
;
1479 bp
+= argp
->page
.size
;
1485 * PUBLIC: int __ham_init_print __P((DB_ENV *));
1488 __ham_init_print(dbenv
)
1493 if ((ret
= __db_add_recovery(dbenv
,
1494 __ham_insdel_print
, DB_ham_insdel
)) != 0)
1496 if ((ret
= __db_add_recovery(dbenv
,
1497 __ham_newpage_print
, DB_ham_newpage
)) != 0)
1499 if ((ret
= __db_add_recovery(dbenv
,
1500 __ham_splitmeta_print
, DB_ham_splitmeta
)) != 0)
1502 if ((ret
= __db_add_recovery(dbenv
,
1503 __ham_splitdata_print
, DB_ham_splitdata
)) != 0)
1505 if ((ret
= __db_add_recovery(dbenv
,
1506 __ham_replace_print
, DB_ham_replace
)) != 0)
1508 if ((ret
= __db_add_recovery(dbenv
,
1509 __ham_newpgno_print
, DB_ham_newpgno
)) != 0)
1511 if ((ret
= __db_add_recovery(dbenv
,
1512 __ham_ovfl_print
, DB_ham_ovfl
)) != 0)
1514 if ((ret
= __db_add_recovery(dbenv
,
1515 __ham_copypage_print
, DB_ham_copypage
)) != 0)
1521 * PUBLIC: int __ham_init_recover __P((DB_ENV *));
1524 __ham_init_recover(dbenv
)
1529 if ((ret
= __db_add_recovery(dbenv
,
1530 __ham_insdel_recover
, DB_ham_insdel
)) != 0)
1532 if ((ret
= __db_add_recovery(dbenv
,
1533 __ham_newpage_recover
, DB_ham_newpage
)) != 0)
1535 if ((ret
= __db_add_recovery(dbenv
,
1536 __ham_splitmeta_recover
, DB_ham_splitmeta
)) != 0)
1538 if ((ret
= __db_add_recovery(dbenv
,
1539 __ham_splitdata_recover
, DB_ham_splitdata
)) != 0)
1541 if ((ret
= __db_add_recovery(dbenv
,
1542 __ham_replace_recover
, DB_ham_replace
)) != 0)
1544 if ((ret
= __db_add_recovery(dbenv
,
1545 __ham_newpgno_recover
, DB_ham_newpgno
)) != 0)
1547 if ((ret
= __db_add_recovery(dbenv
,
1548 __ham_ovfl_recover
, DB_ham_ovfl
)) != 0)
1550 if ((ret
= __db_add_recovery(dbenv
,
1551 __ham_copypage_recover
, DB_ham_copypage
)) != 0)