From: Florian Westphal <fw@strlen.de>
To: Julia Lawall <julia.lawall@lip6.fr>
Cc: Florian Westphal <fw@strlen.de>,
linux-decnet-user@lists.sourceforge.net, bhumirks@gmail.com,
kernel-janitors@vger.kernel.org,
Pablo Neira Ayuso <pablo@netfilter.org>,
Jozsef Kadlecsik <kadlec@blackhole.kfki.hu>,
"David S. Miller" <davem@davemloft.net>,
netfilter-devel@vger.kernel.org, coreteam@netfilter.org,
netdev@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH 0/2] constify nf_hook_ops structures
Date: Sat, 29 Jul 2017 09:41:36 +0000 [thread overview]
Message-ID: <20170729094136.GG28392@breakpoint.cc> (raw)
In-Reply-To: <alpine.DEB.2.20.1707291120580.2002@hadrien>
Julia Lawall <julia.lawall@lip6.fr> wrote:
> On Sat, 29 Jul 2017, Florian Westphal wrote:
> > From a quick glance I don't see why we can't e.g. constify
> > nf_conntrack_l3/4_proto too. It is not going to be as simple
> > as just placing const everywhere, but I see no requirement for
> > having these writeable.
>
> I will take a look.
Thanks.
nf_logger and nf_loginfo also look like constify candidates.
If there is a way to add "const" qualifier to pointer-to-structs
that are not modified this would good as well to have IMO, if just
for purpose of documentation. For instance:
+++ b/net/netfilter/nf_conntrack_core.c
@@ -1177,8 +1177,8 @@ void nf_conntrack_free(struct nf_conn *ct)
static noinline struct nf_conntrack_tuple_hash *
init_conntrack(struct net *net, struct nf_conn *tmpl,
const struct nf_conntrack_tuple *tuple,
- struct nf_conntrack_l3proto *l3proto,
- struct nf_conntrack_l4proto *l4proto,
+ const struct nf_conntrack_l3proto *l3proto,
+ const struct nf_conntrack_l4proto *l4proto,
(its only passed as arg to a function that expects
"const struct nf_conntrack_x *").
I think we have several (also non-static helpers) that
take "struct foo *" arg while they could use "const struct foo*"
instead.
WARNING: multiple messages have this Message-ID (diff)
From: Florian Westphal <fw@strlen.de>
To: Julia Lawall <julia.lawall@lip6.fr>
Cc: Florian Westphal <fw@strlen.de>,
linux-decnet-user@lists.sourceforge.net, bhumirks@gmail.com,
kernel-janitors@vger.kernel.org,
Pablo Neira Ayuso <pablo@netfilter.org>,
Jozsef Kadlecsik <kadlec@blackhole.kfki.hu>,
"David S. Miller" <davem@davemloft.net>,
netfilter-devel@vger.kernel.org, coreteam@netfilter.org,
netdev@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH 0/2] constify nf_hook_ops structures
Date: Sat, 29 Jul 2017 11:41:36 +0200 [thread overview]
Message-ID: <20170729094136.GG28392@breakpoint.cc> (raw)
In-Reply-To: <alpine.DEB.2.20.1707291120580.2002@hadrien>
Julia Lawall <julia.lawall@lip6.fr> wrote:
> On Sat, 29 Jul 2017, Florian Westphal wrote:
> > From a quick glance I don't see why we can't e.g. constify
> > nf_conntrack_l3/4_proto too. It is not going to be as simple
> > as just placing const everywhere, but I see no requirement for
> > having these writeable.
>
> I will take a look.
Thanks.
nf_logger and nf_loginfo also look like constify candidates.
If there is a way to add "const" qualifier to pointer-to-structs
that are not modified this would good as well to have IMO, if just
for purpose of documentation. For instance:
+++ b/net/netfilter/nf_conntrack_core.c
@@ -1177,8 +1177,8 @@ void nf_conntrack_free(struct nf_conn *ct)
static noinline struct nf_conntrack_tuple_hash *
init_conntrack(struct net *net, struct nf_conn *tmpl,
const struct nf_conntrack_tuple *tuple,
- struct nf_conntrack_l3proto *l3proto,
- struct nf_conntrack_l4proto *l4proto,
+ const struct nf_conntrack_l3proto *l3proto,
+ const struct nf_conntrack_l4proto *l4proto,
(its only passed as arg to a function that expects
"const struct nf_conntrack_x *").
I think we have several (also non-static helpers) that
take "struct foo *" arg while they could use "const struct foo*"
instead.
next prev parent reply other threads:[~2017-07-29 9:41 UTC|newest]
Thread overview: 18+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-07-29 6:40 [PATCH 0/2] constify nf_hook_ops structures Julia Lawall
2017-07-29 6:40 ` Julia Lawall
2017-07-29 6:40 ` [PATCH 1/2] decnet: dn_rtmsg: " Julia Lawall
2017-07-29 6:40 ` Julia Lawall
2017-07-29 6:40 ` [PATCH 2/2] netfilter: ipt_CLUSTERIP: " Julia Lawall
2017-07-29 6:40 ` Julia Lawall
2017-07-29 8:44 ` [PATCH 0/2] " Florian Westphal
2017-07-29 8:44 ` Florian Westphal
2017-07-29 8:50 ` Julia Lawall
2017-07-29 8:50 ` Julia Lawall
2017-07-29 9:16 ` Florian Westphal
2017-07-29 9:16 ` Florian Westphal
2017-07-29 9:21 ` Julia Lawall
2017-07-29 9:21 ` Julia Lawall
2017-07-29 9:41 ` Florian Westphal [this message]
2017-07-29 9:41 ` Florian Westphal
2017-07-29 9:56 ` Julia Lawall
2017-07-29 9:56 ` Julia Lawall
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20170729094136.GG28392@breakpoint.cc \
--to=fw@strlen.de \
--cc=bhumirks@gmail.com \
--cc=coreteam@netfilter.org \
--cc=davem@davemloft.net \
--cc=julia.lawall@lip6.fr \
--cc=kadlec@blackhole.kfki.hu \
--cc=kernel-janitors@vger.kernel.org \
--cc=linux-decnet-user@lists.sourceforge.net \
--cc=linux-kernel@vger.kernel.org \
--cc=netdev@vger.kernel.org \
--cc=netfilter-devel@vger.kernel.org \
--cc=pablo@netfilter.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.