mirror of
https://git.openldap.org/openldap/openldap.git
synced 2025-01-06 10:46:21 +08:00
Add mdb_version()
This commit is contained in:
parent
76d7ca8ce0
commit
f9f0ec92a9
@ -437,6 +437,15 @@ memnrcmp(const void *s1, size_t n1, const void *s2, size_t n2)
|
||||
return *p1 - *p2;
|
||||
}
|
||||
|
||||
char *
|
||||
mdb_version(int *maj, int *min, int *pat)
|
||||
{
|
||||
*maj = MDB_VERSION_MAJOR;
|
||||
*min = MDB_VERSION_MINOR;
|
||||
*pat = MDB_VERSION_PATCH;
|
||||
return MDB_VERSION_STRING;
|
||||
}
|
||||
|
||||
int
|
||||
mdb_cmp(MDB_txn *txn, MDB_dbi dbi, const MDB_val *a, const MDB_val *b)
|
||||
{
|
||||
@ -596,10 +605,10 @@ mdb_touch(MDB_txn *txn, MDB_pageparent *pp)
|
||||
}
|
||||
|
||||
int
|
||||
mdb_env_sync(MDB_env *env)
|
||||
mdb_env_sync(MDB_env *env, int force)
|
||||
{
|
||||
int rc = 0;
|
||||
if (!F_ISSET(env->me_flags, MDB_NOSYNC)) {
|
||||
if (force || !F_ISSET(env->me_flags, MDB_NOSYNC)) {
|
||||
if (fsync(env->me_fd))
|
||||
rc = errno;
|
||||
}
|
||||
@ -899,9 +908,9 @@ mdb_txn_commit(MDB_txn *txn)
|
||||
free(dp);
|
||||
}
|
||||
|
||||
if ((n = mdb_env_sync(env)) != 0 ||
|
||||
if ((n = mdb_env_sync(env, 0)) != 0 ||
|
||||
(n = mdb_env_write_meta(txn)) != MDB_SUCCESS ||
|
||||
(n = mdb_env_sync(env)) != 0) {
|
||||
(n = mdb_env_sync(env, 0)) != 0) {
|
||||
mdb_txn_abort(txn);
|
||||
return n;
|
||||
}
|
||||
|
@ -35,7 +35,14 @@
|
||||
#define MDB_VERSION_MAJOR 0
|
||||
#define MDB_VERSION_MINOR 8
|
||||
#define MDB_VERSION_PATCH 0
|
||||
#define MDB_VERSION_FULL ((MDB_VERSION_MAJOR << 24) | (MDB_VERSION_MINOR << 16) | MDB_VERSION_PATCH)
|
||||
#define MDB_VERINT(a,b,c) ((a << 24) | (b << 16) | c)
|
||||
#define MDB_VERSION_FULL \
|
||||
MDB_VERINT(MDB_VERSION_MAJOR,MDB_VERSION_MINOR,MDB_VERSION_PATCH)
|
||||
#define MDB_VERSION_DATE "August 11, 2011"
|
||||
#define MDB_VERSTR(a,b,c,d) "MDB " #a "." #b "." #c ": (" #d ")"
|
||||
#define MDB_VERFOO(a,b,c,d) MDB_VERSTR(a,b,c,d)
|
||||
#define MDB_VERSION_STRING \
|
||||
MDB_VERFOO(MDB_VERSION_MAJOR,MDB_VERSION_MINOR,MDB_VERSION_PATCH,MDB_VERSION_DATE)
|
||||
|
||||
struct MDB_cursor;
|
||||
struct MDB_txn;
|
||||
@ -103,10 +110,11 @@ typedef struct MDB_stat {
|
||||
unsigned long ms_entries;
|
||||
} MDB_stat;
|
||||
|
||||
char *mdb_version(int *major, int *minor, int *patch);
|
||||
int mdb_env_create(MDB_env **env);
|
||||
int mdb_env_open(MDB_env *env, const char *path, unsigned int flags, mode_t mode);
|
||||
int mdb_env_stat(MDB_env *env, MDB_stat *stat);
|
||||
int mdb_env_sync(MDB_env *env);
|
||||
int mdb_env_sync(MDB_env *env, int force);
|
||||
void mdb_env_close(MDB_env *env);
|
||||
int mdb_env_get_flags(MDB_env *env, unsigned int *flags);
|
||||
int mdb_env_get_path(MDB_env *env, const char **path);
|
||||
|
Loading…
Reference in New Issue
Block a user