Skip to content

Commit

Permalink
netfilter: xt_hashlimit: simplify seqfile code
Browse files Browse the repository at this point in the history
Simply pass hashtable to seqfile iterators, proc entry itself is not needed.

Signed-off-by: Alexey Dobriyan <adobriyan@gmail.com>
Signed-off-by: Patrick McHardy <kaber@trash.net>
  • Loading branch information
Alexey Dobriyan authored and Patrick McHardy committed Jan 18, 2010
1 parent e9d3897 commit a1004d8
Showing 1 changed file with 5 additions and 9 deletions.
14 changes: 5 additions & 9 deletions net/netfilter/xt_hashlimit.c
Original file line number Diff line number Diff line change
Expand Up @@ -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)
__acquires(htable->lock)
{
struct proc_dir_entry *pde = s->private;
struct xt_hashlimit_htable *htable = pde->data;
struct xt_hashlimit_htable *htable = s->private;
unsigned int *bucket;

spin_lock_bh(&htable->lock);
Expand All @@ -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)
{
struct proc_dir_entry *pde = s->private;
struct xt_hashlimit_htable *htable = pde->data;
struct xt_hashlimit_htable *htable = s->private;
unsigned int *bucket = (unsigned int *)v;

*pos = ++(*bucket);
Expand All @@ -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)
__releases(htable->lock)
{
struct proc_dir_entry *pde = s->private;
struct xt_hashlimit_htable *htable = pde->data;
struct xt_hashlimit_htable *htable = s->private;
unsigned int *bucket = (unsigned int *)v;

kfree(bucket);
Expand Down Expand Up @@ -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)
{
struct proc_dir_entry *pde = s->private;
struct xt_hashlimit_htable *htable = pde->data;
struct xt_hashlimit_htable *htable = s->private;
unsigned int *bucket = (unsigned int *)v;
struct dsthash_ent *ent;
struct hlist_node *pos;
Expand All @@ -944,7 +940,7 @@ static int dl_proc_open(struct inode *inode, struct file *file)

if (!ret) {
struct seq_file *sf = file->private_data;
sf->private = PDE(inode);
sf->private = PDE(inode)->data;
}
return ret;
}
Expand Down

0 comments on commit a1004d8

Please sign in to comment.