Commit 8cd8937a authored by Patrick McHardy's avatar Patrick McHardy Committed by Pablo Neira Ayuso

netfilter: nf_tables: convert sets to u32 data pointers

Simple conversion to use u32 pointers to the beginning of the data
area to keep follow up patches smaller.
Signed-off-by: default avatarPatrick McHardy <kaber@trash.net>
Signed-off-by: default avatarPablo Neira Ayuso <pablo@netfilter.org>
parent e562d860
...@@ -231,10 +231,10 @@ struct nft_expr; ...@@ -231,10 +231,10 @@ struct nft_expr;
*/ */
struct nft_set_ops { struct nft_set_ops {
bool (*lookup)(const struct nft_set *set, bool (*lookup)(const struct nft_set *set,
const struct nft_data *key, const u32 *key,
const struct nft_set_ext **ext); const struct nft_set_ext **ext);
bool (*update)(struct nft_set *set, bool (*update)(struct nft_set *set,
const struct nft_data *key, const u32 *key,
void *(*new)(struct nft_set *, void *(*new)(struct nft_set *,
const struct nft_expr *, const struct nft_expr *,
struct nft_regs *), struct nft_regs *),
......
...@@ -36,7 +36,7 @@ struct nft_hash_elem { ...@@ -36,7 +36,7 @@ struct nft_hash_elem {
struct nft_hash_cmp_arg { struct nft_hash_cmp_arg {
const struct nft_set *set; const struct nft_set *set;
const struct nft_data *key; const u32 *key;
u8 genmask; u8 genmask;
}; };
...@@ -71,8 +71,7 @@ static inline int nft_hash_cmp(struct rhashtable_compare_arg *arg, ...@@ -71,8 +71,7 @@ static inline int nft_hash_cmp(struct rhashtable_compare_arg *arg,
return 0; return 0;
} }
static bool nft_hash_lookup(const struct nft_set *set, static bool nft_hash_lookup(const struct nft_set *set, const u32 *key,
const struct nft_data *key,
const struct nft_set_ext **ext) const struct nft_set_ext **ext)
{ {
struct nft_hash *priv = nft_set_priv(set); struct nft_hash *priv = nft_set_priv(set);
...@@ -90,7 +89,7 @@ static bool nft_hash_lookup(const struct nft_set *set, ...@@ -90,7 +89,7 @@ static bool nft_hash_lookup(const struct nft_set *set,
return !!he; return !!he;
} }
static bool nft_hash_update(struct nft_set *set, const struct nft_data *key, static bool nft_hash_update(struct nft_set *set, const u32 *key,
void *(*new)(struct nft_set *, void *(*new)(struct nft_set *,
const struct nft_expr *, const struct nft_expr *,
struct nft_regs *regs), struct nft_regs *regs),
...@@ -134,7 +133,7 @@ static int nft_hash_insert(const struct nft_set *set, ...@@ -134,7 +133,7 @@ static int nft_hash_insert(const struct nft_set *set,
struct nft_hash_cmp_arg arg = { struct nft_hash_cmp_arg arg = {
.genmask = nft_genmask_next(read_pnet(&set->pnet)), .genmask = nft_genmask_next(read_pnet(&set->pnet)),
.set = set, .set = set,
.key = &elem->key, .key = elem->key.data,
}; };
return rhashtable_lookup_insert_key(&priv->ht, &arg, &he->node, return rhashtable_lookup_insert_key(&priv->ht, &arg, &he->node,
...@@ -158,7 +157,7 @@ static void *nft_hash_deactivate(const struct nft_set *set, ...@@ -158,7 +157,7 @@ static void *nft_hash_deactivate(const struct nft_set *set,
struct nft_hash_cmp_arg arg = { struct nft_hash_cmp_arg arg = {
.genmask = nft_genmask_next(read_pnet(&set->pnet)), .genmask = nft_genmask_next(read_pnet(&set->pnet)),
.set = set, .set = set,
.key = &elem->key, .key = elem->key.data,
}; };
rcu_read_lock(); rcu_read_lock();
......
...@@ -30,8 +30,7 @@ struct nft_rbtree_elem { ...@@ -30,8 +30,7 @@ struct nft_rbtree_elem {
}; };
static bool nft_rbtree_lookup(const struct nft_set *set, static bool nft_rbtree_lookup(const struct nft_set *set, const u32 *key,
const struct nft_data *key,
const struct nft_set_ext **ext) const struct nft_set_ext **ext)
{ {
const struct nft_rbtree *priv = nft_set_priv(set); const struct nft_rbtree *priv = nft_set_priv(set);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment