#define DATANAME "/data.mdb"
/** The suffix of the lock file when no subdir is used */
#define LOCKSUFF "-lock"
+ /** Only a subset of the @ref mdb_env flags can be changed
+ * at runtime. Changing other flags requires closing the
+ * environment and re-opening it with the new flags.
+ */
+#define CHANGEABLE (MDB_NOSYNC|MDB_NOMETASYNC|MDB_MAPASYNC)
+#define CHANGELESS (MDB_FIXEDMAP|MDB_NOSUBDIR|MDB_RDONLY|MDB_WRITEMAP)
int
mdb_env_open(MDB_env *env, const char *path, unsigned int flags, mode_t mode)
int oflags, rc, len, excl;
char *lpath, *dpath;
- if (env->me_fd != INVALID_HANDLE_VALUE)
+ if (env->me_fd!=INVALID_HANDLE_VALUE || (flags & ~(CHANGEABLE|CHANGELESS)))
return EINVAL;
len = strlen(path);
return mdb_cursor_put(&mc, key, data, flags);
}
-/** Only a subset of the @ref mdb_env flags can be changed
- * at runtime. Changing other flags requires closing the environment
- * and re-opening it with the new flags.
- */
-#define CHANGEABLE (MDB_NOSYNC|MDB_NOMETASYNC|MDB_MAPASYNC)
int
mdb_env_set_flags(MDB_env *env, unsigned int flag, int onoff)
{
typedef void (MDB_rel_func)(MDB_val *item, void *oldptr, void *newptr, void *relctx);
/** @defgroup mdb_env Environment Flags
+ *
+ * Values do not overlap Database Flags.
* @{
*/
/** mmap at a fixed address */
#define MDB_FIXEDMAP 0x01
/** no environment directory */
-#define MDB_NOSUBDIR 0x02
+#define MDB_NOSUBDIR 0x4000
/** don't fsync after commit */
#define MDB_NOSYNC 0x10000
/** read only */
/** @} */
/** @defgroup mdb_open Database Flags
+ *
+ * Values do not overlap Environment Flags.
* @{
*/
/** use reverse string keys */