source: trunk/third/db/btree/bt_reclaim.c @ 17055

Revision 17055, 1003 bytes checked in by ghudson, 23 years ago (diff)
This commit was generated by cvs2svn to compensate for changes in r17054, which included commits to RCS files with non-trunk default branches.
Line 
1/*-
2 * See the file LICENSE for redistribution information.
3 *
4 * Copyright (c) 1998, 1999, 2000
5 *      Sleepycat Software.  All rights reserved.
6 */
7
8#include "db_config.h"
9
10#ifndef lint
11static const char revid[] = "$Id: bt_reclaim.c,v 1.1.1.1 2002-02-11 16:25:43 ghudson Exp $";
12#endif /* not lint */
13
14#ifndef NO_SYSTEM_INCLUDES
15#include <sys/types.h>
16
17#include <string.h>
18#endif
19
20#include "db_int.h"
21#include "db_page.h"
22#include "db_shash.h"
23#include "lock.h"
24#include "btree.h"
25
26/*
27 * __bam_reclaim --
28 *      Free a database.
29 *
30 * PUBLIC: int __bam_reclaim __P((DB *, DB_TXN *));
31 */
32int
33__bam_reclaim(dbp, txn)
34        DB *dbp;
35        DB_TXN *txn;
36{
37        DBC *dbc;
38        int ret, t_ret;
39
40        /* Acquire a cursor. */
41        if ((ret = dbp->cursor(dbp, txn, &dbc, 0)) != 0)
42                return (ret);
43
44        /* Walk the tree, freeing pages. */
45        ret = __bam_traverse(dbc,
46            DB_LOCK_WRITE, dbc->internal->root, __db_reclaim_callback, dbc);
47
48        /* Discard the cursor. */
49        if ((t_ret = dbc->c_close(dbc)) != 0 && ret == 0)
50                ret = t_ret;
51
52        return (ret);
53}
Note: See TracBrowser for help on using the repository browser.