[NETFILTER]: nfnetlink_log: iterator functions need iter_state * only
get_*() don't need access to seq_file - iter_state is enough for them. Signed-off-by: Michal Miroslaw <mirq-linux@rere.qmqm.pl> Signed-off-by: Patrick McHardy <kaber@trash.net> Signed-off-by: David S. Miller <davem@davemloft.net>
This commit is contained in:
parent
9a36e8c2b3
commit
f76cdcee5b
@ -919,10 +919,8 @@ struct iter_state {
|
|||||||
unsigned int bucket;
|
unsigned int bucket;
|
||||||
};
|
};
|
||||||
|
|
||||||
static struct hlist_node *get_first(struct seq_file *seq)
|
static struct hlist_node *get_first(struct iter_state *st)
|
||||||
{
|
{
|
||||||
struct iter_state *st = seq->private;
|
|
||||||
|
|
||||||
if (!st)
|
if (!st)
|
||||||
return NULL;
|
return NULL;
|
||||||
|
|
||||||
@ -933,10 +931,8 @@ static struct hlist_node *get_first(struct seq_file *seq)
|
|||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
static struct hlist_node *get_next(struct seq_file *seq, struct hlist_node *h)
|
static struct hlist_node *get_next(struct iter_state *st, struct hlist_node *h)
|
||||||
{
|
{
|
||||||
struct iter_state *st = seq->private;
|
|
||||||
|
|
||||||
h = h->next;
|
h = h->next;
|
||||||
while (!h) {
|
while (!h) {
|
||||||
if (++st->bucket >= INSTANCE_BUCKETS)
|
if (++st->bucket >= INSTANCE_BUCKETS)
|
||||||
@ -947,13 +943,13 @@ static struct hlist_node *get_next(struct seq_file *seq, struct hlist_node *h)
|
|||||||
return h;
|
return h;
|
||||||
}
|
}
|
||||||
|
|
||||||
static struct hlist_node *get_idx(struct seq_file *seq, loff_t pos)
|
static struct hlist_node *get_idx(struct iter_state *st, loff_t pos)
|
||||||
{
|
{
|
||||||
struct hlist_node *head;
|
struct hlist_node *head;
|
||||||
head = get_first(seq);
|
head = get_first(st);
|
||||||
|
|
||||||
if (head)
|
if (head)
|
||||||
while (pos && (head = get_next(seq, head)))
|
while (pos && (head = get_next(st, head)))
|
||||||
pos--;
|
pos--;
|
||||||
return pos ? NULL : head;
|
return pos ? NULL : head;
|
||||||
}
|
}
|
||||||
@ -961,13 +957,13 @@ static struct hlist_node *get_idx(struct seq_file *seq, loff_t pos)
|
|||||||
static void *seq_start(struct seq_file *seq, loff_t *pos)
|
static void *seq_start(struct seq_file *seq, loff_t *pos)
|
||||||
{
|
{
|
||||||
read_lock_bh(&instances_lock);
|
read_lock_bh(&instances_lock);
|
||||||
return get_idx(seq, *pos);
|
return get_idx(seq->private, *pos);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void *seq_next(struct seq_file *s, void *v, loff_t *pos)
|
static void *seq_next(struct seq_file *s, void *v, loff_t *pos)
|
||||||
{
|
{
|
||||||
(*pos)++;
|
(*pos)++;
|
||||||
return get_next(s, v);
|
return get_next(s->private, v);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void seq_stop(struct seq_file *s, void *v)
|
static void seq_stop(struct seq_file *s, void *v)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user