Commit 699f9c13 authored by Marek Vavruša's avatar Marek Vavruša

zonecut: renamed to zonecut

parent fc5168f8
......@@ -15,8 +15,8 @@ lib/resolve.c
lib/resolve.h
tests/context.c
tests/resolve.c
lib/delegpt.h
lib/delegpt.c
lib/zonecut.h
lib/zonecut.c
lib/rplan.h
lib/rplan.c
lib/layer/stats.h
......
......@@ -14,8 +14,8 @@ libknotresolve_la_SOURCES = \
context.c \
resolve.h \
resolve.c \
delegpt.h \
delegpt.c \
zonecut.h \
zonecut.c \
rplan.h \
rplan.c \
cache.h \
......
......@@ -12,7 +12,7 @@ int kr_context_init(struct kr_context *ctx, mm_ctx_t *mm)
ctx->pool = mm;
kr_rplan_init(&ctx->rplan, mm);
kr_delegmap_init(&ctx->dp_map, mm);
kr_zonecut_init(&ctx->dp_map, mm);
ctx->cache = kr_cache_open("/tmp/kresolved", 0, mm);
if (ctx->cache == NULL) {
......@@ -44,7 +44,7 @@ int kr_context_reset(struct kr_context *ctx)
int kr_context_deinit(struct kr_context *ctx)
{
kr_delegmap_deinit(&ctx->dp_map);
kr_zonecut_deinit(&ctx->dp_map);
kr_cache_close(ctx->cache);
return KNOT_EOK;
......
......@@ -20,7 +20,7 @@ limitations under the License.
#include <libknot/internal/mempattern.h>
#include <libknot/internal/sockaddr.h>
#include "lib/delegpt.h"
#include "lib/zonecut.h"
#include "lib/rplan.h"
#include "lib/cache.h"
......@@ -40,7 +40,7 @@ struct kr_context
struct kr_query *resolved_qry;
const knot_pkt_t *query;
struct kr_rplan rplan;
struct kr_delegmap dp_map;
struct kr_zonecut_map dp_map;
struct kr_cache *cache;
struct {
struct kr_txn *read;
......
#include "lib/delegpt.h"
#include "lib/zonecut.h"
#include "lib/defines.h"
#include <libknot/internal/mempool.h>
......@@ -17,7 +17,7 @@ static void nslist_free(list_t *list, mm_ctx_t *mm)
mm_free(mm, list);
}
static void delegmap_clear(struct kr_delegmap *map)
static void zonecut_clear(struct kr_zonecut_map *map)
{
hattrie_iter_t *i = hattrie_iter_begin(map->trie, false);
while(!hattrie_iter_finished(i)) {
......@@ -31,7 +31,7 @@ static void delegmap_clear(struct kr_delegmap *map)
}
int kr_delegmap_init(struct kr_delegmap *map, mm_ctx_t *mm)
int kr_zonecut_init(struct kr_zonecut_map *map, mm_ctx_t *mm)
{
map->pool = mm;
map->trie = hattrie_create_n(TRIE_BUCKET_SIZE, mm);
......@@ -40,7 +40,7 @@ int kr_delegmap_init(struct kr_delegmap *map, mm_ctx_t *mm)
}
/* Initialize root entry. */
struct kr_zonecut *root = kr_delegmap_get(map, (const knot_dname_t*)"\0");
struct kr_zonecut *root = kr_zonecut_get(map, (const knot_dname_t*)"\0");
if (root == NULL) {
hattrie_free(map->trie);
return KNOT_ENOMEM;
......@@ -49,35 +49,35 @@ int kr_delegmap_init(struct kr_delegmap *map, mm_ctx_t *mm)
return KNOT_EOK;
}
void kr_delegmap_deinit(struct kr_delegmap *map)
void kr_zonecut_deinit(struct kr_zonecut_map *map)
{
delegmap_clear(map);
zonecut_clear(map);
hattrie_free(map->trie);
}
struct kr_zonecut *kr_delegmap_get(struct kr_delegmap *map, const knot_dname_t *name)
struct kr_zonecut *kr_zonecut_get(struct kr_zonecut_map *map, const knot_dname_t *name)
{
value_t *val = hattrie_get(map->trie, (const char *)name, knot_dname_size(name));
if (*val == NULL) {
struct kr_zonecut *dp = mm_alloc(map->pool, sizeof(struct kr_zonecut));
if (dp == NULL) {
struct kr_zonecut *cut = mm_alloc(map->pool, sizeof(struct kr_zonecut));
if (cut == NULL) {
return NULL;
}
dp->name = knot_dname_copy(name, map->pool);
if (dp->name == NULL) {
mm_free(map->pool, dp);
cut->name = knot_dname_copy(name, map->pool);
if (cut->name == NULL) {
mm_free(map->pool, cut);
return NULL;
}
init_list(&dp->nslist);
*val = dp;
init_list(&cut->nslist);
*val = cut;
}
return *val;
}
struct kr_zonecut *kr_delegmap_find(struct kr_delegmap *map, const knot_dname_t *name)
struct kr_zonecut *kr_zonecut_find(struct kr_zonecut_map *map, const knot_dname_t *name)
{
value_t *val = NULL;
while(val == NULL) {
......
......@@ -37,15 +37,15 @@ struct kr_zonecut {
knot_dname_t *name;
};
struct kr_delegmap {
struct kr_zonecut_map {
mm_ctx_t *pool;
hattrie_t *trie;
};
int kr_delegmap_init(struct kr_delegmap *map, mm_ctx_t *mm);
void kr_delegmap_deinit(struct kr_delegmap *map);
struct kr_zonecut *kr_delegmap_get(struct kr_delegmap *map, const knot_dname_t *name);
struct kr_zonecut *kr_delegmap_find(struct kr_delegmap *map, const knot_dname_t *name);
int kr_zonecut_init(struct kr_zonecut_map *map, mm_ctx_t *mm);
void kr_zonecut_deinit(struct kr_zonecut_map *map);
struct kr_zonecut *kr_zonecut_get(struct kr_zonecut_map *map, const knot_dname_t *name);
struct kr_zonecut *kr_zonecut_find(struct kr_zonecut_map *map, const knot_dname_t *name);
/* TODO: find out how to do expire/refresh efficiently, maybe a sweep point and
* evaluate only DPs with validity before or around the sweep point, then
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment