x25: use proc_remove_subtree()
... and don't bother with ->owner, while we are at it - procfs fops do not need it. Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
This commit is contained in:
Родитель
fbd387aea0
Коммит
345566bd72
|
@ -187,7 +187,6 @@ static int x25_seq_forward_open(struct inode *inode, struct file *file)
|
||||||
}
|
}
|
||||||
|
|
||||||
static const struct file_operations x25_seq_socket_fops = {
|
static const struct file_operations x25_seq_socket_fops = {
|
||||||
.owner = THIS_MODULE,
|
|
||||||
.open = x25_seq_socket_open,
|
.open = x25_seq_socket_open,
|
||||||
.read = seq_read,
|
.read = seq_read,
|
||||||
.llseek = seq_lseek,
|
.llseek = seq_lseek,
|
||||||
|
@ -195,7 +194,6 @@ static const struct file_operations x25_seq_socket_fops = {
|
||||||
};
|
};
|
||||||
|
|
||||||
static const struct file_operations x25_seq_route_fops = {
|
static const struct file_operations x25_seq_route_fops = {
|
||||||
.owner = THIS_MODULE,
|
|
||||||
.open = x25_seq_route_open,
|
.open = x25_seq_route_open,
|
||||||
.read = seq_read,
|
.read = seq_read,
|
||||||
.llseek = seq_lseek,
|
.llseek = seq_lseek,
|
||||||
|
@ -203,55 +201,38 @@ static const struct file_operations x25_seq_route_fops = {
|
||||||
};
|
};
|
||||||
|
|
||||||
static const struct file_operations x25_seq_forward_fops = {
|
static const struct file_operations x25_seq_forward_fops = {
|
||||||
.owner = THIS_MODULE,
|
|
||||||
.open = x25_seq_forward_open,
|
.open = x25_seq_forward_open,
|
||||||
.read = seq_read,
|
.read = seq_read,
|
||||||
.llseek = seq_lseek,
|
.llseek = seq_lseek,
|
||||||
.release = seq_release,
|
.release = seq_release,
|
||||||
};
|
};
|
||||||
|
|
||||||
static struct proc_dir_entry *x25_proc_dir;
|
|
||||||
|
|
||||||
int __init x25_proc_init(void)
|
int __init x25_proc_init(void)
|
||||||
{
|
{
|
||||||
struct proc_dir_entry *p;
|
if (!proc_mkdir("x25", init_net.proc_net))
|
||||||
int rc = -ENOMEM;
|
return -ENOMEM;
|
||||||
|
|
||||||
x25_proc_dir = proc_mkdir("x25", init_net.proc_net);
|
if (!proc_create("x25/route", S_IRUGO, init_net.proc_net,
|
||||||
if (!x25_proc_dir)
|
&x25_seq_route_fops))
|
||||||
goto out;
|
goto out;
|
||||||
|
|
||||||
p = proc_create("route", S_IRUGO, x25_proc_dir, &x25_seq_route_fops);
|
if (!proc_create("x25/socket", S_IRUGO, init_net.proc_net,
|
||||||
if (!p)
|
&x25_seq_socket_fops))
|
||||||
goto out_route;
|
goto out;
|
||||||
|
|
||||||
p = proc_create("socket", S_IRUGO, x25_proc_dir, &x25_seq_socket_fops);
|
if (!proc_create("x25/forward", S_IRUGO, init_net.proc_net,
|
||||||
if (!p)
|
&x25_seq_forward_fops))
|
||||||
goto out_socket;
|
goto out;
|
||||||
|
return 0;
|
||||||
p = proc_create("forward", S_IRUGO, x25_proc_dir,
|
|
||||||
&x25_seq_forward_fops);
|
|
||||||
if (!p)
|
|
||||||
goto out_forward;
|
|
||||||
rc = 0;
|
|
||||||
|
|
||||||
out:
|
out:
|
||||||
return rc;
|
remove_proc_subtree("x25", init_net.proc_net);
|
||||||
out_forward:
|
return -ENOMEM;
|
||||||
remove_proc_entry("socket", x25_proc_dir);
|
|
||||||
out_socket:
|
|
||||||
remove_proc_entry("route", x25_proc_dir);
|
|
||||||
out_route:
|
|
||||||
remove_proc_entry("x25", init_net.proc_net);
|
|
||||||
goto out;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void __exit x25_proc_exit(void)
|
void __exit x25_proc_exit(void)
|
||||||
{
|
{
|
||||||
remove_proc_entry("forward", x25_proc_dir);
|
remove_proc_subtree("x25", init_net.proc_net);
|
||||||
remove_proc_entry("route", x25_proc_dir);
|
|
||||||
remove_proc_entry("socket", x25_proc_dir);
|
|
||||||
remove_proc_entry("x25", init_net.proc_net);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#else /* CONFIG_PROC_FS */
|
#else /* CONFIG_PROC_FS */
|
||||||
|
|
Загрузка…
Ссылка в новой задаче