Re: netfilter: nf_nat: make find/put static

From: Geert Uytterhoeven
Date: Thu Oct 28 2010 - 14:42:30 EST


On Sat, Oct 23, 2010 at 21:23, Linux Kernel Mailing List
<linux-kernel@xxxxxxxxxxxxxxx> wrote:
> Gitweb: Â Â http://git.kernel.org/linus/0c200d935346fe0ebde9b6dffbb683dddd166fb9
> Commit: Â Â 0c200d935346fe0ebde9b6dffbb683dddd166fb9
> Parent: Â Â 758ff03387228824617cef9507e5682488bf9e0c
> Author: Â Â Stephen Hemminger <shemminger@xxxxxxxxxx>
> AuthorDate: Mon Oct 4 20:53:18 2010 +0200
> Committer: ÂPatrick McHardy <kaber@xxxxxxxxx>
> CommitDate: Mon Oct 4 20:53:18 2010 +0200
>
> Â Ânetfilter: nf_nat: make find/put static
>
> Â ÂThe functions nf_nat_proto_find_get and nf_nat_proto_put are
> Â Âonly used internally in nf_nat_core. This might break some out
> Â Âof tree NAT module.
>
> Â ÂSigned-off-by: Stephen Hemminger <shemminger@xxxxxxxxxx>
> Â ÂSigned-off-by: Patrick McHardy <kaber@xxxxxxxxx>
> ---
> Âinclude/net/netfilter/nf_nat_protocol.h | Â Â3 ---
> Ânet/ipv4/netfilter/nf_nat_core.c    Â|  Â6 ++----
> Â2 files changed, 2 insertions(+), 7 deletions(-)
>
> diff --git a/include/net/netfilter/nf_nat_protocol.h b/include/net/netfilter/nf_nat_protocol.h
> index df17bac..93cc90d 100644
> --- a/include/net/netfilter/nf_nat_protocol.h
> +++ b/include/net/netfilter/nf_nat_protocol.h
> @@ -45,9 +45,6 @@ struct nf_nat_protocol {
> Âextern int nf_nat_protocol_register(const struct nf_nat_protocol *proto);
> Âextern void nf_nat_protocol_unregister(const struct nf_nat_protocol *proto);
>
> -extern const struct nf_nat_protocol *nf_nat_proto_find_get(u_int8_t protocol);
> -extern void nf_nat_proto_put(const struct nf_nat_protocol *proto);
> -
> Â/* Built-in protocols. */
> Âextern const struct nf_nat_protocol nf_nat_protocol_tcp;
> Âextern const struct nf_nat_protocol nf_nat_protocol_udp;
> diff --git a/net/ipv4/netfilter/nf_nat_core.c b/net/ipv4/netfilter/nf_nat_core.c
> index 2c084b3..e2e00c4 100644
> --- a/net/ipv4/netfilter/nf_nat_core.c
> +++ b/net/ipv4/netfilter/nf_nat_core.c
> @@ -47,7 +47,7 @@ __nf_nat_proto_find(u_int8_t protonum)
> Â Â Â Âreturn rcu_dereference(nf_nat_protos[protonum]);
> Â}
>
> -const struct nf_nat_protocol *
> +static const struct nf_nat_protocol *
> Ânf_nat_proto_find_get(u_int8_t protonum)
> Â{
> Â Â Â Âconst struct nf_nat_protocol *p;
> @@ -60,14 +60,12 @@ nf_nat_proto_find_get(u_int8_t protonum)
>
> Â Â Â Âreturn p;
> Â}
> -EXPORT_SYMBOL_GPL(nf_nat_proto_find_get);
>
> -void
> +static void
> Ânf_nat_proto_put(const struct nf_nat_protocol *p)
> Â{
> Â Â Â Âmodule_put(p->me);
> Â}
> -EXPORT_SYMBOL_GPL(nf_nat_proto_put);
>
> Â/* We keep an extra hash for each conntrack, for fast searching. */
> Âstatic inline unsigned int

They should be moved inside the
"#if defined(CONFIG_NF_CT_NETLINK) || defined(CONFIG_NF_CT_NETLINK_MODULE)",
as I now get:

net/ipv4/netfilter/nf_nat_core.c:52: warning: ânf_nat_proto_find_getâ
defined but not used
net/ipv4/netfilter/nf_nat_core.c:66: warning: ânf_nat_proto_putâ
defined but not used

Gr{oetje,eeting}s,

            Geert

--
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- geert@xxxxxxxxxxxxxx

In personal conversations with technical people, I call myself a hacker. But
when I'm talking to journalists I just say "programmer" or something like that.
             Â Â -- Linus Torvalds
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/