Google

Berkeley DB Reference Guide:
Upgrading Berkeley DB Applications

PrevRefNext

Release 4.0: memp_XXX

The C API for the Berkeley DB Memory Pool subsystem was reworked in the 4.0 release as follows:

Historic functional interfaceBerkeley DB 4.X method
memp_registerDB_ENV->memp_register
memp_statDB_ENV->memp_stat
memp_syncDB_ENV->memp_sync
memp_trickleDB_ENV->memp_trickle
memp_fopenDB_ENV->memp_fcreate
DB_MPOOL_FINFO: ftypeDB_MPOOLFILE->set_ftype
DB_MPOOL_FINFO: pgcookieDB_MPOOLFILE->set_pgcookie
DB_MPOOL_FINFO: fileidDB_MPOOLFILE->set_fileid
DB_MPOOL_FINFO: lsn_offsetDB_MPOOLFILE->set_lsn_offset
DB_MPOOL_FINFO: clear_lenDB_MPOOLFILE->set_clear_len
memp_fopenDB_MPOOLFILE->open
memp_fcloseDB_MPOOLFILE->close
memp_fputDB_MPOOLFILE->put
memp_fsetDB_MPOOLFILE->set
memp_fsyncDB_MPOOLFILE->sync

Applications calling any of the memp_register, memp_stat, memp_sync or memp_trickle interfaces should update those calls to use the enclosing DB_ENV handle's method (easily done as the first argument to the existing call is the correct DB_ENV handle).

In addition, the DB_ENV->memp_stat call has been changed in the 4.0 release to take a flags argument. To leave their historic behavior unchanged, applications should add a final argument of 0 to any calls made to DB_ENV->memp_stat.

Applications calling the memp_fopen interface should update those calls as follows: First, acquire a DB_MPOOLFILE handle using the DB_ENV->memp_fcreate function. Second, if the DB_MPOOL_FINFO structure reference passed to the memp_fopen interface was non-NULL, call the DB_MPOOLFILE method corresponding to each initialized field in the DB_MPOOL_FINFO structure. Third, call the DB_MPOOLFILE->open function method to open the underlying file. If the DB_MPOOLFILE->open function call fails, then DB_MPOOLFILE->close function must be called to destroy the allocated handle.

Applications calling the memp_fopen, memp_fclose, memp_fput, memp_fset, or memp_fsync interfaces should update those calls to use the enclosing DB_MPOOLFILE handle's method. Again, this is easily done as the first argument to the existing call is the correct DB_MPOOLFILE handle. With one exception, the calling conventions of the old a new interfaces are identical; the one exception is the DB_MPOOLFILE->close function, which requires an additional flag parameter that should be set to 0.

PrevRefNext

Copyright Sleepycat Software