~ubuntu-branches/ubuntu/maverick/evolution-data-server/maverick-proposed

« back to all changes in this revision

Viewing changes to libdb/dist/template/rec_qam

  • 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/__qam.h"
12
 
#include "dbinc/log.h"
13
 
 
14
 
/*
15
 
 * __qam_incfirst_recover --
16
 
 *      Recovery function for incfirst.
17
 
 *
18
 
 * PUBLIC: int __qam_incfirst_recover
19
 
 * PUBLIC:   __P((DB_ENV *, DBT *, DB_LSN *, db_recops, void *));
20
 
 */
21
 
int
22
 
__qam_incfirst_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
 
        __qam_incfirst_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(__qam_incfirst_print);
37
 
        REC_INTRO(__qam_incfirst_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
 
 * __qam_mvptr_recover --
78
 
 *      Recovery function for mvptr.
79
 
 *
80
 
 * PUBLIC: int __qam_mvptr_recover
81
 
 * PUBLIC:   __P((DB_ENV *, DBT *, DB_LSN *, db_recops, void *));
82
 
 */
83
 
int
84
 
__qam_mvptr_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
 
        __qam_mvptr_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(__qam_mvptr_print);
99
 
        REC_INTRO(__qam_mvptr_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
 
 * __qam_del_recover --
140
 
 *      Recovery function for del.
141
 
 *
142
 
 * PUBLIC: int __qam_del_recover
143
 
 * PUBLIC:   __P((DB_ENV *, DBT *, DB_LSN *, db_recops, void *));
144
 
 */
145
 
int
146
 
__qam_del_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
 
        __qam_del_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(__qam_del_print);
161
 
        REC_INTRO(__qam_del_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
 
 * __qam_add_recover --
202
 
 *      Recovery function for add.
203
 
 *
204
 
 * PUBLIC: int __qam_add_recover
205
 
 * PUBLIC:   __P((DB_ENV *, DBT *, DB_LSN *, db_recops, void *));
206
 
 */
207
 
int
208
 
__qam_add_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
 
        __qam_add_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(__qam_add_print);
223
 
        REC_INTRO(__qam_add_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
 
 * __qam_delext_recover --
264
 
 *      Recovery function for delext.
265
 
 *
266
 
 * PUBLIC: int __qam_delext_recover
267
 
 * PUBLIC:   __P((DB_ENV *, DBT *, DB_LSN *, db_recops, void *));
268
 
 */
269
 
int
270
 
__qam_delext_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
 
        __qam_delext_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(__qam_delext_print);
285
 
        REC_INTRO(__qam_delext_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