提交 b999748a 编写于 作者: L Li Zefan 提交者: David S. Miller

net: rose: use seq_hlist_foo() helpers

Simplify seq_file code.
Signed-off-by: NLi Zefan <lizf@cn.fujitsu.com>
Signed-off-by: NDavid S. Miller <davem@davemloft.net>
上级 32d2e3a1
...@@ -1404,29 +1404,13 @@ static int rose_ioctl(struct socket *sock, unsigned int cmd, unsigned long arg) ...@@ -1404,29 +1404,13 @@ static int rose_ioctl(struct socket *sock, unsigned int cmd, unsigned long arg)
static void *rose_info_start(struct seq_file *seq, loff_t *pos) static void *rose_info_start(struct seq_file *seq, loff_t *pos)
__acquires(rose_list_lock) __acquires(rose_list_lock)
{ {
int i;
struct sock *s;
struct hlist_node *node;
spin_lock_bh(&rose_list_lock); spin_lock_bh(&rose_list_lock);
if (*pos == 0) return seq_hlist_start_head(&rose_list, *pos);
return SEQ_START_TOKEN;
i = 1;
sk_for_each(s, node, &rose_list) {
if (i == *pos)
return s;
++i;
}
return NULL;
} }
static void *rose_info_next(struct seq_file *seq, void *v, loff_t *pos) static void *rose_info_next(struct seq_file *seq, void *v, loff_t *pos)
{ {
++*pos; return seq_hlist_next(v, &rose_list, pos);
return (v == SEQ_START_TOKEN) ? sk_head(&rose_list)
: sk_next((struct sock *)v);
} }
static void rose_info_stop(struct seq_file *seq, void *v) static void rose_info_stop(struct seq_file *seq, void *v)
...@@ -1444,7 +1428,7 @@ static int rose_info_show(struct seq_file *seq, void *v) ...@@ -1444,7 +1428,7 @@ static int rose_info_show(struct seq_file *seq, void *v)
"dest_addr dest_call src_addr src_call dev lci neigh st vs vr va t t1 t2 t3 hb idle Snd-Q Rcv-Q inode\n"); "dest_addr dest_call src_addr src_call dev lci neigh st vs vr va t t1 t2 t3 hb idle Snd-Q Rcv-Q inode\n");
else { else {
struct sock *s = v; struct sock *s = sk_entry(v);
struct rose_sock *rose = rose_sk(s); struct rose_sock *rose = rose_sk(s);
const char *devname, *callsign; const char *devname, *callsign;
const struct net_device *dev = rose->device; const struct net_device *dev = rose->device;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册