2504static struct ip6_sf_list *igmp6_mcf_get_next(struct seq_file *seq, struct ip6_sf_list *psf)
2505{
2506 struct igmp6_mcf_iter_state *state = igmp6_mcf_seq_private(seq);
2507
2508 psf = psf->sf_next;
2509 while (!psf) {
2510 spin_unlock_bh(&state->im->mca_lock);
2511 state->im = state->im->next;
2512 while (!state->im) {
2513 if (likely(state->idev != NULL)) {
2514 read_unlock_bh(&state->idev->lock);
2515 in6_dev_put(state->idev);
2516 }
2517 state->dev = next_net_device(state->dev);
2518 if (!state->dev) {
2519 state->idev = NULL;
2520 goto out;
2521 }
2522 state->idev = in6_dev_get(state->dev);
2523 if (!state->idev)
2524 continue;
2525 read_lock_bh(&state->idev->lock);
2526 state->im = state->idev->mc_list;
2527 }
2528 if (!state->im)
2529 break;
2530 spin_lock_bh(&state->im->mca_lock);
2531 psf = state->im->mca_sources;
2532 }
2533out:
2534 return psf;
2535}
2536
2537static struct ip6_sf_list *igmp6_mcf_get_idx(struct seq_file *seq, loff_t pos)
2538{
2539 struct ip6_sf_list *psf = igmp6_mcf_get_first(seq);
2540 if (psf)
2541 while (pos && (psf = igmp6_mcf_get_next(seq, psf)) != NULL)
2542 --pos;
2543 return pos ? NULL : psf;
2544}