From patchwork Sat Apr 16 20:17:43 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Arnd Bergmann X-Patchwork-Id: 102511 Delivered-To: patch@linaro.org Received: by 10.140.93.198 with SMTP id d64csp567859qge; Sat, 16 Apr 2016 13:19:20 -0700 (PDT) X-Received: by 10.98.20.6 with SMTP id 6mr9587485pfu.166.1460837960811; Sat, 16 Apr 2016 13:19:20 -0700 (PDT) Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id gl9si12436937pac.111.2016.04.16.13.19.20; Sat, 16 Apr 2016 13:19:20 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752013AbcDPUTS (ORCPT + 29 others); Sat, 16 Apr 2016 16:19:18 -0400 Received: from mout.kundenserver.de ([212.227.17.10]:52494 "EHLO mout.kundenserver.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751711AbcDPUTQ (ORCPT ); Sat, 16 Apr 2016 16:19:16 -0400 Received: from wuerfel.lan. ([78.42.132.4]) by mrelayeu.kundenserver.de (mreue103) with ESMTPA (Nemesis) id 0MCfv0-1azo8J0cZG-009OlM; Sat, 16 Apr 2016 22:18:41 +0200 From: Arnd Bergmann To: Pablo Neira Ayuso Cc: Arnd Bergmann , Patrick McHardy , Jozsef Kadlecsik , "David S. Miller" , Daniel Borkmann , Ken-ichirou MATSUZAWA , netfilter-devel@vger.kernel.org, coreteam@netfilter.org, netdev@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH] netfilter: ctnetlink: add more #ifdef around unused code Date: Sat, 16 Apr 2016 22:17:43 +0200 Message-Id: <1460837916-1241019-1-git-send-email-arnd@arndb.de> X-Mailer: git-send-email 2.7.0 X-Provags-ID: V03:K0:ZxnWsC8+PPcZslsxv//jzMo32UJmvX6x1HyvQDMyEwnvaZhpipv Y4FYvP2talTU76SQdHU84oBb+/JqeA8bgaCQETgBZDyufn6s2PBGNNyHgYbYyyv2vy6GM9C EwKfO+W5Qh48/xowoje8JIjGpRGUhq5YNWmimVAgCo6mM83TXUPvGdGBnjQnh+nuV1/s/Fm AtwXAAiQY/dhgSBAsZFFA== X-UI-Out-Filterresults: notjunk:1; V01:K0:uTu7FRhLwZY=:xh5hsopsf6mkEhj++D1nfw CDPdwf8GPX8ije19Tr8xV8IX2/uhNqaQ3r5Vi8XRBFtn1c+iDdq0jrt/xKkElxEui3SbMCc54 G7HN7wu7DKazgbIaxJqFC7vBuZoChjkcuzzq6i6jdKh037nqiw0MZb/sIgE5IJfueWQmrEEQt X7v1H6J/KTU4ggjNfs9MaeBa/SAr2zcppOyNaQ0O3+Rwqc6fFVMGBUn+ImX0HaO6Bzyy1fYDU o1ekMMz/+vi5/vno2hJt9MrKapIH5CKaZcnyKr2KjcKKEygEJ6k6qb3k5yBM9e9vHxPjY+x2P 6PN8M5bvtj9Der+NWD5X4TANPyU4yVj44gCC2ClskdmlSS4ckmHMQkrMDuF5dnWy+e7tuc0bC X0o4NFuLSTWqYwpG+KSUuTrc1G50Yud2EMIjzA7KoMzIGispJ9TRKBDWBFTteYBEpt0AHBCCD OnTOeqsSGd2QJ/ZdzawVDweW4tjmNOEJyeb+mKuxjgomy4JcsCh6hxfojj+fZC2cH+9meLCMq DzqEWiwLJcNvDJceS199RTq51M5gW2S7rp8NwqiJ4O9/lqi4Aib31AZvjuW3IlQL85llnyyoE F5uf/4hqIbh/KHIlN6pWNMxb7qXRYT1x+BAlq6HrRokK9bExmFtmd2YLL2J4gNWSmhSx7Eit8 9OBrPndGT79XPLmooF1hIRd2DuyFqRYDivhVwBF3XrVJXj5HgQ167dhcUvMWJxw31R94= Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org A recent patch removed many 'inline' annotations for static functions in this file, which has caused warnings for functions that are not used in a given configuration, in particular when CONFIG_NF_CONNTRACK_EVENTS is disabled: nf_conntrack_netlink.c:572:15: 'ctnetlink_timestamp_size' defined but not used nf_conntrack_netlink.c:546:15: 'ctnetlink_acct_size' defined but not used nf_conntrack_netlink.c:339:12: 'ctnetlink_label_size' defined but not used I first tried to replace some of the existing #ifdefs with nicer 'if (IS_ENABLED())' checks, but ran into several other problems with that, so this patch adds even more #ifdef conditionals to avoid the remaining warnings. Another option would be to put '__maybe_unused' annotations in place of the previous 'inline' keyword. Signed-off-by: Arnd Bergmann Fixes: 4054ff45454a ("netfilter: ctnetlink: remove unnecessary inlining") --- net/netfilter/nf_conntrack_netlink.c | 26 +++++++++++++++----------- 1 file changed, 15 insertions(+), 11 deletions(-) -- 2.7.0 diff --git a/net/netfilter/nf_conntrack_netlink.c b/net/netfilter/nf_conntrack_netlink.c index caa4efe5930b..f893012986c7 100644 --- a/net/netfilter/nf_conntrack_netlink.c +++ b/net/netfilter/nf_conntrack_netlink.c @@ -336,6 +336,7 @@ nla_put_failure: #endif #ifdef CONFIG_NF_CONNTRACK_LABELS +#ifdef CONFIG_NF_CONNTRACK_EVENTS static int ctnetlink_label_size(const struct nf_conn *ct) { struct nf_conn_labels *labels = nf_ct_labels_find(ct); @@ -344,6 +345,7 @@ static int ctnetlink_label_size(const struct nf_conn *ct) return 0; return nla_total_size(labels->words * sizeof(long)); } +#endif static int ctnetlink_dump_labels(struct sk_buff *skb, const struct nf_conn *ct) @@ -526,6 +528,7 @@ nla_put_failure: return -1; } +#if defined(CONFIG_NF_CONNTRACK_EVENTS) || defined(CONFIG_NETFILTER_NETLINK_GLUE_CT) static size_t ctnetlink_proto_size(const struct nf_conn *ct) { struct nf_conntrack_l3proto *l3proto; @@ -543,16 +546,6 @@ static size_t ctnetlink_proto_size(const struct nf_conn *ct) return len; } -static size_t ctnetlink_acct_size(const struct nf_conn *ct) -{ - if (!nf_ct_ext_exist(ct, NF_CT_EXT_ACCT)) - return 0; - return 2 * nla_total_size(0) /* CTA_COUNTERS_ORIG|REPL */ - + 2 * nla_total_size(sizeof(uint64_t)) /* CTA_COUNTERS_PACKETS */ - + 2 * nla_total_size(sizeof(uint64_t)) /* CTA_COUNTERS_BYTES */ - ; -} - static int ctnetlink_secctx_size(const struct nf_conn *ct) { #ifdef CONFIG_NF_CONNTRACK_SECMARK @@ -568,6 +561,18 @@ static int ctnetlink_secctx_size(const struct nf_conn *ct) return 0; #endif } +#endif + +#ifdef CONFIG_NF_CONNTRACK_EVENTS +static size_t ctnetlink_acct_size(const struct nf_conn *ct) +{ + if (!nf_ct_ext_exist(ct, NF_CT_EXT_ACCT)) + return 0; + return 2 * nla_total_size(0) /* CTA_COUNTERS_ORIG|REPL */ + + 2 * nla_total_size(sizeof(uint64_t)) /* CTA_COUNTERS_PACKETS */ + + 2 * nla_total_size(sizeof(uint64_t)) /* CTA_COUNTERS_BYTES */ + ; +} static size_t ctnetlink_timestamp_size(const struct nf_conn *ct) { @@ -580,7 +585,6 @@ static size_t ctnetlink_timestamp_size(const struct nf_conn *ct) #endif } -#ifdef CONFIG_NF_CONNTRACK_EVENTS static size_t ctnetlink_nlmsg_size(const struct nf_conn *ct) { return NLMSG_ALIGN(sizeof(struct nfgenmsg))