From: Ulrich Drepper <drepper@redhat.com>
To: Arjan van de Ven <arjan@infradead.org>
Cc: "David S. Miller" <davem@davemloft.net>, linux-kernel@vger.kernel.org
Subject: Re: ntohs/ntohl and bitops
Date: Wed, 11 Jan 2006 00:36:11 -0800 [thread overview]
Message-ID: <43C4C37B.9020801@redhat.com> (raw)
In-Reply-To: <1136967192.2929.6.camel@laptopd505.fenrus.org>
[-- Attachment #1: Type: text/plain, Size: 2443 bytes --]
Arjan van de Ven wrote:
> why this __constant_htons and not just plain htons ??
> htons() gets auto-remapped to that anyway via the builtin "is this a
> constant" thing...... and to be honest htons() is more readable.
Indeed, why the need for the uglification?
Anyway, candidates for this kind of transformation:
net/ipx/af_ipx.c:1450: if (ntohs(addr->sipx_port) <
IPX_MIN_EPHEMERAL_SOCKET &&
net/atm/br2684.c:308: if (ntohs(eth->h_proto) >= 1536)
net/ipv6/netfilter/ip6t_LOG.c:114: if
(ntohs(fh->frag_off) & 0xFFF8)
net/ipv6/exthdrs_core.c:89: if (ntohs(*fp) & ~0x7)
net/ipv4/ipmr.c:1182: if (skb->len+encap > dst_mtu(&rt->u.dst) &&
(ntohs(iph->frag_off) & IP_DF)) {
net/ipv4/netfilter/ip_conntrack_helper_pptp.c:710: if
(ntohs(pptph->packetType) != PPTP_PACKET_CONTROL ||
net/ipv4/netfilter/ipt_LOG.c:70: if (ntohs(ih->frag_off) & IP_CE)
net/ipv4/netfilter/ipt_LOG.c:72: if (ntohs(ih->frag_off) & IP_DF)
net/ipv4/netfilter/ipt_LOG.c:74: if (ntohs(ih->frag_off) & IP_MF)
net/ipv4/netfilter/ipt_LOG.c:78: if (ntohs(ih->frag_off) & IP_OFFSET)
net/ipv4/netfilter/ipt_LOG.c:108: if (ntohs(ih->frag_off)
& IP_OFFSET)
net/ipv4/netfilter/ipt_LOG.c:180: if (ntohs(ih->frag_off)
& IP_OFFSET)
net/ipv4/netfilter/ipt_LOG.c:221: if (ntohs(ih->frag_off)
& IP_OFFSET)
net/ipv4/netfilter/ipt_LOG.c:286: if (ntohs(ih->frag_off)
& IP_OFFSET)
net/ipv4/netfilter/ipt_LOG.c:311: if (ntohs(ih->frag_off)
& IP_OFFSET)
net/bridge/netfilter/ebt_ip.c:55: if (ntohs(ih->frag_off)
& IP_OFFSET)
net/sunrpc/auth_gss/svcauth_gss.c:793: if (ntohl(svc_getu32(argv)) !=
RPC_GSS_VERSION)
net/sunrpc/auth_gss/svcauth_gss.c:823: if
(ntohl(svc_getu32(argv)) != RPC_AUTH_NULL)
net/sunrpc/auth_gss/svcauth_gss.c:825: if
(ntohl(svc_getu32(argv)) != 0)
net/bluetooth/bnep/core.c:343: if (ntohs(s->eh.h_proto) == 0x8100) {
(svcauth_gss.c:825 is a good one).
For consistency reasons, ntohs should be changed to htons here:
net/ipv6/netfilter/ip6t_eui64.c:43: if (eth_hdr(skb)->h_proto ==
ntohs(ETH_P_IPV6)) {
Around net/ipv4/ipconfig.c:376 you might want to store the transformed
ic_myaddr in a variable instead of repeating the ntohl call.
--
➧ Ulrich Drepper ➧ Red Hat, Inc. ➧ 444 Castro St ➧ Mountain View, CA ❖
[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 251 bytes --]
next prev parent reply other threads:[~2006-01-11 8:36 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
2006-01-10 22:02 ntohs/ntohl and bitops Ulrich Drepper
2006-01-11 8:00 ` David S. Miller
2006-01-11 8:13 ` Arjan van de Ven
2006-01-11 8:36 ` David S. Miller
2006-01-11 8:36 ` Ulrich Drepper [this message]
2006-01-11 8:44 ` David S. Miller
2006-01-11 9:48 ` Jakub Jelinek
2006-01-11 18:35 ` Jan Engelhardt
2006-01-11 18:45 ` Ulrich Drepper
2006-01-11 20:19 ` David S. Miller
2006-01-12 1:04 ` Pavel Machek
2006-01-14 9:52 ` YOSHIFUJI Hideaki / 吉藤英明
2006-01-15 1:46 ` David S. Miller
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=43C4C37B.9020801@redhat.com \
--to=drepper@redhat.com \
--cc=arjan@infradead.org \
--cc=davem@davemloft.net \
--cc=linux-kernel@vger.kernel.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).