Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in / Register
Toggle navigation
Menu
Open sidebar
HAMANO Tsukasa
OpenLDAP
Commits
92a63ff7
Commit
92a63ff7
authored
Sep 11, 2011
by
Howard Chu
Browse files
Merge branch 'mdb.master' of
ssh://git-master.openldap.org/~git/git/openldap
into mdb.master
parents
35012485
946b38f4
Changes
6
Expand all
Hide whitespace changes
Inline
Side-by-side
libraries/libmdb/.gitignore
View file @
92a63ff7
...
...
@@ -11,3 +11,5 @@ mdb_stat
core
core.*
valgrind.*
man/
html/
libraries/libmdb/mdb.c
View file @
92a63ff7
This diff is collapsed.
Click to expand it.
libraries/libmdb/mdb.h
View file @
92a63ff7
...
...
@@ -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
...
...
libraries/libmdb/mdb_stat.c
View file @
92a63ff7
...
...
@@ -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: %
l
u
\n
"
,
mst
.
ms_branch_pages
);
printf
(
"Leaf pages: %
l
u
\n
"
,
mst
.
ms_leaf_pages
);
printf
(
"Overflow pages: %
l
u
\n
"
,
mst
.
ms_overflow_pages
);
printf
(
"Entries: %
l
u
\n
"
,
mst
.
ms_entries
);
printf
(
"Branch pages: %
z
u
\n
"
,
mst
.
ms_branch_pages
);
printf
(
"Leaf pages: %
z
u
\n
"
,
mst
.
ms_leaf_pages
);
printf
(
"Overflow pages: %
z
u
\n
"
,
mst
.
ms_overflow_pages
);
printf
(
"Entries: %
z
u
\n
"
,
mst
.
ms_entries
);
mdb_close
(
txn
,
dbi
);
mdb_txn_abort
(
txn
);
mdb_env_close
(
env
);
...
...
libraries/libmdb/midl.c
View file @
92a63ff7
...
...
@@ -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
;
...
...
libraries/libmdb/midl.h
View file @
92a63ff7
...
...
@@ -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
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment