00001
00002
00003
00004
00005
00006
00007
00008 #include "config.h"
00009
00010 #ifndef lint
00011 static const char revid[] = "$Id: bt__conv_8c-source.html,v 1.1 2008/06/08 10:13:30 sebdiaz Exp $";
00012 #endif
00013
00014 #ifndef NO_SYSTEM_INCLUDES
00015 #include <sys/types.h>
00016 #endif
00017
00018 #include "db_int.h"
00019 #include "db_page.h"
00020 #include "db_swap.h"
00021 #include "btree.h"
00022
00023
00024
00025
00026
00027
00028
00029
00030 int
00031 CDB___bam_pgin(dbenv, pg, pp, cookie)
00032 DB_ENV *dbenv;
00033 db_pgno_t pg;
00034 void *pp;
00035 DBT *cookie;
00036 {
00037 DB_PGINFO *pginfo;
00038 PAGE *h;
00039
00040 pginfo = (DB_PGINFO *)cookie->data;
00041 if (!pginfo->needswap)
00042 return (0);
00043
00044 h = pp;
00045 return (TYPE(h) == P_BTREEMETA ? CDB___bam_mswap(pp) :
00046 CDB___db_byteswap(dbenv, pg, pp, pginfo->db_pagesize, 1));
00047 }
00048
00049
00050
00051
00052
00053
00054
00055
00056 int
00057 CDB___bam_pgout(dbenv, pg, pp, cookie)
00058 DB_ENV *dbenv;
00059 db_pgno_t pg;
00060 void *pp;
00061 DBT *cookie;
00062 {
00063 DB_PGINFO *pginfo;
00064 PAGE *h;
00065
00066 pginfo = (DB_PGINFO *)cookie->data;
00067 if (!pginfo->needswap)
00068 return (0);
00069
00070 h = pp;
00071 return (TYPE(h) == P_BTREEMETA ? CDB___bam_mswap(pp) :
00072 CDB___db_byteswap(dbenv, pg, pp, pginfo->db_pagesize, 0));
00073 }
00074
00075
00076
00077
00078
00079
00080
00081 int
00082 CDB___bam_mswap(pg)
00083 PAGE *pg;
00084 {
00085 u_int8_t *p;
00086
00087 CDB___db_metaswap(pg);
00088
00089 p = (u_int8_t *)pg + sizeof(DBMETA);
00090
00091 SWAP32(p);
00092 SWAP32(p);
00093 SWAP32(p);
00094 SWAP32(p);
00095 SWAP32(p);
00096
00097 return (0);
00098 }