Move LMDB common definitions in a dedicated header
As several places uses custom LMDB macros, this centralize those definitions inside a dedicated `lib/isc/include/isc/lmdb.h` header file, so future uses cases not DNS-centrics could fit into there as well. MDB_CREATE is removed as well because: - it was useless (it's needed only for named DB, which is not the case for all use case so far) - it was used in `mdb_env_open` which is not expecting this flag: it should be passed (if needed) to `mdb_dbi_open`. It was likely ignored so far.
This commit is contained in:
@@ -45,6 +45,7 @@
|
||||
#include <isc/httpd.h>
|
||||
#include <isc/job.h>
|
||||
#include <isc/lex.h>
|
||||
#include <isc/lmdb.h>
|
||||
#include <isc/loop.h>
|
||||
#include <isc/meminfo.h>
|
||||
#include <isc/netmgr.h>
|
||||
|
||||
@@ -11,13 +11,10 @@
|
||||
* information regarding copyright ownership.
|
||||
*/
|
||||
|
||||
#include <lmdb.h>
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
|
||||
#include <isc/lib.h>
|
||||
|
||||
/* Included just to get DNS_LMDB_FLAGS definition */
|
||||
#include <isc/lmdb.h>
|
||||
#include <dns/view.h>
|
||||
|
||||
int
|
||||
|
||||
@@ -248,17 +248,6 @@ struct dns_view {
|
||||
#define DNS_VIEWATTR_ADBSHUTDOWN 0x02
|
||||
#define DNS_VIEWATTR_REQSHUTDOWN 0x04
|
||||
|
||||
#define DNS_LMDB_COMMON_FLAGS (MDB_CREATE | MDB_NOSUBDIR | MDB_NOLOCK)
|
||||
#ifndef __OpenBSD__
|
||||
#define DNS_LMDB_FLAGS (DNS_LMDB_COMMON_FLAGS)
|
||||
#else /* __OpenBSD__ */
|
||||
/*
|
||||
* OpenBSD does not have a unified buffer cache, which requires both reads and
|
||||
* writes to be performed using mmap().
|
||||
*/
|
||||
#define DNS_LMDB_FLAGS (DNS_LMDB_COMMON_FLAGS | MDB_WRITEMAP)
|
||||
#endif /* __OpenBSD__ */
|
||||
|
||||
void
|
||||
dns_view_create(isc_mem_t *mctx, isc_loopmgr_t *loopmgr,
|
||||
dns_dispatchmgr_t *dispmgr, dns_rdataclass_t rdclass,
|
||||
|
||||
+1
-1
@@ -15,7 +15,6 @@
|
||||
|
||||
#include <inttypes.h>
|
||||
#include <limits.h>
|
||||
#include <lmdb.h>
|
||||
#include <stdbool.h>
|
||||
|
||||
#include <isc/atomic.h>
|
||||
@@ -23,6 +22,7 @@
|
||||
#include <isc/file.h>
|
||||
#include <isc/hash.h>
|
||||
#include <isc/lex.h>
|
||||
#include <isc/lmdb.h>
|
||||
#include <isc/md.h>
|
||||
#include <isc/result.h>
|
||||
#include <isc/stats.h>
|
||||
|
||||
@@ -45,6 +45,7 @@ libisc_la_HEADERS = \
|
||||
include/isc/lex.h \
|
||||
include/isc/lib.h \
|
||||
include/isc/list.h \
|
||||
include/isc/lmdb.h \
|
||||
include/isc/log.h \
|
||||
include/isc/loop.h \
|
||||
include/isc/magic.h \
|
||||
|
||||
+2
-2
@@ -11,17 +11,17 @@
|
||||
* information regarding copyright ownership.
|
||||
*/
|
||||
|
||||
#include <lmdb.h>
|
||||
#include <stdbool.h>
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
|
||||
#include <isc/cfgmgr.h>
|
||||
#include <isc/list.h>
|
||||
#include <isc/lmdb.h>
|
||||
#include <isc/mem.h>
|
||||
#include <isc/random.h>
|
||||
#include <isc/thread.h>
|
||||
#include <isc/util.h>
|
||||
#include <isc/cfgmgr.h>
|
||||
|
||||
/*
|
||||
* See MDB_MAXKEYSIZE documentation, but not accessible as defined in
|
||||
|
||||
@@ -0,0 +1,27 @@
|
||||
/*
|
||||
* Copyright (C) Internet Systems Consortium, Inc. ("ISC")
|
||||
*
|
||||
* SPDX-License-Identifier: MPL-2.0
|
||||
*
|
||||
* This Source Code Form is subject to the terms of the Mozilla Public
|
||||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
* file, you can obtain one at https://mozilla.org/MPL/2.0/.
|
||||
*
|
||||
* See the COPYRIGHT file distributed with this work for additional
|
||||
* information regarding copyright ownership.
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <lmdb.h>
|
||||
|
||||
#define DNS_LMDB_COMMON_FLAGS (MDB_NOSUBDIR | MDB_NOLOCK)
|
||||
#ifndef __OpenBSD__
|
||||
#define DNS_LMDB_FLAGS (DNS_LMDB_COMMON_FLAGS)
|
||||
#else /* __OpenBSD__ */
|
||||
/*
|
||||
* OpenBSD does not have a unified buffer cache, which requires both reads and
|
||||
* writes to be performed using mmap().
|
||||
*/
|
||||
#define DNS_LMDB_FLAGS (DNS_LMDB_COMMON_FLAGS | MDB_WRITEMAP)
|
||||
#endif /* __OpenBSD__ */
|
||||
Reference in New Issue
Block a user