1 /* Do not edit: automatically built by dist/db_gen.sh. */
4 #ifndef NO_SYSTEM_INCLUDES
14 #include "db_dispatch.h"
18 * PUBLIC: int __log_register_log
19 * PUBLIC: __P((DB_LOG *, DB_TXN *, DB_LSN *, u_int32_t,
20 * PUBLIC: u_int32_t, const DBT *, const DBT *, u_int32_t,
23 int __log_register_log(logp
, txnid
, ret_lsnp
, flags
,
24 opcode
, name
, uid
, id
, ftype
)
36 DB_LSN
*lsnp
, null_lsn
;
38 u_int32_t rectype
, txn_num
;
42 rectype
= DB_log_register
;
43 txn_num
= txnid
== NULL
? 0 : txnid
->txnid
;
48 lsnp
= &txnid
->last_lsn
;
49 logrec
.size
= sizeof(rectype
) + sizeof(txn_num
) + sizeof(DB_LSN
)
51 + sizeof(u_int32_t
) + (name
== NULL
? 0 : name
->size
)
52 + sizeof(u_int32_t
) + (uid
== NULL
? 0 : uid
->size
)
55 if ((ret
= __os_malloc(logrec
.size
, NULL
, &logrec
.data
)) != 0)
59 memcpy(bp
, &rectype
, sizeof(rectype
));
60 bp
+= sizeof(rectype
);
61 memcpy(bp
, &txn_num
, sizeof(txn_num
));
62 bp
+= sizeof(txn_num
);
63 memcpy(bp
, lsnp
, sizeof(DB_LSN
));
65 memcpy(bp
, &opcode
, sizeof(opcode
));
69 memcpy(bp
, &zero
, sizeof(u_int32_t
));
70 bp
+= sizeof(u_int32_t
);
72 memcpy(bp
, &name
->size
, sizeof(name
->size
));
73 bp
+= sizeof(name
->size
);
74 memcpy(bp
, name
->data
, name
->size
);
79 memcpy(bp
, &zero
, sizeof(u_int32_t
));
80 bp
+= sizeof(u_int32_t
);
82 memcpy(bp
, &uid
->size
, sizeof(uid
->size
));
83 bp
+= sizeof(uid
->size
);
84 memcpy(bp
, uid
->data
, uid
->size
);
87 memcpy(bp
, &id
, sizeof(id
));
89 memcpy(bp
, &ftype
, sizeof(ftype
));
92 if ((u_int32_t
)(bp
- (u_int8_t
*)logrec
.data
) != logrec
.size
)
93 fprintf(stderr
, "Error in log record length");
95 ret
= __log_put(logp
, ret_lsnp
, (DBT
*)&logrec
, flags
);
97 txnid
->last_lsn
= *ret_lsnp
;
98 __os_free(logrec
.data
, 0);
103 * PUBLIC: int __log_register_print
104 * PUBLIC: __P((DB_LOG *, DBT *, DB_LSN *, int, void *));
107 __log_register_print(notused1
, dbtp
, lsnp
, notused2
, notused3
)
114 __log_register_args
*argp
;
125 if ((ret
= __log_register_read(dbtp
->data
, &argp
)) != 0)
127 printf("[%lu][%lu]log_register: rec: %lu txnid %lx prevlsn [%lu][%lu]\n",
129 (u_long
)lsnp
->offset
,
131 (u_long
)argp
->txnid
->txnid
,
132 (u_long
)argp
->prev_lsn
.file
,
133 (u_long
)argp
->prev_lsn
.offset
);
134 printf("\topcode: %lu\n", (u_long
)argp
->opcode
);
136 for (i
= 0; i
< argp
->name
.size
; i
++) {
137 ch
= ((u_int8_t
*)argp
->name
.data
)[i
];
138 if (isprint(ch
) || ch
== 0xa)
145 for (i
= 0; i
< argp
->uid
.size
; i
++) {
146 ch
= ((u_int8_t
*)argp
->uid
.data
)[i
];
147 if (isprint(ch
) || ch
== 0xa)
153 printf("\tid: %lu\n", (u_long
)argp
->id
);
154 printf("\tftype: 0x%lx\n", (u_long
)argp
->ftype
);
161 * PUBLIC: int __log_register_read __P((void *, __log_register_args **));
164 __log_register_read(recbuf
, argpp
)
166 __log_register_args
**argpp
;
168 __log_register_args
*argp
;
172 ret
= __os_malloc(sizeof(__log_register_args
) +
173 sizeof(DB_TXN
), NULL
, &argp
);
176 argp
->txnid
= (DB_TXN
*)&argp
[1];
178 memcpy(&argp
->type
, bp
, sizeof(argp
->type
));
179 bp
+= sizeof(argp
->type
);
180 memcpy(&argp
->txnid
->txnid
, bp
, sizeof(argp
->txnid
->txnid
));
181 bp
+= sizeof(argp
->txnid
->txnid
);
182 memcpy(&argp
->prev_lsn
, bp
, sizeof(DB_LSN
));
183 bp
+= sizeof(DB_LSN
);
184 memcpy(&argp
->opcode
, bp
, sizeof(argp
->opcode
));
185 bp
+= sizeof(argp
->opcode
);
186 memcpy(&argp
->name
.size
, bp
, sizeof(u_int32_t
));
187 bp
+= sizeof(u_int32_t
);
188 argp
->name
.data
= bp
;
189 bp
+= argp
->name
.size
;
190 memcpy(&argp
->uid
.size
, bp
, sizeof(u_int32_t
));
191 bp
+= sizeof(u_int32_t
);
193 bp
+= argp
->uid
.size
;
194 memcpy(&argp
->id
, bp
, sizeof(argp
->id
));
195 bp
+= sizeof(argp
->id
);
196 memcpy(&argp
->ftype
, bp
, sizeof(argp
->ftype
));
197 bp
+= sizeof(argp
->ftype
);
203 * PUBLIC: int __log_init_print __P((DB_ENV *));
206 __log_init_print(dbenv
)
211 if ((ret
= __db_add_recovery(dbenv
,
212 __log_register_print
, DB_log_register
)) != 0)
218 * PUBLIC: int __log_init_recover __P((DB_ENV *));
221 __log_init_recover(dbenv
)
226 if ((ret
= __db_add_recovery(dbenv
,
227 __log_register_recover
, DB_log_register
)) != 0)