~ubuntu-branches/ubuntu/natty/evolution-data-server/natty

« back to all changes in this revision

Viewing changes to libdb/dist/template/rec_db

  • Committer: Bazaar Package Importer
  • Author(s): Didier Roche
  • Date: 2010-05-17 17:02:06 UTC
  • mfrom: (1.1.79 upstream) (1.6.12 experimental)
  • Revision ID: james.westby@ubuntu.com-20100517170206-4ufr52vwrhh26yh0
Tags: 2.30.1-1ubuntu1
* Merge from debian experimental. Remaining change:
  (LP: #42199, #229669, #173703, #360344, #508494)
  + debian/control:
    - add Vcs-Bzr tag
    - don't use libgnome
    - Use Breaks instead of Conflicts against evolution 2.25 and earlier.
  + debian/evolution-data-server.install,
    debian/patches/45_libcamel_providers_version.patch:
    - use the upstream versioning, not a Debian-specific one 
  + debian/libedata-book1.2-dev.install, debian/libebackend-1.2-dev.install,
    debian/libcamel1.2-dev.install, debian/libedataserverui1.2-dev.install:
    - install html documentation
  + debian/rules:
    - don't build documentation it's shipped with the tarball

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
#include "db_config.h"
2
 
 
3
 
#ifndef NO_SYSTEM_INCLUDES
4
 
#include <sys/types.h>
5
 
 
6
 
#include <string.h>
7
 
#endif
8
 
 
9
 
#include "db_int.h"
10
 
#include "dbinc/db_page.h"
11
 
#include "dbinc/__db.h"
12
 
#include "dbinc/log.h"
13
 
 
14
 
/*
15
 
 * __db_addrem_recover --
16
 
 *      Recovery function for addrem.
17
 
 *
18
 
 * PUBLIC: int __db_addrem_recover
19
 
 * PUBLIC:   __P((DB_ENV *, DBT *, DB_LSN *, db_recops, void *));
20
 
 */
21
 
int
22
 
__db_addrem_recover(dbenv, dbtp, lsnp, op, info)
23
 
        DB_ENV *dbenv;
24
 
        DBT *dbtp;
25
 
        DB_LSN *lsnp;
26
 
        db_recops op;
27
 
        void *info;
28
 
{
29
 
        __db_addrem_args *argp;
30
 
        DB *file_dbp;
31
 
        DBC *dbc;
32
 
        DB_MPOOLFILE *mpf;
33
 
        PAGE *pagep;
34
 
        int cmp_n, cmp_p, modified, ret;
35
 
 
36
 
        REC_PRINT(__db_addrem_print);
37
 
        REC_INTRO(__db_addrem_read, 1);
38
 
 
39
 
        if ((ret = mpf->get(mpf, &argp->pgno, 0, &pagep)) != 0)
40
 
                if (DB_REDO(op)) {
41
 
                        if ((ret = mpf->get(mpf,
42
 
                            &argp->pgno, DB_MPOOL_CREATE, &pagep)) != 0)
43
 
                                goto out;
44
 
                } else {
45
 
                        *lsnp = argp->prev_lsn;
46
 
                        ret = 0;
47
 
                        goto out;
48
 
                }
49
 
 
50
 
        modified = 0;
51
 
        cmp_n = log_compare(lsnp, &LSN(pagep));
52
 
 
53
 
        /*
54
 
         * Use this when there is something like "pagelsn" in the argp
55
 
         * structure.  Sometimes, you might need to compare meta-data
56
 
         * lsn's instead.
57
 
         *
58
 
         * cmp_p = log_compare(&LSN(pagep), argp->pagelsn);
59
 
         */
60
 
        if (cmp_p == 0 && DB_REDO(op)) {
61
 
                /* Need to redo update described. */
62
 
                modified = 1;
63
 
        } else if (cmp_n == 0 && !DB_REDO(op)) {
64
 
                /* Need to undo update described. */
65
 
                modified = 1;
66
 
        }
67
 
        if (ret = mpf->put(mpf, pagep, modified ? DB_MPOOL_DIRTY : 0))
68
 
                goto out;
69
 
 
70
 
        *lsnp = argp->prev_lsn;
71
 
        ret = 0;
72
 
 
73
 
out:    REC_CLOSE;
74
 
}
75
 
 
76
 
/*
77
 
 * __db_big_recover --
78
 
 *      Recovery function for big.
79
 
 *
80
 
 * PUBLIC: int __db_big_recover
81
 
 * PUBLIC:   __P((DB_ENV *, DBT *, DB_LSN *, db_recops, void *));
82
 
 */
83
 
int
84
 
__db_big_recover(dbenv, dbtp, lsnp, op, info)
85
 
        DB_ENV *dbenv;
86
 
        DBT *dbtp;
87
 
        DB_LSN *lsnp;
88
 
        db_recops op;
89
 
        void *info;
90
 
{
91
 
        __db_big_args *argp;
92
 
        DB *file_dbp;
93
 
        DBC *dbc;
94
 
        DB_MPOOLFILE *mpf;
95
 
        PAGE *pagep;
96
 
        int cmp_n, cmp_p, modified, ret;
97
 
 
98
 
        REC_PRINT(__db_big_print);
99
 
        REC_INTRO(__db_big_read, 1);
100
 
 
101
 
        if ((ret = mpf->get(mpf, &argp->pgno, 0, &pagep)) != 0)
102
 
                if (DB_REDO(op)) {
103
 
                        if ((ret = mpf->get(mpf,
104
 
                            &argp->pgno, DB_MPOOL_CREATE, &pagep)) != 0)
105
 
                                goto out;
106
 
                } else {
107
 
                        *lsnp = argp->prev_lsn;
108
 
                        ret = 0;
109
 
                        goto out;
110
 
                }
111
 
 
112
 
        modified = 0;
113
 
        cmp_n = log_compare(lsnp, &LSN(pagep));
114
 
 
115
 
        /*
116
 
         * Use this when there is something like "pagelsn" in the argp
117
 
         * structure.  Sometimes, you might need to compare meta-data
118
 
         * lsn's instead.
119
 
         *
120
 
         * cmp_p = log_compare(&LSN(pagep), argp->pagelsn);
121
 
         */
122
 
        if (cmp_p == 0 && DB_REDO(op)) {
123
 
                /* Need to redo update described. */
124
 
                modified = 1;
125
 
        } else if (cmp_n == 0 && !DB_REDO(op)) {
126
 
                /* Need to undo update described. */
127
 
                modified = 1;
128
 
        }
129
 
        if (ret = mpf->put(mpf, pagep, modified ? DB_MPOOL_DIRTY : 0))
130
 
                goto out;
131
 
 
132
 
        *lsnp = argp->prev_lsn;
133
 
        ret = 0;
134
 
 
135
 
out:    REC_CLOSE;
136
 
}
137
 
 
138
 
/*
139
 
 * __db_ovref_recover --
140
 
 *      Recovery function for ovref.
141
 
 *
142
 
 * PUBLIC: int __db_ovref_recover
143
 
 * PUBLIC:   __P((DB_ENV *, DBT *, DB_LSN *, db_recops, void *));
144
 
 */
145
 
int
146
 
__db_ovref_recover(dbenv, dbtp, lsnp, op, info)
147
 
        DB_ENV *dbenv;
148
 
        DBT *dbtp;
149
 
        DB_LSN *lsnp;
150
 
        db_recops op;
151
 
        void *info;
152
 
{
153
 
        __db_ovref_args *argp;
154
 
        DB *file_dbp;
155
 
        DBC *dbc;
156
 
        DB_MPOOLFILE *mpf;
157
 
        PAGE *pagep;
158
 
        int cmp_n, cmp_p, modified, ret;
159
 
 
160
 
        REC_PRINT(__db_ovref_print);
161
 
        REC_INTRO(__db_ovref_read, 1);
162
 
 
163
 
        if ((ret = mpf->get(mpf, &argp->pgno, 0, &pagep)) != 0)
164
 
                if (DB_REDO(op)) {
165
 
                        if ((ret = mpf->get(mpf,
166
 
                            &argp->pgno, DB_MPOOL_CREATE, &pagep)) != 0)
167
 
                                goto out;
168
 
                } else {
169
 
                        *lsnp = argp->prev_lsn;
170
 
                        ret = 0;
171
 
                        goto out;
172
 
                }
173
 
 
174
 
        modified = 0;
175
 
        cmp_n = log_compare(lsnp, &LSN(pagep));
176
 
 
177
 
        /*
178
 
         * Use this when there is something like "pagelsn" in the argp
179
 
         * structure.  Sometimes, you might need to compare meta-data
180
 
         * lsn's instead.
181
 
         *
182
 
         * cmp_p = log_compare(&LSN(pagep), argp->pagelsn);
183
 
         */
184
 
        if (cmp_p == 0 && DB_REDO(op)) {
185
 
                /* Need to redo update described. */
186
 
                modified = 1;
187
 
        } else if (cmp_n == 0 && !DB_REDO(op)) {
188
 
                /* Need to undo update described. */
189
 
                modified = 1;
190
 
        }
191
 
        if (ret = mpf->put(mpf, pagep, modified ? DB_MPOOL_DIRTY : 0))
192
 
                goto out;
193
 
 
194
 
        *lsnp = argp->prev_lsn;
195
 
        ret = 0;
196
 
 
197
 
out:    REC_CLOSE;
198
 
}
199
 
 
200
 
/*
201
 
 * __db_relink_recover --
202
 
 *      Recovery function for relink.
203
 
 *
204
 
 * PUBLIC: int __db_relink_recover
205
 
 * PUBLIC:   __P((DB_ENV *, DBT *, DB_LSN *, db_recops, void *));
206
 
 */
207
 
int
208
 
__db_relink_recover(dbenv, dbtp, lsnp, op, info)
209
 
        DB_ENV *dbenv;
210
 
        DBT *dbtp;
211
 
        DB_LSN *lsnp;
212
 
        db_recops op;
213
 
        void *info;
214
 
{
215
 
        __db_relink_args *argp;
216
 
        DB *file_dbp;
217
 
        DBC *dbc;
218
 
        DB_MPOOLFILE *mpf;
219
 
        PAGE *pagep;
220
 
        int cmp_n, cmp_p, modified, ret;
221
 
 
222
 
        REC_PRINT(__db_relink_print);
223
 
        REC_INTRO(__db_relink_read, 1);
224
 
 
225
 
        if ((ret = mpf->get(mpf, &argp->pgno, 0, &pagep)) != 0)
226
 
                if (DB_REDO(op)) {
227
 
                        if ((ret = mpf->get(mpf,
228
 
                            &argp->pgno, DB_MPOOL_CREATE, &pagep)) != 0)
229
 
                                goto out;
230
 
                } else {
231
 
                        *lsnp = argp->prev_lsn;
232
 
                        ret = 0;
233
 
                        goto out;
234
 
                }
235
 
 
236
 
        modified = 0;
237
 
        cmp_n = log_compare(lsnp, &LSN(pagep));
238
 
 
239
 
        /*
240
 
         * Use this when there is something like "pagelsn" in the argp
241
 
         * structure.  Sometimes, you might need to compare meta-data
242
 
         * lsn's instead.
243
 
         *
244
 
         * cmp_p = log_compare(&LSN(pagep), argp->pagelsn);
245
 
         */
246
 
        if (cmp_p == 0 && DB_REDO(op)) {
247
 
                /* Need to redo update described. */
248
 
                modified = 1;
249
 
        } else if (cmp_n == 0 && !DB_REDO(op)) {
250
 
                /* Need to undo update described. */
251
 
                modified = 1;
252
 
        }
253
 
        if (ret = mpf->put(mpf, pagep, modified ? DB_MPOOL_DIRTY : 0))
254
 
                goto out;
255
 
 
256
 
        *lsnp = argp->prev_lsn;
257
 
        ret = 0;
258
 
 
259
 
out:    REC_CLOSE;
260
 
}
261
 
 
262
 
/*
263
 
 * __db_debug_recover --
264
 
 *      Recovery function for debug.
265
 
 *
266
 
 * PUBLIC: int __db_debug_recover
267
 
 * PUBLIC:   __P((DB_ENV *, DBT *, DB_LSN *, db_recops, void *));
268
 
 */
269
 
int
270
 
__db_debug_recover(dbenv, dbtp, lsnp, op, info)
271
 
        DB_ENV *dbenv;
272
 
        DBT *dbtp;
273
 
        DB_LSN *lsnp;
274
 
        db_recops op;
275
 
        void *info;
276
 
{
277
 
        __db_debug_args *argp;
278
 
        DB *file_dbp;
279
 
        DBC *dbc;
280
 
        DB_MPOOLFILE *mpf;
281
 
        PAGE *pagep;
282
 
        int cmp_n, cmp_p, modified, ret;
283
 
 
284
 
        REC_PRINT(__db_debug_print);
285
 
        REC_INTRO(__db_debug_read, 1);
286
 
 
287
 
        if ((ret = mpf->get(mpf, &argp->pgno, 0, &pagep)) != 0)
288
 
                if (DB_REDO(op)) {
289
 
                        if ((ret = mpf->get(mpf,
290
 
                            &argp->pgno, DB_MPOOL_CREATE, &pagep)) != 0)
291
 
                                goto out;
292
 
                } else {
293
 
                        *lsnp = argp->prev_lsn;
294
 
                        ret = 0;
295
 
                        goto out;
296
 
                }
297
 
 
298
 
        modified = 0;
299
 
        cmp_n = log_compare(lsnp, &LSN(pagep));
300
 
 
301
 
        /*
302
 
         * Use this when there is something like "pagelsn" in the argp
303
 
         * structure.  Sometimes, you might need to compare meta-data
304
 
         * lsn's instead.
305
 
         *
306
 
         * cmp_p = log_compare(&LSN(pagep), argp->pagelsn);
307
 
         */
308
 
        if (cmp_p == 0 && DB_REDO(op)) {
309
 
                /* Need to redo update described. */
310
 
                modified = 1;
311
 
        } else if (cmp_n == 0 && !DB_REDO(op)) {
312
 
                /* Need to undo update described. */
313
 
                modified = 1;
314
 
        }
315
 
        if (ret = mpf->put(mpf, pagep, modified ? DB_MPOOL_DIRTY : 0))
316
 
                goto out;
317
 
 
318
 
        *lsnp = argp->prev_lsn;
319
 
        ret = 0;
320
 
 
321
 
out:    REC_CLOSE;
322
 
}
323
 
 
324
 
/*
325
 
 * __db_noop_recover --
326
 
 *      Recovery function for noop.
327
 
 *
328
 
 * PUBLIC: int __db_noop_recover
329
 
 * PUBLIC:   __P((DB_ENV *, DBT *, DB_LSN *, db_recops, void *));
330
 
 */
331
 
int
332
 
__db_noop_recover(dbenv, dbtp, lsnp, op, info)
333
 
        DB_ENV *dbenv;
334
 
        DBT *dbtp;
335
 
        DB_LSN *lsnp;
336
 
        db_recops op;
337
 
        void *info;
338
 
{
339
 
        __db_noop_args *argp;
340
 
        DB *file_dbp;
341
 
        DBC *dbc;
342
 
        DB_MPOOLFILE *mpf;
343
 
        PAGE *pagep;
344
 
        int cmp_n, cmp_p, modified, ret;
345
 
 
346
 
        REC_PRINT(__db_noop_print);
347
 
        REC_INTRO(__db_noop_read, 1);
348
 
 
349
 
        if ((ret = mpf->get(mpf, &argp->pgno, 0, &pagep)) != 0)
350
 
                if (DB_REDO(op)) {
351
 
                        if ((ret = mpf->get(mpf,
352
 
                            &argp->pgno, DB_MPOOL_CREATE, &pagep)) != 0)
353
 
                                goto out;
354
 
                } else {
355
 
                        *lsnp = argp->prev_lsn;
356
 
                        ret = 0;
357
 
                        goto out;
358
 
                }
359
 
 
360
 
        modified = 0;
361
 
        cmp_n = log_compare(lsnp, &LSN(pagep));
362
 
 
363
 
        /*
364
 
         * Use this when there is something like "pagelsn" in the argp
365
 
         * structure.  Sometimes, you might need to compare meta-data
366
 
         * lsn's instead.
367
 
         *
368
 
         * cmp_p = log_compare(&LSN(pagep), argp->pagelsn);
369
 
         */
370
 
        if (cmp_p == 0 && DB_REDO(op)) {
371
 
                /* Need to redo update described. */
372
 
                modified = 1;
373
 
        } else if (cmp_n == 0 && !DB_REDO(op)) {
374
 
                /* Need to undo update described. */
375
 
                modified = 1;
376
 
        }
377
 
        if (ret = mpf->put(mpf, pagep, modified ? DB_MPOOL_DIRTY : 0))
378
 
                goto out;
379
 
 
380
 
        *lsnp = argp->prev_lsn;
381
 
        ret = 0;
382
 
 
383
 
out:    REC_CLOSE;
384
 
}
385
 
 
386
 
/*
387
 
 * __db_pg_alloc_recover --
388
 
 *      Recovery function for pg_alloc.
389
 
 *
390
 
 * PUBLIC: int __db_pg_alloc_recover
391
 
 * PUBLIC:   __P((DB_ENV *, DBT *, DB_LSN *, db_recops, void *));
392
 
 */
393
 
int
394
 
__db_pg_alloc_recover(dbenv, dbtp, lsnp, op, info)
395
 
        DB_ENV *dbenv;
396
 
        DBT *dbtp;
397
 
        DB_LSN *lsnp;
398
 
        db_recops op;
399
 
        void *info;
400
 
{
401
 
        __db_pg_alloc_args *argp;
402
 
        DB *file_dbp;
403
 
        DBC *dbc;
404
 
        DB_MPOOLFILE *mpf;
405
 
        PAGE *pagep;
406
 
        int cmp_n, cmp_p, modified, ret;
407
 
 
408
 
        REC_PRINT(__db_pg_alloc_print);
409
 
        REC_INTRO(__db_pg_alloc_read, 1);
410
 
 
411
 
        if ((ret = mpf->get(mpf, &argp->pgno, 0, &pagep)) != 0)
412
 
                if (DB_REDO(op)) {
413
 
                        if ((ret = mpf->get(mpf,
414
 
                            &argp->pgno, DB_MPOOL_CREATE, &pagep)) != 0)
415
 
                                goto out;
416
 
                } else {
417
 
                        *lsnp = argp->prev_lsn;
418
 
                        ret = 0;
419
 
                        goto out;
420
 
                }
421
 
 
422
 
        modified = 0;
423
 
        cmp_n = log_compare(lsnp, &LSN(pagep));
424
 
 
425
 
        /*
426
 
         * Use this when there is something like "pagelsn" in the argp
427
 
         * structure.  Sometimes, you might need to compare meta-data
428
 
         * lsn's instead.
429
 
         *
430
 
         * cmp_p = log_compare(&LSN(pagep), argp->pagelsn);
431
 
         */
432
 
        if (cmp_p == 0 && DB_REDO(op)) {
433
 
                /* Need to redo update described. */
434
 
                modified = 1;
435
 
        } else if (cmp_n == 0 && !DB_REDO(op)) {
436
 
                /* Need to undo update described. */
437
 
                modified = 1;
438
 
        }
439
 
        if (ret = mpf->put(mpf, pagep, modified ? DB_MPOOL_DIRTY : 0))
440
 
                goto out;
441
 
 
442
 
        *lsnp = argp->prev_lsn;
443
 
        ret = 0;
444
 
 
445
 
out:    REC_CLOSE;
446
 
}
447
 
 
448
 
/*
449
 
 * __db_pg_free_recover --
450
 
 *      Recovery function for pg_free.
451
 
 *
452
 
 * PUBLIC: int __db_pg_free_recover
453
 
 * PUBLIC:   __P((DB_ENV *, DBT *, DB_LSN *, db_recops, void *));
454
 
 */
455
 
int
456
 
__db_pg_free_recover(dbenv, dbtp, lsnp, op, info)
457
 
        DB_ENV *dbenv;
458
 
        DBT *dbtp;
459
 
        DB_LSN *lsnp;
460
 
        db_recops op;
461
 
        void *info;
462
 
{
463
 
        __db_pg_free_args *argp;
464
 
        DB *file_dbp;
465
 
        DBC *dbc;
466
 
        DB_MPOOLFILE *mpf;
467
 
        PAGE *pagep;
468
 
        int cmp_n, cmp_p, modified, ret;
469
 
 
470
 
        REC_PRINT(__db_pg_free_print);
471
 
        REC_INTRO(__db_pg_free_read, 1);
472
 
 
473
 
        if ((ret = mpf->get(mpf, &argp->pgno, 0, &pagep)) != 0)
474
 
                if (DB_REDO(op)) {
475
 
                        if ((ret = mpf->get(mpf,
476
 
                            &argp->pgno, DB_MPOOL_CREATE, &pagep)) != 0)
477
 
                                goto out;
478
 
                } else {
479
 
                        *lsnp = argp->prev_lsn;
480
 
                        ret = 0;
481
 
                        goto out;
482
 
                }
483
 
 
484
 
        modified = 0;
485
 
        cmp_n = log_compare(lsnp, &LSN(pagep));
486
 
 
487
 
        /*
488
 
         * Use this when there is something like "pagelsn" in the argp
489
 
         * structure.  Sometimes, you might need to compare meta-data
490
 
         * lsn's instead.
491
 
         *
492
 
         * cmp_p = log_compare(&LSN(pagep), argp->pagelsn);
493
 
         */
494
 
        if (cmp_p == 0 && DB_REDO(op)) {
495
 
                /* Need to redo update described. */
496
 
                modified = 1;
497
 
        } else if (cmp_n == 0 && !DB_REDO(op)) {
498
 
                /* Need to undo update described. */
499
 
                modified = 1;
500
 
        }
501
 
        if (ret = mpf->put(mpf, pagep, modified ? DB_MPOOL_DIRTY : 0))
502
 
                goto out;
503
 
 
504
 
        *lsnp = argp->prev_lsn;
505
 
        ret = 0;
506
 
 
507
 
out:    REC_CLOSE;
508
 
}
509
 
 
510
 
/*
511
 
 * __db_cksum_recover --
512
 
 *      Recovery function for cksum.
513
 
 *
514
 
 * PUBLIC: int __db_cksum_recover
515
 
 * PUBLIC:   __P((DB_ENV *, DBT *, DB_LSN *, db_recops, void *));
516
 
 */
517
 
int
518
 
__db_cksum_recover(dbenv, dbtp, lsnp, op, info)
519
 
        DB_ENV *dbenv;
520
 
        DBT *dbtp;
521
 
        DB_LSN *lsnp;
522
 
        db_recops op;
523
 
        void *info;
524
 
{
525
 
        __db_cksum_args *argp;
526
 
        DB *file_dbp;
527
 
        DBC *dbc;
528
 
        DB_MPOOLFILE *mpf;
529
 
        PAGE *pagep;
530
 
        int cmp_n, cmp_p, modified, ret;
531
 
 
532
 
        REC_PRINT(__db_cksum_print);
533
 
        REC_INTRO(__db_cksum_read, 1);
534
 
 
535
 
        if ((ret = mpf->get(mpf, &argp->pgno, 0, &pagep)) != 0)
536
 
                if (DB_REDO(op)) {
537
 
                        if ((ret = mpf->get(mpf,
538
 
                            &argp->pgno, DB_MPOOL_CREATE, &pagep)) != 0)
539
 
                                goto out;
540
 
                } else {
541
 
                        *lsnp = argp->prev_lsn;
542
 
                        ret = 0;
543
 
                        goto out;
544
 
                }
545
 
 
546
 
        modified = 0;
547
 
        cmp_n = log_compare(lsnp, &LSN(pagep));
548
 
 
549
 
        /*
550
 
         * Use this when there is something like "pagelsn" in the argp
551
 
         * structure.  Sometimes, you might need to compare meta-data
552
 
         * lsn's instead.
553
 
         *
554
 
         * cmp_p = log_compare(&LSN(pagep), argp->pagelsn);
555
 
         */
556
 
        if (cmp_p == 0 && DB_REDO(op)) {
557
 
                /* Need to redo update described. */
558
 
                modified = 1;
559
 
        } else if (cmp_n == 0 && !DB_REDO(op)) {
560
 
                /* Need to undo update described. */
561
 
                modified = 1;
562
 
        }
563
 
        if (ret = mpf->put(mpf, pagep, modified ? DB_MPOOL_DIRTY : 0))
564
 
                goto out;
565
 
 
566
 
        *lsnp = argp->prev_lsn;
567
 
        ret = 0;
568
 
 
569
 
out:    REC_CLOSE;
570
 
}
571