diff options
author | Xin Long <lucien.xin@gmail.com> | 2016-04-14 03:35:34 -0400 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2016-04-15 17:29:36 -0400 |
commit | b5e2f4e6998a2b999da8fa0290b692f0bd85c8b7 (patch) | |
tree | 08da79646ae423c79c8ebc3ed46e5fa6760084a5 /net/sctp | |
parent | 8f840e47f190cbe61a96945c13e9551048d42cef (diff) |
sctp: merge the seq_start/next/exits in remaddrs and assocs
In sctp proc, these three functions in remaddrs and assocs are the
same. we should merge them into one.
Signed-off-by: Xin Long <lucien.xin@gmail.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'net/sctp')
-rw-r--r-- | net/sctp/proc.c | 45 |
1 files changed, 9 insertions, 36 deletions
diff --git a/net/sctp/proc.c b/net/sctp/proc.c index dd8492f0037d..9fe139368ad7 100644 --- a/net/sctp/proc.c +++ b/net/sctp/proc.c | |||
@@ -282,7 +282,7 @@ struct sctp_ht_iter { | |||
282 | struct rhashtable_iter hti; | 282 | struct rhashtable_iter hti; |
283 | }; | 283 | }; |
284 | 284 | ||
285 | static void *sctp_assocs_seq_start(struct seq_file *seq, loff_t *pos) | 285 | static void *sctp_transport_seq_start(struct seq_file *seq, loff_t *pos) |
286 | { | 286 | { |
287 | struct sctp_ht_iter *iter = seq->private; | 287 | struct sctp_ht_iter *iter = seq->private; |
288 | int err = sctp_transport_walk_start(&iter->hti); | 288 | int err = sctp_transport_walk_start(&iter->hti); |
@@ -293,14 +293,14 @@ static void *sctp_assocs_seq_start(struct seq_file *seq, loff_t *pos) | |||
293 | return sctp_transport_get_idx(seq_file_net(seq), &iter->hti, *pos); | 293 | return sctp_transport_get_idx(seq_file_net(seq), &iter->hti, *pos); |
294 | } | 294 | } |
295 | 295 | ||
296 | static void sctp_assocs_seq_stop(struct seq_file *seq, void *v) | 296 | static void sctp_transport_seq_stop(struct seq_file *seq, void *v) |
297 | { | 297 | { |
298 | struct sctp_ht_iter *iter = seq->private; | 298 | struct sctp_ht_iter *iter = seq->private; |
299 | 299 | ||
300 | sctp_transport_walk_stop(&iter->hti); | 300 | sctp_transport_walk_stop(&iter->hti); |
301 | } | 301 | } |
302 | 302 | ||
303 | static void *sctp_assocs_seq_next(struct seq_file *seq, void *v, loff_t *pos) | 303 | static void *sctp_transport_seq_next(struct seq_file *seq, void *v, loff_t *pos) |
304 | { | 304 | { |
305 | struct sctp_ht_iter *iter = seq->private; | 305 | struct sctp_ht_iter *iter = seq->private; |
306 | 306 | ||
@@ -367,9 +367,9 @@ static int sctp_assocs_seq_show(struct seq_file *seq, void *v) | |||
367 | } | 367 | } |
368 | 368 | ||
369 | static const struct seq_operations sctp_assoc_ops = { | 369 | static const struct seq_operations sctp_assoc_ops = { |
370 | .start = sctp_assocs_seq_start, | 370 | .start = sctp_transport_seq_start, |
371 | .next = sctp_assocs_seq_next, | 371 | .next = sctp_transport_seq_next, |
372 | .stop = sctp_assocs_seq_stop, | 372 | .stop = sctp_transport_seq_stop, |
373 | .show = sctp_assocs_seq_show, | 373 | .show = sctp_assocs_seq_show, |
374 | }; | 374 | }; |
375 | 375 | ||
@@ -406,33 +406,6 @@ void sctp_assocs_proc_exit(struct net *net) | |||
406 | remove_proc_entry("assocs", net->sctp.proc_net_sctp); | 406 | remove_proc_entry("assocs", net->sctp.proc_net_sctp); |
407 | } | 407 | } |
408 | 408 | ||
409 | static void *sctp_remaddr_seq_start(struct seq_file *seq, loff_t *pos) | ||
410 | { | ||
411 | struct sctp_ht_iter *iter = seq->private; | ||
412 | int err = sctp_transport_walk_start(&iter->hti); | ||
413 | |||
414 | if (err) | ||
415 | return ERR_PTR(err); | ||
416 | |||
417 | return sctp_transport_get_idx(seq_file_net(seq), &iter->hti, *pos); | ||
418 | } | ||
419 | |||
420 | static void *sctp_remaddr_seq_next(struct seq_file *seq, void *v, loff_t *pos) | ||
421 | { | ||
422 | struct sctp_ht_iter *iter = seq->private; | ||
423 | |||
424 | ++*pos; | ||
425 | |||
426 | return sctp_transport_get_next(seq_file_net(seq), &iter->hti); | ||
427 | } | ||
428 | |||
429 | static void sctp_remaddr_seq_stop(struct seq_file *seq, void *v) | ||
430 | { | ||
431 | struct sctp_ht_iter *iter = seq->private; | ||
432 | |||
433 | sctp_transport_walk_stop(&iter->hti); | ||
434 | } | ||
435 | |||
436 | static int sctp_remaddr_seq_show(struct seq_file *seq, void *v) | 409 | static int sctp_remaddr_seq_show(struct seq_file *seq, void *v) |
437 | { | 410 | { |
438 | struct sctp_association *assoc; | 411 | struct sctp_association *assoc; |
@@ -506,9 +479,9 @@ static int sctp_remaddr_seq_show(struct seq_file *seq, void *v) | |||
506 | } | 479 | } |
507 | 480 | ||
508 | static const struct seq_operations sctp_remaddr_ops = { | 481 | static const struct seq_operations sctp_remaddr_ops = { |
509 | .start = sctp_remaddr_seq_start, | 482 | .start = sctp_transport_seq_start, |
510 | .next = sctp_remaddr_seq_next, | 483 | .next = sctp_transport_seq_next, |
511 | .stop = sctp_remaddr_seq_stop, | 484 | .stop = sctp_transport_seq_stop, |
512 | .show = sctp_remaddr_seq_show, | 485 | .show = sctp_remaddr_seq_show, |
513 | }; | 486 | }; |
514 | 487 | ||