From: Ajay Kaher <akaher@vmware.com>
To: rostedt@goodmis.org, mhiramat@kernel.org
Cc: linux-kernel@vger.kernel.org, linux-trace-kernel@vger.kernel.org,
chinglinyu@google.com, namit@vmware.com, srivatsab@vmware.com,
srivatsa@csail.mit.edu, amakhalov@vmware.com,
vsirnapalli@vmware.com, tkundu@vmware.com,
er.ajay.kaher@gmail.com, Ajay Kaher <akaher@vmware.com>
Subject: [PATCH 1/8] eventfs: introducing struct tracefs_inode
Date: Sun, 22 Jan 2023 22:37:00 +0530 [thread overview]
Message-ID: <1674407228-49109-1-git-send-email-akaher@vmware.com> (raw)
Introducing tracefs_inode structure, this will help eventfs
to keep track of inode, flags and pointer to private date.
Renaming, removing static property from some function name.
Signed-off-by: Ajay Kaher <akaher@vmware.com>
Co-developed-by: Steven Rostedt (VMware) <rostedt@goodmis.org>
Signed-off-by: Steven Rostedt (VMware) <rostedt@goodmis.org>
Tested-by: Ching-lin Yu <chinglinyu@google.com>
---
fs/tracefs/inode.c | 20 ++++++++++----------
fs/tracefs/internal.h | 25 +++++++++++++++++++++++++
2 files changed, 35 insertions(+), 10 deletions(-)
create mode 100644 fs/tracefs/internal.h
diff --git a/fs/tracefs/inode.c b/fs/tracefs/inode.c
index da85b39..015b7b8 100644
--- a/fs/tracefs/inode.c
+++ b/fs/tracefs/inode.c
@@ -127,7 +127,7 @@ static const struct inode_operations tracefs_dir_inode_operations = {
.rmdir = tracefs_syscall_rmdir,
};
-static struct inode *tracefs_get_inode(struct super_block *sb)
+struct inode *tracefs_get_inode(struct super_block *sb)
{
struct inode *inode = new_inode(sb);
if (inode) {
@@ -399,7 +399,7 @@ static struct file_system_type trace_fs_type = {
};
MODULE_ALIAS_FS("tracefs");
-static struct dentry *start_creating(const char *name, struct dentry *parent)
+struct dentry *tracefs_start_creating(const char *name, struct dentry *parent)
{
struct dentry *dentry;
int error;
@@ -437,7 +437,7 @@ static struct dentry *start_creating(const char *name, struct dentry *parent)
return dentry;
}
-static struct dentry *failed_creating(struct dentry *dentry)
+struct dentry *tracefs_failed_creating(struct dentry *dentry)
{
inode_unlock(d_inode(dentry->d_parent));
dput(dentry);
@@ -445,7 +445,7 @@ static struct dentry *failed_creating(struct dentry *dentry)
return NULL;
}
-static struct dentry *end_creating(struct dentry *dentry)
+struct dentry *tracefs_end_creating(struct dentry *dentry)
{
inode_unlock(d_inode(dentry->d_parent));
return dentry;
@@ -490,14 +490,14 @@ struct dentry *tracefs_create_file(const char *name, umode_t mode,
if (!(mode & S_IFMT))
mode |= S_IFREG;
BUG_ON(!S_ISREG(mode));
- dentry = start_creating(name, parent);
+ dentry = tracefs_start_creating(name, parent);
if (IS_ERR(dentry))
return NULL;
inode = tracefs_get_inode(dentry->d_sb);
if (unlikely(!inode))
- return failed_creating(dentry);
+ return tracefs_failed_creating(dentry);
inode->i_mode = mode;
inode->i_fop = fops ? fops : &tracefs_file_operations;
@@ -506,13 +506,13 @@ struct dentry *tracefs_create_file(const char *name, umode_t mode,
inode->i_gid = d_inode(dentry->d_parent)->i_gid;
d_instantiate(dentry, inode);
fsnotify_create(d_inode(dentry->d_parent), dentry);
- return end_creating(dentry);
+ return tracefs_end_creating(dentry);
}
static struct dentry *__create_dir(const char *name, struct dentry *parent,
const struct inode_operations *ops)
{
- struct dentry *dentry = start_creating(name, parent);
+ struct dentry *dentry = tracefs_start_creating(name, parent);
struct inode *inode;
if (IS_ERR(dentry))
@@ -520,7 +520,7 @@ static struct dentry *__create_dir(const char *name, struct dentry *parent,
inode = tracefs_get_inode(dentry->d_sb);
if (unlikely(!inode))
- return failed_creating(dentry);
+ return tracefs_failed_creating(dentry);
/* Do not set bits for OTH */
inode->i_mode = S_IFDIR | S_IRWXU | S_IRUSR| S_IRGRP | S_IXUSR | S_IXGRP;
@@ -534,7 +534,7 @@ static struct dentry *__create_dir(const char *name, struct dentry *parent,
d_instantiate(dentry, inode);
inc_nlink(d_inode(dentry->d_parent));
fsnotify_mkdir(d_inode(dentry->d_parent), dentry);
- return end_creating(dentry);
+ return tracefs_end_creating(dentry);
}
/**
diff --git a/fs/tracefs/internal.h b/fs/tracefs/internal.h
new file mode 100644
index 0000000..27869ea
--- /dev/null
+++ b/fs/tracefs/internal.h
@@ -0,0 +1,25 @@
+#ifndef _TRACEFS_INTERNAL_H
+#define _TRACEFS_INTERNAL_H
+
+enum {
+ TRACEFS_EVENT_INODE = BIT(1),
+};
+
+struct tracefs_inode {
+ unsigned long flags;
+ void *private;
+ struct inode vfs_inode;
+};
+
+static inline struct tracefs_inode *get_tracefs(const struct inode *inode)
+{
+ return container_of(inode, struct tracefs_inode, vfs_inode);
+}
+
+struct dentry *tracefs_start_creating(const char *name, struct dentry *parent);
+struct dentry *tracefs_end_creating(struct dentry *dentry);
+struct dentry *tracefs_failed_creating(struct dentry *dentry);
+struct inode *tracefs_get_inode(struct super_block *sb);
+
+#endif
+
--
2.7.4
next reply other threads:[~2023-01-22 17:07 UTC|newest]
Thread overview: 28+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-01-22 17:07 Ajay Kaher [this message]
2023-01-22 17:07 ` [PATCH 2/8] eventfs: adding eventfs dir add functions Ajay Kaher
2023-01-23 2:06 ` kernel test robot
2023-01-23 7:44 ` kernel test robot
2023-01-23 12:04 ` Dan Carpenter
2023-01-22 17:07 ` [PATCH 3/8] eventfs: adding eventfs file " Ajay Kaher
2023-01-22 17:07 ` [PATCH 4/8] eventfs: adding eventfs file, directory remove function Ajay Kaher
2023-01-22 17:07 ` [PATCH 5/8] eventfs: adding functions to create eventfs files and directories Ajay Kaher
2023-01-22 18:45 ` kernel test robot
2023-01-22 20:09 ` kernel test robot
2023-01-23 9:26 ` kernel test robot
2023-01-22 17:07 ` [PATCH 6/8] eventfs: adding eventfs lookup, read, open functions Ajay Kaher
2023-01-22 19:38 ` kernel test robot
2023-01-23 11:49 ` kernel test robot
2023-01-23 16:54 ` Steven Rostedt
2023-01-22 17:07 ` [PATCH 7/8] eventfs: creating tracefs_inode_cache Ajay Kaher
2023-01-22 17:07 ` [PATCH 8/8] eventfs: moving tracing/events to eventfs Ajay Kaher
2023-01-22 21:00 ` kernel test robot
2023-01-23 14:14 ` kernel test robot
2023-01-31 8:08 ` kernel test robot
2023-01-22 17:07 ` [PATCH 0/8] tracing: introducing eventfs Ajay Kaher
2023-01-23 16:51 ` Steven Rostedt
2023-01-29 18:07 ` Ajay Kaher
2023-01-30 6:43 ` Nadav Amit
2023-03-28 22:47 ` Steven Rostedt
2023-03-29 18:00 ` Ajay Kaher
2023-01-23 5:41 ` [PATCH 1/8] eventfs: introducing struct tracefs_inode kernel test robot
2023-01-23 6:01 ` kernel test robot
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=1674407228-49109-1-git-send-email-akaher@vmware.com \
--to=akaher@vmware.com \
--cc=amakhalov@vmware.com \
--cc=chinglinyu@google.com \
--cc=er.ajay.kaher@gmail.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-trace-kernel@vger.kernel.org \
--cc=mhiramat@kernel.org \
--cc=namit@vmware.com \
--cc=rostedt@goodmis.org \
--cc=srivatsa@csail.mit.edu \
--cc=srivatsab@vmware.com \
--cc=tkundu@vmware.com \
--cc=vsirnapalli@vmware.com \
/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;
as well as URLs for NNTP newsgroup(s).