[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20090309210843.GB18357@localhost>
Date: Tue, 10 Mar 2009 00:08:43 +0300
From: Cyrill Gorcunov <gorcunov@...il.com>
To: Patrick McHardy <kaber@...sh.net>, davem@...emloft.net,
netdev@...r.kernel.org, linux-next@...r.kernel.org,
xemul@...nvz.org, adobriyan@...il.com,
Netfilter Development Mailinglist
<netfilter-devel@...r.kernel.org>
Subject: Re: [RFC 0/4] netfilter conntrack sysctls pernet support
[Cyrill Gorcunov - Mon, Mar 09, 2009 at 10:07:44PM +0300]
...
| >> + sn->sysctl_table[0].data = &sn->sctp_timeouts[SCTP_CONNTRACK_CLOSED];
| >> + sn->sysctl_table[1].data = &sn->sctp_timeouts[SCTP_CONNTRACK_COOKIE_WAIT];
| >> + sn->sysctl_table[2].data = &sn->sctp_timeouts[SCTP_CONNTRACK_COOKIE_ECHOED];
| >> + sn->sysctl_table[3].data = &sn->sctp_timeouts[SCTP_CONNTRACK_ESTABLISHED];
| >> + sn->sysctl_table[4].data = &sn->sctp_timeouts[SCTP_CONNTRACK_SHUTDOWN_SENT];
| >> + sn->sysctl_table[5].data = &sn->sctp_timeouts[SCTP_CONNTRACK_SHUTDOWN_RECD];
| >> + sn->sysctl_table[6].data = &sn->sctp_timeouts[SCTP_CONNTRACK_SHUTDOWN_ACK_SENT];
| >
| > Please use an iteration to avoid these repetitve overly long lines.
| >
|
| Ah, thanks a lot! Indeed.
|
| - Cyrill -
Patrick, if I make it like that (iterations)
...
BUILD_BUG_ON(ARRAY_SIZE(sctp_compat_sysctl_table) != SCTP_CONNTRACK_MAX);
for (i = 0; i < ARRAY_SIZE(sctp_compat_sysctl_table) - 1; i++)
sn->compat_sysctl_table[i].data = &sn->sctp_timeouts[i + 1];
...
it seems the code become hard to follow. Yes it was long (repetitive) lines
but it was obvious what is set for every table entry and easy to find what
should be changed if SCTP_ enumeration is changed or table entry removed
(for some reason). I could make it shorter in length but remain the same
explicit assignment. How do you think?
- Cyrill -
--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Powered by blists - more mailing lists