diff options
Diffstat (limited to 'drivers/oprofile/oprofilefs.c')
-rw-r--r-- | drivers/oprofile/oprofilefs.c | 44 |
1 files changed, 21 insertions, 23 deletions
diff --git a/drivers/oprofile/oprofilefs.c b/drivers/oprofile/oprofilefs.c index 7c12d9c2b230..3f493459378f 100644 --- a/drivers/oprofile/oprofilefs.c +++ b/drivers/oprofile/oprofilefs.c @@ -132,9 +132,8 @@ static const struct file_operations ulong_ro_fops = { }; -static int __oprofilefs_create_file(struct super_block *sb, - struct dentry *root, char const *name, const struct file_operations *fops, - int perm, void *priv) +static int __oprofilefs_create_file(struct dentry *root, char const *name, + const struct file_operations *fops, int perm, void *priv) { struct dentry *dentry; struct inode *inode; @@ -145,7 +144,7 @@ static int __oprofilefs_create_file(struct super_block *sb, mutex_unlock(&root->d_inode->i_mutex); return -ENOMEM; } - inode = oprofilefs_get_inode(sb, S_IFREG | perm); + inode = oprofilefs_get_inode(root->d_sb, S_IFREG | perm); if (!inode) { dput(dentry); mutex_unlock(&root->d_inode->i_mutex); @@ -159,18 +158,18 @@ static int __oprofilefs_create_file(struct super_block *sb, } -int oprofilefs_create_ulong(struct super_block *sb, struct dentry *root, +int oprofilefs_create_ulong(struct dentry *root, char const *name, unsigned long *val) { - return __oprofilefs_create_file(sb, root, name, + return __oprofilefs_create_file(root, name, &ulong_fops, 0644, val); } -int oprofilefs_create_ro_ulong(struct super_block *sb, struct dentry *root, +int oprofilefs_create_ro_ulong(struct dentry *root, char const *name, unsigned long *val) { - return __oprofilefs_create_file(sb, root, name, + return __oprofilefs_create_file(root, name, &ulong_ro_fops, 0444, val); } @@ -189,50 +188,49 @@ static const struct file_operations atomic_ro_fops = { }; -int oprofilefs_create_ro_atomic(struct super_block *sb, struct dentry *root, +int oprofilefs_create_ro_atomic(struct dentry *root, char const *name, atomic_t *val) { - return __oprofilefs_create_file(sb, root, name, + return __oprofilefs_create_file(root, name, &atomic_ro_fops, 0444, val); } -int oprofilefs_create_file(struct super_block *sb, struct dentry *root, +int oprofilefs_create_file(struct dentry *root, char const *name, const struct file_operations *fops) { - return __oprofilefs_create_file(sb, root, name, fops, 0644, NULL); + return __oprofilefs_create_file(root, name, fops, 0644, NULL); } -int oprofilefs_create_file_perm(struct super_block *sb, struct dentry *root, +int oprofilefs_create_file_perm(struct dentry *root, char const *name, const struct file_operations *fops, int perm) { - return __oprofilefs_create_file(sb, root, name, fops, perm, NULL); + return __oprofilefs_create_file(root, name, fops, perm, NULL); } -struct dentry *oprofilefs_mkdir(struct super_block *sb, - struct dentry *root, char const *name) +struct dentry *oprofilefs_mkdir(struct dentry *parent, char const *name) { struct dentry *dentry; struct inode *inode; - mutex_lock(&root->d_inode->i_mutex); - dentry = d_alloc_name(root, name); + mutex_lock(&parent->d_inode->i_mutex); + dentry = d_alloc_name(parent, name); if (!dentry) { - mutex_unlock(&root->d_inode->i_mutex); + mutex_unlock(&parent->d_inode->i_mutex); return NULL; } - inode = oprofilefs_get_inode(sb, S_IFDIR | 0755); + inode = oprofilefs_get_inode(parent->d_sb, S_IFDIR | 0755); if (!inode) { dput(dentry); - mutex_unlock(&root->d_inode->i_mutex); + mutex_unlock(&parent->d_inode->i_mutex); return NULL; } inode->i_op = &simple_dir_inode_operations; inode->i_fop = &simple_dir_operations; d_add(dentry, inode); - mutex_unlock(&root->d_inode->i_mutex); + mutex_unlock(&parent->d_inode->i_mutex); return dentry; } @@ -256,7 +254,7 @@ static int oprofilefs_fill_super(struct super_block *sb, void *data, int silent) if (!sb->s_root) return -ENOMEM; - oprofile_create_files(sb, sb->s_root); + oprofile_create_files(sb->s_root); // FIXME: verify kill_litter_super removes our dentries return 0; |