Skip to content

Commit

Permalink
tracefs: Rename and export some tracefs functions
Browse files Browse the repository at this point in the history
Export a few tracefs functions that will be needed by the eventfs dynamic
file system. Rename them to start with "tracefs_" to keep with the name
space.

start_creating -> tracefs_start_creating
failed_creating -> tracefs_failed_creating
end_creating -> tracefs_end_creating

Link: https://lkml.kernel.org/r/1690568452-46553-4-git-send-email-akaher@vmware.com

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>
Signed-off-by: Steven Rostedt (Google) <rostedt@goodmis.org>
  • Loading branch information
Ajay Kaher authored and Steven Rostedt (Google) committed Jul 30, 2023
1 parent ba37ff7 commit 2c6b6b1
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 10 deletions.
20 changes: 10 additions & 10 deletions fs/tracefs/inode.c
Original file line number Diff line number Diff line change
Expand Up @@ -147,7 +147,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) {
Expand Down Expand Up @@ -422,7 +422,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;
Expand Down Expand Up @@ -460,15 +460,15 @@ 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);
simple_release_fs(&tracefs_mount, &tracefs_mount_count);
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;
Expand Down Expand Up @@ -513,14 +513,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;
Expand All @@ -529,21 +529,21 @@ 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))
return NULL;

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;
Expand All @@ -557,7 +557,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);
}

/**
Expand Down
5 changes: 5 additions & 0 deletions fs/tracefs/internal.h
Original file line number Diff line number Diff line change
Expand Up @@ -12,4 +12,9 @@ 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 /* _TRACEFS_INTERNAL_H */

0 comments on commit 2c6b6b1

Please sign in to comment.