mirror of
https://github.com/torvalds/linux.git
synced 2024-11-23 04:31:50 +00:00
[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:
parent
10b1fbdb0a
commit
4833ed0940
@ -7,8 +7,8 @@
|
||||
|
||||
struct sockaddr_ipx {
|
||||
sa_family_t sipx_family;
|
||||
__u16 sipx_port;
|
||||
__u32 sipx_network;
|
||||
__be16 sipx_port;
|
||||
__be32 sipx_network;
|
||||
unsigned char sipx_node[IPX_NODE_LEN];
|
||||
__u8 sipx_type;
|
||||
unsigned char sipx_zero; /* 16 byte fill */
|
||||
@ -23,13 +23,13 @@ struct sockaddr_ipx {
|
||||
#define IPX_CRTITF 1
|
||||
|
||||
struct ipx_route_definition {
|
||||
__u32 ipx_network;
|
||||
__u32 ipx_router_network;
|
||||
__be32 ipx_network;
|
||||
__be32 ipx_router_network;
|
||||
unsigned char ipx_router_node[IPX_NODE_LEN];
|
||||
};
|
||||
|
||||
struct ipx_interface_definition {
|
||||
__u32 ipx_network;
|
||||
__be32 ipx_network;
|
||||
unsigned char ipx_device[16];
|
||||
unsigned char ipx_dlink_type;
|
||||
#define IPX_FRAME_NONE 0
|
||||
@ -55,8 +55,8 @@ struct ipx_config_data {
|
||||
*/
|
||||
|
||||
struct ipx_route_def {
|
||||
__u32 ipx_network;
|
||||
__u32 ipx_router_network;
|
||||
__be32 ipx_network;
|
||||
__be32 ipx_router_network;
|
||||
#define IPX_ROUTE_NO_ROUTER 0
|
||||
unsigned char ipx_router_node[IPX_NODE_LEN];
|
||||
unsigned char ipx_device[16];
|
||||
|
@ -15,9 +15,9 @@
|
||||
#include <linux/list.h>
|
||||
|
||||
struct ipx_address {
|
||||
__u32 net;
|
||||
__be32 net;
|
||||
__u8 node[IPX_NODE_LEN];
|
||||
__u16 sock;
|
||||
__be16 sock;
|
||||
};
|
||||
|
||||
#define ipx_broadcast_node "\377\377\377\377\377\377"
|
||||
@ -28,7 +28,7 @@ struct ipx_address {
|
||||
struct ipxhdr {
|
||||
__u16 ipx_checksum __attribute__ ((packed));
|
||||
#define IPX_NO_CHECKSUM 0xFFFF
|
||||
__u16 ipx_pktsize __attribute__ ((packed));
|
||||
__be16 ipx_pktsize __attribute__ ((packed));
|
||||
__u8 ipx_tctrl;
|
||||
__u8 ipx_type;
|
||||
#define IPX_TYPE_UNKNOWN 0x00
|
||||
@ -48,14 +48,14 @@ static __inline__ struct ipxhdr *ipx_hdr(struct sk_buff *skb)
|
||||
|
||||
struct ipx_interface {
|
||||
/* IPX address */
|
||||
__u32 if_netnum;
|
||||
__be32 if_netnum;
|
||||
unsigned char if_node[IPX_NODE_LEN];
|
||||
atomic_t refcnt;
|
||||
|
||||
/* physical device info */
|
||||
struct net_device *if_dev;
|
||||
struct datalink_proto *if_dlink;
|
||||
unsigned short if_dlink_type;
|
||||
__be16 if_dlink_type;
|
||||
|
||||
/* socket support */
|
||||
unsigned short if_sknum;
|
||||
@ -71,7 +71,7 @@ struct ipx_interface {
|
||||
};
|
||||
|
||||
struct ipx_route {
|
||||
__u32 ir_net;
|
||||
__be32 ir_net;
|
||||
struct ipx_interface *ir_intrfc;
|
||||
unsigned char ir_routed;
|
||||
unsigned char ir_router_node[IPX_NODE_LEN];
|
||||
@ -82,10 +82,10 @@ struct ipx_route {
|
||||
#ifdef __KERNEL__
|
||||
struct ipx_cb {
|
||||
u8 ipx_tctrl;
|
||||
u32 ipx_dest_net;
|
||||
u32 ipx_source_net;
|
||||
__be32 ipx_dest_net;
|
||||
__be32 ipx_source_net;
|
||||
struct {
|
||||
u32 netnum;
|
||||
__be32 netnum;
|
||||
int index;
|
||||
} last_hop;
|
||||
};
|
||||
@ -97,7 +97,7 @@ struct ipx_sock {
|
||||
struct sock sk;
|
||||
struct ipx_address dest_addr;
|
||||
struct ipx_interface *intrfc;
|
||||
unsigned short port;
|
||||
__be16 port;
|
||||
#ifdef CONFIG_IPX_INTERN
|
||||
unsigned char node[IPX_NODE_LEN];
|
||||
#endif
|
||||
@ -132,7 +132,7 @@ extern struct ipx_interface *ipx_primary_net;
|
||||
extern int ipx_proc_init(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);
|
||||
|
||||
static __inline__ void ipxitf_hold(struct ipx_interface *intrfc)
|
||||
|
@ -83,13 +83,13 @@ DEFINE_SPINLOCK(ipx_interfaces_lock);
|
||||
struct ipx_interface *ipx_primary_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);
|
||||
extern void ipxrtr_del_routes(struct ipx_interface *intrfc);
|
||||
extern int ipxrtr_route_packet(struct sock *sk, struct sockaddr_ipx *usipx,
|
||||
struct iovec *iov, int len, int noblock);
|
||||
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);
|
||||
|
||||
#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,
|
||||
unsigned short datalink)
|
||||
__be16 datalink)
|
||||
{
|
||||
struct ipx_interface *i;
|
||||
|
||||
@ -190,7 +190,7 @@ out:
|
||||
}
|
||||
|
||||
static struct ipx_interface *ipxitf_find_using_phys(struct net_device *dev,
|
||||
unsigned short datalink)
|
||||
__be16 datalink)
|
||||
{
|
||||
struct ipx_interface *i;
|
||||
|
||||
@ -202,7 +202,7 @@ static struct ipx_interface *ipxitf_find_using_phys(struct net_device *dev,
|
||||
return i;
|
||||
}
|
||||
|
||||
struct ipx_interface *ipxitf_find_using_net(__u32 net)
|
||||
struct ipx_interface *ipxitf_find_using_net(__be32 net)
|
||||
{
|
||||
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 */
|
||||
static struct sock *__ipxitf_find_socket(struct ipx_interface *intrfc,
|
||||
unsigned short port)
|
||||
__be16 port)
|
||||
{
|
||||
struct sock *s;
|
||||
struct hlist_node *node;
|
||||
@ -252,7 +252,7 @@ found:
|
||||
|
||||
/* caller must hold a reference to intrfc */
|
||||
static struct sock *ipxitf_find_socket(struct ipx_interface *intrfc,
|
||||
unsigned short port)
|
||||
__be16 port)
|
||||
{
|
||||
struct sock *s;
|
||||
|
||||
@ -268,7 +268,7 @@ static struct sock *ipxitf_find_socket(struct ipx_interface *intrfc,
|
||||
#ifdef CONFIG_IPX_INTERN
|
||||
static struct sock *ipxitf_find_internal_socket(struct ipx_interface *intrfc,
|
||||
unsigned char *ipx_node,
|
||||
unsigned short port)
|
||||
__be16 port)
|
||||
{
|
||||
struct sock *s;
|
||||
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 */
|
||||
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) +
|
||||
IPX_SKB_CB(skb)->last_hop.index *
|
||||
sizeof(u32));
|
||||
sizeof(__be32));
|
||||
*last_hop = IPX_SKB_CB(skb)->last_hop.netnum;
|
||||
IPX_SKB_CB(skb)->last_hop.index = -1;
|
||||
}
|
||||
@ -772,7 +772,7 @@ static void ipxitf_discover_netnum(struct ipx_interface *intrfc,
|
||||
} else {
|
||||
printk(KERN_WARNING "IPX: Network number collision "
|
||||
"%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_frame_name(i->if_dlink_type),
|
||||
ipx_device_name(intrfc),
|
||||
@ -812,7 +812,7 @@ static int ipxitf_pprop(struct ipx_interface *intrfc, struct sk_buff *skb)
|
||||
int i, rc = -EINVAL;
|
||||
struct ipx_interface *ifcs;
|
||||
char *c;
|
||||
u32 *l;
|
||||
__be32 *l;
|
||||
|
||||
/* Illegal packet - too many hops or too short */
|
||||
/* 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;
|
||||
|
||||
c = ((u8 *) ipx) + sizeof(struct ipxhdr);
|
||||
l = (u32 *) c;
|
||||
l = (__be32 *) c;
|
||||
|
||||
/* Don't broadcast packet if already seen this net */
|
||||
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 */
|
||||
if (ifcs == intrfc)
|
||||
continue;
|
||||
l = (__u32 *) c;
|
||||
l = (__be32 *) c;
|
||||
/* don't consider the last entry in the packet list,
|
||||
* it is our netnum, and it is not there yet */
|
||||
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;
|
||||
}
|
||||
|
||||
static struct ipx_interface *ipxitf_alloc(struct net_device *dev, __u32 netnum,
|
||||
unsigned short dlink_type,
|
||||
static struct ipx_interface *ipxitf_alloc(struct net_device *dev, __be32 netnum,
|
||||
__be16 dlink_type,
|
||||
struct datalink_proto *dlink,
|
||||
unsigned char internal,
|
||||
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)
|
||||
{
|
||||
struct net_device *dev;
|
||||
unsigned short dlink_type = 0;
|
||||
__be16 dlink_type = 0;
|
||||
struct datalink_proto *datalink = NULL;
|
||||
struct ipx_interface *intrfc;
|
||||
int rc;
|
||||
@ -1073,7 +1073,7 @@ out:
|
||||
static int ipxitf_delete(struct ipx_interface_definition *idef)
|
||||
{
|
||||
struct net_device *dev = NULL;
|
||||
unsigned short dlink_type = 0;
|
||||
__be16 dlink_type = 0;
|
||||
struct ipx_interface *intrfc;
|
||||
int rc = 0;
|
||||
|
||||
@ -1110,7 +1110,7 @@ out:
|
||||
}
|
||||
|
||||
static struct ipx_interface *ipxitf_auto_create(struct net_device *dev,
|
||||
unsigned short dlink_type)
|
||||
__be16 dlink_type)
|
||||
{
|
||||
struct ipx_interface *intrfc = NULL;
|
||||
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)
|
||||
goto out;
|
||||
|
||||
switch (htons(dlink_type)) {
|
||||
switch (ntohs(dlink_type)) {
|
||||
case ETH_P_IPX: datalink = pEII_datalink; break;
|
||||
case ETH_P_802_2: datalink = p8022_datalink; break;
|
||||
case ETH_P_SNAP: datalink = pSNAP_datalink; break;
|
||||
@ -1266,7 +1266,7 @@ __u16 ipx_cksum(struct ipxhdr *packet, int length)
|
||||
return ~sum;
|
||||
}
|
||||
|
||||
const char *ipx_frame_name(unsigned short frame)
|
||||
const char *ipx_frame_name(__be16 frame)
|
||||
{
|
||||
char* rc = "None";
|
||||
|
||||
@ -1401,7 +1401,7 @@ out:
|
||||
|
||||
/* 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;
|
||||
|
||||
@ -1410,7 +1410,7 @@ static unsigned short ipx_first_free_socketnum(struct ipx_interface *intrfc)
|
||||
if (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)
|
||||
socketNum = IPX_MIN_EPHEMERAL_SOCKET;
|
||||
else
|
||||
@ -1419,7 +1419,7 @@ static unsigned short ipx_first_free_socketnum(struct ipx_interface *intrfc)
|
||||
spin_unlock_bh(&intrfc->if_sklist_lock);
|
||||
intrfc->if_sknum = socketNum;
|
||||
|
||||
return ntohs(socketNum);
|
||||
return htons(socketNum);
|
||||
}
|
||||
|
||||
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)) {
|
||||
SOCK_DEBUG(sk,
|
||||
"IPX: bind failed because port %X in use.\n",
|
||||
ntohs((int)addr->sipx_port));
|
||||
ntohs(addr->sipx_port));
|
||||
goto out_put;
|
||||
}
|
||||
} 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)) {
|
||||
SOCK_DEBUG(sk,
|
||||
"IPX: bind failed because port %X in use.\n",
|
||||
ntohs((int)addr->sipx_port));
|
||||
ntohs(addr->sipx_port));
|
||||
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);
|
||||
if (!intrfc) {
|
||||
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);
|
||||
if (intrfc)
|
||||
ipxitf_hold(intrfc);
|
||||
|
@ -260,22 +260,22 @@ static int ipx_seq_socket_show(struct seq_file *seq, void *v)
|
||||
ipxs = ipx_sk(s);
|
||||
#ifdef CONFIG_IPX_INTERN
|
||||
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[4], ipxs->node[5], htons(ipxs->port));
|
||||
ipxs->node[4], ipxs->node[5], ntohs(ipxs->port));
|
||||
#else
|
||||
seq_printf(seq, "%08lX:%04X ", (unsigned long) htonl(ipxs->intrfc->if_netnum),
|
||||
htons(ipxs->port));
|
||||
seq_printf(seq, "%08lX:%04X ", (unsigned long) ntohl(ipxs->intrfc->if_netnum),
|
||||
ntohs(ipxs->port));
|
||||
#endif /* CONFIG_IPX_INTERN */
|
||||
if (s->sk_state != TCP_ESTABLISHED)
|
||||
seq_printf(seq, "%-28s", "Not_Connected");
|
||||
else {
|
||||
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[2], ipxs->dest_addr.node[3],
|
||||
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",
|
||||
|
@ -20,16 +20,16 @@ DEFINE_RWLOCK(ipx_routes_lock);
|
||||
extern struct ipx_interface *ipx_internal_net;
|
||||
|
||||
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,
|
||||
struct sk_buff *skb, int copy);
|
||||
extern int ipxitf_demux_socket(struct ipx_interface *intrfc,
|
||||
struct sk_buff *skb, int copy);
|
||||
extern int ipxitf_send(struct ipx_interface *intrfc, struct sk_buff *skb,
|
||||
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;
|
||||
|
||||
@ -48,7 +48,7 @@ unlock:
|
||||
/*
|
||||
* 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)
|
||||
{
|
||||
struct ipx_route *rt;
|
||||
@ -118,7 +118,7 @@ out:
|
||||
return rc;
|
||||
}
|
||||
|
||||
static int ipxrtr_delete(__u32 net)
|
||||
static int ipxrtr_delete(__be32 net)
|
||||
{
|
||||
struct ipx_route *r, *tmp;
|
||||
int rc;
|
||||
|
Loading…
Reference in New Issue
Block a user