From 1c9faf8c218bc7ff4617557383e4116f1adb11e5 Mon Sep 17 00:00:00 2001 From: Pablo Neira Ayuso Date: Sun, 25 Jan 2009 17:53:02 +0100 Subject: cache: move lifetime feature to main cache code The lifetime feature is used by all working modes, it is useful to know how long it has been an entry living in the cache. This patch moves the lifetime feature to the main caching code. Signed-off-by: Pablo Neira Ayuso --- src/cache.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'src/cache.c') diff --git a/src/cache.c b/src/cache.c index a5f37dd..71825e1 100644 --- a/src/cache.c +++ b/src/cache.c @@ -26,6 +26,7 @@ #include #include #include +#include static uint32_t __hash4(const struct nf_conntrack *ct, const struct hashtable *table) @@ -94,7 +95,6 @@ static int compare(const void *data1, const void *data2) struct cache_feature *cache_feature[CACHE_MAX_FEATURE] = { [TIMER_FEATURE] = &timer_feature, - [LIFETIME_FEATURE] = &lifetime_feature, [WRITE_THROUGH_FEATURE] = &writethrough_feature, }; @@ -249,6 +249,7 @@ static int __add(struct cache *c, struct cache_object *obj, int id) c->extra->add(obj, ((char *) obj) + c->extra_offset); c->stats.active++; + obj->lifetime = time(NULL); obj->status = C_OBJ_NEW; obj->refcnt++; return 0; -- cgit v1.2.3