Commit f76cdcee5ba4a3fb41de93d5f1c17fb6ab4d0820
Committed by
David S. Miller
1 parent
9a36e8c2b3
Exists in
master
and in
7 other branches
[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>
Showing 1 changed file with 7 additions and 11 deletions Side-by-side Diff
net/netfilter/nfnetlink_log.c
... | ... | @@ -919,10 +919,8 @@ |
919 | 919 | unsigned int bucket; |
920 | 920 | }; |
921 | 921 | |
922 | -static struct hlist_node *get_first(struct seq_file *seq) | |
922 | +static struct hlist_node *get_first(struct iter_state *st) | |
923 | 923 | { |
924 | - struct iter_state *st = seq->private; | |
925 | - | |
926 | 924 | if (!st) |
927 | 925 | return NULL; |
928 | 926 | |
929 | 927 | |
... | ... | @@ -933,10 +931,8 @@ |
933 | 931 | return NULL; |
934 | 932 | } |
935 | 933 | |
936 | -static struct hlist_node *get_next(struct seq_file *seq, struct hlist_node *h) | |
934 | +static struct hlist_node *get_next(struct iter_state *st, struct hlist_node *h) | |
937 | 935 | { |
938 | - struct iter_state *st = seq->private; | |
939 | - | |
940 | 936 | h = h->next; |
941 | 937 | while (!h) { |
942 | 938 | if (++st->bucket >= INSTANCE_BUCKETS) |
943 | 939 | |
944 | 940 | |
... | ... | @@ -947,13 +943,13 @@ |
947 | 943 | return h; |
948 | 944 | } |
949 | 945 | |
950 | -static struct hlist_node *get_idx(struct seq_file *seq, loff_t pos) | |
946 | +static struct hlist_node *get_idx(struct iter_state *st, loff_t pos) | |
951 | 947 | { |
952 | 948 | struct hlist_node *head; |
953 | - head = get_first(seq); | |
949 | + head = get_first(st); | |
954 | 950 | |
955 | 951 | if (head) |
956 | - while (pos && (head = get_next(seq, head))) | |
952 | + while (pos && (head = get_next(st, head))) | |
957 | 953 | pos--; |
958 | 954 | return pos ? NULL : head; |
959 | 955 | } |
960 | 956 | |
... | ... | @@ -961,13 +957,13 @@ |
961 | 957 | static void *seq_start(struct seq_file *seq, loff_t *pos) |
962 | 958 | { |
963 | 959 | read_lock_bh(&instances_lock); |
964 | - return get_idx(seq, *pos); | |
960 | + return get_idx(seq->private, *pos); | |
965 | 961 | } |
966 | 962 | |
967 | 963 | static void *seq_next(struct seq_file *s, void *v, loff_t *pos) |
968 | 964 | { |
969 | 965 | (*pos)++; |
970 | - return get_next(s, v); | |
966 | + return get_next(s->private, v); | |
971 | 967 | } |
972 | 968 | |
973 | 969 | static void seq_stop(struct seq_file *s, void *v) |