Commit a1004d8e authored by Alexey Dobriyan's avatar Alexey Dobriyan Committed by Patrick McHardy

netfilter: xt_hashlimit: simplify seqfile code

Simply pass hashtable to seqfile iterators, proc entry itself is not needed.
Signed-off-by: default avatarAlexey Dobriyan <adobriyan@gmail.com>
Signed-off-by: default avatarPatrick McHardy <kaber@trash.net>
parent e9d3897c
...@@ -841,8 +841,7 @@ static struct xt_match hashlimit_mt_reg[] __read_mostly = { ...@@ -841,8 +841,7 @@ static struct xt_match hashlimit_mt_reg[] __read_mostly = {
static void *dl_seq_start(struct seq_file *s, loff_t *pos) static void *dl_seq_start(struct seq_file *s, loff_t *pos)
__acquires(htable->lock) __acquires(htable->lock)
{ {
struct proc_dir_entry *pde = s->private; struct xt_hashlimit_htable *htable = s->private;
struct xt_hashlimit_htable *htable = pde->data;
unsigned int *bucket; unsigned int *bucket;
spin_lock_bh(&htable->lock); spin_lock_bh(&htable->lock);
...@@ -859,8 +858,7 @@ static void *dl_seq_start(struct seq_file *s, loff_t *pos) ...@@ -859,8 +858,7 @@ static void *dl_seq_start(struct seq_file *s, loff_t *pos)
static void *dl_seq_next(struct seq_file *s, void *v, loff_t *pos) static void *dl_seq_next(struct seq_file *s, void *v, loff_t *pos)
{ {
struct proc_dir_entry *pde = s->private; struct xt_hashlimit_htable *htable = s->private;
struct xt_hashlimit_htable *htable = pde->data;
unsigned int *bucket = (unsigned int *)v; unsigned int *bucket = (unsigned int *)v;
*pos = ++(*bucket); *pos = ++(*bucket);
...@@ -874,8 +872,7 @@ static void *dl_seq_next(struct seq_file *s, void *v, loff_t *pos) ...@@ -874,8 +872,7 @@ static void *dl_seq_next(struct seq_file *s, void *v, loff_t *pos)
static void dl_seq_stop(struct seq_file *s, void *v) static void dl_seq_stop(struct seq_file *s, void *v)
__releases(htable->lock) __releases(htable->lock)
{ {
struct proc_dir_entry *pde = s->private; struct xt_hashlimit_htable *htable = s->private;
struct xt_hashlimit_htable *htable = pde->data;
unsigned int *bucket = (unsigned int *)v; unsigned int *bucket = (unsigned int *)v;
kfree(bucket); kfree(bucket);
...@@ -917,8 +914,7 @@ static int dl_seq_real_show(struct dsthash_ent *ent, u_int8_t family, ...@@ -917,8 +914,7 @@ static int dl_seq_real_show(struct dsthash_ent *ent, u_int8_t family,
static int dl_seq_show(struct seq_file *s, void *v) static int dl_seq_show(struct seq_file *s, void *v)
{ {
struct proc_dir_entry *pde = s->private; struct xt_hashlimit_htable *htable = s->private;
struct xt_hashlimit_htable *htable = pde->data;
unsigned int *bucket = (unsigned int *)v; unsigned int *bucket = (unsigned int *)v;
struct dsthash_ent *ent; struct dsthash_ent *ent;
struct hlist_node *pos; struct hlist_node *pos;
...@@ -944,7 +940,7 @@ static int dl_proc_open(struct inode *inode, struct file *file) ...@@ -944,7 +940,7 @@ static int dl_proc_open(struct inode *inode, struct file *file)
if (!ret) { if (!ret) {
struct seq_file *sf = file->private_data; struct seq_file *sf = file->private_data;
sf->private = PDE(inode); sf->private = PDE(inode)->data;
} }
return ret; return ret;
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment