summaryrefslogtreecommitdiff
path: root/include
diff options
context:
space:
mode:
authorDavid S. Miller <davem@nuts.ninka.net>2003-05-05 10:28:27 -0700
committerDavid S. Miller <davem@nuts.ninka.net>2003-05-05 10:28:27 -0700
commit18c01243652f743d3d59c210fea6e0732d62990d (patch)
treed02fd8888250529cc4eb9a02d74807a1c5a67af1 /include
parent7f1648a622916edb3ca08fe67696757f0ee70171 (diff)
parent975dc0dc390802114b5cd7b80c9c2f901c9fb2bb (diff)
Merge bk://kernel.bkbits.net/acme/ipx-2.5
into nuts.ninka.net:/home/davem/src/BK/net-2.5
Diffstat (limited to 'include')
-rw-r--r--include/linux/ipx.h27
-rw-r--r--include/linux/list.h13
-rw-r--r--include/net/ipx.h68
3 files changed, 61 insertions, 47 deletions
diff --git a/include/linux/ipx.h b/include/linux/ipx.h
index a6fa09060107..4f29c60964c4 100644
--- a/include/linux/ipx.h
+++ b/include/linux/ipx.h
@@ -5,8 +5,7 @@
#define IPX_NODE_LEN 6
#define IPX_MTU 576
-struct sockaddr_ipx
-{
+struct sockaddr_ipx {
sa_family_t sipx_family;
__u16 sipx_port;
__u32 sipx_network;
@@ -16,9 +15,8 @@ struct sockaddr_ipx
};
/*
- * So we can fit the extra info for SIOCSIFADDR into the address nicely
+ * So we can fit the extra info for SIOCSIFADDR into the address nicely
*/
-
#define sipx_special sipx_port
#define sipx_action sipx_zero
#define IPX_DLTITF 0
@@ -56,14 +54,13 @@ struct ipx_config_data {
* OLD Route Definition for backward compatibility.
*/
-struct ipx_route_def
-{
- __u32 ipx_network;
- __u32 ipx_router_network;
+struct ipx_route_def {
+ __u32 ipx_network;
+ __u32 ipx_router_network;
#define IPX_ROUTE_NO_ROUTER 0
- unsigned char ipx_router_node[IPX_NODE_LEN];
- unsigned char ipx_device[16];
- unsigned short ipx_flags;
+ unsigned char ipx_router_node[IPX_NODE_LEN];
+ unsigned char ipx_device[16];
+ unsigned short ipx_flags;
#define IPX_RT_SNAP 8
#define IPX_RT_8022 4
#define IPX_RT_BLUEBOOK 2
@@ -71,7 +68,7 @@ struct ipx_route_def
};
#define SIOCAIPXITFCRT (SIOCPROTOPRIVATE)
-#define SIOCAIPXPRISLT (SIOCPROTOPRIVATE+1)
-#define SIOCIPXCFGDATA (SIOCPROTOPRIVATE+2)
-#define SIOCIPXNCPCONN (SIOCPROTOPRIVATE+3)
-#endif /* def _IPX_H_ */
+#define SIOCAIPXPRISLT (SIOCPROTOPRIVATE + 1)
+#define SIOCIPXCFGDATA (SIOCPROTOPRIVATE + 2)
+#define SIOCIPXNCPCONN (SIOCPROTOPRIVATE + 3)
+#endif /* _IPX_H_ */
diff --git a/include/linux/list.h b/include/linux/list.h
index 11b8674c14ff..a6dea8afd99d 100644
--- a/include/linux/list.h
+++ b/include/linux/list.h
@@ -297,6 +297,19 @@ static inline void list_splice_init(struct list_head *list,
prefetch(pos->member.next))
/**
+ * list_for_each_entry_safe - iterate over list of given type safe against removal of list entry
+ * @pos: the type * to use as a loop counter.
+ * @n: another type * to use as temporary storage
+ * @head: the head for your list.
+ * @member: the name of the list_struct within the struct.
+ */
+#define list_for_each_entry_safe(pos, n, head, member) \
+ for (pos = list_entry((head)->next, typeof(*pos), member), \
+ n = list_entry(pos->member.next, typeof(*pos), member); \
+ &pos->member != (head); \
+ pos = n, n = list_entry(n->member.next, typeof(*n), member))
+
+/**
* list_for_each_rcu - iterate over an rcu-protected list
* @pos: the &struct list_head to use as a loop counter.
* @head: the head for your list.
diff --git a/include/net/ipx.h b/include/net/ipx.h
index c3b1e4698438..864359402b31 100644
--- a/include/net/ipx.h
+++ b/include/net/ipx.h
@@ -12,6 +12,7 @@
#include <linux/netdevice.h>
#include <net/datalink.h>
#include <linux/ipx.h>
+#include <linux/list.h>
struct ipx_address {
__u32 net;
@@ -25,11 +26,11 @@ struct ipx_address {
#define IPX_MAX_PPROP_HOPS 8
struct ipxhdr {
- __u16 ipx_checksum __attribute__ ((packed));
+ __u16 ipx_checksum __attribute__ ((packed));
#define IPX_NO_CHECKSUM 0xFFFF
- __u16 ipx_pktsize __attribute__ ((packed));
- __u8 ipx_tctrl;
- __u8 ipx_type;
+ __u16 ipx_pktsize __attribute__ ((packed));
+ __u8 ipx_tctrl;
+ __u8 ipx_type;
#define IPX_TYPE_UNKNOWN 0x00
#define IPX_TYPE_RIP 0x01 /* may also be 0 */
#define IPX_TYPE_SAP 0x04 /* may also be 0 */
@@ -47,42 +48,42 @@ static __inline__ struct ipxhdr *ipx_hdr(struct sk_buff *skb)
struct ipx_interface {
/* IPX address */
- __u32 if_netnum;
- unsigned char if_node[IPX_NODE_LEN];
- atomic_t refcnt;
+ __u32 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;
+ unsigned short if_dlink_type;
/* socket support */
- unsigned short if_sknum;
- struct sock *if_sklist;
- spinlock_t if_sklist_lock;
+ unsigned short if_sknum;
+ struct sock *if_sklist;
+ spinlock_t if_sklist_lock;
/* administrative overhead */
- int if_ipx_offset;
- unsigned char if_internal;
- unsigned char if_primary;
+ int if_ipx_offset;
+ unsigned char if_internal;
+ unsigned char if_primary;
- struct ipx_interface *if_next;
+ struct list_head node; /* node in ipx_interfaces list */
};
struct ipx_route {
- __u32 ir_net;
+ __u32 ir_net;
struct ipx_interface *ir_intrfc;
- unsigned char ir_routed;
- unsigned char ir_router_node[IPX_NODE_LEN];
- struct ipx_route *ir_next;
- atomic_t refcnt;
+ unsigned char ir_routed;
+ unsigned char ir_router_node[IPX_NODE_LEN];
+ struct list_head node; /* node in ipx_routes list */
+ atomic_t refcnt;
};
#ifdef __KERNEL__
struct ipx_cb {
- u8 ipx_tctrl;
- u32 ipx_dest_net;
- u32 ipx_source_net;
+ u8 ipx_tctrl;
+ u32 ipx_dest_net;
+ u32 ipx_source_net;
struct {
u32 netnum;
int index;
@@ -92,14 +93,16 @@ struct ipx_cb {
struct ipx_opt {
struct ipx_address dest_addr;
struct ipx_interface *intrfc;
- unsigned short port;
+ unsigned short port;
#ifdef CONFIG_IPX_INTERN
- unsigned char node[IPX_NODE_LEN];
+ unsigned char node[IPX_NODE_LEN];
#endif
- unsigned short type;
- /* To handle special ncp connection-handling sockets for mars_nwe,
- * the connection number must be stored in the socket. */
- unsigned short ipx_ncp_conn;
+ unsigned short type;
+ /*
+ * To handle special ncp connection-handling sockets for mars_nwe,
+ * the connection number must be stored in the socket.
+ */
+ unsigned short ipx_ncp_conn;
};
#define ipx_sk(__sk) ((struct ipx_opt *)(__sk)->protinfo)
@@ -108,10 +111,11 @@ struct ipx_opt {
#define IPX_MIN_EPHEMERAL_SOCKET 0x4000
#define IPX_MAX_EPHEMERAL_SOCKET 0x7fff
-extern struct ipx_route *ipx_routes;
+extern struct list_head ipx_routes;
extern rwlock_t ipx_routes_lock;
-extern struct ipx_interface *ipx_interfaces;
+extern struct list_head ipx_interfaces;
+extern struct ipx_interface *ipx_interfaces_head(void);
extern spinlock_t ipx_interfaces_lock;
extern struct ipx_interface *ipx_primary_net;
@@ -121,4 +125,4 @@ extern void ipx_proc_exit(void);
extern const char *ipx_frame_name(unsigned short);
extern const char *ipx_device_name(struct ipx_interface *intrfc);
-#endif /* def _NET_INET_IPX_H_ */
+#endif /* _NET_INET_IPX_H_ */