2
* See the file LICENSE for redistribution information.
4
* Copyright (c) 1998-2002
5
* Sleepycat Software. All rights reserved.
11
static const char revid[] = "$Id$";
14
#ifndef NO_SYSTEM_INCLUDES
15
#include <sys/types.h>
21
#include "dbinc/db_page.h"
22
#include "dbinc/btree.h"
28
* PUBLIC: int __bam_reclaim __P((DB *, DB_TXN *));
31
__bam_reclaim(dbp, txn)
38
/* Acquire a cursor. */
39
if ((ret = dbp->cursor(dbp, txn, &dbc, 0)) != 0)
42
/* Walk the tree, freeing pages. */
43
ret = __bam_traverse(dbc,
44
DB_LOCK_WRITE, dbc->internal->root, __db_reclaim_callback, dbc);
46
/* Discard the cursor. */
47
if ((t_ret = dbc->c_close(dbc)) != 0 && ret == 0)
55
* Truncate a database.
57
* PUBLIC: int __bam_truncate __P((DB *, DB_TXN *, u_int32_t *));
60
__bam_truncate(dbp, txn, countp)
69
/* Acquire a cursor. */
70
if ((ret = dbp->cursor(dbp, txn, &dbc, 0)) != 0)
75
/* Walk the tree, freeing pages. */
76
ret = __bam_traverse(dbc,
77
DB_LOCK_WRITE, dbc->internal->root, __db_truncate_callback, &trunc);
79
/* Discard the cursor. */
80
if ((t_ret = dbc->c_close(dbc)) != 0 && ret == 0)
83
*countp = trunc.count;