diff options
author | Pavel Emelyanov <xemul@openvz.org> | 2007-11-20 01:38:33 -0500 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2008-01-28 17:54:32 -0500 |
commit | 42a73808ed4f30b739eb52bcbb33a02fe62ceef5 (patch) | |
tree | 3bd75f0afd1277d9340aa416ff79eec0be040392 /include | |
parent | ab70768ec78c6784958bab3b58fbe3f4150006df (diff) |
[RAW]: Consolidate proc interface.
Both ipv6/raw.c and ipv4/raw.c use the seq files to walk
through the raw sockets hash and show them.
The "walking" code is rather huge, but is identical in both
cases. The difference is the hash table to walk over and
the protocol family to check (this was not in the first
virsion of the patch, which was noticed by YOSHIFUJI)
Make the ->open store the needed hash table and the family
on the allocated raw_iter_state and make the start/next/stop
callbacks work with it.
This removes most of the code.
Signed-off-by: Pavel Emelyanov <xemul@openvz.org>
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'include')
-rw-r--r-- | include/net/raw.h | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/include/net/raw.h b/include/net/raw.h index 81a1773b58ba..4d1aba032bf5 100644 --- a/include/net/raw.h +++ b/include/net/raw.h | |||
@@ -37,6 +37,20 @@ struct raw_hashinfo { | |||
37 | #ifdef CONFIG_PROC_FS | 37 | #ifdef CONFIG_PROC_FS |
38 | extern int raw_proc_init(void); | 38 | extern int raw_proc_init(void); |
39 | extern void raw_proc_exit(void); | 39 | extern void raw_proc_exit(void); |
40 | |||
41 | struct raw_iter_state { | ||
42 | int bucket; | ||
43 | unsigned short family; | ||
44 | struct raw_hashinfo *h; | ||
45 | }; | ||
46 | |||
47 | #define raw_seq_private(seq) ((struct raw_iter_state *)(seq)->private) | ||
48 | void *raw_seq_start(struct seq_file *seq, loff_t *pos); | ||
49 | void *raw_seq_next(struct seq_file *seq, void *v, loff_t *pos); | ||
50 | void raw_seq_stop(struct seq_file *seq, void *v); | ||
51 | int raw_seq_open(struct file *file, struct raw_hashinfo *h, | ||
52 | unsigned short family); | ||
53 | |||
40 | #endif | 54 | #endif |
41 | 55 | ||
42 | void raw_hash_sk(struct sock *sk, struct raw_hashinfo *h); | 56 | void raw_hash_sk(struct sock *sk, struct raw_hashinfo *h); |