Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
linux-seco-imx
Manage
Activity
Members
Labels
Plan
Issues
0
Issue boards
Milestones
Iterations
Jira
Code
Merge requests
12
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Locked files
Deploy
Releases
Package Registry
Model registry
Operate
Terraform modules
Analyze
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Clea OS
bsp
nxp
linux-seco-imx
Commits
cfa57c11
Commit
cfa57c11
authored
12 years ago
by
Al Viro
Browse files
Options
Downloads
Patches
Plain Diff
debugfs: fold debugfs_create_by_name() into the only caller
Signed-off-by:
Al Viro
<
viro@zeniv.linux.org.uk
>
parent
c3b1a350
Loading
Loading
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
fs/debugfs/inode.c
+20
-33
20 additions, 33 deletions
fs/debugfs/inode.c
with
20 additions
and
33 deletions
fs/debugfs/inode.c
+
20
−
33
View file @
cfa57c11
...
...
@@ -293,13 +293,19 @@ static struct file_system_type debug_fs_type = {
.
kill_sb
=
kill_litter_super
,
};
static
int
debugfs_create_by_name
(
const
char
*
name
,
umode_t
mode
,
struct
dentry
*
parent
,
struct
dentry
**
dentry
,
void
*
data
,
const
struct
file_operations
*
fops
)
struct
dentry
*
__create_file
(
const
char
*
name
,
umode_t
mode
,
struct
dentry
*
parent
,
void
*
data
,
const
struct
file_operations
*
fops
)
{
int
error
=
0
;
struct
dentry
*
dentry
=
NULL
;
int
error
;
pr_debug
(
"debugfs: creating file '%s'
\n
"
,
name
);
error
=
simple_pin_fs
(
&
debug_fs_type
,
&
debugfs_mount
,
&
debugfs_mount_count
);
if
(
error
)
goto
exit
;
/* If the parent is not specified, we create it in the root.
* We need the root dentry to do this, which is in the super
...
...
@@ -309,48 +315,29 @@ static int debugfs_create_by_name(const char *name, umode_t mode,
if
(
!
parent
)
parent
=
debugfs_mount
->
mnt_root
;
*
dentry
=
NULL
;
dentry
=
NULL
;
mutex_lock
(
&
parent
->
d_inode
->
i_mutex
);
*
dentry
=
lookup_one_len
(
name
,
parent
,
strlen
(
name
));
if
(
!
IS_ERR
(
*
dentry
))
{
dentry
=
lookup_one_len
(
name
,
parent
,
strlen
(
name
));
if
(
!
IS_ERR
(
dentry
))
{
switch
(
mode
&
S_IFMT
)
{
case
S_IFDIR
:
error
=
debugfs_mkdir
(
parent
->
d_inode
,
*
dentry
,
mode
,
error
=
debugfs_mkdir
(
parent
->
d_inode
,
dentry
,
mode
,
data
,
fops
);
break
;
case
S_IFLNK
:
error
=
debugfs_link
(
parent
->
d_inode
,
*
dentry
,
mode
,
error
=
debugfs_link
(
parent
->
d_inode
,
dentry
,
mode
,
data
,
fops
);
break
;
default:
error
=
debugfs_create
(
parent
->
d_inode
,
*
dentry
,
mode
,
error
=
debugfs_create
(
parent
->
d_inode
,
dentry
,
mode
,
data
,
fops
);
break
;
}
dput
(
*
dentry
);
dput
(
dentry
);
}
else
error
=
PTR_ERR
(
*
dentry
);
error
=
PTR_ERR
(
dentry
);
mutex_unlock
(
&
parent
->
d_inode
->
i_mutex
);
return
error
;
}
struct
dentry
*
__create_file
(
const
char
*
name
,
umode_t
mode
,
struct
dentry
*
parent
,
void
*
data
,
const
struct
file_operations
*
fops
)
{
struct
dentry
*
dentry
=
NULL
;
int
error
;
pr_debug
(
"debugfs: creating file '%s'
\n
"
,
name
);
error
=
simple_pin_fs
(
&
debug_fs_type
,
&
debugfs_mount
,
&
debugfs_mount_count
);
if
(
error
)
goto
exit
;
error
=
debugfs_create_by_name
(
name
,
mode
,
parent
,
&
dentry
,
data
,
fops
);
if
(
error
)
{
dentry
=
NULL
;
simple_release_fs
(
&
debugfs_mount
,
&
debugfs_mount_count
);
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment