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

netfiltr: ipt_CLUSTERIP: simplify seq_file codeA

Pass "struct clusterip_config" itself to seq_file iterators
and save one dereference. Proc entry itself isn't interesting.
Signed-off-by: default avatarAlexey Dobriyan <adobriyan@gmail.com>
Signed-off-by: default avatarPatrick McHardy <kaber@trash.net>
parent 7c070aa9
...@@ -560,8 +560,7 @@ struct clusterip_seq_position { ...@@ -560,8 +560,7 @@ struct clusterip_seq_position {
static void *clusterip_seq_start(struct seq_file *s, loff_t *pos) static void *clusterip_seq_start(struct seq_file *s, loff_t *pos)
{ {
const struct proc_dir_entry *pde = s->private; struct clusterip_config *c = s->private;
struct clusterip_config *c = pde->data;
unsigned int weight; unsigned int weight;
u_int32_t local_nodes; u_int32_t local_nodes;
struct clusterip_seq_position *idx; struct clusterip_seq_position *idx;
...@@ -632,10 +631,9 @@ static int clusterip_proc_open(struct inode *inode, struct file *file) ...@@ -632,10 +631,9 @@ static int clusterip_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;
struct proc_dir_entry *pde = PDE(inode); struct clusterip_config *c = PDE(inode)->data;
struct clusterip_config *c = pde->data;
sf->private = pde; sf->private = c;
clusterip_config_get(c); clusterip_config_get(c);
} }
...@@ -645,8 +643,7 @@ static int clusterip_proc_open(struct inode *inode, struct file *file) ...@@ -645,8 +643,7 @@ static int clusterip_proc_open(struct inode *inode, struct file *file)
static int clusterip_proc_release(struct inode *inode, struct file *file) static int clusterip_proc_release(struct inode *inode, struct file *file)
{ {
struct proc_dir_entry *pde = PDE(inode); struct clusterip_config *c = PDE(inode)->data;
struct clusterip_config *c = pde->data;
int ret; int ret;
ret = seq_release(inode, file); ret = seq_release(inode, file);
...@@ -660,10 +657,9 @@ static int clusterip_proc_release(struct inode *inode, struct file *file) ...@@ -660,10 +657,9 @@ static int clusterip_proc_release(struct inode *inode, struct file *file)
static ssize_t clusterip_proc_write(struct file *file, const char __user *input, static ssize_t clusterip_proc_write(struct file *file, const char __user *input,
size_t size, loff_t *ofs) size_t size, loff_t *ofs)
{ {
struct clusterip_config *c = PDE(file->f_path.dentry->d_inode)->data;
#define PROC_WRITELEN 10 #define PROC_WRITELEN 10
char buffer[PROC_WRITELEN+1]; char buffer[PROC_WRITELEN+1];
const struct proc_dir_entry *pde = PDE(file->f_path.dentry->d_inode);
struct clusterip_config *c = pde->data;
unsigned long nodenum; unsigned long nodenum;
if (copy_from_user(buffer, input, PROC_WRITELEN)) if (copy_from_user(buffer, input, PROC_WRITELEN))
......
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