Commit b7ceabd9 authored by Li Zefan's avatar Li Zefan Committed by David S. Miller
Browse files

net: packet: use seq_hlist_foo() helpers

Simplify seq_file code.
Signed-off-by: default avatarLi Zefan <>
Signed-off-by: default avatarDavid S. Miller <>
parent b999748a
......@@ -2510,33 +2510,19 @@ static struct notifier_block packet_netdev_notifier = {
static inline struct sock *packet_seq_idx(struct net *net, loff_t off)
struct sock *s;
struct hlist_node *node;
sk_for_each(s, node, &net->packet.sklist) {
if (!off--)
return s;
return NULL;
static void *packet_seq_start(struct seq_file *seq, loff_t *pos)
struct net *net = seq_file_net(seq);
return *pos ? packet_seq_idx(net, *pos - 1) : SEQ_START_TOKEN;
return seq_hlist_start_head(&net->packet.sklist, *pos);
static void *packet_seq_next(struct seq_file *seq, void *v, loff_t *pos)
struct net *net = seq_file_net(seq);
return (v == SEQ_START_TOKEN)
? sk_head(&net->packet.sklist)
: sk_next((struct sock *)v) ;
return seq_hlist_next(v, &net->packet.sklist, pos);
static void packet_seq_stop(struct seq_file *seq, void *v)
......@@ -2551,7 +2537,7 @@ static int packet_seq_show(struct seq_file *seq, void *v)
seq_puts(seq, "sk RefCnt Type Proto Iface R Rmem User Inode\n");
else {
struct sock *s = v;
struct sock *s = sk_entry(v);
const struct packet_sock *po = pkt_sk(s);
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment