Change BSD-2.0 to BSD-3-Clause
[platform/upstream/db4.git] / txn / txn_autop.c
1 /* Do not edit: automatically built by gen_rec.awk. */
2
3 #include "db_config.h"
4
5 #include "db_int.h"
6 #include "dbinc/crypto.h"
7 #include "dbinc/db_page.h"
8 #include "dbinc/db_dispatch.h"
9 #include "dbinc/db_am.h"
10 #include "dbinc/lock.h"
11 #include "dbinc/log.h"
12 #include "dbinc/txn.h"
13
14 /*
15  * PUBLIC: int __txn_regop_42_print __P((ENV *, DBT *, DB_LSN *,
16  * PUBLIC:     db_recops, void *));
17  */
18 int
19 __txn_regop_42_print(env, dbtp, lsnp, notused2, notused3)
20         ENV *env;
21         DBT *dbtp;
22         DB_LSN *lsnp;
23         db_recops notused2;
24         void *notused3;
25 {
26         __txn_regop_42_args *argp;
27         struct tm *lt;
28         time_t timeval;
29         char time_buf[CTIME_BUFLEN];
30         int ret;
31
32         notused2 = DB_TXN_PRINT;
33         notused3 = NULL;
34
35         if ((ret = __txn_regop_42_read(env, dbtp->data, &argp)) != 0)
36                 return (ret);
37         (void)printf(
38     "[%lu][%lu]__txn_regop_42%s: rec: %lu txnp %lx prevlsn [%lu][%lu]\n",
39             (u_long)lsnp->file, (u_long)lsnp->offset,
40             (argp->type & DB_debug_FLAG) ? "_debug" : "",
41             (u_long)argp->type,
42             (u_long)argp->txnp->txnid,
43             (u_long)argp->prev_lsn.file, (u_long)argp->prev_lsn.offset);
44         (void)printf("\topcode: %lu\n", (u_long)argp->opcode);
45         timeval = (time_t)argp->timestamp;
46         lt = localtime(&timeval);
47         (void)printf(
48             "\ttimestamp: %ld (%.24s, 20%02lu%02lu%02lu%02lu%02lu.%02lu)\n",
49             (long)argp->timestamp, __os_ctime(&timeval, time_buf),
50             (u_long)lt->tm_year - 100, (u_long)lt->tm_mon+1,
51             (u_long)lt->tm_mday, (u_long)lt->tm_hour,
52             (u_long)lt->tm_min, (u_long)lt->tm_sec);
53         (void)printf("\tlocks: \n");
54         __lock_list_print(env, &argp->locks);
55         (void)printf("\n");
56         __os_free(env, argp);
57         return (0);
58 }
59
60 /*
61  * PUBLIC: int __txn_regop_print __P((ENV *, DBT *, DB_LSN *,
62  * PUBLIC:     db_recops, void *));
63  */
64 int
65 __txn_regop_print(env, dbtp, lsnp, notused2, notused3)
66         ENV *env;
67         DBT *dbtp;
68         DB_LSN *lsnp;
69         db_recops notused2;
70         void *notused3;
71 {
72         __txn_regop_args *argp;
73         struct tm *lt;
74         time_t timeval;
75         char time_buf[CTIME_BUFLEN];
76         int ret;
77
78         notused2 = DB_TXN_PRINT;
79         notused3 = NULL;
80
81         if ((ret = __txn_regop_read(env, dbtp->data, &argp)) != 0)
82                 return (ret);
83         (void)printf(
84     "[%lu][%lu]__txn_regop%s: rec: %lu txnp %lx prevlsn [%lu][%lu]\n",
85             (u_long)lsnp->file, (u_long)lsnp->offset,
86             (argp->type & DB_debug_FLAG) ? "_debug" : "",
87             (u_long)argp->type,
88             (u_long)argp->txnp->txnid,
89             (u_long)argp->prev_lsn.file, (u_long)argp->prev_lsn.offset);
90         (void)printf("\topcode: %lu\n", (u_long)argp->opcode);
91         timeval = (time_t)argp->timestamp;
92         lt = localtime(&timeval);
93         (void)printf(
94             "\ttimestamp: %ld (%.24s, 20%02lu%02lu%02lu%02lu%02lu.%02lu)\n",
95             (long)argp->timestamp, __os_ctime(&timeval, time_buf),
96             (u_long)lt->tm_year - 100, (u_long)lt->tm_mon+1,
97             (u_long)lt->tm_mday, (u_long)lt->tm_hour,
98             (u_long)lt->tm_min, (u_long)lt->tm_sec);
99         (void)printf("\tenvid: %lu\n", (u_long)argp->envid);
100         (void)printf("\tlocks: \n");
101         __lock_list_print(env, &argp->locks);
102         (void)printf("\n");
103         __os_free(env, argp);
104         return (0);
105 }
106
107 /*
108  * PUBLIC: int __txn_ckp_42_print __P((ENV *, DBT *, DB_LSN *,
109  * PUBLIC:     db_recops, void *));
110  */
111 int
112 __txn_ckp_42_print(env, dbtp, lsnp, notused2, notused3)
113         ENV *env;
114         DBT *dbtp;
115         DB_LSN *lsnp;
116         db_recops notused2;
117         void *notused3;
118 {
119         __txn_ckp_42_args *argp;
120         struct tm *lt;
121         time_t timeval;
122         char time_buf[CTIME_BUFLEN];
123         int ret;
124
125         notused2 = DB_TXN_PRINT;
126         notused3 = NULL;
127
128         if ((ret = __txn_ckp_42_read(env, dbtp->data, &argp)) != 0)
129                 return (ret);
130         (void)printf(
131     "[%lu][%lu]__txn_ckp_42%s: rec: %lu txnp %lx prevlsn [%lu][%lu]\n",
132             (u_long)lsnp->file, (u_long)lsnp->offset,
133             (argp->type & DB_debug_FLAG) ? "_debug" : "",
134             (u_long)argp->type,
135             (u_long)argp->txnp->txnid,
136             (u_long)argp->prev_lsn.file, (u_long)argp->prev_lsn.offset);
137         (void)printf("\tckp_lsn: [%lu][%lu]\n",
138             (u_long)argp->ckp_lsn.file, (u_long)argp->ckp_lsn.offset);
139         (void)printf("\tlast_ckp: [%lu][%lu]\n",
140             (u_long)argp->last_ckp.file, (u_long)argp->last_ckp.offset);
141         timeval = (time_t)argp->timestamp;
142         lt = localtime(&timeval);
143         (void)printf(
144             "\ttimestamp: %ld (%.24s, 20%02lu%02lu%02lu%02lu%02lu.%02lu)\n",
145             (long)argp->timestamp, __os_ctime(&timeval, time_buf),
146             (u_long)lt->tm_year - 100, (u_long)lt->tm_mon+1,
147             (u_long)lt->tm_mday, (u_long)lt->tm_hour,
148             (u_long)lt->tm_min, (u_long)lt->tm_sec);
149         (void)printf("\trep_gen: %lu\n", (u_long)argp->rep_gen);
150         (void)printf("\n");
151         __os_free(env, argp);
152         return (0);
153 }
154
155 /*
156  * PUBLIC: int __txn_ckp_print __P((ENV *, DBT *, DB_LSN *,
157  * PUBLIC:     db_recops, void *));
158  */
159 int
160 __txn_ckp_print(env, dbtp, lsnp, notused2, notused3)
161         ENV *env;
162         DBT *dbtp;
163         DB_LSN *lsnp;
164         db_recops notused2;
165         void *notused3;
166 {
167         __txn_ckp_args *argp;
168         struct tm *lt;
169         time_t timeval;
170         char time_buf[CTIME_BUFLEN];
171         int ret;
172
173         notused2 = DB_TXN_PRINT;
174         notused3 = NULL;
175
176         if ((ret = __txn_ckp_read(env, dbtp->data, &argp)) != 0)
177                 return (ret);
178         (void)printf(
179     "[%lu][%lu]__txn_ckp%s: rec: %lu txnp %lx prevlsn [%lu][%lu]\n",
180             (u_long)lsnp->file, (u_long)lsnp->offset,
181             (argp->type & DB_debug_FLAG) ? "_debug" : "",
182             (u_long)argp->type,
183             (u_long)argp->txnp->txnid,
184             (u_long)argp->prev_lsn.file, (u_long)argp->prev_lsn.offset);
185         (void)printf("\tckp_lsn: [%lu][%lu]\n",
186             (u_long)argp->ckp_lsn.file, (u_long)argp->ckp_lsn.offset);
187         (void)printf("\tlast_ckp: [%lu][%lu]\n",
188             (u_long)argp->last_ckp.file, (u_long)argp->last_ckp.offset);
189         timeval = (time_t)argp->timestamp;
190         lt = localtime(&timeval);
191         (void)printf(
192             "\ttimestamp: %ld (%.24s, 20%02lu%02lu%02lu%02lu%02lu.%02lu)\n",
193             (long)argp->timestamp, __os_ctime(&timeval, time_buf),
194             (u_long)lt->tm_year - 100, (u_long)lt->tm_mon+1,
195             (u_long)lt->tm_mday, (u_long)lt->tm_hour,
196             (u_long)lt->tm_min, (u_long)lt->tm_sec);
197         (void)printf("\tenvid: %lu\n", (u_long)argp->envid);
198         (void)printf("\tspare: %lu\n", (u_long)argp->spare);
199         (void)printf("\n");
200         __os_free(env, argp);
201         return (0);
202 }
203
204 /*
205  * PUBLIC: int __txn_child_print __P((ENV *, DBT *, DB_LSN *,
206  * PUBLIC:     db_recops, void *));
207  */
208 int
209 __txn_child_print(env, dbtp, lsnp, notused2, notused3)
210         ENV *env;
211         DBT *dbtp;
212         DB_LSN *lsnp;
213         db_recops notused2;
214         void *notused3;
215 {
216         __txn_child_args *argp;
217         int ret;
218
219         notused2 = DB_TXN_PRINT;
220         notused3 = NULL;
221
222         if ((ret = __txn_child_read(env, dbtp->data, &argp)) != 0)
223                 return (ret);
224         (void)printf(
225     "[%lu][%lu]__txn_child%s: rec: %lu txnp %lx prevlsn [%lu][%lu]\n",
226             (u_long)lsnp->file, (u_long)lsnp->offset,
227             (argp->type & DB_debug_FLAG) ? "_debug" : "",
228             (u_long)argp->type,
229             (u_long)argp->txnp->txnid,
230             (u_long)argp->prev_lsn.file, (u_long)argp->prev_lsn.offset);
231         (void)printf("\tchild: 0x%lx\n", (u_long)argp->child);
232         (void)printf("\tc_lsn: [%lu][%lu]\n",
233             (u_long)argp->c_lsn.file, (u_long)argp->c_lsn.offset);
234         (void)printf("\n");
235         __os_free(env, argp);
236         return (0);
237 }
238
239 /*
240  * PUBLIC: int __txn_xa_regop_42_print __P((ENV *, DBT *, DB_LSN *,
241  * PUBLIC:     db_recops, void *));
242  */
243 int
244 __txn_xa_regop_42_print(env, dbtp, lsnp, notused2, notused3)
245         ENV *env;
246         DBT *dbtp;
247         DB_LSN *lsnp;
248         db_recops notused2;
249         void *notused3;
250 {
251         __txn_xa_regop_42_args *argp;
252         u_int32_t i;
253         int ch;
254         int ret;
255
256         notused2 = DB_TXN_PRINT;
257         notused3 = NULL;
258
259         if ((ret = __txn_xa_regop_42_read(env, dbtp->data, &argp)) != 0)
260                 return (ret);
261         (void)printf(
262     "[%lu][%lu]__txn_xa_regop_42%s: rec: %lu txnp %lx prevlsn [%lu][%lu]\n",
263             (u_long)lsnp->file, (u_long)lsnp->offset,
264             (argp->type & DB_debug_FLAG) ? "_debug" : "",
265             (u_long)argp->type,
266             (u_long)argp->txnp->txnid,
267             (u_long)argp->prev_lsn.file, (u_long)argp->prev_lsn.offset);
268         (void)printf("\topcode: %lu\n", (u_long)argp->opcode);
269         (void)printf("\txid: ");
270         for (i = 0; i < argp->xid.size; i++) {
271                 ch = ((u_int8_t *)argp->xid.data)[i];
272                 printf(isprint(ch) || ch == 0x0a ? "%c" : "%#x ", ch);
273         }
274         (void)printf("\n");
275         (void)printf("\tformatID: %ld\n", (long)argp->formatID);
276         (void)printf("\tgtrid: %lu\n", (u_long)argp->gtrid);
277         (void)printf("\tbqual: %lu\n", (u_long)argp->bqual);
278         (void)printf("\tbegin_lsn: [%lu][%lu]\n",
279             (u_long)argp->begin_lsn.file, (u_long)argp->begin_lsn.offset);
280         (void)printf("\tlocks: \n");
281         __lock_list_print(env, &argp->locks);
282         (void)printf("\n");
283         __os_free(env, argp);
284         return (0);
285 }
286
287 /*
288  * PUBLIC: int __txn_prepare_print __P((ENV *, DBT *, DB_LSN *,
289  * PUBLIC:     db_recops, void *));
290  */
291 int
292 __txn_prepare_print(env, dbtp, lsnp, notused2, notused3)
293         ENV *env;
294         DBT *dbtp;
295         DB_LSN *lsnp;
296         db_recops notused2;
297         void *notused3;
298 {
299         __txn_prepare_args *argp;
300         u_int32_t i;
301         int ch;
302         int ret;
303
304         notused2 = DB_TXN_PRINT;
305         notused3 = NULL;
306
307         if ((ret = __txn_prepare_read(env, dbtp->data, &argp)) != 0)
308                 return (ret);
309         (void)printf(
310     "[%lu][%lu]__txn_prepare%s: rec: %lu txnp %lx prevlsn [%lu][%lu]\n",
311             (u_long)lsnp->file, (u_long)lsnp->offset,
312             (argp->type & DB_debug_FLAG) ? "_debug" : "",
313             (u_long)argp->type,
314             (u_long)argp->txnp->txnid,
315             (u_long)argp->prev_lsn.file, (u_long)argp->prev_lsn.offset);
316         (void)printf("\topcode: %lu\n", (u_long)argp->opcode);
317         (void)printf("\tgid: ");
318         for (i = 0; i < argp->gid.size; i++) {
319                 ch = ((u_int8_t *)argp->gid.data)[i];
320                 printf(isprint(ch) || ch == 0x0a ? "%c" : "%#x ", ch);
321         }
322         (void)printf("\n");
323         (void)printf("\tbegin_lsn: [%lu][%lu]\n",
324             (u_long)argp->begin_lsn.file, (u_long)argp->begin_lsn.offset);
325         (void)printf("\tlocks: \n");
326         __lock_list_print(env, &argp->locks);
327         (void)printf("\n");
328         __os_free(env, argp);
329         return (0);
330 }
331
332 /*
333  * PUBLIC: int __txn_recycle_print __P((ENV *, DBT *, DB_LSN *,
334  * PUBLIC:     db_recops, void *));
335  */
336 int
337 __txn_recycle_print(env, dbtp, lsnp, notused2, notused3)
338         ENV *env;
339         DBT *dbtp;
340         DB_LSN *lsnp;
341         db_recops notused2;
342         void *notused3;
343 {
344         __txn_recycle_args *argp;
345         int ret;
346
347         notused2 = DB_TXN_PRINT;
348         notused3 = NULL;
349
350         if ((ret = __txn_recycle_read(env, dbtp->data, &argp)) != 0)
351                 return (ret);
352         (void)printf(
353     "[%lu][%lu]__txn_recycle%s: rec: %lu txnp %lx prevlsn [%lu][%lu]\n",
354             (u_long)lsnp->file, (u_long)lsnp->offset,
355             (argp->type & DB_debug_FLAG) ? "_debug" : "",
356             (u_long)argp->type,
357             (u_long)argp->txnp->txnid,
358             (u_long)argp->prev_lsn.file, (u_long)argp->prev_lsn.offset);
359         (void)printf("\tmin: %lu\n", (u_long)argp->min);
360         (void)printf("\tmax: %lu\n", (u_long)argp->max);
361         (void)printf("\n");
362         __os_free(env, argp);
363         return (0);
364 }
365
366 /*
367  * PUBLIC: int __txn_init_print __P((ENV *, DB_DISTAB *));
368  */
369 int
370 __txn_init_print(env, dtabp)
371         ENV *env;
372         DB_DISTAB *dtabp;
373 {
374         int ret;
375
376         if ((ret = __db_add_recovery_int(env, dtabp,
377             __txn_regop_print, DB___txn_regop)) != 0)
378                 return (ret);
379         if ((ret = __db_add_recovery_int(env, dtabp,
380             __txn_ckp_print, DB___txn_ckp)) != 0)
381                 return (ret);
382         if ((ret = __db_add_recovery_int(env, dtabp,
383             __txn_child_print, DB___txn_child)) != 0)
384                 return (ret);
385         if ((ret = __db_add_recovery_int(env, dtabp,
386             __txn_prepare_print, DB___txn_prepare)) != 0)
387                 return (ret);
388         if ((ret = __db_add_recovery_int(env, dtabp,
389             __txn_recycle_print, DB___txn_recycle)) != 0)
390                 return (ret);
391         return (0);
392 }