From: Steven Rostedt <rostedt@goodmis.org>
To: linux-kernel@vger.kernel.org
Cc: Al Viro <viro@ZenIV.linux.org.uk>,
Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
Ingo Molnar <mingo@kernel.org>,
Andrew Morton <akpm@linux-foundation.org>,
Al Viro <viro@ZenIV.linux.org.uk>
Subject: [PATCH 09/16 v3] debugfs: take mode-dependent parts of debugfs_get_inode() into callers
Date: Mon, 26 Jan 2015 10:09:22 -0500 [thread overview]
Message-ID: <20150126151000.193295757@goodmis.org> (raw)
In-Reply-To: 20150126150913.653681560@goodmis.org
[-- Attachment #1: 0009-debugfs-take-mode-dependent-parts-of-debugfs_get_ino.patch --]
[-- Type: text/plain, Size: 3218 bytes --]
From: Al Viro <viro@zeniv.linux.org.uk>
... and trim the arguments list
Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
---
fs/debugfs/inode.c | 48 ++++++++++++++++--------------------------------
1 file changed, 16 insertions(+), 32 deletions(-)
diff --git a/fs/debugfs/inode.c b/fs/debugfs/inode.c
index b765c04eba20..61e9a6815a19 100644
--- a/fs/debugfs/inode.c
+++ b/fs/debugfs/inode.c
@@ -34,37 +34,12 @@ static struct vfsmount *debugfs_mount;
static int debugfs_mount_count;
static bool debugfs_registered;
-static struct inode *debugfs_get_inode(struct super_block *sb, umode_t mode, dev_t dev,
- void *data, const struct file_operations *fops)
-
+static struct inode *debugfs_get_inode(struct super_block *sb)
{
struct inode *inode = new_inode(sb);
-
if (inode) {
inode->i_ino = get_next_ino();
- inode->i_mode = mode;
inode->i_atime = inode->i_mtime = inode->i_ctime = CURRENT_TIME;
- switch (mode & S_IFMT) {
- default:
- init_special_inode(inode, mode, dev);
- break;
- case S_IFREG:
- inode->i_fop = fops ? fops : &debugfs_file_operations;
- inode->i_private = data;
- break;
- case S_IFLNK:
- inode->i_op = &debugfs_link_operations;
- inode->i_private = data;
- break;
- case S_IFDIR:
- inode->i_op = &simple_dir_inode_operations;
- inode->i_fop = &simple_dir_operations;
-
- /* directory inodes start off with i_nlink == 2
- * (for "." entry) */
- inc_nlink(inode);
- break;
- }
}
return inode;
}
@@ -334,10 +309,13 @@ struct dentry *debugfs_create_file(const char *name, umode_t mode,
if (IS_ERR(dentry))
return NULL;
- inode = debugfs_get_inode(dentry->d_sb, mode, 0, data, fops);
+ inode = debugfs_get_inode(dentry->d_sb);
if (unlikely(!inode))
return end_creating(dentry, -ENOMEM);
+ inode->i_mode = mode;
+ inode->i_fop = fops ? fops : &debugfs_file_operations;
+ inode->i_private = data;
d_instantiate(dentry, inode);
dget(dentry);
fsnotify_create(dentry->d_parent->d_inode, dentry);
@@ -371,12 +349,16 @@ struct dentry *debugfs_create_dir(const char *name, struct dentry *parent)
if (IS_ERR(dentry))
return NULL;
- inode = debugfs_get_inode(dentry->d_sb,
- S_IFDIR | S_IRWXU | S_IRUGO | S_IXUGO,
- 0, NULL, NULL);
+ inode = debugfs_get_inode(dentry->d_sb);
if (unlikely(!inode))
return end_creating(dentry, -ENOMEM);
+ inode->i_mode = S_IFDIR | S_IRWXU | S_IRUGO | S_IXUGO;
+ inode->i_op = &simple_dir_inode_operations;
+ inode->i_fop = &simple_dir_operations;
+
+ /* directory inodes start off with i_nlink == 2 (for "." entry) */
+ inc_nlink(inode);
d_instantiate(dentry, inode);
dget(dentry);
inc_nlink(dentry->d_parent->d_inode);
@@ -423,12 +405,14 @@ struct dentry *debugfs_create_symlink(const char *name, struct dentry *parent,
return NULL;
}
- inode = debugfs_get_inode(dentry->d_sb, S_IFLNK | S_IRWXUGO, 0,
- link, NULL);
+ inode = debugfs_get_inode(dentry->d_sb);
if (unlikely(!inode)) {
kfree(link);
return end_creating(dentry, -ENOMEM);
}
+ inode->i_mode = S_IFLNK | S_IRWXUGO;
+ inode->i_op = &debugfs_link_operations;
+ inode->i_private = link;
d_instantiate(dentry, inode);
dget(dentry);
return end_creating(dentry, 0);
--
2.1.4
next prev parent reply other threads:[~2015-01-26 15:11 UTC|newest]
Thread overview: 40+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-01-26 15:09 [PATCH 00/16 v3] tracing: Add new file system tracefs Steven Rostedt
2015-01-26 15:09 ` [PATCH 01/16 v3] debugfs_{mkdir,create,link}(): get rid of redundant argument Steven Rostedt
2015-01-26 15:09 ` [PATCH 02/16 v3] debugfs: split the beginning and the end of __create_file() off Steven Rostedt
2015-01-26 15:09 ` [PATCH 03/16 v3] debugfs: kill __create_file() Steven Rostedt
2015-01-26 15:09 ` [PATCH 04/16 v3] fold debugfs_link() into caller Steven Rostedt
2015-01-26 15:09 ` [PATCH 05/16 v3] debugfs_mknod(): get rid useless arguments Steven Rostedt
2015-01-26 15:09 ` [PATCH 06/16 v3] fold debugfs_mkdir() into caller Steven Rostedt
2015-01-26 15:09 ` [PATCH 07/16 v3] fold debugfs_create() " Steven Rostedt
2015-01-26 15:09 ` [PATCH 08/16 v3] fold debugfs_mknod() into callers Steven Rostedt
2015-01-26 15:09 ` Steven Rostedt [this message]
2015-01-26 15:09 ` [PATCH 10/16 v3] debugfs: split end_creating() into success and failure cases Steven Rostedt
2015-01-26 15:09 ` [PATCH 11/16 v3] new primitive: debugfs_create_automount() Steven Rostedt
2015-01-26 15:09 ` [PATCH 12/16 v3] tracefs: Add new tracefs file system Steven Rostedt
2015-01-26 15:09 ` [PATCH 13/16 v3] tracing: Convert the tracing facility over to use tracefs Steven Rostedt
2015-01-26 15:09 ` [PATCH 14/16 v3] tracing: Automatically mount tracefs on debugfs/tracing Steven Rostedt
2015-01-26 15:09 ` [PATCH 15/16 v3] tracefs: Add directory /sys/kernel/tracing Steven Rostedt
2015-01-26 15:09 ` [PATCH 16/16 v3] tracing: Have mkdir and rmdir be part of tracefs Steven Rostedt
2015-01-26 19:30 ` [PATCH 00/16 v3] tracing: Add new file system tracefs Al Viro
2015-01-26 20:42 ` Steven Rostedt
2015-01-26 20:44 ` Steven Rostedt
2015-01-26 20:58 ` Steven Rostedt
2015-01-26 21:44 ` Al Viro
2015-01-26 21:46 ` Al Viro
2015-01-26 23:02 ` Al Viro
2015-01-26 23:39 ` Steven Rostedt
2015-01-26 23:43 ` Steven Rostedt
2015-01-26 23:49 ` Steven Rostedt
2015-01-27 0:39 ` Steven Rostedt
2015-01-27 4:34 ` Al Viro
2015-01-27 15:15 ` Steven Rostedt
2015-01-27 0:37 ` Al Viro
2015-01-27 1:02 ` Steven Rostedt
2015-01-27 1:03 ` Steven Rostedt
2015-01-27 4:38 ` Al Viro
2015-01-27 15:19 ` Steven Rostedt
2015-01-27 15:44 ` Steven Rostedt
2015-01-26 21:40 ` Al Viro
2015-01-26 23:37 ` Steven Rostedt
2015-01-27 2:34 ` Steven Rostedt
2015-01-27 4:46 ` Al Viro
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20150126151000.193295757@goodmis.org \
--to=rostedt@goodmis.org \
--cc=akpm@linux-foundation.org \
--cc=gregkh@linuxfoundation.org \
--cc=linux-kernel@vger.kernel.org \
--cc=mingo@kernel.org \
--cc=viro@ZenIV.linux.org.uk \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox