2 * See the file LICENSE for redistribution information.
4 * Copyright (c) 1996-2009 Oracle. All rights reserved.
12 #include "dbinc/db_page.h"
13 #include "dbinc/db_swap.h"
14 #include "dbinc/btree.h"
18 * Convert host-specific page layout from the host-independent format
21 * PUBLIC: int __bam_pgin __P((DB *, db_pgno_t, void *, DBT *));
24 __bam_pgin(dbp, pg, pp, cookie)
33 pginfo = (DB_PGINFO *)cookie->data;
34 if (!F_ISSET(pginfo, DB_AM_SWAP))
38 return (TYPE(h) == P_BTREEMETA ? __bam_mswap(dbp->env, pp) :
39 __db_byteswap(dbp, pg, pp, pginfo->db_pagesize, 1));
44 * Convert host-specific page layout to the host-independent format
47 * PUBLIC: int __bam_pgout __P((DB *, db_pgno_t, void *, DBT *));
50 __bam_pgout(dbp, pg, pp, cookie)
59 pginfo = (DB_PGINFO *)cookie->data;
60 if (!F_ISSET(pginfo, DB_AM_SWAP))
64 return (TYPE(h) == P_BTREEMETA ? __bam_mswap(dbp->env, pp) :
65 __db_byteswap(dbp, pg, pp, pginfo->db_pagesize, 0));
70 * Swap the bytes on the btree metadata page.
72 * PUBLIC: int __bam_mswap __P((ENV *, PAGE *));
84 p = (u_int8_t *)pg + sizeof(DBMETA);
86 p += sizeof(u_int32_t); /* unused */
87 SWAP32(p); /* minkey */
88 SWAP32(p); /* re_len */
89 SWAP32(p); /* re_pad */
91 p += 92 * sizeof(u_int32_t); /* unused */
92 SWAP32(p); /* crypto_magic */