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
e41d2378
Commit
e41d2378
authored
Dec 27, 2020
by
Al Viro
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
qib_fs: switch to simple_recursive_removal()
Signed-off-by:
Al Viro
<
viro@zeniv.linux.org.uk
>
parent
a38fd874
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
5 additions
and
63 deletions
+5
-63
drivers/infiniband/hw/qib/qib_fs.c
drivers/infiniband/hw/qib/qib_fs.c
+5
-63
No files found.
drivers/infiniband/hw/qib/qib_fs.c
View file @
e41d2378
...
@@ -427,79 +427,21 @@ static int add_cntr_files(struct super_block *sb, struct qib_devdata *dd)
...
@@ -427,79 +427,21 @@ static int add_cntr_files(struct super_block *sb, struct qib_devdata *dd)
return
ret
;
return
ret
;
}
}
static
int
remove_file
(
struct
dentry
*
parent
,
char
*
name
)
{
struct
dentry
*
tmp
;
int
ret
;
tmp
=
lookup_one_len
(
name
,
parent
,
strlen
(
name
));
if
(
IS_ERR
(
tmp
))
{
ret
=
PTR_ERR
(
tmp
);
goto
bail
;
}
spin_lock
(
&
tmp
->
d_lock
);
if
(
simple_positive
(
tmp
))
{
__d_drop
(
tmp
);
spin_unlock
(
&
tmp
->
d_lock
);
simple_unlink
(
d_inode
(
parent
),
tmp
);
}
else
{
spin_unlock
(
&
tmp
->
d_lock
);
}
dput
(
tmp
);
ret
=
0
;
bail:
/*
* We don't expect clients to care about the return value, but
* it's there if they need it.
*/
return
ret
;
}
static
int
remove_device_files
(
struct
super_block
*
sb
,
static
int
remove_device_files
(
struct
super_block
*
sb
,
struct
qib_devdata
*
dd
)
struct
qib_devdata
*
dd
)
{
{
struct
dentry
*
dir
,
*
root
;
struct
dentry
*
dir
;
char
unit
[
10
];
char
unit
[
10
];
int
ret
,
i
;
root
=
dget
(
sb
->
s_root
);
inode_lock
(
d_inode
(
root
));
snprintf
(
unit
,
sizeof
(
unit
),
"%u"
,
dd
->
unit
);
snprintf
(
unit
,
sizeof
(
unit
),
"%u"
,
dd
->
unit
);
dir
=
lookup_one_len
(
unit
,
root
,
strlen
(
unit
));
dir
=
lookup_one_len
_unlocked
(
unit
,
sb
->
s_
root
,
strlen
(
unit
));
if
(
IS_ERR
(
dir
))
{
if
(
IS_ERR
(
dir
))
{
ret
=
PTR_ERR
(
dir
);
pr_err
(
"Lookup of %s failed
\n
"
,
unit
);
pr_err
(
"Lookup of %s failed
\n
"
,
unit
);
goto
bail
;
return
PTR_ERR
(
dir
)
;
}
}
simple_recursive_removal
(
dir
,
NULL
);
inode_lock
(
d_inode
(
dir
));
return
0
;
remove_file
(
dir
,
"counters"
);
remove_file
(
dir
,
"counter_names"
);
remove_file
(
dir
,
"portcounter_names"
);
for
(
i
=
0
;
i
<
dd
->
num_pports
;
i
++
)
{
char
fname
[
24
];
sprintf
(
fname
,
"port%dcounters"
,
i
+
1
);
remove_file
(
dir
,
fname
);
if
(
dd
->
flags
&
QIB_HAS_QSFP
)
{
sprintf
(
fname
,
"qsfp%d"
,
i
+
1
);
remove_file
(
dir
,
fname
);
}
}
remove_file
(
dir
,
"flash"
);
inode_unlock
(
d_inode
(
dir
));
ret
=
simple_rmdir
(
d_inode
(
root
),
dir
);
d_drop
(
dir
);
dput
(
dir
);
bail:
inode_unlock
(
d_inode
(
root
));
dput
(
root
);
return
ret
;
}
}
/*
/*
...
...
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