Skip to contentSkip to conversation

Introduce raw_hashinfo structure

PATCH Applied Pavel Emelyanov 2 participants 2 messages Nov 16, 2007 – Nov 20, 2007

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 3/6 Introduce raw_hashinfo structure

The ipv4/raw.c and ipv6/raw.c contain many common code (most of which is proc interface) which can be consolidated.

Most of the places to consolidate deal with the raw sockets hashtable, so introduce a struct raw_hashinfo which describes the raw sockets hash.

---

include/net/raw.h +7 -0
index 7fc3c77..70b27c7 100644
@@ -27,6 +27,13 @@ int raw_local_deliver(struct sk_buff *, int);
 
 extern int 	raw_rcv(struct sock *, struct sk_buff *);
 
+#define RAW_HTABLE_SIZE	MAX_INET_PROTOS
+
+struct raw_hashinfo {
+	rwlock_t lock;
+	struct hlist_head ht[RAW_HTABLE_SIZE];
+};
+
 #ifdef CONFIG_PROC_FS
 extern int  raw_proc_init(void);
 extern void raw_proc_exit(void);
net/ipv4/raw.c +25 -25

125 lines not on this page · raw message

net/ipv6/raw.c +25 -24

128 lines not on this page · raw message

maintainer Applied
#1 lore raw

From: Pavel Emelyanov <[email protected]>
Date: Fri, 16 Nov 2007 17:12:31 +0300

Quoted 8 lines

The ipv4/raw.c and ipv6/raw.c contain many common code (most of which is proc interface) which can be consolidated.

Most of the places to consolidate deal with the raw sockets hashtable, so introduce a struct raw_hashinfo which describes the raw sockets hash.

Applied.