Skip to content

Commit c544478

Browse files
Florian Westphalummakynes
authored andcommitted
netfilter: nft_set_pipapo: merge deactivate helper into caller
Its the only remaining call site so there is no need for this to be separated anymore. Signed-off-by: Florian Westphal <[email protected]> Reviewed-by: Stefano Brivio <[email protected]> Signed-off-by: Pablo Neira Ayuso <[email protected]>
1 parent 6c108d9 commit c544478

File tree

1 file changed

+9
-30
lines changed

1 file changed

+9
-30
lines changed

net/netfilter/nft_set_pipapo.c

Lines changed: 9 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -1851,52 +1851,31 @@ static void nft_pipapo_activate(const struct net *net,
18511851
}
18521852

18531853
/**
1854-
* pipapo_deactivate() - Check that element is in set, mark as inactive
1854+
* nft_pipapo_deactivate() - Search for element and make it inactive
18551855
* @net: Network namespace
18561856
* @set: nftables API set representation
1857-
* @data: Input key data
1858-
* @ext: nftables API extension pointer, used to check for end element
1859-
*
1860-
* This is a convenience function that can be called from both
1861-
* nft_pipapo_deactivate() and nft_pipapo_flush(), as they are in fact the same
1862-
* operation.
1857+
* @elem: nftables API element representation containing key data
18631858
*
18641859
* Return: deactivated element if found, NULL otherwise.
18651860
*/
1866-
static void *pipapo_deactivate(const struct net *net, const struct nft_set *set,
1867-
const u8 *data, const struct nft_set_ext *ext)
1861+
static struct nft_elem_priv *
1862+
nft_pipapo_deactivate(const struct net *net, const struct nft_set *set,
1863+
const struct nft_set_elem *elem)
18681864
{
18691865
struct nft_pipapo_elem *e;
18701866

1871-
e = pipapo_get(net, set, data, nft_genmask_next(net),
1872-
nft_net_tstamp(net), GFP_KERNEL);
1867+
e = pipapo_get(net, set, (const u8 *)elem->key.val.data,
1868+
nft_genmask_next(net), nft_net_tstamp(net), GFP_KERNEL);
18731869
if (IS_ERR(e))
18741870
return NULL;
18751871

18761872
nft_set_elem_change_active(net, set, &e->ext);
18771873

1878-
return e;
1879-
}
1880-
1881-
/**
1882-
* nft_pipapo_deactivate() - Call pipapo_deactivate() to make element inactive
1883-
* @net: Network namespace
1884-
* @set: nftables API set representation
1885-
* @elem: nftables API element representation containing key data
1886-
*
1887-
* Return: deactivated element if found, NULL otherwise.
1888-
*/
1889-
static struct nft_elem_priv *
1890-
nft_pipapo_deactivate(const struct net *net, const struct nft_set *set,
1891-
const struct nft_set_elem *elem)
1892-
{
1893-
const struct nft_set_ext *ext = nft_set_elem_ext(set, elem->priv);
1894-
1895-
return pipapo_deactivate(net, set, (const u8 *)elem->key.val.data, ext);
1874+
return &e->priv;
18961875
}
18971876

18981877
/**
1899-
* nft_pipapo_flush() - Call pipapo_deactivate() to make element inactive
1878+
* nft_pipapo_flush() - make element inactive
19001879
* @net: Network namespace
19011880
* @set: nftables API set representation
19021881
* @elem_priv: nftables API element representation containing key data

0 commit comments

Comments
 (0)