Skip to content

Commit b5e2f4e

Browse files
lxindavem330
authored andcommitted
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 <[email protected]> Signed-off-by: David S. Miller <[email protected]>
1 parent 8f840e4 commit b5e2f4e

File tree

1 file changed

+9
-36
lines changed

1 file changed

+9
-36
lines changed

net/sctp/proc.c

Lines changed: 9 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -282,7 +282,7 @@ struct sctp_ht_iter {
282282
struct rhashtable_iter hti;
283283
};
284284

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)
286286
{
287287
struct sctp_ht_iter *iter = seq->private;
288288
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)
293293
return sctp_transport_get_idx(seq_file_net(seq), &iter->hti, *pos);
294294
}
295295

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)
297297
{
298298
struct sctp_ht_iter *iter = seq->private;
299299

300300
sctp_transport_walk_stop(&iter->hti);
301301
}
302302

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)
304304
{
305305
struct sctp_ht_iter *iter = seq->private;
306306

@@ -367,9 +367,9 @@ static int sctp_assocs_seq_show(struct seq_file *seq, void *v)
367367
}
368368

369369
static const struct seq_operations sctp_assoc_ops = {
370-
.start = sctp_assocs_seq_start,
371-
.next = sctp_assocs_seq_next,
372-
.stop = sctp_assocs_seq_stop,
370+
.start = sctp_transport_seq_start,
371+
.next = sctp_transport_seq_next,
372+
.stop = sctp_transport_seq_stop,
373373
.show = sctp_assocs_seq_show,
374374
};
375375

@@ -406,33 +406,6 @@ void sctp_assocs_proc_exit(struct net *net)
406406
remove_proc_entry("assocs", net->sctp.proc_net_sctp);
407407
}
408408

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-
436409
static int sctp_remaddr_seq_show(struct seq_file *seq, void *v)
437410
{
438411
struct sctp_association *assoc;
@@ -506,9 +479,9 @@ static int sctp_remaddr_seq_show(struct seq_file *seq, void *v)
506479
}
507480

508481
static const struct seq_operations sctp_remaddr_ops = {
509-
.start = sctp_remaddr_seq_start,
510-
.next = sctp_remaddr_seq_next,
511-
.stop = sctp_remaddr_seq_stop,
482+
.start = sctp_transport_seq_start,
483+
.next = sctp_transport_seq_next,
484+
.stop = sctp_transport_seq_stop,
512485
.show = sctp_remaddr_seq_show,
513486
};
514487

0 commit comments

Comments
 (0)