1 /* Do not edit: automatically built by dist/db_gen.sh. */
4 #ifndef NO_SYSTEM_INCLUDES
14 #include "db_dispatch.h"
18 * PUBLIC: int __txn_regop_log
19 * PUBLIC: __P((DB_LOG *, DB_TXN *, DB_LSN *, u_int32_t,
20 * PUBLIC: u_int32_t));
22 int __txn_regop_log(logp
, txnid
, ret_lsnp
, flags
,
31 DB_LSN
*lsnp
, null_lsn
;
32 u_int32_t rectype
, txn_num
;
36 rectype
= DB_txn_regop
;
37 txn_num
= txnid
== NULL
? 0 : txnid
->txnid
;
42 lsnp
= &txnid
->last_lsn
;
43 logrec
.size
= sizeof(rectype
) + sizeof(txn_num
) + sizeof(DB_LSN
)
45 if ((ret
= __os_malloc(logrec
.size
, NULL
, &logrec
.data
)) != 0)
49 memcpy(bp
, &rectype
, sizeof(rectype
));
50 bp
+= sizeof(rectype
);
51 memcpy(bp
, &txn_num
, sizeof(txn_num
));
52 bp
+= sizeof(txn_num
);
53 memcpy(bp
, lsnp
, sizeof(DB_LSN
));
55 memcpy(bp
, &opcode
, sizeof(opcode
));
58 if ((u_int32_t
)(bp
- (u_int8_t
*)logrec
.data
) != logrec
.size
)
59 fprintf(stderr
, "Error in log record length");
61 ret
= log_put(logp
, ret_lsnp
, (DBT
*)&logrec
, flags
);
63 txnid
->last_lsn
= *ret_lsnp
;
64 __os_free(logrec
.data
, 0);
69 * PUBLIC: int __txn_regop_print
70 * PUBLIC: __P((DB_LOG *, DBT *, DB_LSN *, int, void *));
73 __txn_regop_print(notused1
, dbtp
, lsnp
, notused2
, notused3
)
80 __txn_regop_args
*argp
;
91 if ((ret
= __txn_regop_read(dbtp
->data
, &argp
)) != 0)
93 printf("[%lu][%lu]txn_regop: rec: %lu txnid %lx prevlsn [%lu][%lu]\n",
97 (u_long
)argp
->txnid
->txnid
,
98 (u_long
)argp
->prev_lsn
.file
,
99 (u_long
)argp
->prev_lsn
.offset
);
100 printf("\topcode: %lu\n", (u_long
)argp
->opcode
);
107 * PUBLIC: int __txn_regop_read __P((void *, __txn_regop_args **));
110 __txn_regop_read(recbuf
, argpp
)
112 __txn_regop_args
**argpp
;
114 __txn_regop_args
*argp
;
118 ret
= __os_malloc(sizeof(__txn_regop_args
) +
119 sizeof(DB_TXN
), NULL
, &argp
);
122 argp
->txnid
= (DB_TXN
*)&argp
[1];
124 memcpy(&argp
->type
, bp
, sizeof(argp
->type
));
125 bp
+= sizeof(argp
->type
);
126 memcpy(&argp
->txnid
->txnid
, bp
, sizeof(argp
->txnid
->txnid
));
127 bp
+= sizeof(argp
->txnid
->txnid
);
128 memcpy(&argp
->prev_lsn
, bp
, sizeof(DB_LSN
));
129 bp
+= sizeof(DB_LSN
);
130 memcpy(&argp
->opcode
, bp
, sizeof(argp
->opcode
));
131 bp
+= sizeof(argp
->opcode
);
137 * PUBLIC: int __txn_ckp_log
138 * PUBLIC: __P((DB_LOG *, DB_TXN *, DB_LSN *, u_int32_t,
139 * PUBLIC: DB_LSN *, DB_LSN *));
141 int __txn_ckp_log(logp
, txnid
, ret_lsnp
, flags
,
151 DB_LSN
*lsnp
, null_lsn
;
152 u_int32_t rectype
, txn_num
;
156 rectype
= DB_txn_ckp
;
157 txn_num
= txnid
== NULL
? 0 : txnid
->txnid
;
162 lsnp
= &txnid
->last_lsn
;
163 logrec
.size
= sizeof(rectype
) + sizeof(txn_num
) + sizeof(DB_LSN
)
166 if ((ret
= __os_malloc(logrec
.size
, NULL
, &logrec
.data
)) != 0)
170 memcpy(bp
, &rectype
, sizeof(rectype
));
171 bp
+= sizeof(rectype
);
172 memcpy(bp
, &txn_num
, sizeof(txn_num
));
173 bp
+= sizeof(txn_num
);
174 memcpy(bp
, lsnp
, sizeof(DB_LSN
));
175 bp
+= sizeof(DB_LSN
);
177 memcpy(bp
, ckp_lsn
, sizeof(*ckp_lsn
));
179 memset(bp
, 0, sizeof(*ckp_lsn
));
180 bp
+= sizeof(*ckp_lsn
);
181 if (last_ckp
!= NULL
)
182 memcpy(bp
, last_ckp
, sizeof(*last_ckp
));
184 memset(bp
, 0, sizeof(*last_ckp
));
185 bp
+= sizeof(*last_ckp
);
187 if ((u_int32_t
)(bp
- (u_int8_t
*)logrec
.data
) != logrec
.size
)
188 fprintf(stderr
, "Error in log record length");
190 ret
= log_put(logp
, ret_lsnp
, (DBT
*)&logrec
, flags
);
192 txnid
->last_lsn
= *ret_lsnp
;
193 __os_free(logrec
.data
, 0);
198 * PUBLIC: int __txn_ckp_print
199 * PUBLIC: __P((DB_LOG *, DBT *, DB_LSN *, int, void *));
202 __txn_ckp_print(notused1
, dbtp
, lsnp
, notused2
, notused3
)
209 __txn_ckp_args
*argp
;
220 if ((ret
= __txn_ckp_read(dbtp
->data
, &argp
)) != 0)
222 printf("[%lu][%lu]txn_ckp: rec: %lu txnid %lx prevlsn [%lu][%lu]\n",
224 (u_long
)lsnp
->offset
,
226 (u_long
)argp
->txnid
->txnid
,
227 (u_long
)argp
->prev_lsn
.file
,
228 (u_long
)argp
->prev_lsn
.offset
);
229 printf("\tckp_lsn: [%lu][%lu]\n",
230 (u_long
)argp
->ckp_lsn
.file
, (u_long
)argp
->ckp_lsn
.offset
);
231 printf("\tlast_ckp: [%lu][%lu]\n",
232 (u_long
)argp
->last_ckp
.file
, (u_long
)argp
->last_ckp
.offset
);
239 * PUBLIC: int __txn_ckp_read __P((void *, __txn_ckp_args **));
242 __txn_ckp_read(recbuf
, argpp
)
244 __txn_ckp_args
**argpp
;
246 __txn_ckp_args
*argp
;
250 ret
= __os_malloc(sizeof(__txn_ckp_args
) +
251 sizeof(DB_TXN
), NULL
, &argp
);
254 argp
->txnid
= (DB_TXN
*)&argp
[1];
256 memcpy(&argp
->type
, bp
, sizeof(argp
->type
));
257 bp
+= sizeof(argp
->type
);
258 memcpy(&argp
->txnid
->txnid
, bp
, sizeof(argp
->txnid
->txnid
));
259 bp
+= sizeof(argp
->txnid
->txnid
);
260 memcpy(&argp
->prev_lsn
, bp
, sizeof(DB_LSN
));
261 bp
+= sizeof(DB_LSN
);
262 memcpy(&argp
->ckp_lsn
, bp
, sizeof(argp
->ckp_lsn
));
263 bp
+= sizeof(argp
->ckp_lsn
);
264 memcpy(&argp
->last_ckp
, bp
, sizeof(argp
->last_ckp
));
265 bp
+= sizeof(argp
->last_ckp
);
271 * PUBLIC: int __txn_xa_regop_log
272 * PUBLIC: __P((DB_LOG *, DB_TXN *, DB_LSN *, u_int32_t,
273 * PUBLIC: u_int32_t, const DBT *, int32_t, u_int32_t,
274 * PUBLIC: u_int32_t, DB_LSN *));
276 int __txn_xa_regop_log(logp
, txnid
, ret_lsnp
, flags
,
277 opcode
, xid
, formatID
, gtrid
, bqual
, begin_lsn
)
290 DB_LSN
*lsnp
, null_lsn
;
292 u_int32_t rectype
, txn_num
;
296 rectype
= DB_txn_xa_regop
;
297 txn_num
= txnid
== NULL
? 0 : txnid
->txnid
;
302 lsnp
= &txnid
->last_lsn
;
303 logrec
.size
= sizeof(rectype
) + sizeof(txn_num
) + sizeof(DB_LSN
)
305 + sizeof(u_int32_t
) + (xid
== NULL
? 0 : xid
->size
)
309 + sizeof(*begin_lsn
);
310 if ((ret
= __os_malloc(logrec
.size
, NULL
, &logrec
.data
)) != 0)
314 memcpy(bp
, &rectype
, sizeof(rectype
));
315 bp
+= sizeof(rectype
);
316 memcpy(bp
, &txn_num
, sizeof(txn_num
));
317 bp
+= sizeof(txn_num
);
318 memcpy(bp
, lsnp
, sizeof(DB_LSN
));
319 bp
+= sizeof(DB_LSN
);
320 memcpy(bp
, &opcode
, sizeof(opcode
));
321 bp
+= sizeof(opcode
);
324 memcpy(bp
, &zero
, sizeof(u_int32_t
));
325 bp
+= sizeof(u_int32_t
);
327 memcpy(bp
, &xid
->size
, sizeof(xid
->size
));
328 bp
+= sizeof(xid
->size
);
329 memcpy(bp
, xid
->data
, xid
->size
);
332 memcpy(bp
, &formatID
, sizeof(formatID
));
333 bp
+= sizeof(formatID
);
334 memcpy(bp
, >rid
, sizeof(gtrid
));
336 memcpy(bp
, &bqual
, sizeof(bqual
));
338 if (begin_lsn
!= NULL
)
339 memcpy(bp
, begin_lsn
, sizeof(*begin_lsn
));
341 memset(bp
, 0, sizeof(*begin_lsn
));
342 bp
+= sizeof(*begin_lsn
);
344 if ((u_int32_t
)(bp
- (u_int8_t
*)logrec
.data
) != logrec
.size
)
345 fprintf(stderr
, "Error in log record length");
347 ret
= log_put(logp
, ret_lsnp
, (DBT
*)&logrec
, flags
);
349 txnid
->last_lsn
= *ret_lsnp
;
350 __os_free(logrec
.data
, 0);
355 * PUBLIC: int __txn_xa_regop_print
356 * PUBLIC: __P((DB_LOG *, DBT *, DB_LSN *, int, void *));
359 __txn_xa_regop_print(notused1
, dbtp
, lsnp
, notused2
, notused3
)
366 __txn_xa_regop_args
*argp
;
377 if ((ret
= __txn_xa_regop_read(dbtp
->data
, &argp
)) != 0)
379 printf("[%lu][%lu]txn_xa_regop: rec: %lu txnid %lx prevlsn [%lu][%lu]\n",
381 (u_long
)lsnp
->offset
,
383 (u_long
)argp
->txnid
->txnid
,
384 (u_long
)argp
->prev_lsn
.file
,
385 (u_long
)argp
->prev_lsn
.offset
);
386 printf("\topcode: %lu\n", (u_long
)argp
->opcode
);
388 for (i
= 0; i
< argp
->xid
.size
; i
++) {
389 ch
= ((u_int8_t
*)argp
->xid
.data
)[i
];
390 if (isprint(ch
) || ch
== 0xa)
396 printf("\tformatID: %ld\n", (long)argp
->formatID
);
397 printf("\tgtrid: %u\n", argp
->gtrid
);
398 printf("\tbqual: %u\n", argp
->bqual
);
399 printf("\tbegin_lsn: [%lu][%lu]\n",
400 (u_long
)argp
->begin_lsn
.file
, (u_long
)argp
->begin_lsn
.offset
);
407 * PUBLIC: int __txn_xa_regop_read __P((void *, __txn_xa_regop_args **));
410 __txn_xa_regop_read(recbuf
, argpp
)
412 __txn_xa_regop_args
**argpp
;
414 __txn_xa_regop_args
*argp
;
418 ret
= __os_malloc(sizeof(__txn_xa_regop_args
) +
419 sizeof(DB_TXN
), NULL
, &argp
);
422 argp
->txnid
= (DB_TXN
*)&argp
[1];
424 memcpy(&argp
->type
, bp
, sizeof(argp
->type
));
425 bp
+= sizeof(argp
->type
);
426 memcpy(&argp
->txnid
->txnid
, bp
, sizeof(argp
->txnid
->txnid
));
427 bp
+= sizeof(argp
->txnid
->txnid
);
428 memcpy(&argp
->prev_lsn
, bp
, sizeof(DB_LSN
));
429 bp
+= sizeof(DB_LSN
);
430 memcpy(&argp
->opcode
, bp
, sizeof(argp
->opcode
));
431 bp
+= sizeof(argp
->opcode
);
432 memcpy(&argp
->xid
.size
, bp
, sizeof(u_int32_t
));
433 bp
+= sizeof(u_int32_t
);
435 bp
+= argp
->xid
.size
;
436 memcpy(&argp
->formatID
, bp
, sizeof(argp
->formatID
));
437 bp
+= sizeof(argp
->formatID
);
438 memcpy(&argp
->gtrid
, bp
, sizeof(argp
->gtrid
));
439 bp
+= sizeof(argp
->gtrid
);
440 memcpy(&argp
->bqual
, bp
, sizeof(argp
->bqual
));
441 bp
+= sizeof(argp
->bqual
);
442 memcpy(&argp
->begin_lsn
, bp
, sizeof(argp
->begin_lsn
));
443 bp
+= sizeof(argp
->begin_lsn
);
449 * PUBLIC: int __txn_child_log
450 * PUBLIC: __P((DB_LOG *, DB_TXN *, DB_LSN *, u_int32_t,
451 * PUBLIC: u_int32_t, u_int32_t));
453 int __txn_child_log(logp
, txnid
, ret_lsnp
, flags
,
463 DB_LSN
*lsnp
, null_lsn
;
464 u_int32_t rectype
, txn_num
;
468 rectype
= DB_txn_child
;
469 txn_num
= txnid
== NULL
? 0 : txnid
->txnid
;
474 lsnp
= &txnid
->last_lsn
;
475 logrec
.size
= sizeof(rectype
) + sizeof(txn_num
) + sizeof(DB_LSN
)
478 if ((ret
= __os_malloc(logrec
.size
, NULL
, &logrec
.data
)) != 0)
482 memcpy(bp
, &rectype
, sizeof(rectype
));
483 bp
+= sizeof(rectype
);
484 memcpy(bp
, &txn_num
, sizeof(txn_num
));
485 bp
+= sizeof(txn_num
);
486 memcpy(bp
, lsnp
, sizeof(DB_LSN
));
487 bp
+= sizeof(DB_LSN
);
488 memcpy(bp
, &opcode
, sizeof(opcode
));
489 bp
+= sizeof(opcode
);
490 memcpy(bp
, &parent
, sizeof(parent
));
491 bp
+= sizeof(parent
);
493 if ((u_int32_t
)(bp
- (u_int8_t
*)logrec
.data
) != logrec
.size
)
494 fprintf(stderr
, "Error in log record length");
496 ret
= log_put(logp
, ret_lsnp
, (DBT
*)&logrec
, flags
);
498 txnid
->last_lsn
= *ret_lsnp
;
499 __os_free(logrec
.data
, 0);
504 * PUBLIC: int __txn_child_print
505 * PUBLIC: __P((DB_LOG *, DBT *, DB_LSN *, int, void *));
508 __txn_child_print(notused1
, dbtp
, lsnp
, notused2
, notused3
)
515 __txn_child_args
*argp
;
526 if ((ret
= __txn_child_read(dbtp
->data
, &argp
)) != 0)
528 printf("[%lu][%lu]txn_child: rec: %lu txnid %lx prevlsn [%lu][%lu]\n",
530 (u_long
)lsnp
->offset
,
532 (u_long
)argp
->txnid
->txnid
,
533 (u_long
)argp
->prev_lsn
.file
,
534 (u_long
)argp
->prev_lsn
.offset
);
535 printf("\topcode: %lu\n", (u_long
)argp
->opcode
);
536 printf("\tparent: %lu\n", (u_long
)argp
->parent
);
543 * PUBLIC: int __txn_child_read __P((void *, __txn_child_args **));
546 __txn_child_read(recbuf
, argpp
)
548 __txn_child_args
**argpp
;
550 __txn_child_args
*argp
;
554 ret
= __os_malloc(sizeof(__txn_child_args
) +
555 sizeof(DB_TXN
), NULL
, &argp
);
558 argp
->txnid
= (DB_TXN
*)&argp
[1];
560 memcpy(&argp
->type
, bp
, sizeof(argp
->type
));
561 bp
+= sizeof(argp
->type
);
562 memcpy(&argp
->txnid
->txnid
, bp
, sizeof(argp
->txnid
->txnid
));
563 bp
+= sizeof(argp
->txnid
->txnid
);
564 memcpy(&argp
->prev_lsn
, bp
, sizeof(DB_LSN
));
565 bp
+= sizeof(DB_LSN
);
566 memcpy(&argp
->opcode
, bp
, sizeof(argp
->opcode
));
567 bp
+= sizeof(argp
->opcode
);
568 memcpy(&argp
->parent
, bp
, sizeof(argp
->parent
));
569 bp
+= sizeof(argp
->parent
);
575 * PUBLIC: int __txn_init_print __P((DB_ENV *));
578 __txn_init_print(dbenv
)
583 if ((ret
= __db_add_recovery(dbenv
,
584 __txn_regop_print
, DB_txn_regop
)) != 0)
586 if ((ret
= __db_add_recovery(dbenv
,
587 __txn_ckp_print
, DB_txn_ckp
)) != 0)
589 if ((ret
= __db_add_recovery(dbenv
,
590 __txn_xa_regop_print
, DB_txn_xa_regop
)) != 0)
592 if ((ret
= __db_add_recovery(dbenv
,
593 __txn_child_print
, DB_txn_child
)) != 0)
599 * PUBLIC: int __txn_init_recover __P((DB_ENV *));
602 __txn_init_recover(dbenv
)
607 if ((ret
= __db_add_recovery(dbenv
,
608 __txn_regop_recover
, DB_txn_regop
)) != 0)
610 if ((ret
= __db_add_recovery(dbenv
,
611 __txn_ckp_recover
, DB_txn_ckp
)) != 0)
613 if ((ret
= __db_add_recovery(dbenv
,
614 __txn_xa_regop_recover
, DB_txn_xa_regop
)) != 0)
616 if ((ret
= __db_add_recovery(dbenv
,
617 __txn_child_recover
, DB_txn_child
)) != 0)