From a070b0de9f9e9cbca150eea4eda74757ca588bed Mon Sep 17 00:00:00 2001 From: Jordan Augé Date: Wed, 23 Sep 2020 17:50:52 +0200 Subject: [HICN-645] Control plane (WIP) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Change-Id: I4be6a40b690b62f22f57de6d8c10b01a1be42a6d Signed-off-by: Jordan Augé Signed-off-by: Enrico Loparco (eloparco) Signed-off-by: Mauro Sardara --- hicn-light/src/hicn/core/content_store.c | 14 ++++++-------- 1 file changed, 6 insertions(+), 8 deletions(-) (limited to 'hicn-light/src/hicn/core/content_store.c') diff --git a/hicn-light/src/hicn/core/content_store.c b/hicn-light/src/hicn/core/content_store.c index 74b675224..cf1fe3af9 100644 --- a/hicn-light/src/hicn/core/content_store.c +++ b/hicn-light/src/hicn/core/content_store.c @@ -112,11 +112,10 @@ void cs_clear(cs_t * cs) } off_t -cs_match(cs_t * cs, off_t msgbuf_id, uint64_t now) +cs_match(cs_t * cs, msgbuf_pool_t * msgbuf_pool, off_t msgbuf_id, uint64_t now) { assert(cs); - const msgbuf_pool_t * msgbuf_pool = cs_get_msgbuf_pool(cs); const msgbuf_t * msgbuf = msgbuf_pool_at(msgbuf_pool, msgbuf_id); assert(msgbuf); @@ -133,7 +132,7 @@ cs_match(cs_t * cs, off_t msgbuf_id, uint64_t now) if (cs_entry_has_expiry_time(entry) && cs_entry_get_expiry_time(entry) < now) { // the entry is expired, we can remove it - cs_remove_entry(cs, entry); + cs_remove_entry(cs, msgbuf_pool, entry); goto NOT_FOUND; } @@ -160,7 +159,7 @@ NOT_FOUND: #define msgbuf_acquire(x) (x) cs_entry_t * -cs_add(cs_t * cs, off_t msgbuf_id, uint64_t now) +cs_add(cs_t * cs, msgbuf_pool_t * msgbuf_pool, off_t msgbuf_id, uint64_t now) { assert(cs); assert(msgbuf_id_is_valid(msgbuf_id)); @@ -235,7 +234,7 @@ ERR_ENTRY: } int -cs_remove_entry(cs_t * cs, cs_entry_t * entry) +cs_remove_entry(cs_t * cs, msgbuf_pool_t * msgbuf_pool, cs_entry_t * entry) { assert(cs); assert(entry); @@ -245,7 +244,6 @@ cs_remove_entry(cs_t * cs, cs_entry_t * entry) off_t msgbuf_id = cs_entry_get_msgbuf_id(entry); - const msgbuf_pool_t * msgbuf_pool = cs_get_msgbuf_pool(cs); const msgbuf_t * msgbuf = msgbuf_pool_at(msgbuf_pool, msgbuf_id); khiter_t k = kh_get_cs_name(cs->index_by_name, msgbuf_get_name(msgbuf)); @@ -263,7 +261,7 @@ cs_remove_entry(cs_t * cs, cs_entry_t * entry) // // XXX TODO what is the difference between purge and remove ? bool -cs_remove(cs_t * cs, msgbuf_t * msgbuf) +cs_remove(cs_t * cs, msgbuf_pool_t * msgbuf_pool, msgbuf_t * msgbuf) { assert(cs); assert(msgbuf); @@ -277,7 +275,7 @@ cs_remove(cs_t * cs, msgbuf_t * msgbuf) cs_entry_t * entry = cs->entries + kh_val(cs->index_by_name, k); assert(entry); - cs_remove_entry(cs, entry); + cs_remove_entry(cs, msgbuf_pool, entry); return true; } -- cgit 1.2.3-korg