net: replace __constant_{endian} uses in net headers
Subsystems (8)
PATCH 1/1 net: replace __constant_{endian} uses in net headers
Base versions handle constant folding now. For headers exposed to userspace, we must only expose the __ prefixed versions.
Signed-off-by Harvey Harrison <[email protected]>
--- include/linux/if_pppox.h | 20 ++++---- include/linux/if_tunnel.h | 16 +++--- include/linux/ncp_no.h | 26 +++++----- include/linux/netdevice.h | 4 +- include/linux/netfilter_bridge.h | 4 +- include/linux/pim.h | 4 +- include/linux/sctp.h | 90 +++++++++++++++++++------------------- include/linux/tcp.h | 20 ++++---- include/net/inet_ecn.h | 4 +- include/net/ip_vs.h | 4 +- include/net/ipv6.h | 4 +- include/net/ipx.h | 2 +- include/net/transp_v6.h | 2 +- include/rdma/ib_verbs.h | 2 +- 14 files changed, 101 insertions(+), 101 deletions(-)
include/linux/if_pppox.h +10 -10
@@ -95,16 +95,16 @@ struct pppoe_tag { } __attribute ((packed));/* Tag identifiers */ -#define PTT_EOL __constant_htons(0x0000) -#define PTT_SRV_NAME __constant_htons(0x0101) -#define PTT_AC_NAME __constant_htons(0x0102) -#define PTT_HOST_UNIQ __constant_htons(0x0103) -#define PTT_AC_COOKIE __constant_htons(0x0104) -#define PTT_VENDOR __constant_htons(0x0105) -#define PTT_RELAY_SID __constant_htons(0x0110) -#define PTT_SRV_ERR __constant_htons(0x0201) -#define PTT_SYS_ERR __constant_htons(0x0202) -#define PTT_GEN_ERR __constant_htons(0x0203) +#define PTT_EOL __cpu_to_be16(0x0000) +#define PTT_SRV_NAME __cpu_to_be16(0x0101) +#define PTT_AC_NAME __cpu_to_be16(0x0102) +#define PTT_HOST_UNIQ __cpu_to_be16(0x0103) +#define PTT_AC_COOKIE __cpu_to_be16(0x0104) +#define PTT_VENDOR __cpu_to_be16(0x0105) +#define PTT_RELAY_SID __cpu_to_be16(0x0110) +#define PTT_SRV_ERR __cpu_to_be16(0x0201) +#define PTT_SYS_ERR __cpu_to_be16(0x0202) +#define PTT_GEN_ERR __cpu_to_be16(0x0203)struct pppoe_hdr {#if defined(__LITTLE_ENDIAN_BITFIELD)
include/linux/if_tunnel.h +8 -8
@@ -16,14 +16,14 @@#define SIOCDELPRL (SIOCDEVPRIVATE + 6)#define SIOCCHGPRL (SIOCDEVPRIVATE + 7) -#define GRE_CSUM __constant_htons(0x8000) -#define GRE_ROUTING __constant_htons(0x4000) -#define GRE_KEY __constant_htons(0x2000) -#define GRE_SEQ __constant_htons(0x1000) -#define GRE_STRICT __constant_htons(0x0800) -#define GRE_REC __constant_htons(0x0700) -#define GRE_FLAGS __constant_htons(0x00F8) -#define GRE_VERSION __constant_htons(0x0007) +#define GRE_CSUM __cpu_to_be16(0x8000) +#define GRE_ROUTING __cpu_to_be16(0x4000) +#define GRE_KEY __cpu_to_be16(0x2000) +#define GRE_SEQ __cpu_to_be16(0x1000) +#define GRE_STRICT __cpu_to_be16(0x0800) +#define GRE_REC __cpu_to_be16(0x0700) +#define GRE_FLAGS __cpu_to_be16(0x00F8) +#define GRE_VERSION __cpu_to_be16(0x0007)struct ip_tunnel_parm {
include/linux/ncp_no.h +13 -13
@@ -2,18 +2,18 @@#define _NCP_NO/* these define the attribute byte as seen by NCP */ -#define aRONLY (__constant_cpu_to_le32(1)) -#define aHIDDEN (__constant_cpu_to_le32(2)) -#define aSYSTEM (__constant_cpu_to_le32(4)) -#define aEXECUTE (__constant_cpu_to_le32(8)) -#define aDIR (__constant_cpu_to_le32(0x10)) -#define aARCH (__constant_cpu_to_le32(0x20)) -#define aSHARED (__constant_cpu_to_le32(0x80)) -#define aDONTSUBALLOCATE (__constant_cpu_to_le32(1L<<11)) -#define aTRANSACTIONAL (__constant_cpu_to_le32(1L<<12)) -#define aPURGE (__constant_cpu_to_le32(1L<<16)) -#define aRENAMEINHIBIT (__constant_cpu_to_le32(1L<<17)) -#define aDELETEINHIBIT (__constant_cpu_to_le32(1L<<18)) -#define aDONTCOMPRESS (__constant_cpu_to_le32(1L<<27)) +#define aRONLY (__cpu_to_le32(1)) +#define aHIDDEN (__cpu_to_le32(2)) +#define aSYSTEM (__cpu_to_le32(4)) +#define aEXECUTE (__cpu_to_le32(8)) +#define aDIR (__cpu_to_le32(0x10)) +#define aARCH (__cpu_to_le32(0x20)) +#define aSHARED (__cpu_to_le32(0x80)) +#define aDONTSUBALLOCATE (__cpu_to_le32(1L<<11)) +#define aTRANSACTIONAL (__cpu_to_le32(1L<<12)) +#define aPURGE (__cpu_to_le32(1L<<16)) +#define aRENAMEINHIBIT (__cpu_to_le32(1L<<17)) +#define aDELETEINHIBIT (__cpu_to_le32(1L<<18)) +#define aDONTCOMPRESS (__cpu_to_le32(1L<<27))#endif /* _NCP_NO */
include/linux/netdevice.h +2 -2
@@ -1863,7 +1863,7 @@ static inline int skb_bond_should_drop(struct sk_buff *skb)if (dev->priv_flags &IFF_SLAVE_INACTIVE ) {if ((dev->priv_flags &IFF_SLAVE_NEEDARP ) && - skb->protocol ==__constant_htons (ETH_P_ARP )) + skb->protocol ==__cpu_to_be16 (ETH_P_ARP ))return 0 ;if (master->priv_flags &IFF_MASTER_ALB ) {
@@ -1872,7 +1872,7 @@ static inline int skb_bond_should_drop(struct sk_buff *skb)return 0 ; }if (master->priv_flags &IFF_MASTER_8023AD && - skb->protocol ==__constant_htons (ETH_P_SLOW )) + skb->protocol ==__cpu_to_be16 (ETH_P_SLOW ))return 0 ;return 1 ;
include/linux/netfilter_bridge.h +2 -2
@@ -59,9 +59,9 @@ static inline int nf_bridge_maybe_copy_header(struct sk_buff *skb)static inline unsigned int nf_bridge_encap_header_len (const struct sk_buff *skb) {switch (skb->protocol) { -case __constant_htons (ETH_P_8021Q ): +case __cpu_to_be16 (ETH_P_8021Q ):return VLAN_HLEN ; -case __constant_htons (ETH_P_PPP_SES ): +case __cpu_to_be16 (ETH_P_PPP_SES ):return PPPOE_SES_HLEN ;default :return 0 ;
include/linux/pim.h +2 -2
@@ -4,14 +4,14 @@#include <asm/byteorder.h> /* Message types - V1 */ -#define PIM_V1_VERSION __constant_htonl(0x10000000) +#define PIM_V1_VERSION cpu_to_be32(0x10000000)#define PIM_V1_REGISTER 1/* Message types - V2 */ #define PIM_VERSION 2#define PIM_REGISTER 1 -#define PIM_NULL_REGISTER __constant_htonl(0x40000000) +#define PIM_NULL_REGISTER cpu_to_be32(0x40000000)/* PIMv2 register message header layout (ietf-draft-idmr-pimvsm-v2-00.ps */ struct pimreghdr
include/linux/sctp.h +45 -45
137 lines not on this page · raw message
include/linux/tcp.h +10 -10
@@ -69,16 +69,16 @@ union tcp_word_hdr {#define tcp_flag_word (tp) ( ((union tcp_word_hdr *)(tp))->words [3])enum { -TCP_FLAG_CWR =__constant_htonl (0x00800000 ), -TCP_FLAG_ECE =__constant_htonl (0x00400000 ), -TCP_FLAG_URG =__constant_htonl (0x00200000 ), -TCP_FLAG_ACK =__constant_htonl (0x00100000 ), -TCP_FLAG_PSH =__constant_htonl (0x00080000 ), -TCP_FLAG_RST =__constant_htonl (0x00040000 ), -TCP_FLAG_SYN =__constant_htonl (0x00020000 ), -TCP_FLAG_FIN =__constant_htonl (0x00010000 ), -TCP_RESERVED_BITS =__constant_htonl (0x0F000000 ), -TCP_DATA_OFFSET =__constant_htonl (0xF0000000 ) +TCP_FLAG_CWR =__cpu_to_be32 (0x00800000 ), +TCP_FLAG_ECE =__cpu_to_be32 (0x00400000 ), +TCP_FLAG_URG =__cpu_to_be32 (0x00200000 ), +TCP_FLAG_ACK =__cpu_to_be32 (0x00100000 ), +TCP_FLAG_PSH =__cpu_to_be32 (0x00080000 ), +TCP_FLAG_RST =__cpu_to_be32 (0x00040000 ), +TCP_FLAG_SYN =__cpu_to_be32 (0x00020000 ), +TCP_FLAG_FIN =__cpu_to_be32 (0x00010000 ), +TCP_RESERVED_BITS =__cpu_to_be32 (0x0F000000 ), +TCP_DATA_OFFSET =__cpu_to_be32 (0xF0000000 ) };/* TCP socket options */
include/net/inet_ecn.h +2 -2
@@ -113,12 +113,12 @@ static inline void ipv6_copy_dscp(unsigned int dscp, struct ipv6hdr *inner)static inline int INET_ECN_set_ce (struct sk_buff *skb) {switch (skb->protocol) { -case __constant_htons (ETH_P_IP ): +case cpu_to_be16 (ETH_P_IP ):if (skb->network_header +sizeof (struct iphdr ) <= skb->tail)return IP_ECN_set_ce (ip_hdr (skb));break ; -case __constant_htons (ETH_P_IPV6 ): +case cpu_to_be16 (ETH_P_IPV6 ):if (skb->network_header +sizeof (struct ipv6hdr ) <= skb->tail)return IP6_ECN_set_ce (ipv6_hdr (skb));break ;
include/net/ip_vs.h +2 -2
@@ -184,8 +184,8 @@ static inline const char *ip_vs_dbg_addr(int af, char *buf, size_t buf_len,/* * The port number of FTP service (in network order). */ -#define FTPPORT __constant_htons(21) -#define FTPDATA __constant_htons(20) +#define FTPPORT cpu_to_be16(21) +#define FTPDATA cpu_to_be16(20)/* * TCP State Values
include/net/ipv6.h +2 -2
@@ -196,8 +196,8 @@ struct ip6_flowlabelstruct net *fl_net; }; -#define IPV6_FLOWINFO_MASK __constant_htonl(0x0FFFFFFF) -#define IPV6_FLOWLABEL_MASK __constant_htonl(0x000FFFFF) +#define IPV6_FLOWINFO_MASK cpu_to_be32(0x0FFFFFFF) +#define IPV6_FLOWLABEL_MASK cpu_to_be32(0x000FFFFF)struct ipv6_fl_socklist {
include/net/ipx.h +1 -1
@@ -27,7 +27,7 @@ struct ipx_address {struct ipxhdr {__be16 ipx_checksum __attribute__ ((packed)); -#define IPX_NO_CHECKSUM __constant_htons(0xFFFF) +#define IPX_NO_CHECKSUM cpu_to_be16(0xFFFF)__be16 ipx_pktsize __attribute__ ((packed));__u8 ipx_tctrl;__u8 ipx_type;
include/net/transp_v6.h +1 -1
@@ -46,7 +46,7 @@ extern int datagram_send_ctl(struct net *net,struct ipv6_txoptions *opt, int *hlimit, int *tclass); -#define LOOPBACK4_IPV6 __constant_htonl(0x7f000006) +#define LOOPBACK4_IPV6 cpu_to_be32(0x7f000006)/* * address family specific functions
include/rdma/ib_verbs.h +1 -1
@@ -388,7 +388,7 @@ enum {IB_MULTICAST_QPN =0xffffff }; -#define IB_LID_PERMISSIVE __constant_htons(0xFFFF) +#define IB_LID_PERMISSIVE cpu_to_be16(0xFFFF)enum ib_ah_flags {IB_AH_GRH =1
Signature · 1 line
1.6.2.rc0.218.gde7c
From: Harvey Harrison <[email protected]>
Date: Wed, 11 Feb 2009 17:15:27 -0800
Quoted 4 lines
Base versions handle constant folding now. For headers exposed to userspace, we must only expose the __ prefixed versions.
Signed-off-by Harvey Harrison <[email protected]>
Applied, thanks.