Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 89798
b: refs/heads/master
c: 642d631
h: refs/heads/master
v: v3
  • Loading branch information
Denis V. Lunev authored and David S. Miller committed Feb 29, 2008
1 parent 6cd8e70 commit 3c0d475
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 6 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: 317805b8f875ca1bd43d594c0a210e24fab7d177
refs/heads/master: 642d6318119af60ac019524bd4edcfbd19d9d211
18 changes: 13 additions & 5 deletions trunk/net/ipv4/route.c
Original file line number Diff line number Diff line change
Expand Up @@ -294,7 +294,8 @@ static struct rtable *rt_cache_get_first(struct rt_cache_iter_state *st)
return r;
}

static struct rtable *rt_cache_get_next(struct rt_cache_iter_state *st, struct rtable *r)
static struct rtable *__rt_cache_get_next(struct rt_cache_iter_state *st,
struct rtable *r)
{
r = r->u.dst.rt_next;
while (!r) {
Expand All @@ -307,16 +308,23 @@ static struct rtable *rt_cache_get_next(struct rt_cache_iter_state *st, struct r
return rcu_dereference(r);
}

static struct rtable *rt_cache_get_next(struct rt_cache_iter_state *st,
struct rtable *r)
{
while ((r = __rt_cache_get_next(st, r)) != NULL) {
if (r->rt_genid == st->genid)
break;
}
return r;
}

static struct rtable *rt_cache_get_idx(struct rt_cache_iter_state *st, loff_t pos)
{
struct rtable *r = rt_cache_get_first(st);

if (r)
while (pos && (r = rt_cache_get_next(st, r))) {
if (r->rt_genid != st->genid)
continue;
while (pos && (r = rt_cache_get_next(st, r)))
--pos;
}
return pos ? NULL : r;
}

Expand Down

0 comments on commit 3c0d475

Please sign in to comment.