Commit 92a63ff7 authored by Howard Chu's avatar Howard Chu
Browse files

Merge branch 'mdb.master' of ssh://git-master.openldap.org/~git/git/openldap into mdb.master

parents 35012485 946b38f4
......@@ -11,3 +11,5 @@ mdb_stat
core
core.*
valgrind.*
man/
html/
This diff is collapsed.
......@@ -232,10 +232,10 @@ typedef struct MDB_stat {
unsigned int ms_psize; /**< Size of a database page.
This is currently the same for all databases. */
unsigned int ms_depth; /**< Depth (height) of the B-tree */
unsigned long ms_branch_pages; /**< Number of internal (non-leaf) pages */
unsigned long ms_leaf_pages; /**< Number of leaf pages */
unsigned long ms_overflow_pages; /**< Number of overflow pages */
unsigned long ms_entries; /**< Number of data items */
size_t ms_branch_pages; /**< Number of internal (non-leaf) pages */
size_t ms_leaf_pages; /**< Number of leaf pages */
size_t ms_overflow_pages; /**< Number of overflow pages */
size_t ms_entries; /**< Number of data items */
} MDB_stat;
/** Return the mdb library version information.
......@@ -414,7 +414,7 @@ int mdb_env_set_mapsize(MDB_env *env, size_t size);
* <li>EINVAL - an invalid parameter was specified, or the environment is already open.
* </ul>
*/
int mdb_env_set_maxreaders(MDB_env *env, int readers);
int mdb_env_set_maxreaders(MDB_env *env, unsigned int readers);
/** Get the maximum number of threads for the environment.
* @param[in] env An environment handle returned by #mdb_env_create()
......@@ -425,7 +425,7 @@ int mdb_env_set_maxreaders(MDB_env *env, int readers);
* <li>EINVAL - an invalid parameter was specified.
* </ul>
*/
int mdb_env_get_maxreaders(MDB_env *env, int *readers);
int mdb_env_get_maxreaders(MDB_env *env, unsigned int *readers);
/** Set the maximum number of databases for the environment.
* This function is only needed if multiple databases will be used in the
......@@ -440,7 +440,7 @@ int mdb_env_get_maxreaders(MDB_env *env, int *readers);
* <li>EINVAL - an invalid parameter was specified, or the environment is already open.
* </ul>
*/
int mdb_env_set_maxdbs(MDB_env *env, int dbs);
int mdb_env_set_maxdbs(MDB_env *env, MDB_dbi dbs);
/** Create a transaction for use with the environment.
* The transaction handle may be discarded using #mdb_txn_abort() or #mdb_txn_commit().
......@@ -542,7 +542,7 @@ int mdb_txn_renew(MDB_txn *txn);
* <li>#MDB_INTEGERKEY
* Keys are binary integers in native byte order. Setting this option
* requires all keys to be the same size, typically sizeof(int)
* or sizeof(long).
* or sizeof(size_t).
* <li>#MDB_DUPFIXED
* This flag may only be used in combination with #MDB_DUPSORT. This option
* tells the library that the data items for this database are all the same
......@@ -839,7 +839,7 @@ int mdb_cursor_del(MDB_cursor *cursor, unsigned int flags);
* <li>EINVAL - cursor is not initialized, or an invalid parameter was specified.
* </ul>
*/
int mdb_cursor_count(MDB_cursor *cursor, unsigned long *countp);
int mdb_cursor_count(MDB_cursor *cursor, size_t *countp);
/** Compare two data items according to a particular database.
* This returns a comparison as if the two data items were keys in the
......
......@@ -52,10 +52,10 @@ int main(int argc,char * argv[])
rc = mdb_stat(txn, dbi, &mst);
printf("Page size: %u\n", mst.ms_psize);
printf("Tree depth: %u\n", mst.ms_depth);
printf("Branch pages: %lu\n", mst.ms_branch_pages);
printf("Leaf pages: %lu\n", mst.ms_leaf_pages);
printf("Overflow pages: %lu\n", mst.ms_overflow_pages);
printf("Entries: %lu\n", mst.ms_entries);
printf("Branch pages: %zu\n", mst.ms_branch_pages);
printf("Leaf pages: %zu\n", mst.ms_leaf_pages);
printf("Overflow pages: %zu\n", mst.ms_overflow_pages);
printf("Entries: %zu\n", mst.ms_entries);
mdb_close(txn, dbi);
mdb_txn_abort(txn);
mdb_env_close(env);
......
......@@ -15,6 +15,7 @@
* <http://www.OpenLDAP.org/license.html>.
*/
#include <limits.h>
#include <string.h>
#include <sys/types.h>
#include <assert.h>
......@@ -129,12 +130,13 @@ int mdb_midl_append( IDL ids, ID id )
/* Quicksort + Insertion sort for small arrays */
#define SMALL 8
#define SWAP(a,b) itmp=(a);(a)=(b);(b)=itmp
#define SWAP(a,b) { itmp=(a); (a)=(b); (b)=itmp; }
void
mdb_midl_sort( ID *ids )
{
int istack[16*sizeof(int)];
/* Max possible depth of int-indexed tree * 2 items/level */
int istack[sizeof(int)*CHAR_BIT * 2];
int i,j,k,l,ir,jstack;
ID a, itmp;
......
......@@ -26,19 +26,20 @@
#ifndef _MDB_MIDL_H_
#define _MDB_MIDL_H_
#include <stddef.h>
/** @defgroup internal MDB Internals
* @{
*/
/** ULONG should be the largest integer type supported on a machine.
* It should be equal to the size of a pointer.
*/
#define ULONG unsigned long
/** @defgroup idls ID List Management
* @{
*/
/** A generic ID number. These were entryIDs in back-bdb.
* It should be the largest integer type supported on a machine.
* It should be equal to the size of a pointer.
*/
typedef ULONG ID;
typedef size_t ID;
/** An IDL is an ID List, a sorted array of IDs. The first
* element of the array is a counter for how many actual
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment