Commit 092fd1f2 authored by Daniel Salzman's avatar Daniel Salzman

contrib: move hhash and hat-trie from internal, divide mempattern into mm_ctx and mempattern

parent c93fabc0
......@@ -49,12 +49,18 @@ src/contrib/dnstap/writer.h
src/contrib/endian.h
src/contrib/getline.c
src/contrib/getline.h
src/contrib/hat-trie/hat-trie.c
src/contrib/hat-trie/hat-trie.h
src/contrib/hhash.c
src/contrib/hhash.h
src/contrib/lmdb/lmdb.h
src/contrib/lmdb/mdb.c
src/contrib/lmdb/midl.c
src/contrib/lmdb/midl.h
src/contrib/lookup.h
src/contrib/macros.h
src/contrib/mempattern.c
src/contrib/mempattern.h
src/contrib/murmurhash3/murmurhash3.c
src/contrib/murmurhash3/murmurhash3.h
src/contrib/net.c
......@@ -374,20 +380,15 @@ src/libknot/dnssec/rrset-sign.h
src/libknot/errcode.h
src/libknot/error.c
src/libknot/error.h
src/libknot/internal/hhash.c
src/libknot/internal/hhash.h
src/libknot/internal/lists.c
src/libknot/internal/lists.h
src/libknot/internal/mempattern.c
src/libknot/internal/mempattern.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/internal/trie/hat-trie.c
src/libknot/internal/trie/hat-trie.h
src/libknot/libknot.h
src/libknot/mm_ctx.h
src/libknot/packet/compr.c
src/libknot/packet/compr.h
src/libknot/packet/pkt.c
......
......@@ -28,8 +28,10 @@ nobase_libcontrib_la_HEADERS = \
contrib/base64.h \
contrib/endian.h \
contrib/getline.h \
contrib/hhash.h \
contrib/lookup.h \
contrib/macros.h \
contrib/mempattern.h \
contrib/net.h \
contrib/print.h \
contrib/sockaddr.h \
......@@ -37,6 +39,7 @@ nobase_libcontrib_la_HEADERS = \
contrib/tolower.h \
contrib/wire.h \
contrib/wire_ctx.h \
contrib/hat-trie/hat-trie.h \
contrib/murmurhash3/murmurhash3.h \
contrib/openbsd/strlcat.h \
contrib/openbsd/strlcpy.h \
......@@ -58,6 +61,7 @@ nobase_libknot_la_HEADERS = \
libknot/errcode.h \
libknot/error.h \
libknot/libknot.h \
libknot/mm_ctx.h \
libknot/packet/compr.h \
libknot/packet/pkt.h \
libknot/packet/rrset-wire.h \
......@@ -86,13 +90,10 @@ nobase_libknot_la_HEADERS = \
libknot_internal_ladir = $(includedir)
nobase_libknot_internal_la_HEADERS = \
libknot/internal/hhash.h \
libknot/internal/lists.h \
libknot/internal/mempattern.h \
libknot/internal/namedb/namedb.h \
libknot/internal/namedb/namedb_lmdb.h \
libknot/internal/namedb/namedb_trie.h \
libknot/internal/trie/hat-trie.h
libknot/internal/namedb/namedb_trie.h
libknot_yparser_ladir = $(includedir)
nobase_libknot_yparser_la_HEADERS = \
......@@ -106,10 +107,13 @@ libcontrib_la_SOURCES = \
contrib/base32hex.c \
contrib/base64.c \
contrib/getline.c \
contrib/hhash.c \
contrib/mempattern.c \
contrib/net.c \
contrib/print.c \
contrib/sockaddr.c \
contrib/string.c \
contrib/hat-trie/hat-trie.c \
contrib/murmurhash3/murmurhash3.c \
contrib/openbsd/strlcat.c \
contrib/openbsd/strlcpy.c \
......@@ -156,12 +160,9 @@ libknot_yparser_la_SOURCES = \
$(nobase_libknot_yparser_la_HEADERS)
libknot_internal_la_SOURCES = \
libknot/internal/hhash.c \
libknot/internal/lists.c \
libknot/internal/mempattern.c \
libknot/internal/namedb/namedb_lmdb.c \
libknot/internal/namedb/namedb_trie.c \
libknot/internal/trie/hat-trie.c \
$(nobase_libknot_internal_la_HEADERS)
libcontrib_la_CPPFLAGS = $(AM_CPPFLAGS)
......
......@@ -8,8 +8,10 @@
#include <stdint.h>
#include <assert.h>
#include <string.h>
#include "libknot/internal/trie/hat-trie.h"
#include "libknot/internal/hhash.h"
#include "contrib/hhash.h"
#include "contrib/hat-trie/hat-trie.h"
#include "contrib/mempattern.h"
#include "libknot/errcode.h"
/* number of child nodes for used alphabet */
#define NODE_CHILDS (TRIE_MAXCHAR+1)
......@@ -52,7 +54,7 @@ struct hattrie_t_
node_ptr root; // root node
size_t m; // number of stored keys
unsigned bsize; // bucket size
mm_ctx_t mm;
knot_mm_t mm;
};
/* Create an empty trie node. */
......@@ -277,7 +279,7 @@ static void hattrie_initroot(hattrie_t *T)
}
/* Free hat-trie nodes recursively. */
static void hattrie_free_node(node_ptr node, mm_free_t free_cb)
static void hattrie_free_node(node_ptr node, knot_mm_free_t free_cb)
{
if (*node.flag & NODE_TYPE_TRIE) {
size_t i;
......@@ -315,7 +317,7 @@ static void hattrie_deinit(hattrie_t * T)
hattrie_t* hattrie_create()
{
mm_ctx_t mm;
knot_mm_t mm;
mm_ctx_init(&mm);
return hattrie_create_n(TRIE_BUCKET_SIZE, &mm);
}
......@@ -371,10 +373,10 @@ size_t hattrie_weight (const hattrie_t *T)
return T->m;
}
hattrie_t* hattrie_create_n(unsigned bucket_size, const mm_ctx_t *mm)
hattrie_t* hattrie_create_n(unsigned bucket_size, const knot_mm_t *mm)
{
hattrie_t* T = mm_alloc((mm_ctx_t *)mm, sizeof(hattrie_t));
memcpy(&T->mm, mm, sizeof(mm_ctx_t));
hattrie_t* T = mm_alloc((knot_mm_t *)mm, sizeof(hattrie_t));
memcpy(&T->mm, mm, sizeof(knot_mm_t));
hattrie_init(T, bucket_size);
return T;
}
......
......@@ -23,9 +23,10 @@ extern "C" {
#include <stdlib.h>
#include <stdbool.h>
#include "libknot/internal/mempattern.h"
#include "libknot/internal/hhash.h"
#include "libknot/errcode.h"
#include "contrib/hhash.h"
struct knot_mm;
/* Hat-trie defines. */
#define TRIE_ZEROBUCKETS 0 /* Do not use hash buckets (pure trie). */
......@@ -44,7 +45,7 @@ size_t hattrie_weight (const hattrie_t*); //< Number of entries
/** Create new trie with custom bucket size and memory management.
*/
hattrie_t* hattrie_create_n (unsigned, const mm_ctx_t *);
hattrie_t* hattrie_create_n (unsigned, const struct knot_mm *);
/** Duplicate an existing trie.
*/
......
/* Copyright (C) 2011 CZ.NIC, z.s.p.o. <knot-dns@labs.nic.cz>
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#include <string.h>
#include <assert.h>
#include <stdbool.h>
#include "contrib/hhash.h"
#include "contrib/macros.h"
#include "contrib/mempattern.h"
#include "contrib/murmurhash3/murmurhash3.h"
#include "libknot/internal/hhash.h"
#include "libknot/errcode.h"
/* UCW array sorting defines. */
......@@ -128,14 +145,14 @@ static int hhelem_free(hhash_t* tbl, uint32_t id, unsigned dist, value_t *val)
}
/* Erase data from target element. */
if (tbl->mm.free) {
tbl->mm.free(elm->d);
if (tbl->mm->free) {
tbl->mm->free(elm->d);
elm->d = NULL;
}
/* Invalidate index. */
if (tbl->mm.free) {
tbl->mm.free(tbl->index);
if (tbl->mm->free) {
tbl->mm->free(tbl->index);
tbl->index = NULL;
}
......@@ -193,37 +210,47 @@ static unsigned find_match(hhash_t *tbl, uint32_t idx, const char* key, uint16_t
static void hhash_free_buckets(hhash_t *tbl)
{
assert(tbl != NULL);
if (tbl->mm.free) {
if (tbl->mm->free) {
/* Free buckets. */
for (unsigned i = 0; i < tbl->size; ++i) {
tbl->mm.free(tbl->item[i].d);
tbl->mm->free(tbl->item[i].d);
}
/* Free order index. */
tbl->mm.free(tbl->index);
tbl->mm->free(tbl->index);
}
}
hhash_t *hhash_create(uint32_t size)
{
mm_ctx_t mm;
knot_mm_t mm;
mm_ctx_init(&mm);
return hhash_create_mm(size, &mm);
}
hhash_t *hhash_create_mm(uint32_t size, const mm_ctx_t *mm)
hhash_t *hhash_create_mm(uint32_t size, const knot_mm_t *mm)
{
if (size == 0) {
return NULL;
}
const size_t total_len = sizeof(hhash_t) + size * sizeof(hhelem_t);
hhash_t *tbl = mm_alloc((mm_ctx_t *)mm, total_len);
if (tbl) {
memset(tbl, 0, total_len);
tbl->size = size;
memcpy(&tbl->mm, mm, sizeof(mm_ctx_t));
hhash_t *tbl = mm_alloc((knot_mm_t *)mm, total_len);
if (tbl == NULL) {
return NULL;
}
memset(tbl, 0, total_len);
knot_mm_t *mm_copy = mm_alloc((knot_mm_t *)mm, sizeof(knot_mm_t));
if (mm_copy == NULL) {
mm_free((knot_mm_t *)mm, tbl);
return NULL;
}
memcpy(mm_copy, mm, sizeof(knot_mm_t));
tbl->size = size;
tbl->mm = mm_copy;
return tbl;
}
......@@ -253,8 +280,10 @@ void hhash_free(hhash_t *tbl)
hhash_free_buckets(tbl);
/* Free table. */
if (tbl->mm.free) {
tbl->mm.free(tbl);
knot_mm_free_t mm_free = tbl->mm->free;
if (mm_free) {
mm_free(tbl->mm);
mm_free(tbl);
}
}
......@@ -313,7 +342,7 @@ value_t *hhash_map(hhash_t* tbl, const char* key, uint16_t len, uint16_t mode)
}
/* Insert to given position. */
char *new_key = tbl->mm.alloc(tbl->mm.ctx, HHKEY_LEN + len);
char *new_key = tbl->mm->alloc(tbl->mm->ctx, HHKEY_LEN + len);
if (new_key != NULL) {
memset(KEY_VAL(new_key), 0, sizeof(value_t));
memcpy(KEY_LEN(new_key), &len, sizeof(uint16_t));
......@@ -331,7 +360,7 @@ value_t *hhash_map(hhash_t* tbl, const char* key, uint16_t len, uint16_t mode)
/* Free old index. */
if (tbl->index) {
if (tbl->mm.free) {
if (tbl->mm->free) {
free(tbl->index);
}
tbl->index = NULL;
......@@ -382,8 +411,8 @@ void hhash_build_index(hhash_t* tbl)
/* Free old index. */
if (tbl->index) {
if (tbl->mm.free) {
tbl->mm.free(tbl->index);
if (tbl->mm->free) {
tbl->mm->free(tbl->index);
}
tbl->index = NULL;
}
......@@ -393,7 +422,7 @@ void hhash_build_index(hhash_t* tbl)
if (total == 0) {
return;
}
tbl->index = tbl->mm.alloc(tbl->mm.ctx, total * sizeof(uint32_t));
tbl->index = tbl->mm->alloc(tbl->mm->ctx, total * sizeof(uint32_t));
uint32_t i = 0, indexed = 0;
while (indexed < total) {
......
......@@ -14,13 +14,11 @@
along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
/*!
* \file hhash.h
*
* \author Marek Vavrusa <marek.vavrusa@nic.cz>
* \file
*
* \brief Hopscotch hashing scheme based hash table.
*
* \addtogroup common_lib
* \addtogroup contrib
* @{
*/
......@@ -29,7 +27,8 @@
#include <stdlib.h>
#include <stdint.h>
#include <stdbool.h>
#include "libknot/internal/mempattern.h"
struct knot_mm;
/*! \brief Bitvector type. */
typedef unsigned hhbitvec_t;
......@@ -59,13 +58,13 @@ typedef struct hhash {
uint8_t c1;
/* Metadata */
uint32_t size; /*!< Number of buckets */
uint32_t weight; /*!< Table weight (number of inserted). */
uint32_t size; /*!< Number of buckets */
uint32_t weight; /*!< Table weight (number of inserted). */
/* Table data storage. */
mm_ctx_t mm; /*!< Memory manager. */
uint32_t *index; /*!< Order index (optional). */
hhelem_t item[]; /*!< Table items. */
struct knot_mm *mm; /*!< Memory manager. */
uint32_t *index; /*!< Order index (optional). */
hhelem_t item[]; /*!< Table items. */
} hhash_t;
/*!
......@@ -78,7 +77,7 @@ typedef struct hhash {
hhash_t *hhash_create(uint32_t size);
/*! \brief Create hopscotch hash table (custom memory manager). */
hhash_t *hhash_create_mm(uint32_t size, const mm_ctx_t *mm);
hhash_t *hhash_create_mm(uint32_t size, const struct knot_mm *mm);
/*!
* \brief Clear hash table.
......
......@@ -16,7 +16,7 @@
#include <stdlib.h>
#include "libknot/internal/mempattern.h"
#include "contrib/mempattern.h"
#include "contrib/ucw/mempool.h"
static void mm_nofree(void *p)
......@@ -30,7 +30,7 @@ static void *mm_malloc(void *ctx, size_t n)
return malloc(n);
}
void *mm_alloc(mm_ctx_t *mm, size_t size)
void *mm_alloc(knot_mm_t *mm, size_t size)
{
if (mm) {
return mm->alloc(mm->ctx, size);
......@@ -39,7 +39,7 @@ void *mm_alloc(mm_ctx_t *mm, size_t size)
}
}
void *mm_realloc(mm_ctx_t *mm, void *what, size_t size, size_t prev_size)
void *mm_realloc(knot_mm_t *mm, void *what, size_t size, size_t prev_size)
{
if (mm) {
void *p = mm->alloc(mm->ctx, size);
......@@ -58,7 +58,7 @@ void *mm_realloc(mm_ctx_t *mm, void *what, size_t size, size_t prev_size)
}
}
void mm_free(mm_ctx_t *mm, void *what)
void mm_free(knot_mm_t *mm, void *what)
{
if (mm) {
if (mm->free) {
......@@ -69,16 +69,16 @@ void mm_free(mm_ctx_t *mm, void *what)
}
}
void mm_ctx_init(mm_ctx_t *mm)
void mm_ctx_init(knot_mm_t *mm)
{
mm->ctx = NULL;
mm->alloc = mm_malloc;
mm->free = free;
}
void mm_ctx_mempool(mm_ctx_t *mm, size_t chunk_size)
void mm_ctx_mempool(knot_mm_t *mm, size_t chunk_size)
{
mm->ctx = mp_new(chunk_size);
mm->alloc = (mm_alloc_t)mp_alloc;
mm->alloc = (knot_mm_alloc_t)mp_alloc;
mm->free = mm_nofree;
}
......@@ -14,46 +14,32 @@
along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
/*!
* \file mempattern.h
*
* \author Marek Vavrusa <marek.vavrusa@nic.cz>
* \file
*
* \brief Memory allocation related functions.
*
* \addtogroup alloc
* \addtogroup contrib
* @{
*/
#pragma once
#include <stddef.h>
#include "libknot/mm_ctx.h"
/* Default memory block size. */
#define MM_DEFAULT_BLKSIZE 4096
/* Memory allocation function prototypes. */
typedef void* (*mm_alloc_t)(void* ctx, size_t len);
typedef void (*mm_free_t)(void *p);
typedef void (*mm_flush_t)(void *p);
/*! \brief Memory allocation context. */
typedef struct mm_ctx {
void *ctx; /* \note Must be first */
mm_alloc_t alloc;
mm_free_t free;
} mm_ctx_t;
/*! \brief Allocs using 'mm' if any, uses system malloc() otherwise. */
void *mm_alloc(mm_ctx_t *mm, size_t size);
void *mm_alloc(knot_mm_t *mm, size_t size);
/*! \brief Reallocs using 'mm' if any, uses system realloc() otherwise. */
void *mm_realloc(mm_ctx_t *mm, void *what, size_t size, size_t prev_size);
void *mm_realloc(knot_mm_t *mm, void *what, size_t size, size_t prev_size);
/*! \brief Free using 'mm' if any, uses system free() otherwise. */
void mm_free(mm_ctx_t *mm, void *what);
void mm_free(knot_mm_t *mm, void *what);
/*! \brief Initialize default memory allocation context. */
void mm_ctx_init(mm_ctx_t *mm);
void mm_ctx_init(knot_mm_t *mm);
/*! \brief Memory pool context. */
void mm_ctx_mempool(mm_ctx_t *mm, size_t chunk_size);
void mm_ctx_mempool(knot_mm_t *mm, size_t chunk_size);
/*! @} */
......@@ -29,6 +29,7 @@
#include "libknot/libknot.h"
#include "libknot/yparser/ypformat.h"
#include "libknot/yparser/yptrafo.h"
#include "contrib/mempattern.h"
#include "contrib/sockaddr.h"
#include "contrib/string.h"
#include "contrib/ucw/mempool.h"
......@@ -110,7 +111,7 @@ int conf_new(
}
// Prepare namedb api.
out->mm = malloc(sizeof(mm_ctx_t));
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;
lmdb_opts.mapsize = 500 * 1024 * 1024;
......
......@@ -68,7 +68,7 @@ typedef struct {
/*! Configuration scheme. */
yp_item_t *scheme;
/*! Memory context. */
mm_ctx_t *mm;
knot_mm_t *mm;
/*! Configuration database. */
namedb_t *db;
......
......@@ -18,6 +18,7 @@
#include "knot/ctl/estimator.h"
#include "knot/zone/node.h"
#include "libknot/errcode.h"
#include "libknot/dname.h"
#include "libknot/internal/lists.h"
#include "libknot/descriptor.h"
......
......@@ -26,7 +26,7 @@
#pragma once
#include "libknot/internal/trie/hat-trie.h"
#include "contrib/hat-trie/hat-trie.h"
#include "zscanner/scanner.h"
// Mutiplicative constant, needed because of malloc's fragmentation
......
......@@ -812,9 +812,9 @@ static int cmd_memstats(cmd_args_t *args)
/* Init malloc wrapper for trie size estimation. */
size_t malloc_size = 0;
mm_ctx_t mem_ctx = { .ctx = &malloc_size,
.alloc = estimator_malloc,
.free = estimator_free };
knot_mm_t mem_ctx = { .ctx = &malloc_size,
.alloc = estimator_malloc,
.free = estimator_free };
/* Init memory estimation context. */
zone_estim_t est = {.node_table = hattrie_create_n(TRIE_BUCKET_SIZE, &mem_ctx),
......
......@@ -187,7 +187,7 @@ static dnssec_nsec_bitmap_t *synth_bitmap(knot_pkt_t *pkt, const struct query_da
return map;
}
static knot_rrset_t *synth_nsec(knot_pkt_t *pkt, struct query_data *qdata, mm_ctx_t *mm)
static knot_rrset_t *synth_nsec(knot_pkt_t *pkt, struct query_data *qdata, knot_mm_t *mm)
{
knot_rrset_t *nsec = knot_rrset_new(qdata->name, KNOT_RRTYPE_NSEC, KNOT_CLASS_IN, mm);
if (!nsec) {
......@@ -230,7 +230,7 @@ static knot_rrset_t *sign_rrset(const knot_dname_t *owner,
const knot_rrset_t *cover,
online_sign_ctx_t *module_ctx,
dnssec_sign_ctx_t *sign_ctx,
mm_ctx_t *mm)
knot_mm_t *mm)
{
// copy of RR set with replaced owner name
......@@ -349,7 +349,7 @@ static int synth_authority(int state, knot_pkt_t *pkt, struct query_data *qdata,
}
static knot_rrset_t *synth_dnskey(const zone_t *zone, const dnssec_key_t *key,
mm_ctx_t *mm)
knot_mm_t *mm)
{
knot_rrset_t *dnskey = knot_rrset_new(zone->name, KNOT_RRTYPE_DNSKEY,
KNOT_CLASS_IN, mm);
......
......@@ -58,7 +58,7 @@ struct cache
{
MDB_dbi dbi;
MDB_env *env;
mm_ctx_t *pool;
knot_mm_t *pool;
};
struct rdentry {
......@@ -239,7 +239,7 @@ static int remove_entry(MDB_cursor *cur)
/* database api */
struct cache *cache_open(const char *handle, unsigned flags, mm_ctx_t *mm)
struct cache *cache_open(const char *handle, unsigned flags, knot_mm_t *mm)
{
struct cache *cache = mm_alloc(mm, sizeof(struct cache));
if (cache == NULL) {
......
......@@ -158,7 +158,7 @@ int main(int argc, char *argv[])
}
static int parse_rdata(struct entry *entry, const char *owner, const char *rrtype, const char *rdata,
int ttl, mm_ctx_t *mm)
int ttl, knot_mm_t *mm)
{
knot_rdataset_init(&entry->data.rrs);
int ret = knot_rrtype_from_string(rrtype, &entry->data.type);
......
......@@ -134,7 +134,7 @@ static int axfr_query_init(struct query_data *qdata)
}
/* Create transfer processing context. */
mm_ctx_t *mm = qdata->mm;
knot_mm_t *mm = qdata->mm;
zone_contents_t *zone = qdata->zone->contents;
struct axfr_proc *axfr = mm_alloc(mm, sizeof(struct axfr_proc));
......@@ -171,7 +171,7 @@ int xfr_process_list(knot_pkt_t *pkt, xfr_put_cb process_item,
}
int ret = KNOT_EOK;
mm_ctx_t *mm = qdata->mm;
knot_mm_t *mm = qdata->mm;
struct xfr_proc *xfer = qdata->ext;
zone_contents_t *zone = qdata->zone->contents;
......
......@@ -66,7 +66,7 @@ static const char *get_txt_response_string(const knot_dname_t *qname)
* \return KNOT_EOK
*/
static int create_txt_rrset(knot_rrset_t *rrset, const knot_dname_t *owner,
const char *response, mm_ctx_t *mm)
const char *response, knot_mm_t *mm)
{
/* Truncate response to one TXT label. */
size_t response_len = strlen(response);
......
......@@ -52,7 +52,7 @@ static int wildcard_visit(struct query_data *qdata, const zone_node_t *node, con
return KNOT_EOK;
}
mm_ctx_t *mm = qdata->mm;
knot_mm_t *mm = qdata->mm;
struct wildcard_hit *item = mm_alloc(mm, sizeof(struct wildcard_hit));
item->node = node;
item->sname = sname;
......@@ -64,7 +64,7 @@ static int wildcard_visit(struct query_data *qdata, const zone_node_t *node, con
static int dname_cname_synth(const knot_rrset_t *dname_rr,
const knot_dname_t *qname,
knot_rrset_t *cname_rrset,
mm_ctx_t *mm)
knot_mm_t *mm)
{
if (cname_rrset == NULL) {
return KNOT_EINVAL;
......
......@@ -52,7 +52,7 @@ struct ixfr_proc {
list_t changesets; /* Processed changesets. */
size_t change_count; /* Count of changesets received. */
zone_t *zone; /* Modified zone - for journal access. */
mm_ctx_t *mm; /* Memory context for RR allocations. */
knot_mm_t *mm; /* Memory context for RR allocations. */
struct query_data *qdata;
const knot_rrset_t *soa_from;
const knot_rrset_t *soa_to;
......@@ -221,7 +221,7 @@ static int ixfr_query_check(struct query_data *qdata)
static void ixfr_answer_cleanup(struct query_data *qdata)
{
struct ixfr_proc *ixfr = (struct ixfr_proc *)qdata->ext;
mm_ctx_t *mm = qdata->mm;
knot_mm_t *mm = qdata->mm;
ptrlist_free(&ixfr->proc.nodes, mm);
changeset_iter_clear(&ixfr->cur);
......@@ -256,7 +256,7 @@ static int ixfr_answer_init(struct query_data *qdata)
}
/* Initialize transfer processing. */
mm_ctx_t *mm = qdata->mm;
knot_mm_t *mm = qdata->mm;
struct ixfr_proc *xfer = mm_alloc(mm, sizeof(struct ixfr_proc));
if (xfer == NULL) {
changesets_free(&chgsets);
......@@ -461,7 +461,7 @@ static int solve_soa_del(const knot_rrset_t *rr, struct ixfr_proc *proc)
}
/*! \brief Stores ending SOA into changeset. */
static int solve_soa_add(const knot_rrset_t *rr, changeset_t *change, mm_ctx_t *mm)
static int solve_soa_add(const knot_rrset_t *rr, changeset_t *change, knot_mm_t *mm)
{
assert(rr->type == KNOT_RRTYPE_SOA);
change->soa_to = knot_rrset_copy(rr, NULL);
......@@ -473,13 +473,13 @@ static int solve_soa_add(const knot_rrset_t *rr, changeset_t *change, mm_ctx_t *
}
/*! \brief Adds single RR into remove section of changeset. */
static int solve_del(const knot_rrset_t *rr, changeset_t *change, mm_ctx_t *mm)
static int solve_del(const knot_rrset_t *rr, changeset_t *change, knot_mm_t *mm)
{
return changeset_rem_rrset(change, rr);
}
/*! \brief Adds single RR into add section of changeset. */
static int solve_add(const knot_rrset_t *rr, changeset_t *change, mm_ctx_t *mm)
static int solve_add(const knot_rrset_t *rr, changeset_t *change, knot_mm_t *mm)