summaryrefslogtreecommitdiffstats
path: root/include
diff options
context:
space:
mode:
Diffstat (limited to 'include')
-rw-r--r--include/cache.h15
-rw-r--r--include/rule.h12
2 files changed, 19 insertions, 8 deletions
diff --git a/include/cache.h b/include/cache.h
index 987b122b..4d91a736 100644
--- a/include/cache.h
+++ b/include/cache.h
@@ -72,4 +72,19 @@ struct chain *chain_cache_find(const struct table *table, const char *name);
void set_cache_add(struct set *set, struct table *table);
struct set *set_cache_find(const struct table *table, const char *name);
+struct cache {
+ struct list_head *ht;
+ struct list_head list;
+};
+
+struct cache_item {
+ struct list_head hlist;
+ struct list_head list;
+};
+
+void cache_init(struct cache *cache);
+void cache_free(struct cache *cache);
+void cache_add(struct cache_item *item, struct cache *cache, uint32_t hash);
+void cache_del(struct cache_item *item);
+
#endif /* _NFT_CACHE_H_ */
diff --git a/include/rule.h b/include/rule.h
index 7896eafe..b238c85b 100644
--- a/include/rule.h
+++ b/include/rule.h
@@ -155,11 +155,9 @@ struct table {
struct handle handle;
struct location location;
struct scope scope;
- struct list_head *cache_chain_ht;
- struct list_head cache_chain;
+ struct cache chain_cache;
+ struct cache set_cache;
struct list_head chains;
- struct list_head *cache_set_ht;
- struct list_head cache_set;
struct list_head sets;
struct list_head objs;
struct list_head flowtables;
@@ -233,8 +231,7 @@ struct hook_spec {
*/
struct chain {
struct list_head list;
- struct list_head cache_hlist;
- struct list_head cache_list;
+ struct cache_item cache;
struct handle handle;
struct location location;
unsigned int refcnt;
@@ -333,8 +330,7 @@ void rule_stmt_insert_at(struct rule *rule, struct stmt *nstmt,
*/
struct set {
struct list_head list;
- struct list_head cache_hlist;
- struct list_head cache_list;
+ struct cache_item cache;
struct handle handle;
struct location location;
unsigned int refcnt;