net: filter: move filter accounting to filter core
authorDaniel Borkmann <dborkman@redhat.com>
Fri, 28 Mar 2014 17:58:20 +0000 (18:58 +0100)
committerDavid S. Miller <davem@davemloft.net>
Mon, 31 Mar 2014 04:45:09 +0000 (00:45 -0400)
commitfbc907f0b1386c02e00516aa78a0fa6b0454fd0b
treea747b5bb1dec44ce93e0924e4ea2de3411417b2c
parenta3ea269b8bcdbb0c5fa2fd449a436e7987446975
net: filter: move filter accounting to filter core

This patch basically does two things, i) removes the extern keyword
from the include/linux/filter.h file to be more consistent with the
rest of Joe's changes, and ii) moves filter accounting into the filter
core framework.

Filter accounting mainly done through sk_filter_{un,}charge() take
care of the case when sockets are being cloned through sk_clone_lock()
so that removal of the filter on one socket won't result in eviction
as it's still referenced by the other.

These functions actually belong to net/core/filter.c and not
include/net/sock.h as we want to keep all that in a central place.
It's also not in fast-path so uninlining them is fine and even allows
us to get rd of sk_filter_release_rcu()'s EXPORT_SYMBOL and a forward
declaration.

Joint work with Alexei Starovoitov.

Signed-off-by: Daniel Borkmann <dborkman@redhat.com>
Signed-off-by: Alexei Starovoitov <ast@plumgrid.com>
Cc: Pavel Emelyanov <xemul@parallels.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
include/linux/filter.h
include/net/sock.h
net/core/filter.c