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

« back to all changes in this revision

Viewing changes to libdb/btree/bt_conv.c

  • 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
 
/*-
2
 
 * See the file LICENSE for redistribution information.
3
 
 *
4
 
 * Copyright (c) 1996-2002
5
 
 *      Sleepycat Software.  All rights reserved.
6
 
 */
7
 
 
8
 
#include "db_config.h"
9
 
 
10
 
#ifndef lint
11
 
static const char revid[] = "$Id$";
12
 
#endif /* not lint */
13
 
 
14
 
#ifndef NO_SYSTEM_INCLUDES
15
 
#include <sys/types.h>
16
 
#endif
17
 
 
18
 
#include "db_int.h"
19
 
#include "dbinc/db_page.h"
20
 
#include "dbinc/db_swap.h"
21
 
#include "dbinc/btree.h"
22
 
 
23
 
/*
24
 
 * __bam_pgin --
25
 
 *      Convert host-specific page layout from the host-independent format
26
 
 *      stored on disk.
27
 
 *
28
 
 * PUBLIC: int __bam_pgin __P((DB_ENV *, DB *, db_pgno_t, void *, DBT *));
29
 
 */
30
 
int
31
 
__bam_pgin(dbenv, dummydbp, pg, pp, cookie)
32
 
        DB_ENV *dbenv;
33
 
        DB *dummydbp;
34
 
        db_pgno_t pg;
35
 
        void *pp;
36
 
        DBT *cookie;
37
 
{
38
 
        DB_PGINFO *pginfo;
39
 
        PAGE *h;
40
 
 
41
 
        pginfo = (DB_PGINFO *)cookie->data;
42
 
        if (!F_ISSET(pginfo, DB_AM_SWAP))
43
 
                return (0);
44
 
 
45
 
        h = pp;
46
 
        return (TYPE(h) == P_BTREEMETA ?  __bam_mswap(pp) :
47
 
            __db_byteswap(dbenv, dummydbp, pg, pp, pginfo->db_pagesize, 1));
48
 
}
49
 
 
50
 
/*
51
 
 * __bam_pgout --
52
 
 *      Convert host-specific page layout to the host-independent format
53
 
 *      stored on disk.
54
 
 *
55
 
 * PUBLIC: int __bam_pgout __P((DB_ENV *, DB *, db_pgno_t, void *, DBT *));
56
 
 */
57
 
int
58
 
__bam_pgout(dbenv, dummydbp, pg, pp, cookie)
59
 
        DB_ENV *dbenv;
60
 
        DB *dummydbp;
61
 
        db_pgno_t pg;
62
 
        void *pp;
63
 
        DBT *cookie;
64
 
{
65
 
        DB_PGINFO *pginfo;
66
 
        PAGE *h;
67
 
 
68
 
        pginfo = (DB_PGINFO *)cookie->data;
69
 
        if (!F_ISSET(pginfo, DB_AM_SWAP))
70
 
                return (0);
71
 
 
72
 
        h = pp;
73
 
        return (TYPE(h) == P_BTREEMETA ?  __bam_mswap(pp) :
74
 
            __db_byteswap(dbenv, dummydbp, pg, pp, pginfo->db_pagesize, 0));
75
 
}
76
 
 
77
 
/*
78
 
 * __bam_mswap --
79
 
 *      Swap the bytes on the btree metadata page.
80
 
 *
81
 
 * PUBLIC: int __bam_mswap __P((PAGE *));
82
 
 */
83
 
int
84
 
__bam_mswap(pg)
85
 
        PAGE *pg;
86
 
{
87
 
        u_int8_t *p;
88
 
 
89
 
        __db_metaswap(pg);
90
 
 
91
 
        p = (u_int8_t *)pg + sizeof(DBMETA);
92
 
 
93
 
        SWAP32(p);              /* maxkey */
94
 
        SWAP32(p);              /* minkey */
95
 
        SWAP32(p);              /* re_len */
96
 
        SWAP32(p);              /* re_pad */
97
 
        SWAP32(p);              /* root */
98
 
        p += 92 * sizeof(u_int32_t); /* unused */
99
 
        SWAP32(p);              /* crypto_magic */
100
 
 
101
 
        return (0);
102
 
}