bt_reclaim.c

Go to the documentation of this file.
00001 /*-
00002  * See the file LICENSE for redistribution information.
00003  *
00004  * Copyright (c) 1998, 1999, 2000
00005  *      Sleepycat Software.  All rights reserved.
00006  */
00007 
00008 #include "config.h"
00009 
00010 #ifndef lint
00011 static const char revid[] = "$Id: bt__reclaim_8c-source.html,v 1.1 2008/06/08 10:13:40 sebdiaz Exp $";
00012 #endif /* not lint */
00013 
00014 #ifndef NO_SYSTEM_INCLUDES
00015 #include <sys/types.h>
00016 
00017 #include <string.h>
00018 #endif
00019 
00020 #include "db_int.h"
00021 #include "db_page.h"
00022 #include "db_shash.h"
00023 #include "lock.h"
00024 #include "btree.h"
00025 
00026 /*
00027  * CDB___bam_reclaim --
00028  *      Free a database.
00029  *
00030  * PUBLIC: int CDB___bam_reclaim __P((DB *, DB_TXN *));
00031  */
00032 int
00033 CDB___bam_reclaim(dbp, txn)
00034         DB *dbp;
00035         DB_TXN *txn;
00036 {
00037         DBC *dbc;
00038         int ret, t_ret;
00039 
00040         /* Acquire a cursor. */
00041         if ((ret = dbp->cursor(dbp, txn, &dbc, 0)) != 0)
00042                 return (ret);
00043 
00044         /* Walk the tree, freeing pages. */
00045         ret = CDB___bam_traverse(dbc,
00046             DB_LOCK_WRITE, dbc->internal->root, CDB___db_reclaim_callback, dbc);
00047 
00048         /* Discard the cursor. */
00049         if ((t_ret = dbc->c_close(dbc)) != 0 && ret == 0)
00050                 ret = t_ret;
00051 
00052         return (ret);
00053 }

Generated on Sun Jun 8 10:56:35 2008 for GNUmifluz by  doxygen 1.5.5