1 /* Do not edit: automatically built by dist/db_gen.sh. */
4 #ifndef NO_SYSTEM_INCLUDES
15 #include "db_dispatch.h"
19 * PUBLIC: int __log_register_log
20 * PUBLIC: __P((DB_LOG *, DB_TXN *, DB_LSN *, u_int32_t,
21 * PUBLIC: u_int32_t, const DBT *, const DBT *, u_int32_t,
24 int __log_register_log(logp
, txnid
, ret_lsnp
, flags
,
25 opcode
, name
, uid
, id
, ftype
)
37 DB_LSN
*lsnp
, null_lsn
;
39 u_int32_t rectype
, txn_num
;
43 rectype
= DB_log_register
;
44 txn_num
= txnid
== NULL
? 0 : txnid
->txnid
;
50 lsnp
= &txnid
->last_lsn
;
51 logrec
.size
= sizeof(rectype
) + sizeof(txn_num
) + sizeof(DB_LSN
)
53 + sizeof(u_int32_t
) + (name
== NULL
? 0 : name
->size
)
54 + sizeof(u_int32_t
) + (uid
== NULL
? 0 : uid
->size
)
57 if ((logrec
.data
= (void *)__db_malloc(logrec
.size
)) == NULL
)
61 memcpy(bp
, &rectype
, sizeof(rectype
));
62 bp
+= sizeof(rectype
);
63 memcpy(bp
, &txn_num
, sizeof(txn_num
));
64 bp
+= sizeof(txn_num
);
65 memcpy(bp
, lsnp
, sizeof(DB_LSN
));
67 memcpy(bp
, &opcode
, sizeof(opcode
));
71 memcpy(bp
, &zero
, sizeof(u_int32_t
));
72 bp
+= sizeof(u_int32_t
);
74 memcpy(bp
, &name
->size
, sizeof(name
->size
));
75 bp
+= sizeof(name
->size
);
76 memcpy(bp
, name
->data
, name
->size
);
81 memcpy(bp
, &zero
, sizeof(u_int32_t
));
82 bp
+= sizeof(u_int32_t
);
84 memcpy(bp
, &uid
->size
, sizeof(uid
->size
));
85 bp
+= sizeof(uid
->size
);
86 memcpy(bp
, uid
->data
, uid
->size
);
89 memcpy(bp
, &id
, sizeof(id
));
91 memcpy(bp
, &ftype
, sizeof(ftype
));
94 if ((u_int32_t
)(bp
- (u_int8_t
*)logrec
.data
) != logrec
.size
)
95 fprintf(stderr
, "Error in log record length");
97 ret
= __log_put(logp
, ret_lsnp
, (DBT
*)&logrec
, flags
);
99 txnid
->last_lsn
= *ret_lsnp
;
100 __db_free(logrec
.data
);
105 * PUBLIC: int __log_register_print
106 * PUBLIC: __P((DB_LOG *, DBT *, DB_LSN *, int, void *));
109 __log_register_print(notused1
, dbtp
, lsnp
, notused2
, notused3
)
116 __log_register_args
*argp
;
127 if ((ret
= __log_register_read(dbtp
->data
, &argp
)) != 0)
129 printf("[%lu][%lu]log_register: rec: %lu txnid %lx prevlsn [%lu][%lu]\n",
131 (u_long
)lsnp
->offset
,
133 (u_long
)argp
->txnid
->txnid
,
134 (u_long
)argp
->prev_lsn
.file
,
135 (u_long
)argp
->prev_lsn
.offset
);
136 printf("\topcode: %lu\n", (u_long
)argp
->opcode
);
138 for (i
= 0; i
< argp
->name
.size
; i
++) {
139 ch
= ((u_int8_t
*)argp
->name
.data
)[i
];
140 if (isprint(ch
) || ch
== 0xa)
147 for (i
= 0; i
< argp
->uid
.size
; i
++) {
148 ch
= ((u_int8_t
*)argp
->uid
.data
)[i
];
149 if (isprint(ch
) || ch
== 0xa)
155 printf("\tid: %lu\n", (u_long
)argp
->id
);
156 printf("\tftype: 0x%lx\n", (u_long
)argp
->ftype
);
163 * PUBLIC: int __log_register_read __P((void *, __log_register_args **));
166 __log_register_read(recbuf
, argpp
)
168 __log_register_args
**argpp
;
170 __log_register_args
*argp
;
173 argp
= (__log_register_args
*)__db_malloc(sizeof(__log_register_args
) +
177 argp
->txnid
= (DB_TXN
*)&argp
[1];
179 memcpy(&argp
->type
, bp
, sizeof(argp
->type
));
180 bp
+= sizeof(argp
->type
);
181 memcpy(&argp
->txnid
->txnid
, bp
, sizeof(argp
->txnid
->txnid
));
182 bp
+= sizeof(argp
->txnid
->txnid
);
183 memcpy(&argp
->prev_lsn
, bp
, sizeof(DB_LSN
));
184 bp
+= sizeof(DB_LSN
);
185 memcpy(&argp
->opcode
, bp
, sizeof(argp
->opcode
));
186 bp
+= sizeof(argp
->opcode
);
187 memcpy(&argp
->name
.size
, bp
, sizeof(u_int32_t
));
188 bp
+= sizeof(u_int32_t
);
189 argp
->name
.data
= bp
;
190 bp
+= argp
->name
.size
;
191 memcpy(&argp
->uid
.size
, bp
, sizeof(u_int32_t
));
192 bp
+= sizeof(u_int32_t
);
194 bp
+= argp
->uid
.size
;
195 memcpy(&argp
->id
, bp
, sizeof(argp
->id
));
196 bp
+= sizeof(argp
->id
);
197 memcpy(&argp
->ftype
, bp
, sizeof(argp
->ftype
));
198 bp
+= sizeof(argp
->ftype
);
204 * PUBLIC: int __log_init_print __P((DB_ENV *));
207 __log_init_print(dbenv
)
212 if ((ret
= __db_add_recovery(dbenv
,
213 __log_register_print
, DB_log_register
)) != 0)
219 * PUBLIC: int __log_init_recover __P((DB_ENV *));
222 __log_init_recover(dbenv
)
227 if ((ret
= __db_add_recovery(dbenv
,
228 __log_register_recover
, DB_log_register
)) != 0)