Basically all use cases get renamed to *_E(), except one in utils/kr_cache_gc.
It was perhaps confusing that this name only applied to 'E' entries.
}
/* When going stricter, BEWARE of breaking entry_h_consistent_NSEC() */
-struct entry_h * entry_h_consistent(knot_db_val_t data, uint16_t type)
+struct entry_h * entry_h_consistent_E(knot_db_val_t data, uint16_t type)
{
(void) type; /* unused, for now */
if (!data.data) return NULL;
eh->rank = 0;
assert(false);
}
- assert(entry_h_consistent(val_new_entry, rr->type));
+ assert(entry_h_consistent_E(val_new_entry, rr->type));
#if 0 /* Occasionally useful when debugging some kinds of changes. */
{
if (!ret) ret = entry_h_seek(&val, type);
if (ret) return kr_error(ret);
- const struct entry_h *eh = entry_h_consistent(val, type);
+ const struct entry_h *eh = entry_h_consistent_E(val, type);
if (!eh || eh->is_packet) {
// TODO: no packets, but better get rid of whole kr_cache_peek_exact().
return kr_error(ENOENT);
}
/* val is on the entry, in either case (or error) */
if (!ret) {
- eh_orig = entry_h_consistent(val, type);
+ eh_orig = entry_h_consistent_E(val, type);
}
} else {
/* We want to fully overwrite the entry, so don't even read it. */
/** Check basic consistency of entry_h for 'E' entries, not looking into ->data.
* (for is_packet the length of data is checked)
*/
-KR_EXPORT
-struct entry_h * entry_h_consistent(knot_db_val_t data, uint16_t type);
+struct entry_h * entry_h_consistent_E(knot_db_val_t data, uint16_t type);
struct entry_apex * entry_apex_consistent(knot_db_val_t val);
static inline struct entry_h * entry_h_consistent_NSEC(knot_db_val_t data)
{
/* ATM it's enough to just extend the checks for exact entries. */
- const struct entry_h *eh = entry_h_consistent(data, KNOT_RRTYPE_NSEC);
+ const struct entry_h *eh = entry_h_consistent_E(data, KNOT_RRTYPE_NSEC);
bool ok = eh != NULL;
ok = ok && !eh->is_packet && !eh->has_optout;
return ok ? /*const-cast*/(struct entry_h *)eh : NULL;
}
+static inline struct entry_h * entry_h_consistent(knot_db_val_t data, uint16_t type)
+{
+ switch (type) {
+ case KNOT_RRTYPE_NSEC:
+ case KNOT_RRTYPE_NSEC3:
+ return entry_h_consistent_NSEC(data);
+ default:
+ return entry_h_consistent_E(data, type);
+ }
+}
/* nsec_p* - NSEC* chain parameters */
knot_db_val_t val = { NULL, 0 };
ret = cache_op(cache, read, &key, &val, 1);
const struct entry_h *eh;
- if (ret || !(eh = entry_h_consistent(val, KNOT_RRTYPE_SOA))) {
+ if (ret || !(eh = entry_h_consistent_E(val, KNOT_RRTYPE_SOA))) {
assert(ret); /* only want to catch `eh` failures */
VERBOSE_MSG(qry, "=> SOA missed\n");
return ctx->state;
int ret = entry_h_seek(&val, qry->stype);
if (ret) return ret;
- const struct entry_h *eh = entry_h_consistent(val, qry->stype);
+ const struct entry_h *eh = entry_h_consistent_E(val, qry->stype);
if (!eh) {
assert(false);
return kr_error(ENOENT);
return ret;
}
/* Check if the record is OK. */
- const struct entry_h *eh = entry_h_consistent(val, type);
+ const struct entry_h *eh = entry_h_consistent_E(val, type);
if (!eh) {
assert(false);
return kr_error(ret);
} else {
type = EL2RRTYPE(i);
/* Find the entry for the type, check positivity, TTL */
- const struct entry_h *eh = entry_h_consistent(entry, type);
+ const struct entry_h *eh = entry_h_consistent_E(entry, type);
if (!eh) {
VERBOSE_MSG(qry, "=> EH not consistent\n");
assert(false);