2
* See the file LICENSE for redistribution information.
4
* Copyright (c) 1997-2002
5
* Sleepycat Software. All rights reserved.
11
static const char revid[] = "$Id$";
17
#include "dbinc/cxx_int.h"
21
// Helper macros for simple methods that pass through to the
22
// underlying C method. It may return an error or raise an exception.
23
// Note this macro expects that input _argspec is an argument
24
// list element (e.g., "char *arg") and that _arglist is the arguments
25
// that should be passed through to the C method (e.g., "(mpf, arg)")
27
#define DB_MPOOLFILE_METHOD(_name, _argspec, _arglist, _retok) \
28
int DbMpoolFile::_name _argspec \
31
DB_MPOOLFILE *mpf = unwrap(this); \
36
ret = mpf->_name _arglist; \
38
DB_ERROR("DbMpoolFile::"#_name, ret, ON_ERROR_UNKNOWN); \
42
#define DB_MPOOLFILE_METHOD_VOID(_name, _argspec, _arglist) \
43
void DbMpoolFile::_name _argspec \
45
DB_MPOOLFILE *mpf = unwrap(this); \
47
mpf->_name _arglist; \
50
////////////////////////////////////////////////////////////////////////
54
////////////////////////////////////////////////////////////////////////
56
DbMpoolFile::DbMpoolFile()
61
DbMpoolFile::~DbMpoolFile()
65
int DbMpoolFile::close(u_int32_t flags)
67
DB_MPOOLFILE *mpf = unwrap(this);
73
ret = mpf->close(mpf, flags);
75
imp_ = 0; // extra safety
77
// This may seem weird, but is legal as long as we don't access
78
// any data before returning.
81
if (!DB_RETOK_STD(ret))
82
DB_ERROR("DbMpoolFile::close", ret, ON_ERROR_UNKNOWN);
87
DB_MPOOLFILE_METHOD(get, (db_pgno_t *pgnoaddr, u_int32_t flags, void *pagep),
88
(mpf, pgnoaddr, flags, pagep), DB_RETOK_MPGET)
89
DB_MPOOLFILE_METHOD_VOID(last_pgno, (db_pgno_t *pgnoaddr), (mpf, pgnoaddr))
90
DB_MPOOLFILE_METHOD(open,
91
(const char *file, u_int32_t flags, int mode, size_t pagesize),
92
(mpf, file, flags, mode, pagesize), DB_RETOK_STD)
93
DB_MPOOLFILE_METHOD(put, (void *pgaddr, u_int32_t flags),
94
(mpf, pgaddr, flags), DB_RETOK_STD)
95
DB_MPOOLFILE_METHOD_VOID(refcnt, (db_pgno_t *pgnoaddr), (mpf, pgnoaddr))
96
DB_MPOOLFILE_METHOD(set, (void *pgaddr, u_int32_t flags),
97
(mpf, pgaddr, flags), DB_RETOK_STD)
98
DB_MPOOLFILE_METHOD(set_clear_len, (u_int32_t len),
99
(mpf, len), DB_RETOK_STD)
100
DB_MPOOLFILE_METHOD(set_fileid, (u_int8_t *fileid),
101
(mpf, fileid), DB_RETOK_STD)
102
DB_MPOOLFILE_METHOD(set_ftype, (int ftype),
103
(mpf, ftype), DB_RETOK_STD)
104
DB_MPOOLFILE_METHOD(set_lsn_offset, (int32_t offset),
105
(mpf, offset), DB_RETOK_STD)
106
DB_MPOOLFILE_METHOD(set_pgcookie, (DBT *dbt),
107
(mpf, dbt), DB_RETOK_STD)
108
DB_MPOOLFILE_METHOD_VOID(set_unlink, (int ul), (mpf, ul))
109
DB_MPOOLFILE_METHOD(sync, (),