From: Vladimír Čunát Date: Fri, 10 Nov 2017 16:52:17 +0000 (+0100) Subject: minor cleanups, reduce verbosity X-Git-Tag: v2.0.0~6^2~64 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=041f0a45e8ddd4b7be9727689aecfc07e94e35d3;p=thirdparty%2Fknot-resolver.git minor cleanups, reduce verbosity --- diff --git a/lib/cache.c b/lib/cache.c index fae560934..ce406e86d 100644 --- a/lib/cache.c +++ b/lib/cache.c @@ -208,7 +208,7 @@ int32_t get_new_ttl(const struct entry_h *entry, uint32_t current_time) diff = 0; } int32_t res = entry->ttl - diff; - VERBOSE_MSG(NULL, "TTL remains: %d\n", (int)res); + //VERBOSE_MSG(NULL, "TTL remains: %d\n", (int)res); return res; } int32_t kr_cache_ttl(const struct kr_cache_p *peek, uint32_t current_time) @@ -219,12 +219,6 @@ int32_t kr_cache_ttl(const struct kr_cache_p *peek, uint32_t current_time) -/* forwards for larger chunks of code */ - -static uint8_t get_lowest_rank(const struct kr_request *req, const struct kr_query *qry); -static int found_exact_hit(kr_layer_t *ctx, knot_pkt_t *pkt, knot_db_val_t val, - uint8_t lowest_rank); -static knot_db_val_t closest_NS(kr_layer_t *ctx, struct key *k); @@ -264,7 +258,7 @@ knot_db_val_t key_exact_type_maypkt(struct key *k, uint16_t type) return (knot_db_val_t){ k->buf + 1, name_len + 4 }; } -/** TODO */ +/** Like key_exact_type_maypkt but with extra checks if used for RRs only. */ static knot_db_val_t key_exact_type(struct key *k, uint16_t type) { switch (type) { @@ -489,6 +483,11 @@ static int dname_wire_reconstruct(knot_dname_t *buf, const struct key *k, } +/* Forwards for larger chunks of code. All just for cache_lmbd_peek. */ +static uint8_t get_lowest_rank(const struct kr_request *req, const struct kr_query *qry); +static int found_exact_hit(kr_layer_t *ctx, knot_pkt_t *pkt, knot_db_val_t val, + uint8_t lowest_rank); +static knot_db_val_t closest_NS(kr_layer_t *ctx, struct key *k); static int answer_simple_hit(kr_layer_t *ctx, knot_pkt_t *pkt, uint16_t type, const struct entry_h *eh, const void *eh_bound, uint32_t new_ttl); diff --git a/lib/cache/entry_rr.c b/lib/cache/entry_rr.c index ed8dfc6a2..c44751eb4 100644 --- a/lib/cache/entry_rr.c +++ b/lib/cache/entry_rr.c @@ -83,7 +83,7 @@ static int rdataset_materialize(knot_rdataset_t * restrict rds, const void *data //d_out = kr_rdataset_next(d_out); d_out += 4 + 2 + len; /* TTL + rdlen + rdata */ } - VERBOSE_MSG(NULL, "materialized from %d B\n", (int)(d - data)); + //VERBOSE_MSG(NULL, "materialized from %d B\n", (int)(d - data)); return d - data; } diff --git a/lib/cache/impl.h b/lib/cache/impl.h index 9c08c09c6..27ec2fda6 100644 --- a/lib/cache/impl.h +++ b/lib/cache/impl.h @@ -80,7 +80,9 @@ static inline size_t key_nwz_off(const struct key *k) return k->zlf_len + 2; } - +/** Finish constructing string key for for exact search. + * It's assumed that kr_dname_lf(k->buf, owner, NULL) had been ran. + */ knot_db_val_t key_exact_type_maypkt(struct key *k, uint16_t type);