Commit 2e0aebfc authored by Daniel Salzman's avatar Daniel Salzman

libknot: move namedb from internal as knot_db

parent bcd2b199
......@@ -373,6 +373,11 @@ src/libknot/binary.h
src/libknot/codes.c
src/libknot/codes.h
src/libknot/consts.h
src/libknot/db/db.h
src/libknot/db/db_lmdb.c
src/libknot/db/db_lmdb.h
src/libknot/db/db_trie.c
src/libknot/db/db_trie.h
src/libknot/descriptor.c
src/libknot/descriptor.h
src/libknot/dname.c
......@@ -382,11 +387,6 @@ src/libknot/dnssec/rrset-sign.h
src/libknot/errcode.h
src/libknot/error.c
src/libknot/error.h
src/libknot/internal/namedb/namedb.h
src/libknot/internal/namedb/namedb_lmdb.c
src/libknot/internal/namedb/namedb_lmdb.h
src/libknot/internal/namedb/namedb_trie.c
src/libknot/internal/namedb/namedb_trie.h
src/libknot/libknot.h
src/libknot/mm_ctx.h
src/libknot/packet/compr.c
......
......@@ -5,7 +5,6 @@ lib_LTLIBRARIES = \
libknot.la
noinst_LTLIBRARIES = \
libcontrib.la \
libknot-internal.la \
libknot-yparser.la
AM_CPPFLAGS = \
......@@ -22,6 +21,7 @@ AM_LDFLAGS = $(CODE_COVERAGE_LDFLAGS)
# Knot DNS Libraries #
######################
# static: libcontrib headers
libcontrib_ladir = $(includedir)
nobase_libcontrib_la_HEADERS = \
contrib/base32hex.h \
......@@ -63,6 +63,9 @@ nobase_libknot_la_HEADERS = \
libknot/error.h \
libknot/libknot.h \
libknot/mm_ctx.h \
libknot/db/db.h \
libknot/db/db_lmdb.h \
libknot/db/db_trie.h \
libknot/packet/compr.h \
libknot/packet/pkt.h \
libknot/packet/rrset-wire.h \
......@@ -89,12 +92,7 @@ nobase_libknot_la_HEADERS = \
libknot/tsig-op.h \
libknot/tsig.h
libknot_internal_ladir = $(includedir)
nobase_libknot_internal_la_HEADERS = \
libknot/internal/namedb/namedb.h \
libknot/internal/namedb/namedb_lmdb.h \
libknot/internal/namedb/namedb_trie.h
# static: libknot-yparser headers
libknot_yparser_ladir = $(includedir)
nobase_libknot_yparser_la_HEADERS = \
libknot/yparser/yparser.h \
......@@ -102,7 +100,7 @@ nobase_libknot_yparser_la_HEADERS = \
libknot/yparser/ypscheme.h \
libknot/yparser/yptrafo.h
# dynamic: libknot sources
# static: libcontrib sources
libcontrib_la_SOURCES = \
contrib/base32hex.c \
contrib/base64.c \
......@@ -122,6 +120,7 @@ libcontrib_la_SOURCES = \
contrib/ucw/mempool.c \
$(nobase_libcontrib_la_HEADERS)
# dynamic: libknot sources
libknot_la_SOURCES = \
libknot/binary.c \
libknot/codes.c \
......@@ -129,6 +128,8 @@ libknot_la_SOURCES = \
libknot/dname.c \
libknot/dnssec/rrset-sign.c \
libknot/error.c \
libknot/db/db_lmdb.c \
libknot/db/db_trie.c \
libknot/packet/compr.c \
libknot/packet/pkt.c \
libknot/packet/rrset-wire.c \
......@@ -152,6 +153,7 @@ libknot_la_SOURCES = \
libknot/tsig.c \
$(nobase_libknot_la_HEADERS)
# static: libknot-yparser sources
libknot_yparser_la_SOURCES = \
libknot/yparser/yparser.c \
libknot/yparser/ypbody.c \
......@@ -160,32 +162,21 @@ libknot_yparser_la_SOURCES = \
libknot/yparser/yptrafo.c \
$(nobase_libknot_yparser_la_HEADERS)
libknot_internal_la_SOURCES = \
libknot/internal/namedb/namedb_lmdb.c \
libknot/internal/namedb/namedb_trie.c \
$(nobase_libknot_internal_la_HEADERS)
libcontrib_la_CPPFLAGS = $(AM_CPPFLAGS)
libcontrib_la_CFLAGS = $(AM_CFLAGS)
libknot_internal_la_CPPFLAGS = $(AM_CPPFLAGS) $(lmdb_CFLAGS)
libknot_internal_la_CFLAGS = $(AM_CFLAGS)
libknot_la_CPPFLAGS = $(AM_CPPFLAGS) $(CFLAG_VISIBILITY) $(lmdb_CFLAGS)
libknot_la_CFLAGS = $(AM_CFLAGS)
libknot_la_LDFLAGS = $(AM_LDFLAGS) $(libknot_VERSION_INFO) $(lmdb_LIBS)
libknot_la_LIBADD = dnssec/libdnssec.la libcontrib.la libknot-internal.la
libknot_la_LIBADD = dnssec/libdnssec.la libcontrib.la
# pkg-config
pkgconfig_DATA = libknot.pc
if !HAVE_LMDB
libknot_internal_la_SOURCES += \
libknot_la_SOURCES += \
contrib/lmdb/lmdb.h \
contrib/lmdb/mdb.c \
contrib/lmdb/midl.c \
contrib/lmdb/midl.h
libknot_internal_la_CPPFLAGS += \
libknot_la_CPPFLAGS += \
-I$(srcdir)/contrib/lmdb/
endif
......@@ -366,7 +357,7 @@ libknotd_la_LIBADD = libknot.la libknot-yparser.la zscanner/libzscanner.la $(lib
knotd_CPPFLAGS = $(AM_CPPFLAGS) $(liburcu_CFLAGS)
knotd_LDADD = libknotd.la $(liburcu_LIBS)
knotc_LDADD = libknotd.la
knot1to2_LDADD = libknot-internal.la libcontrib.la
knot1to2_LDADD = libcontrib.la
####################################
# Optional Knot DNS Daemon modules #
......
......@@ -113,9 +113,9 @@ int conf_new(
// Prepare namedb api.
out->mm = malloc(sizeof(knot_mm_t));
mm_ctx_mempool(out->mm, MM_DEFAULT_BLKSIZE);
struct namedb_lmdb_opts lmdb_opts = NAMEDB_LMDB_OPTS_INITIALIZER;
struct knot_db_lmdb_opts lmdb_opts = KNOT_DB_LMDB_OPTS_INITIALIZER;
lmdb_opts.mapsize = 500 * 1024 * 1024;
lmdb_opts.flags.env = NAMEDB_LMDB_NOTLS;
lmdb_opts.flags.env = KNOT_DB_LMDB_NOTLS;
// Open database.
if (db_dir == NULL) {
......@@ -126,14 +126,14 @@ int conf_new(
ret = KNOT_ENOMEM;
goto new_error;
}
out->api = namedb_lmdb_api();
out->api = knot_db_lmdb_api();
ret = out->api->init(&out->db, out->mm, &lmdb_opts);
// Remove opened database to ensure it is temporary.
rm_dir(tpl);
} else {
lmdb_opts.path = db_dir;
out->api = namedb_lmdb_api();
out->api = knot_db_lmdb_api();
ret = out->api->init(&out->db, out->mm, &lmdb_opts);
}
......@@ -143,7 +143,7 @@ int conf_new(
}
// Initialize/check database.
namedb_txn_t txn;
knot_db_txn_t txn;
ret = out->api->txn_begin(out->db, &txn, 0);
if (ret != KNOT_EOK) {
out->api->deinit(out->db);
......@@ -164,7 +164,7 @@ int conf_new(
}
// Open common read-only transaction.
ret = out->api->txn_begin(out->db, &out->read_txn, NAMEDB_RDONLY);
ret = out->api->txn_begin(out->db, &out->read_txn, KNOT_DB_RDONLY);
if (ret != KNOT_EOK) {
out->api->deinit(out->db);
goto new_error;
......@@ -212,7 +212,7 @@ int conf_clone(
out->filename = s_conf->filename;
// Open common read-only transaction.
ret = out->api->txn_begin(out->db, &out->read_txn, NAMEDB_RDONLY);
ret = out->api->txn_begin(out->db, &out->read_txn, KNOT_DB_RDONLY);
if (ret != KNOT_EOK) {
yp_scheme_free(out->scheme);
free(out);
......@@ -467,7 +467,7 @@ static void log_prev_err(
static int parser_calls(
conf_t *conf,
namedb_txn_t *txn,
knot_db_txn_t *txn,
yp_parser_t *parser,
yp_check_ctx_t *ctx)
{
......@@ -555,7 +555,7 @@ static int parser_calls(
int conf_parse(
conf_t *conf,
namedb_txn_t *txn,
knot_db_txn_t *txn,
const char *input,
bool is_file,
void *data)
......@@ -653,7 +653,7 @@ int conf_import(
int ret;
namedb_txn_t txn;
knot_db_txn_t txn;
ret = conf->api->txn_begin(conf->db, &txn, 0);
if (ret != KNOT_EOK) {
goto import_error;
......@@ -690,7 +690,7 @@ int conf_import(
// Update read-only transaction.
conf->api->txn_abort(&conf->read_txn);
ret = conf->api->txn_begin(conf->db, &conf->read_txn, NAMEDB_RDONLY);
ret = conf->api->txn_begin(conf->db, &conf->read_txn, KNOT_DB_RDONLY);
if (ret != KNOT_EOK) {
goto import_error;
}
......
......@@ -26,7 +26,6 @@
#pragma once
#include "libknot/libknot.h"
#include "libknot/internal/namedb/namedb_lmdb.h"
#include "libknot/yparser/ypscheme.h"
#include "contrib/ucw/lists.h"
......@@ -64,22 +63,22 @@ typedef struct {
/*! Configuration context. */
typedef struct {
/*! Currently used namedb api. */
const struct namedb_api *api;
const struct knot_db_api *api;
/*! Configuration scheme. */
yp_item_t *scheme;
/*! Memory context. */
knot_mm_t *mm;
/*! Configuration database. */
namedb_t *db;
knot_db_t *db;
/*! Read-only transaction for config access. */
namedb_txn_t read_txn;
knot_db_txn_t read_txn;
struct {
/*! The current writing transaction. */
namedb_txn_t *txn;
knot_db_txn_t *txn;
/*! Stack of nested writing transactions. */
namedb_txn_t txn_stack[CONF_MAX_TXN_DEPTH];
knot_db_txn_t txn_stack[CONF_MAX_TXN_DEPTH];
} io;
/*! Prearranged hostname string (for automatic NSID or CH ident value). */
......@@ -206,7 +205,7 @@ void conf_deactivate_modules(
*/
int conf_parse(
conf_t *conf,
namedb_txn_t *txn,
knot_db_txn_t *txn,
const char *input,
bool is_file,
void *data
......
......@@ -41,7 +41,7 @@
conf_val_t conf_get_txn(
conf_t *conf,
namedb_txn_t *txn,
knot_db_txn_t *txn,
const yp_name_t *key0_name,
const yp_name_t *key1_name)
{
......@@ -67,7 +67,7 @@ conf_val_t conf_get_txn(
conf_val_t conf_rawid_get_txn(
conf_t *conf,
namedb_txn_t *txn,
knot_db_txn_t *txn,
const yp_name_t *key0_name,
const yp_name_t *key1_name,
const uint8_t *id,
......@@ -95,7 +95,7 @@ conf_val_t conf_rawid_get_txn(
conf_val_t conf_id_get_txn(
conf_t *conf,
namedb_txn_t *txn,
knot_db_txn_t *txn,
const yp_name_t *key0_name,
const yp_name_t *key1_name,
conf_val_t *id)
......@@ -125,7 +125,7 @@ conf_val_t conf_id_get_txn(
conf_val_t conf_mod_get_txn(
conf_t *conf,
namedb_txn_t *txn,
knot_db_txn_t *txn,
const yp_name_t *key1_name,
const conf_mod_id_t *mod_id)
{
......@@ -152,7 +152,7 @@ conf_val_t conf_mod_get_txn(
conf_val_t conf_zone_get_txn(
conf_t *conf,
namedb_txn_t *txn,
knot_db_txn_t *txn,
const yp_name_t *key1_name,
const knot_dname_t *dname)
{
......@@ -212,7 +212,7 @@ conf_val_t conf_zone_get_txn(
conf_val_t conf_default_get_txn(
conf_t *conf,
namedb_txn_t *txn,
knot_db_txn_t *txn,
const yp_name_t *key1_name)
{
conf_val_t val = { NULL };
......@@ -240,7 +240,7 @@ conf_val_t conf_default_get_txn(
size_t conf_id_count_txn(
conf_t *conf,
namedb_txn_t *txn,
knot_db_txn_t *txn,
const yp_name_t *key0_name)
{
size_t count = 0;
......@@ -255,7 +255,7 @@ size_t conf_id_count_txn(
conf_iter_t conf_iter_txn(
conf_t *conf,
namedb_txn_t *txn,
knot_db_txn_t *txn,
const yp_name_t *key0_name)
{
conf_iter_t iter = { NULL };
......@@ -852,7 +852,7 @@ static int str_label(
static char* get_filename(
conf_t *conf,
namedb_txn_t *txn,
knot_db_txn_t *txn,
const knot_dname_t *zone,
const char *name)
{
......@@ -951,7 +951,7 @@ static char* get_filename(
char* conf_zonefile_txn(
conf_t *conf,
namedb_txn_t *txn,
knot_db_txn_t *txn,
const knot_dname_t *zone)
{
if (zone == NULL) {
......@@ -971,7 +971,7 @@ char* conf_zonefile_txn(
char* conf_journalfile_txn(
conf_t *conf,
namedb_txn_t *txn,
knot_db_txn_t *txn,
const knot_dname_t *zone)
{
if (zone == NULL) {
......@@ -983,7 +983,7 @@ char* conf_journalfile_txn(
size_t conf_udp_threads_txn(
conf_t *conf,
namedb_txn_t *txn)
knot_db_txn_t *txn)
{
conf_val_t val = conf_get_txn(conf, txn, C_SRV, C_UDP_WORKERS);
int64_t workers = conf_int(&val);
......@@ -996,7 +996,7 @@ size_t conf_udp_threads_txn(
size_t conf_tcp_threads_txn(
conf_t *conf,
namedb_txn_t *txn)
knot_db_txn_t *txn)
{
conf_val_t val = conf_get_txn(conf, txn, C_SRV, C_TCP_WORKERS);
int64_t workers = conf_int(&val);
......@@ -1009,7 +1009,7 @@ size_t conf_tcp_threads_txn(
size_t conf_bg_threads_txn(
conf_t *conf,
namedb_txn_t *txn)
knot_db_txn_t *txn)
{
conf_val_t val = conf_get_txn(conf, txn, C_SRV, C_BG_WORKERS);
int64_t workers = conf_int(&val);
......@@ -1022,7 +1022,7 @@ size_t conf_bg_threads_txn(
int conf_user_txn(
conf_t *conf,
namedb_txn_t *txn,
knot_db_txn_t *txn,
int *uid,
int *gid)
{
......@@ -1077,7 +1077,7 @@ int conf_user_txn(
conf_remote_t conf_remote_txn(
conf_t *conf,
namedb_txn_t *txn,
knot_db_txn_t *txn,
conf_val_t *id,
size_t index)
{
......
......@@ -47,7 +47,7 @@ typedef struct {
/*! Item description. */
const yp_item_t *item;
/*! Namedb iterator. */
namedb_iter_t *iter;
knot_db_iter_t *iter;
/*! Key0 database code. */
uint8_t key0_code;
// Public items.
......@@ -77,7 +77,7 @@ typedef struct {
*/
conf_val_t conf_get_txn(
conf_t *conf,
namedb_txn_t *txn,
knot_db_txn_t *txn,
const yp_name_t *key0_name,
const yp_name_t *key1_name
);
......@@ -103,7 +103,7 @@ static inline conf_val_t conf_get(
*/
conf_val_t conf_rawid_get_txn(
conf_t *conf,
namedb_txn_t *txn,
knot_db_txn_t *txn,
const yp_name_t *key0_name,
const yp_name_t *key1_name,
const uint8_t *id,
......@@ -133,7 +133,7 @@ static inline conf_val_t conf_rawid_get(
*/
conf_val_t conf_id_get_txn(
conf_t *conf,
namedb_txn_t *txn,
knot_db_txn_t *txn,
const yp_name_t *key0_name,
const yp_name_t *key1_name,
conf_val_t *id
......@@ -159,7 +159,7 @@ static inline conf_val_t conf_id_get(
*/
conf_val_t conf_mod_get_txn(
conf_t *conf,
namedb_txn_t *txn,
knot_db_txn_t *txn,
const yp_name_t *key1_name,
const conf_mod_id_t *mod_id
);
......@@ -185,7 +185,7 @@ static inline conf_val_t conf_mod_get(
*/
conf_val_t conf_zone_get_txn(
conf_t *conf,
namedb_txn_t *txn,
knot_db_txn_t *txn,
const yp_name_t *key1_name,
const knot_dname_t *dname
);
......@@ -208,7 +208,7 @@ static inline conf_val_t conf_zone_get(
*/
conf_val_t conf_default_get_txn(
conf_t *conf,
namedb_txn_t *txn,
knot_db_txn_t *txn,
const yp_name_t *key1_name
);
static inline conf_val_t conf_default_get(
......@@ -229,7 +229,7 @@ static inline conf_val_t conf_default_get(
*/
size_t conf_id_count_txn(
conf_t *conf,
namedb_txn_t *txn,
knot_db_txn_t *txn,
const yp_name_t *key0_name
);
static inline size_t conf_id_count(
......@@ -250,7 +250,7 @@ static inline size_t conf_id_count(
*/
conf_iter_t conf_iter_txn(
conf_t *conf,
namedb_txn_t *txn,
knot_db_txn_t *txn,
const yp_name_t *key0_name
);
static inline conf_iter_t conf_iter(
......@@ -499,7 +499,7 @@ void conf_free_mod_id(
*/
char* conf_zonefile_txn(
conf_t *conf,
namedb_txn_t *txn,
knot_db_txn_t *txn,
const knot_dname_t *zone
);
static inline char* conf_zonefile(
......@@ -522,7 +522,7 @@ static inline char* conf_zonefile(
*/
char* conf_journalfile_txn(
conf_t *conf,
namedb_txn_t *txn,
knot_db_txn_t *txn,
const knot_dname_t *zone
);
static inline char* conf_journalfile(
......@@ -542,7 +542,7 @@ static inline char* conf_journalfile(
*/
size_t conf_udp_threads_txn(
conf_t *conf,
namedb_txn_t *txn
knot_db_txn_t *txn
);
static inline size_t conf_udp_threads(
conf_t *conf)
......@@ -560,7 +560,7 @@ static inline size_t conf_udp_threads(
*/
size_t conf_tcp_threads_txn(
conf_t *conf,
namedb_txn_t *txn
knot_db_txn_t *txn
);
static inline size_t conf_tcp_threads(
conf_t *conf)
......@@ -578,7 +578,7 @@ static inline size_t conf_tcp_threads(
*/
size_t conf_bg_threads_txn(
conf_t *conf,
namedb_txn_t *txn
knot_db_txn_t *txn
);
static inline size_t conf_bg_threads(
conf_t *conf)
......@@ -598,7 +598,7 @@ static inline size_t conf_bg_threads(
*/
int conf_user_txn(
conf_t *conf,
namedb_txn_t *txn,
knot_db_txn_t *txn,
int *uid,
int *gid
);
......@@ -622,7 +622,7 @@ static inline int conf_user(
*/
conf_remote_t conf_remote_txn(
conf_t *conf,
namedb_txn_t *txn,
knot_db_txn_t *txn,
conf_val_t *id,
size_t index
);
......
......@@ -88,11 +88,11 @@ typedef enum {
static int db_check_version(
conf_t *conf,
namedb_txn_t *txn)
knot_db_txn_t *txn)
{
uint8_t k[2] = { KEY0_ROOT, KEY1_VERSION };
namedb_val_t key = { k, sizeof(k) };
namedb_val_t data;
knot_db_val_t key = { k, sizeof(k) };
knot_db_val_t data;
// Get conf-DB version.
int ret = conf->api->find(txn, &key, &data, 0);
......@@ -110,7 +110,7 @@ static int db_check_version(
static int db_check(
conf_t *conf,
namedb_txn_t *txn)
knot_db_txn_t *txn)
{
int ret = conf->api->count(txn);
if (ret == 0) { // Empty DB.
......@@ -124,19 +124,19 @@ static int db_check(
int conf_db_init(
conf_t *conf,
namedb_txn_t *txn)
knot_db_txn_t *txn)
{
if (conf == NULL || txn == NULL) {
return KNOT_EINVAL;
}
uint8_t k[2] = { KEY0_ROOT, KEY1_VERSION };
namedb_val_t key = { k, sizeof(k) };
knot_db_val_t key = { k, sizeof(k) };
int ret = conf->api->count(txn);
if (ret == 0) { // Initialize empty DB with DB version.
uint8_t d[1] = { CONF_DB_VERSION };
namedb_val_t data = { d, sizeof(d) };
knot_db_val_t data = { d, sizeof(d) };
return conf->api->insert(txn, &key, &data, 0);
} else if (ret > 0) { // Check existing DB.
return db_check(conf, txn);
......@@ -147,7 +147,7 @@ int conf_db_init(
static int db_code(
conf_t *conf,
namedb_txn_t *txn,
knot_db_txn_t *txn,
uint8_t section_code,
const yp_name_t *name,
db_action_t action,
......@@ -157,7 +157,7 @@ static int db_code(
return KNOT_EINVAL;
}
namedb_val_t key;
knot_db_val_t key;
uint8_t k[CONF_MIN_KEY_LEN + YP_MAX_ITEM_NAME_LEN];
k[KEY0_POS] = section_code;
k[KEY1_POS] = KEY1_ITEMS;
......@@ -166,7 +166,7 @@ static int db_code(
key.len = CONF_MIN_KEY_LEN + name[0];
// Check if the item is already registered.
namedb_val_t data;
knot_db_val_t data;
int ret = conf->api->find(txn, &key, &data, 0);
switch (ret) {
case KNOT_EOK:
......@@ -192,10 +192,10 @@ static int db_code(
bool codes[KEY1_LAST + 1] = { false };
// Find all used item codes.
namedb_iter_t *it = conf->api->iter_begin(txn, NAMEDB_NOOP);
it = conf->api->iter_seek(it, &key, NAMEDB_GEQ);
knot_db_iter_t *it = conf->api->iter_begin(txn, KNOT_DB_NOOP);
it = conf->api->iter_seek(it, &key, KNOT_DB_GEQ);
while (it != NULL) {
namedb_val_t iter_key;
knot_db_val_t iter_key;
ret = conf->api->iter_key(it, &iter_key);
if (ret != KNOT_EOK) {
conf->api->iter_finish(it);
......@@ -209,7 +209,7 @@ static int db_code(
break;
}
namedb_val_t iter_val;
knot_db_val_t iter_val;
ret = conf->api->iter_val(it, &iter_val);
if (ret != KNOT_EOK) {
conf->api->iter_finish(it);
......@@ -252,8 +252,8 @@ static int db_code(
}
static uint8_t *find_data(
const namedb_val_t *value,
const namedb_val_t *current)
const knot_db_val_t *value,
const knot_db_val_t *current)
{
wire_ctx_t ctx = wire_ctx_init_const(current->data, current->len);
......@@ -279,9 +279,9 @@ static uint8_t *find_data(
static int db_set(
conf_t *conf,
namedb_txn_t *txn,
namedb_val_t *key,
namedb_val_t *data,
knot_db_txn_t *txn,
knot_db_val_t *key,
knot_db_val_t *data,
bool multi)
{
if (!multi) {
......@@ -293,7 +293,7 @@ static int db_set(
return conf->api->insert(txn, key, data, 0);
}
namedb_val_t d;
knot_db_val_t d;
if (data->len > UINT16_MAX) {
return KNOT_ERANGE;
......@@ -346,7 +346,7 @@ static int db_set(
int conf_db_set(
conf_t *conf,
namedb_txn_t *txn,
knot_db_txn_t *txn,
const yp_name_t *key0,
const yp_name_t *key1,
const uint8_t *id,
......@@ -379,7 +379,7 @@ int conf_db_set(
}
uint8_t k[CONF_MAX_KEY_LEN] = { 0 };
namedb_val_t key = { k, CONF_MIN_KEY_LEN };
knot_db_val_t key = { k, CONF_MIN_KEY_LEN };
// Set key0 code.
int ret = db_code(conf, txn, KEY0_ROOT, key0, DB_SET, &k[KEY0_POS]);
......@@ -396,7 +396,7 @@ int conf_db_set(
key.len += id_len;
k[KEY1_POS] = KEY1_ID;
namedb_val_t val = { NULL };
knot_db_val_t val = { NULL };
// Insert id.
if (key1 == NULL) {
......@@ -425,7 +425,7 @@ int conf_db_set(
return ret;
}
namedb_val_t val = { (uint8_t *)data, data_len };
knot_db_val_t val = { (uint8_t *)data, data_len };
ret = db_set(conf, txn, &key, &val, item->flags & YP_FMULTI);
if (ret != KNOT_EOK) {
return ret;
......@@ -437,9 +437,9 @@ int conf_db_set(
static int db_unset(
conf_t *conf,
namedb_txn_t *txn,
namedb_val_t *key,
namedb_val_t *data,
knot_db_txn_t *txn,
knot_db_val_t *key,
knot_db_val_t *data,
bool multi)
{
// No item data can be zero length.
......@@ -447,7 +447,7 @@ static int db_unset(
return conf->api->del(txn, key);
}
namedb_val_t d;
knot_db_val_t d;
int ret = conf->api->find(txn, key, &d, 0);
if (ret != KNOT_EOK) {
......@@ -513,7 +513,7 @@ static int db_unset(
int conf_db_unset(
conf_t *conf,
namedb_txn_t *txn,
knot_db_txn_t *txn,
const yp_name_t *key0,
const yp_name_t *key1,
const uint8_t *id,
......@@ -547,7 +547,7 @@ int conf_db_unset(
}
uint8_t k[CONF_MAX_KEY_LEN] = { 0 };
namedb_val_t key = { k, CONF_MIN_KEY_LEN };
knot_db_val_t key = { k, CONF_MIN_KEY_LEN };
// Set the key0 code.
int ret = db_code(conf, txn, KEY0_ROOT, key0, DB_GET, &k[KEY0_POS]);
......@@ -564,7 +564,7 @@ int conf_db_unset(
key.len += id_len;
k[KEY1_POS] = KEY1_ID;
namedb_val_t val = { NULL };
knot_db_val_t val = { NULL };
// Delete the id.
if (key1 == NULL) {
......@@ -593,7 +593,7 @@ int conf_db_unset(
}
// Delete the item data.
} else {
namedb_val_t val = { (uint8_t *)data, data_len };
knot_db_val_t val = { (uint8_t *)data, data_len };
ret = db_unset(conf, txn, &key, &val, item->flags & YP_FMULTI);
if (ret != KNOT_EOK) {
return ret;
......@@ -606,7 +606,7 @@ int conf_db_unset(
int conf_db_get(
conf_t *conf,