[IPX]: Trivial parts of endianness annotations

Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
Signed-off-by: David S. Miller <davem@davemloft.net>
This commit is contained in:
Al Viro 2006-11-03 00:27:06 -08:00 committed by David S. Miller
parent 10b1fbdb0a
commit 4833ed0940
5 changed files with 56 additions and 56 deletions

View File

@ -7,8 +7,8 @@
struct sockaddr_ipx { struct sockaddr_ipx {
sa_family_t sipx_family; sa_family_t sipx_family;
__u16 sipx_port; __be16 sipx_port;
__u32 sipx_network; __be32 sipx_network;
unsigned char sipx_node[IPX_NODE_LEN]; unsigned char sipx_node[IPX_NODE_LEN];
__u8 sipx_type; __u8 sipx_type;
unsigned char sipx_zero; /* 16 byte fill */ unsigned char sipx_zero; /* 16 byte fill */
@ -23,13 +23,13 @@ struct sockaddr_ipx {
#define IPX_CRTITF 1 #define IPX_CRTITF 1
struct ipx_route_definition { struct ipx_route_definition {
__u32 ipx_network; __be32 ipx_network;
__u32 ipx_router_network; __be32 ipx_router_network;
unsigned char ipx_router_node[IPX_NODE_LEN]; unsigned char ipx_router_node[IPX_NODE_LEN];
}; };
struct ipx_interface_definition { struct ipx_interface_definition {
__u32 ipx_network; __be32 ipx_network;
unsigned char ipx_device[16]; unsigned char ipx_device[16];
unsigned char ipx_dlink_type; unsigned char ipx_dlink_type;
#define IPX_FRAME_NONE 0 #define IPX_FRAME_NONE 0
@ -55,8 +55,8 @@ struct ipx_config_data {
*/ */
struct ipx_route_def { struct ipx_route_def {
__u32 ipx_network; __be32 ipx_network;
__u32 ipx_router_network; __be32 ipx_router_network;
#define IPX_ROUTE_NO_ROUTER 0 #define IPX_ROUTE_NO_ROUTER 0
unsigned char ipx_router_node[IPX_NODE_LEN]; unsigned char ipx_router_node[IPX_NODE_LEN];
unsigned char ipx_device[16]; unsigned char ipx_device[16];

View File

@ -15,9 +15,9 @@
#include <linux/list.h> #include <linux/list.h>
struct ipx_address { struct ipx_address {
__u32 net; __be32 net;
__u8 node[IPX_NODE_LEN]; __u8 node[IPX_NODE_LEN];
__u16 sock; __be16 sock;
}; };
#define ipx_broadcast_node "\377\377\377\377\377\377" #define ipx_broadcast_node "\377\377\377\377\377\377"
@ -28,7 +28,7 @@ struct ipx_address {
struct ipxhdr { struct ipxhdr {
__u16 ipx_checksum __attribute__ ((packed)); __u16 ipx_checksum __attribute__ ((packed));
#define IPX_NO_CHECKSUM 0xFFFF #define IPX_NO_CHECKSUM 0xFFFF
__u16 ipx_pktsize __attribute__ ((packed)); __be16 ipx_pktsize __attribute__ ((packed));
__u8 ipx_tctrl; __u8 ipx_tctrl;
__u8 ipx_type; __u8 ipx_type;
#define IPX_TYPE_UNKNOWN 0x00 #define IPX_TYPE_UNKNOWN 0x00
@ -48,14 +48,14 @@ static __inline__ struct ipxhdr *ipx_hdr(struct sk_buff *skb)
struct ipx_interface { struct ipx_interface {
/* IPX address */ /* IPX address */
__u32 if_netnum; __be32 if_netnum;
unsigned char if_node[IPX_NODE_LEN]; unsigned char if_node[IPX_NODE_LEN];
atomic_t refcnt; atomic_t refcnt;
/* physical device info */ /* physical device info */
struct net_device *if_dev; struct net_device *if_dev;
struct datalink_proto *if_dlink; struct datalink_proto *if_dlink;
unsigned short if_dlink_type; __be16 if_dlink_type;
/* socket support */ /* socket support */
unsigned short if_sknum; unsigned short if_sknum;
@ -71,7 +71,7 @@ struct ipx_interface {
}; };
struct ipx_route { struct ipx_route {
__u32 ir_net; __be32 ir_net;
struct ipx_interface *ir_intrfc; struct ipx_interface *ir_intrfc;
unsigned char ir_routed; unsigned char ir_routed;
unsigned char ir_router_node[IPX_NODE_LEN]; unsigned char ir_router_node[IPX_NODE_LEN];
@ -82,10 +82,10 @@ struct ipx_route {
#ifdef __KERNEL__ #ifdef __KERNEL__
struct ipx_cb { struct ipx_cb {
u8 ipx_tctrl; u8 ipx_tctrl;
u32 ipx_dest_net; __be32 ipx_dest_net;
u32 ipx_source_net; __be32 ipx_source_net;
struct { struct {
u32 netnum; __be32 netnum;
int index; int index;
} last_hop; } last_hop;
}; };
@ -97,7 +97,7 @@ struct ipx_sock {
struct sock sk; struct sock sk;
struct ipx_address dest_addr; struct ipx_address dest_addr;
struct ipx_interface *intrfc; struct ipx_interface *intrfc;
unsigned short port; __be16 port;
#ifdef CONFIG_IPX_INTERN #ifdef CONFIG_IPX_INTERN
unsigned char node[IPX_NODE_LEN]; unsigned char node[IPX_NODE_LEN];
#endif #endif
@ -132,7 +132,7 @@ extern struct ipx_interface *ipx_primary_net;
extern int ipx_proc_init(void); extern int ipx_proc_init(void);
extern void ipx_proc_exit(void); extern void ipx_proc_exit(void);
extern const char *ipx_frame_name(unsigned short); extern const char *ipx_frame_name(__be16);
extern const char *ipx_device_name(struct ipx_interface *intrfc); extern const char *ipx_device_name(struct ipx_interface *intrfc);
static __inline__ void ipxitf_hold(struct ipx_interface *intrfc) static __inline__ void ipxitf_hold(struct ipx_interface *intrfc)

View File

@ -83,13 +83,13 @@ DEFINE_SPINLOCK(ipx_interfaces_lock);
struct ipx_interface *ipx_primary_net; struct ipx_interface *ipx_primary_net;
struct ipx_interface *ipx_internal_net; struct ipx_interface *ipx_internal_net;
extern int ipxrtr_add_route(__u32 network, struct ipx_interface *intrfc, extern int ipxrtr_add_route(__be32 network, struct ipx_interface *intrfc,
unsigned char *node); unsigned char *node);
extern void ipxrtr_del_routes(struct ipx_interface *intrfc); extern void ipxrtr_del_routes(struct ipx_interface *intrfc);
extern int ipxrtr_route_packet(struct sock *sk, struct sockaddr_ipx *usipx, extern int ipxrtr_route_packet(struct sock *sk, struct sockaddr_ipx *usipx,
struct iovec *iov, int len, int noblock); struct iovec *iov, int len, int noblock);
extern int ipxrtr_route_skb(struct sk_buff *skb); extern int ipxrtr_route_skb(struct sk_buff *skb);
extern struct ipx_route *ipxrtr_lookup(__u32 net); extern struct ipx_route *ipxrtr_lookup(__be32 net);
extern int ipxrtr_ioctl(unsigned int cmd, void __user *arg); extern int ipxrtr_ioctl(unsigned int cmd, void __user *arg);
#undef IPX_REFCNT_DEBUG #undef IPX_REFCNT_DEBUG
@ -177,7 +177,7 @@ static void ipxitf_clear_primary_net(void)
} }
static struct ipx_interface *__ipxitf_find_using_phys(struct net_device *dev, static struct ipx_interface *__ipxitf_find_using_phys(struct net_device *dev,
unsigned short datalink) __be16 datalink)
{ {
struct ipx_interface *i; struct ipx_interface *i;
@ -190,7 +190,7 @@ out:
} }
static struct ipx_interface *ipxitf_find_using_phys(struct net_device *dev, static struct ipx_interface *ipxitf_find_using_phys(struct net_device *dev,
unsigned short datalink) __be16 datalink)
{ {
struct ipx_interface *i; struct ipx_interface *i;
@ -202,7 +202,7 @@ static struct ipx_interface *ipxitf_find_using_phys(struct net_device *dev,
return i; return i;
} }
struct ipx_interface *ipxitf_find_using_net(__u32 net) struct ipx_interface *ipxitf_find_using_net(__be32 net)
{ {
struct ipx_interface *i; struct ipx_interface *i;
@ -237,7 +237,7 @@ static void ipxitf_insert_socket(struct ipx_interface *intrfc, struct sock *sk)
/* caller must hold intrfc->if_sklist_lock */ /* caller must hold intrfc->if_sklist_lock */
static struct sock *__ipxitf_find_socket(struct ipx_interface *intrfc, static struct sock *__ipxitf_find_socket(struct ipx_interface *intrfc,
unsigned short port) __be16 port)
{ {
struct sock *s; struct sock *s;
struct hlist_node *node; struct hlist_node *node;
@ -252,7 +252,7 @@ found:
/* caller must hold a reference to intrfc */ /* caller must hold a reference to intrfc */
static struct sock *ipxitf_find_socket(struct ipx_interface *intrfc, static struct sock *ipxitf_find_socket(struct ipx_interface *intrfc,
unsigned short port) __be16 port)
{ {
struct sock *s; struct sock *s;
@ -268,7 +268,7 @@ static struct sock *ipxitf_find_socket(struct ipx_interface *intrfc,
#ifdef CONFIG_IPX_INTERN #ifdef CONFIG_IPX_INTERN
static struct sock *ipxitf_find_internal_socket(struct ipx_interface *intrfc, static struct sock *ipxitf_find_internal_socket(struct ipx_interface *intrfc,
unsigned char *ipx_node, unsigned char *ipx_node,
unsigned short port) __be16 port)
{ {
struct sock *s; struct sock *s;
struct hlist_node *node; struct hlist_node *node;
@ -600,10 +600,10 @@ int ipxitf_send(struct ipx_interface *intrfc, struct sk_buff *skb, char *node)
/* see if we need to include the netnum in the route list */ /* see if we need to include the netnum in the route list */
if (IPX_SKB_CB(skb)->last_hop.index >= 0) { if (IPX_SKB_CB(skb)->last_hop.index >= 0) {
u32 *last_hop = (u32 *)(((u8 *) skb->data) + __be32 *last_hop = (__be32 *)(((u8 *) skb->data) +
sizeof(struct ipxhdr) + sizeof(struct ipxhdr) +
IPX_SKB_CB(skb)->last_hop.index * IPX_SKB_CB(skb)->last_hop.index *
sizeof(u32)); sizeof(__be32));
*last_hop = IPX_SKB_CB(skb)->last_hop.netnum; *last_hop = IPX_SKB_CB(skb)->last_hop.netnum;
IPX_SKB_CB(skb)->last_hop.index = -1; IPX_SKB_CB(skb)->last_hop.index = -1;
} }
@ -772,7 +772,7 @@ static void ipxitf_discover_netnum(struct ipx_interface *intrfc,
} else { } else {
printk(KERN_WARNING "IPX: Network number collision " printk(KERN_WARNING "IPX: Network number collision "
"%lx\n %s %s and %s %s\n", "%lx\n %s %s and %s %s\n",
(unsigned long) htonl(cb->ipx_source_net), (unsigned long) ntohl(cb->ipx_source_net),
ipx_device_name(i), ipx_device_name(i),
ipx_frame_name(i->if_dlink_type), ipx_frame_name(i->if_dlink_type),
ipx_device_name(intrfc), ipx_device_name(intrfc),
@ -812,7 +812,7 @@ static int ipxitf_pprop(struct ipx_interface *intrfc, struct sk_buff *skb)
int i, rc = -EINVAL; int i, rc = -EINVAL;
struct ipx_interface *ifcs; struct ipx_interface *ifcs;
char *c; char *c;
u32 *l; __be32 *l;
/* Illegal packet - too many hops or too short */ /* Illegal packet - too many hops or too short */
/* We decide to throw it away: no broadcasting, no local processing. /* We decide to throw it away: no broadcasting, no local processing.
@ -833,7 +833,7 @@ static int ipxitf_pprop(struct ipx_interface *intrfc, struct sk_buff *skb)
goto out; goto out;
c = ((u8 *) ipx) + sizeof(struct ipxhdr); c = ((u8 *) ipx) + sizeof(struct ipxhdr);
l = (u32 *) c; l = (__be32 *) c;
/* Don't broadcast packet if already seen this net */ /* Don't broadcast packet if already seen this net */
for (i = 0; i < IPX_SKB_CB(skb)->ipx_tctrl; i++) for (i = 0; i < IPX_SKB_CB(skb)->ipx_tctrl; i++)
@ -855,7 +855,7 @@ static int ipxitf_pprop(struct ipx_interface *intrfc, struct sk_buff *skb)
/* That aren't in the list */ /* That aren't in the list */
if (ifcs == intrfc) if (ifcs == intrfc)
continue; continue;
l = (__u32 *) c; l = (__be32 *) c;
/* don't consider the last entry in the packet list, /* don't consider the last entry in the packet list,
* it is our netnum, and it is not there yet */ * it is our netnum, and it is not there yet */
for (i = 0; i < IPX_SKB_CB(skb)->ipx_tctrl; i++) for (i = 0; i < IPX_SKB_CB(skb)->ipx_tctrl; i++)
@ -885,8 +885,8 @@ static void ipxitf_insert(struct ipx_interface *intrfc)
ipx_primary_net = intrfc; ipx_primary_net = intrfc;
} }
static struct ipx_interface *ipxitf_alloc(struct net_device *dev, __u32 netnum, static struct ipx_interface *ipxitf_alloc(struct net_device *dev, __be32 netnum,
unsigned short dlink_type, __be16 dlink_type,
struct datalink_proto *dlink, struct datalink_proto *dlink,
unsigned char internal, unsigned char internal,
int ipx_offset) int ipx_offset)
@ -960,7 +960,7 @@ static __be16 ipx_map_frame_type(unsigned char type)
static int ipxitf_create(struct ipx_interface_definition *idef) static int ipxitf_create(struct ipx_interface_definition *idef)
{ {
struct net_device *dev; struct net_device *dev;
unsigned short dlink_type = 0; __be16 dlink_type = 0;
struct datalink_proto *datalink = NULL; struct datalink_proto *datalink = NULL;
struct ipx_interface *intrfc; struct ipx_interface *intrfc;
int rc; int rc;
@ -1073,7 +1073,7 @@ out:
static int ipxitf_delete(struct ipx_interface_definition *idef) static int ipxitf_delete(struct ipx_interface_definition *idef)
{ {
struct net_device *dev = NULL; struct net_device *dev = NULL;
unsigned short dlink_type = 0; __be16 dlink_type = 0;
struct ipx_interface *intrfc; struct ipx_interface *intrfc;
int rc = 0; int rc = 0;
@ -1110,7 +1110,7 @@ out:
} }
static struct ipx_interface *ipxitf_auto_create(struct net_device *dev, static struct ipx_interface *ipxitf_auto_create(struct net_device *dev,
unsigned short dlink_type) __be16 dlink_type)
{ {
struct ipx_interface *intrfc = NULL; struct ipx_interface *intrfc = NULL;
struct datalink_proto *datalink; struct datalink_proto *datalink;
@ -1122,7 +1122,7 @@ static struct ipx_interface *ipxitf_auto_create(struct net_device *dev,
if (dev->addr_len > IPX_NODE_LEN) if (dev->addr_len > IPX_NODE_LEN)
goto out; goto out;
switch (htons(dlink_type)) { switch (ntohs(dlink_type)) {
case ETH_P_IPX: datalink = pEII_datalink; break; case ETH_P_IPX: datalink = pEII_datalink; break;
case ETH_P_802_2: datalink = p8022_datalink; break; case ETH_P_802_2: datalink = p8022_datalink; break;
case ETH_P_SNAP: datalink = pSNAP_datalink; break; case ETH_P_SNAP: datalink = pSNAP_datalink; break;
@ -1266,7 +1266,7 @@ __u16 ipx_cksum(struct ipxhdr *packet, int length)
return ~sum; return ~sum;
} }
const char *ipx_frame_name(unsigned short frame) const char *ipx_frame_name(__be16 frame)
{ {
char* rc = "None"; char* rc = "None";
@ -1401,7 +1401,7 @@ out:
/* caller must hold a reference to intrfc */ /* caller must hold a reference to intrfc */
static unsigned short ipx_first_free_socketnum(struct ipx_interface *intrfc) static __be16 ipx_first_free_socketnum(struct ipx_interface *intrfc)
{ {
unsigned short socketNum = intrfc->if_sknum; unsigned short socketNum = intrfc->if_sknum;
@ -1410,7 +1410,7 @@ static unsigned short ipx_first_free_socketnum(struct ipx_interface *intrfc)
if (socketNum < IPX_MIN_EPHEMERAL_SOCKET) if (socketNum < IPX_MIN_EPHEMERAL_SOCKET)
socketNum = IPX_MIN_EPHEMERAL_SOCKET; socketNum = IPX_MIN_EPHEMERAL_SOCKET;
while (__ipxitf_find_socket(intrfc, ntohs(socketNum))) while (__ipxitf_find_socket(intrfc, htons(socketNum)))
if (socketNum > IPX_MAX_EPHEMERAL_SOCKET) if (socketNum > IPX_MAX_EPHEMERAL_SOCKET)
socketNum = IPX_MIN_EPHEMERAL_SOCKET; socketNum = IPX_MIN_EPHEMERAL_SOCKET;
else else
@ -1419,7 +1419,7 @@ static unsigned short ipx_first_free_socketnum(struct ipx_interface *intrfc)
spin_unlock_bh(&intrfc->if_sklist_lock); spin_unlock_bh(&intrfc->if_sklist_lock);
intrfc->if_sknum = socketNum; intrfc->if_sknum = socketNum;
return ntohs(socketNum); return htons(socketNum);
} }
static int ipx_bind(struct socket *sock, struct sockaddr *uaddr, int addr_len) static int ipx_bind(struct socket *sock, struct sockaddr *uaddr, int addr_len)
@ -1473,7 +1473,7 @@ static int ipx_bind(struct socket *sock, struct sockaddr *uaddr, int addr_len)
ipxs->port)) { ipxs->port)) {
SOCK_DEBUG(sk, SOCK_DEBUG(sk,
"IPX: bind failed because port %X in use.\n", "IPX: bind failed because port %X in use.\n",
ntohs((int)addr->sipx_port)); ntohs(addr->sipx_port));
goto out_put; goto out_put;
} }
} else { } else {
@ -1488,7 +1488,7 @@ static int ipx_bind(struct socket *sock, struct sockaddr *uaddr, int addr_len)
if (ipxitf_find_socket(intrfc, addr->sipx_port)) { if (ipxitf_find_socket(intrfc, addr->sipx_port)) {
SOCK_DEBUG(sk, SOCK_DEBUG(sk,
"IPX: bind failed because port %X in use.\n", "IPX: bind failed because port %X in use.\n",
ntohs((int)addr->sipx_port)); ntohs(addr->sipx_port));
goto out_put; goto out_put;
} }
} }
@ -1665,7 +1665,7 @@ static int ipx_rcv(struct sk_buff *skb, struct net_device *dev, struct packet_ty
intrfc = ipxitf_find_using_phys(dev, pt->type); intrfc = ipxitf_find_using_phys(dev, pt->type);
if (!intrfc) { if (!intrfc) {
if (ipxcfg_auto_create_interfaces && if (ipxcfg_auto_create_interfaces &&
ntohl(IPX_SKB_CB(skb)->ipx_dest_net)) { IPX_SKB_CB(skb)->ipx_dest_net) {
intrfc = ipxitf_auto_create(dev, pt->type); intrfc = ipxitf_auto_create(dev, pt->type);
if (intrfc) if (intrfc)
ipxitf_hold(intrfc); ipxitf_hold(intrfc);

View File

@ -260,22 +260,22 @@ static int ipx_seq_socket_show(struct seq_file *seq, void *v)
ipxs = ipx_sk(s); ipxs = ipx_sk(s);
#ifdef CONFIG_IPX_INTERN #ifdef CONFIG_IPX_INTERN
seq_printf(seq, "%08lX:%02X%02X%02X%02X%02X%02X:%04X ", seq_printf(seq, "%08lX:%02X%02X%02X%02X%02X%02X:%04X ",
(unsigned long)htonl(ipxs->intrfc->if_netnum), (unsigned long)ntohl(ipxs->intrfc->if_netnum),
ipxs->node[0], ipxs->node[1], ipxs->node[2], ipxs->node[3], ipxs->node[0], ipxs->node[1], ipxs->node[2], ipxs->node[3],
ipxs->node[4], ipxs->node[5], htons(ipxs->port)); ipxs->node[4], ipxs->node[5], ntohs(ipxs->port));
#else #else
seq_printf(seq, "%08lX:%04X ", (unsigned long) htonl(ipxs->intrfc->if_netnum), seq_printf(seq, "%08lX:%04X ", (unsigned long) ntohl(ipxs->intrfc->if_netnum),
htons(ipxs->port)); ntohs(ipxs->port));
#endif /* CONFIG_IPX_INTERN */ #endif /* CONFIG_IPX_INTERN */
if (s->sk_state != TCP_ESTABLISHED) if (s->sk_state != TCP_ESTABLISHED)
seq_printf(seq, "%-28s", "Not_Connected"); seq_printf(seq, "%-28s", "Not_Connected");
else { else {
seq_printf(seq, "%08lX:%02X%02X%02X%02X%02X%02X:%04X ", seq_printf(seq, "%08lX:%02X%02X%02X%02X%02X%02X:%04X ",
(unsigned long)htonl(ipxs->dest_addr.net), (unsigned long)ntohl(ipxs->dest_addr.net),
ipxs->dest_addr.node[0], ipxs->dest_addr.node[1], ipxs->dest_addr.node[0], ipxs->dest_addr.node[1],
ipxs->dest_addr.node[2], ipxs->dest_addr.node[3], ipxs->dest_addr.node[2], ipxs->dest_addr.node[3],
ipxs->dest_addr.node[4], ipxs->dest_addr.node[5], ipxs->dest_addr.node[4], ipxs->dest_addr.node[5],
htons(ipxs->dest_addr.sock)); ntohs(ipxs->dest_addr.sock));
} }
seq_printf(seq, "%08X %08X %02X %03d\n", seq_printf(seq, "%08X %08X %02X %03d\n",

View File

@ -20,16 +20,16 @@ DEFINE_RWLOCK(ipx_routes_lock);
extern struct ipx_interface *ipx_internal_net; extern struct ipx_interface *ipx_internal_net;
extern __u16 ipx_cksum(struct ipxhdr *packet, int length); extern __u16 ipx_cksum(struct ipxhdr *packet, int length);
extern struct ipx_interface *ipxitf_find_using_net(__u32 net); extern struct ipx_interface *ipxitf_find_using_net(__be32 net);
extern int ipxitf_demux_socket(struct ipx_interface *intrfc, extern int ipxitf_demux_socket(struct ipx_interface *intrfc,
struct sk_buff *skb, int copy); struct sk_buff *skb, int copy);
extern int ipxitf_demux_socket(struct ipx_interface *intrfc, extern int ipxitf_demux_socket(struct ipx_interface *intrfc,
struct sk_buff *skb, int copy); struct sk_buff *skb, int copy);
extern int ipxitf_send(struct ipx_interface *intrfc, struct sk_buff *skb, extern int ipxitf_send(struct ipx_interface *intrfc, struct sk_buff *skb,
char *node); char *node);
extern struct ipx_interface *ipxitf_find_using_net(__u32 net); extern struct ipx_interface *ipxitf_find_using_net(__be32 net);
struct ipx_route *ipxrtr_lookup(__u32 net) struct ipx_route *ipxrtr_lookup(__be32 net)
{ {
struct ipx_route *r; struct ipx_route *r;
@ -48,7 +48,7 @@ unlock:
/* /*
* Caller must hold a reference to intrfc * Caller must hold a reference to intrfc
*/ */
int ipxrtr_add_route(__u32 network, struct ipx_interface *intrfc, int ipxrtr_add_route(__be32 network, struct ipx_interface *intrfc,
unsigned char *node) unsigned char *node)
{ {
struct ipx_route *rt; struct ipx_route *rt;
@ -118,7 +118,7 @@ out:
return rc; return rc;
} }
static int ipxrtr_delete(__u32 net) static int ipxrtr_delete(__be32 net)
{ {
struct ipx_route *r, *tmp; struct ipx_route *r, *tmp;
int rc; int rc;