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
nexedi
linux
Commits
680b3024
Commit
680b3024
authored
Jan 25, 2015
by
Al Viro
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fold debugfs_mknod() into callers
Signed-off-by:
Al Viro
<
viro@zeniv.linux.org.uk
>
parent
3473cde5
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
31 additions
and
37 deletions
+31
-37
fs/debugfs/inode.c
fs/debugfs/inode.c
+31
-37
No files found.
fs/debugfs/inode.c
View file @
680b3024
...
@@ -69,21 +69,6 @@ static struct inode *debugfs_get_inode(struct super_block *sb, umode_t mode, dev
...
@@ -69,21 +69,6 @@ static struct inode *debugfs_get_inode(struct super_block *sb, umode_t mode, dev
return
inode
;
return
inode
;
}
}
/* SMP-safe */
static
int
debugfs_mknod
(
struct
dentry
*
dentry
,
umode_t
mode
,
void
*
data
,
const
struct
file_operations
*
fops
)
{
struct
inode
*
inode
;
inode
=
debugfs_get_inode
(
dentry
->
d_sb
,
mode
,
0
,
data
,
fops
);
if
(
unlikely
(
!
inode
))
return
-
EPERM
;
d_instantiate
(
dentry
,
inode
);
dget
(
dentry
);
return
0
;
}
static
inline
int
debugfs_positive
(
struct
dentry
*
dentry
)
static
inline
int
debugfs_positive
(
struct
dentry
*
dentry
)
{
{
return
dentry
->
d_inode
&&
!
d_unhashed
(
dentry
);
return
dentry
->
d_inode
&&
!
d_unhashed
(
dentry
);
...
@@ -339,7 +324,7 @@ struct dentry *debugfs_create_file(const char *name, umode_t mode,
...
@@ -339,7 +324,7 @@ struct dentry *debugfs_create_file(const char *name, umode_t mode,
const
struct
file_operations
*
fops
)
const
struct
file_operations
*
fops
)
{
{
struct
dentry
*
dentry
;
struct
dentry
*
dentry
;
int
error
;
struct
inode
*
inode
;
if
(
!
(
mode
&
S_IFMT
))
if
(
!
(
mode
&
S_IFMT
))
mode
|=
S_IFREG
;
mode
|=
S_IFREG
;
...
@@ -349,10 +334,14 @@ struct dentry *debugfs_create_file(const char *name, umode_t mode,
...
@@ -349,10 +334,14 @@ struct dentry *debugfs_create_file(const char *name, umode_t mode,
if
(
IS_ERR
(
dentry
))
if
(
IS_ERR
(
dentry
))
return
NULL
;
return
NULL
;
error
=
debugfs_mknod
(
dentry
,
mode
,
data
,
fops
);
inode
=
debugfs_get_inode
(
dentry
->
d_sb
,
mode
,
0
,
data
,
fops
);
if
(
!
error
)
if
(
unlikely
(
!
inode
))
fsnotify_create
(
dentry
->
d_parent
->
d_inode
,
dentry
);
return
end_creating
(
dentry
,
-
ENOMEM
);
return
end_creating
(
dentry
,
error
);
d_instantiate
(
dentry
,
inode
);
dget
(
dentry
);
fsnotify_create
(
dentry
->
d_parent
->
d_inode
,
dentry
);
return
end_creating
(
dentry
,
0
);
}
}
EXPORT_SYMBOL_GPL
(
debugfs_create_file
);
EXPORT_SYMBOL_GPL
(
debugfs_create_file
);
...
@@ -377,18 +366,22 @@ EXPORT_SYMBOL_GPL(debugfs_create_file);
...
@@ -377,18 +366,22 @@ EXPORT_SYMBOL_GPL(debugfs_create_file);
struct
dentry
*
debugfs_create_dir
(
const
char
*
name
,
struct
dentry
*
parent
)
struct
dentry
*
debugfs_create_dir
(
const
char
*
name
,
struct
dentry
*
parent
)
{
{
struct
dentry
*
dentry
=
start_creating
(
name
,
parent
);
struct
dentry
*
dentry
=
start_creating
(
name
,
parent
);
int
error
;
struct
inode
*
inode
;
if
(
IS_ERR
(
dentry
))
if
(
IS_ERR
(
dentry
))
return
NULL
;
return
NULL
;
error
=
debugfs_mknod
(
dentry
,
S_IFDIR
|
S_IRWXU
|
S_IRUGO
|
S_IXUGO
,
inode
=
debugfs_get_inode
(
dentry
->
d_sb
,
NULL
,
NULL
);
S_IFDIR
|
S_IRWXU
|
S_IRUGO
|
S_IXUGO
,
if
(
!
error
)
{
0
,
NULL
,
NULL
);
inc_nlink
(
dentry
->
d_parent
->
d_inode
);
if
(
unlikely
(
!
inode
))
fsnotify_mkdir
(
dentry
->
d_parent
->
d_inode
,
dentry
);
return
end_creating
(
dentry
,
-
ENOMEM
);
}
return
end_creating
(
dentry
,
error
);
d_instantiate
(
dentry
,
inode
);
dget
(
dentry
);
inc_nlink
(
dentry
->
d_parent
->
d_inode
);
fsnotify_mkdir
(
dentry
->
d_parent
->
d_inode
,
dentry
);
return
end_creating
(
dentry
,
0
);
}
}
EXPORT_SYMBOL_GPL
(
debugfs_create_dir
);
EXPORT_SYMBOL_GPL
(
debugfs_create_dir
);
...
@@ -419,25 +412,26 @@ struct dentry *debugfs_create_symlink(const char *name, struct dentry *parent,
...
@@ -419,25 +412,26 @@ struct dentry *debugfs_create_symlink(const char *name, struct dentry *parent,
const
char
*
target
)
const
char
*
target
)
{
{
struct
dentry
*
dentry
;
struct
dentry
*
dentry
;
char
*
link
;
struct
inode
*
inode
;
int
error
;
char
*
link
=
kstrdup
(
target
,
GFP_KERNEL
);
link
=
kstrdup
(
target
,
GFP_KERNEL
);
if
(
!
link
)
if
(
!
link
)
return
NULL
;
return
NULL
;
dentry
=
start_creating
(
name
,
parent
);
dentry
=
start_creating
(
name
,
parent
);
if
(
IS_ERR
(
dentry
))
{
if
(
IS_ERR
(
dentry
))
{
kfree
(
link
);
kfree
(
link
);
return
NULL
;
return
NULL
;
}
}
error
=
debugfs_mknod
(
dentry
,
S_IFLNK
|
S_IRWXUGO
,
link
,
NULL
);
inode
=
debugfs_get_inode
(
dentry
->
d_sb
,
S_IFLNK
|
S_IRWXUGO
,
0
,
if
(
error
)
link
,
NULL
);
if
(
unlikely
(
!
inode
))
{
kfree
(
link
);
kfree
(
link
);
return
end_creating
(
dentry
,
-
ENOMEM
);
return
end_creating
(
dentry
,
error
);
}
d_instantiate
(
dentry
,
inode
);
dget
(
dentry
);
return
end_creating
(
dentry
,
0
);
}
}
EXPORT_SYMBOL_GPL
(
debugfs_create_symlink
);
EXPORT_SYMBOL_GPL
(
debugfs_create_symlink
);
...
...
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