Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
L
linux
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Kirill Smelkov
linux
Commits
c35f2e49
Commit
c35f2e49
authored
Mar 31, 2013
by
Al Viro
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
srm_env: use proc_remove_subtree()
Signed-off-by:
Al Viro
<
viro@zeniv.linux.org.uk
>
parent
d9dda78b
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
7 additions
and
57 deletions
+7
-57
arch/alpha/kernel/srm_env.c
arch/alpha/kernel/srm_env.c
+7
-57
No files found.
arch/alpha/kernel/srm_env.c
View file @
c35f2e49
...
...
@@ -51,7 +51,6 @@ MODULE_LICENSE("GPL");
typedef
struct
_srm_env
{
char
*
name
;
unsigned
long
id
;
struct
proc_dir_entry
*
proc_entry
;
}
srm_env_t
;
static
struct
proc_dir_entry
*
base_dir
;
...
...
@@ -149,52 +148,6 @@ static const struct file_operations srm_env_proc_fops = {
.
write
=
srm_env_proc_write
,
};
static
void
srm_env_cleanup
(
void
)
{
srm_env_t
*
entry
;
unsigned
long
var_num
;
if
(
base_dir
)
{
/*
* Remove named entries
*/
if
(
named_dir
)
{
entry
=
srm_named_entries
;
while
(
entry
->
name
!=
NULL
&&
entry
->
id
!=
0
)
{
if
(
entry
->
proc_entry
)
{
remove_proc_entry
(
entry
->
name
,
named_dir
);
entry
->
proc_entry
=
NULL
;
}
entry
++
;
}
remove_proc_entry
(
NAMED_DIR
,
base_dir
);
}
/*
* Remove numbered entries
*/
if
(
numbered_dir
)
{
for
(
var_num
=
0
;
var_num
<=
255
;
var_num
++
)
{
entry
=
&
srm_numbered_entries
[
var_num
];
if
(
entry
->
proc_entry
)
{
remove_proc_entry
(
entry
->
name
,
numbered_dir
);
entry
->
proc_entry
=
NULL
;
entry
->
name
=
NULL
;
}
}
remove_proc_entry
(
NUMBERED_DIR
,
base_dir
);
}
remove_proc_entry
(
BASE_DIR
,
NULL
);
}
return
;
}
static
int
__init
srm_env_init
(
void
)
{
...
...
@@ -225,7 +178,7 @@ srm_env_init(void)
if
(
!
base_dir
)
{
printk
(
KERN_ERR
"Couldn't create base dir /proc/%s
\n
"
,
BASE_DIR
);
goto
cleanup
;
return
-
ENOMEM
;
}
/*
...
...
@@ -254,9 +207,8 @@ srm_env_init(void)
*/
entry
=
srm_named_entries
;
while
(
entry
->
name
&&
entry
->
id
)
{
entry
->
proc_entry
=
proc_create_data
(
entry
->
name
,
0644
,
named_dir
,
&
srm_env_proc_fops
,
entry
);
if
(
!
entry
->
proc_entry
)
if
(
!
proc_create_data
(
entry
->
name
,
0644
,
named_dir
,
&
srm_env_proc_fops
,
entry
))
goto
cleanup
;
entry
++
;
}
...
...
@@ -268,9 +220,8 @@ srm_env_init(void)
entry
=
&
srm_numbered_entries
[
var_num
];
entry
->
name
=
number
[
var_num
];
entry
->
proc_entry
=
proc_create_data
(
entry
->
name
,
0644
,
numbered_dir
,
&
srm_env_proc_fops
,
entry
);
if
(
!
entry
->
proc_entry
)
if
(
!
proc_create_data
(
entry
->
name
,
0644
,
numbered_dir
,
&
srm_env_proc_fops
,
entry
))
goto
cleanup
;
entry
->
id
=
var_num
;
...
...
@@ -282,15 +233,14 @@ srm_env_init(void)
return
0
;
cleanup:
srm_env_cleanup
();
remove_proc_subtree
(
BASE_DIR
,
NULL
);
return
-
ENOMEM
;
}
static
void
__exit
srm_env_exit
(
void
)
{
srm_env_cleanup
(
);
remove_proc_subtree
(
BASE_DIR
,
NULL
);
printk
(
KERN_INFO
"%s: unloaded successfully
\n
"
,
NAME
);
return
;
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment