From: Joe Perches <joe@perches.com>
To: netdev@vger.kernel.org
Cc: linux-kernel@vger.kernel.org
Subject: [PATCH net-next 15/21] in.h: Rename ipv4_is_<foo> functions to ipv4_addr_<foo>
Date: Thu, 18 Oct 2012 21:14:59 -0700 [thread overview]
Message-ID: <e7805590abcf76d60dc0cbeff63c824419726ab4.1350618011.git.joe@perches.com> (raw)
In-Reply-To: <cover.1350618006.git.joe@perches.com>
Make the ipv4_is_<foo> tests use a similar style to ipv6_<foo> tests.
Add backward compatibility #defines to keep current ipv4_is_<foo>
code working until completely converted.
Signed-off-by: Joe Perches <joe@perches.com>
---
include/linux/in.h | 40 ++++++++++++++++++++++++++++------------
1 files changed, 28 insertions(+), 12 deletions(-)
diff --git a/include/linux/in.h b/include/linux/in.h
index 31b4937..2116ce8 100644
--- a/include/linux/in.h
+++ b/include/linux/in.h
@@ -39,66 +39,82 @@ static inline int proto_ports_offset(int proto)
}
}
-static inline bool ipv4_is_loopback(__be32 addr)
+static inline bool ipv4_addr_loopback(__be32 addr)
{
return (addr & htonl(0xff000000)) == htonl(0x7f000000);
}
-static inline bool ipv4_is_multicast(__be32 addr)
+static inline bool ipv4_addr_multicast(__be32 addr)
{
return (addr & htonl(0xf0000000)) == htonl(0xe0000000);
}
-static inline bool ipv4_is_local_multicast(__be32 addr)
+static inline bool ipv4_addr_local_multicast(__be32 addr)
{
return (addr & htonl(0xffffff00)) == htonl(0xe0000000);
}
-static inline bool ipv4_is_lbcast(__be32 addr)
+static inline bool ipv4_addr_lbcast(__be32 addr)
{
/* limited broadcast */
return addr == htonl(INADDR_BROADCAST);
}
-static inline bool ipv4_is_zeronet(__be32 addr)
+static inline bool ipv4_addr_zeronet(__be32 addr)
{
return (addr & htonl(0xff000000)) == htonl(0x00000000);
}
/* Special-Use IPv4 Addresses (RFC3330) */
-static inline bool ipv4_is_private_10(__be32 addr)
+static inline bool ipv4_addr_private_10(__be32 addr)
{
return (addr & htonl(0xff000000)) == htonl(0x0a000000);
}
-static inline bool ipv4_is_private_172(__be32 addr)
+static inline bool ipv4_addr_private_172(__be32 addr)
{
return (addr & htonl(0xfff00000)) == htonl(0xac100000);
}
-static inline bool ipv4_is_private_192(__be32 addr)
+static inline bool ipv4_addr_private_192(__be32 addr)
{
return (addr & htonl(0xffff0000)) == htonl(0xc0a80000);
}
-static inline bool ipv4_is_linklocal_169(__be32 addr)
+static inline bool ipv4_addr_linklocal_169(__be32 addr)
{
return (addr & htonl(0xffff0000)) == htonl(0xa9fe0000);
}
-static inline bool ipv4_is_anycast_6to4(__be32 addr)
+static inline bool ipv4_addr_anycast_6to4(__be32 addr)
{
return (addr & htonl(0xffffff00)) == htonl(0xc0586300);
}
-static inline bool ipv4_is_test_192(__be32 addr)
+static inline bool ipv4_addr_test_192(__be32 addr)
{
return (addr & htonl(0xffffff00)) == htonl(0xc0000200);
}
-static inline bool ipv4_is_test_198(__be32 addr)
+static inline bool ipv4_addr_test_198(__be32 addr)
{
return (addr & htonl(0xfffe0000)) == htonl(0xc6120000);
}
+
+/* Some #defines to make old ipv4_is_<foo> tests work for awhile */
+
+#define ipv4_is_loopback(addr) ipv4_addr_loopback(addr)
+#define ipv4_is_multicast(addr) ipv4_addr_multicast(addr)
+#define ipv4_is_local_multicast(addr) ipv4_addr_local_multicast(addr)
+#define ipv4_is_lbcast(addr) ipv4_addr_lbcast(addr)
+#define ipv4_is_zeronet(addr) ipv4_addr_zeronet(addr)
+#define ipv4_is_private_10(addr) ipv4_addr_private_10(addr)
+#define ipv4_is_private_172(addr) ipv4_addr_private_172(addr)
+#define ipv4_is_private_192(addr) ipv4_addr_private_192(addr)
+#define ipv4_is_linklocal_169(addr) ipv4_addr_linklocal_169(addr)
+#define ipv4_is_anycast_6to4(addr) ipv4_addr_anycast_6to4(addr)
+#define ipv4_is_test_192(addr) ipv4_addr_test_192(addr)
+#define ipv4_is_test_198(addr) ipv4_addr_test_198(addr)
+
#endif /* _LINUX_IN_H */
--
1.7.8.111.gad25c.dirty
next prev parent reply other threads:[~2012-10-19 4:15 UTC|newest]
Thread overview: 26+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-10-19 3:55 [PATCH net-next 00/21] treewide: Use consistent api style for address testing Joe Perches
2012-10-19 3:55 ` [PATCH net-next 01/21] etherdevice: Rename is_<foo>_ether_addr tests to eth_addr_<foo> Joe Perches
2012-10-19 3:55 ` [PATCH net-next 02/21] net: Convert is_<foo>_ether_addr uses " Joe Perches
2012-10-19 3:55 ` [PATCH net-next 03/21] arch: " Joe Perches
2012-10-19 3:55 ` [PATCH net-next 04/21] wireless: " Joe Perches
2012-10-20 2:30 ` Bing Zhao
2012-10-20 16:19 ` Arend van Spriel
2012-10-19 4:14 ` [PATCH net-next 05/21] drivers: net: " Joe Perches
2012-10-19 4:14 ` [PATCH net-next 06/21] staging: " Joe Perches
2012-10-19 4:14 ` [PATCH net-next 07/21] infiniband: " Joe Perches
2012-10-19 4:14 ` [PATCH net-next 08/21] scsi: " Joe Perches
2012-10-19 4:14 ` [PATCH net-next 09/21] of: " Joe Perches
2012-10-19 4:14 ` [PATCH net-next 10/21] s390: " Joe Perches
2012-10-19 4:14 ` [PATCH net-next 11/21] usb: " Joe Perches
2012-10-19 4:14 ` [PATCH net-next 12/21] uwb: " Joe Perches
2012-10-19 4:14 ` [PATCH net-next 13/21] Documentation: networking: " Joe Perches
2012-10-19 4:14 ` [PATCH net-next 14/21] llc_if.h: " Joe Perches
2012-10-19 4:14 ` Joe Perches [this message]
2012-10-19 4:15 ` [PATCH net-next 16/21] net: Convert ipv4_is_<foo> uses to ipv4_addr_<foo> Joe Perches
2012-10-19 4:15 ` [PATCH net-next 17/21] infiniband: " Joe Perches
2012-10-19 4:15 ` [PATCH net-next 18/21] ath6kl: " Joe Perches
2012-10-19 4:15 ` [PATCH net-next 19/21] parisc: " Joe Perches
2012-10-19 4:15 ` [PATCH net-next 20/21] lockd: " Joe Perches
2012-10-19 4:15 ` [PATCH net-next 21/21] sctp: " Joe Perches
[not found] ` <1350630254.2293.183.camel@edumazet-glaptop>
2012-10-19 10:29 ` [PATCH net-next 00/21] treewide: Use consistent api style for address testing Joe Perches
[not found] ` <20121019115517.7b8514a8@mj>
2012-10-19 16:39 ` [ath9k-devel] " Joe Perches
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=e7805590abcf76d60dc0cbeff63c824419726ab4.1350618011.git.joe@perches.com \
--to=joe@perches.com \
--cc=linux-kernel@vger.kernel.org \
--cc=netdev@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
all inboxes | Powered by JetHome®