Commit e2da5913 authored by Pavel Emelyanov's avatar Pavel Emelyanov Committed by David S. Miller

[NETFILTER]: Make netfilter code use the seq_open_private

Just switch to the consolidated calls.

ipt_recent() has to initialize the private, so use
the __seq_open_private() helper.
Signed-off-by: default avatarPavel Emelyanov <xemul@openvz.org>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent cf7732e4
...@@ -381,25 +381,14 @@ static const struct seq_operations recent_seq_ops = { ...@@ -381,25 +381,14 @@ static const struct seq_operations recent_seq_ops = {
static int recent_seq_open(struct inode *inode, struct file *file) static int recent_seq_open(struct inode *inode, struct file *file)
{ {
struct proc_dir_entry *pde = PDE(inode); struct proc_dir_entry *pde = PDE(inode);
struct seq_file *seq;
struct recent_iter_state *st; struct recent_iter_state *st;
int ret;
st = kzalloc(sizeof(*st), GFP_KERNEL); st = __seq_open_private(file, &recent_seq_ops, sizeof(*st));
if (st == NULL) if (st == NULL)
return -ENOMEM; return -ENOMEM;
ret = seq_open(file, &recent_seq_ops);
if (ret) {
kfree(st);
goto out;
}
st->table = pde->data; st->table = pde->data;
seq = file->private_data; return 0;
seq->private = st;
out:
return ret;
} }
static ssize_t recent_proc_write(struct file *file, const char __user *input, static ssize_t recent_proc_write(struct file *file, const char __user *input,
......
...@@ -174,22 +174,8 @@ static const struct seq_operations ct_seq_ops = { ...@@ -174,22 +174,8 @@ static const struct seq_operations ct_seq_ops = {
static int ct_open(struct inode *inode, struct file *file) static int ct_open(struct inode *inode, struct file *file)
{ {
struct seq_file *seq; return seq_open_private(file, &ct_seq_ops,
struct ct_iter_state *st; sizeof(struct ct_iter_state));
int ret;
st = kzalloc(sizeof(struct ct_iter_state), GFP_KERNEL);
if (st == NULL)
return -ENOMEM;
ret = seq_open(file, &ct_seq_ops);
if (ret)
goto out_free;
seq = file->private_data;
seq->private = st;
return ret;
out_free:
kfree(st);
return ret;
} }
static const struct file_operations ct_file_ops = { static const struct file_operations ct_file_ops = {
...@@ -291,22 +277,8 @@ static const struct seq_operations exp_seq_ops = { ...@@ -291,22 +277,8 @@ static const struct seq_operations exp_seq_ops = {
static int exp_open(struct inode *inode, struct file *file) static int exp_open(struct inode *inode, struct file *file)
{ {
struct seq_file *seq; return seq_open_private(file, &exp_seq_ops,
struct ct_expect_iter_state *st; sizeof(struct ct_expect_iter_state));
int ret;
st = kzalloc(sizeof(struct ct_expect_iter_state), GFP_KERNEL);
if (!st)
return -ENOMEM;
ret = seq_open(file, &exp_seq_ops);
if (ret)
goto out_free;
seq = file->private_data;
seq->private = st;
return ret;
out_free:
kfree(st);
return ret;
} }
static const struct file_operations ip_exp_file_ops = { static const struct file_operations ip_exp_file_ops = {
......
...@@ -472,22 +472,8 @@ static const struct seq_operations exp_seq_ops = { ...@@ -472,22 +472,8 @@ static const struct seq_operations exp_seq_ops = {
static int exp_open(struct inode *inode, struct file *file) static int exp_open(struct inode *inode, struct file *file)
{ {
struct seq_file *seq; return seq_open_private(file, &exp_seq_ops,
struct ct_expect_iter_state *st; sizeof(struct ct_expect_iter_state));
int ret;
st = kzalloc(sizeof(struct ct_expect_iter_state), GFP_KERNEL);
if (!st)
return -ENOMEM;
ret = seq_open(file, &exp_seq_ops);
if (ret)
goto out_free;
seq = file->private_data;
seq->private = st;
return ret;
out_free:
kfree(st);
return ret;
} }
static const struct file_operations exp_file_ops = { static const struct file_operations exp_file_ops = {
......
...@@ -195,22 +195,8 @@ static const struct seq_operations ct_seq_ops = { ...@@ -195,22 +195,8 @@ static const struct seq_operations ct_seq_ops = {
static int ct_open(struct inode *inode, struct file *file) static int ct_open(struct inode *inode, struct file *file)
{ {
struct seq_file *seq; return seq_open_private(file, &ct_seq_ops,
struct ct_iter_state *st; sizeof(struct ct_iter_state));
int ret;
st = kzalloc(sizeof(struct ct_iter_state), GFP_KERNEL);
if (st == NULL)
return -ENOMEM;
ret = seq_open(file, &ct_seq_ops);
if (ret)
goto out_free;
seq = file->private_data;
seq->private = st;
return ret;
out_free:
kfree(st);
return ret;
} }
static const struct file_operations ct_file_ops = { static const struct file_operations ct_file_ops = {
......
...@@ -951,22 +951,8 @@ static const struct seq_operations nful_seq_ops = { ...@@ -951,22 +951,8 @@ static const struct seq_operations nful_seq_ops = {
static int nful_open(struct inode *inode, struct file *file) static int nful_open(struct inode *inode, struct file *file)
{ {
struct seq_file *seq; return seq_open_private(file, &nful_seq_ops,
struct iter_state *is; sizeof(struct iter_state));
int ret;
is = kzalloc(sizeof(*is), GFP_KERNEL);
if (!is)
return -ENOMEM;
ret = seq_open(file, &nful_seq_ops);
if (ret < 0)
goto out_free;
seq = file->private_data;
seq->private = is;
return ret;
out_free:
kfree(is);
return ret;
} }
static const struct file_operations nful_file_ops = { static const struct file_operations nful_file_ops = {
......
...@@ -1051,22 +1051,8 @@ static const struct seq_operations nfqnl_seq_ops = { ...@@ -1051,22 +1051,8 @@ static const struct seq_operations nfqnl_seq_ops = {
static int nfqnl_open(struct inode *inode, struct file *file) static int nfqnl_open(struct inode *inode, struct file *file)
{ {
struct seq_file *seq; return seq_open_private(file, &nfqnl_seq_ops,
struct iter_state *is; sizeof(struct iter_state));
int ret;
is = kzalloc(sizeof(*is), GFP_KERNEL);
if (!is)
return -ENOMEM;
ret = seq_open(file, &nfqnl_seq_ops);
if (ret < 0)
goto out_free;
seq = file->private_data;
seq->private = is;
return ret;
out_free:
kfree(is);
return ret;
} }
static const struct file_operations nfqnl_file_ops = { static const struct file_operations nfqnl_file_ops = {
......
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