Commit ecde2823 authored by Al Viro's avatar Al Viro

oprofilefs_mkdir() doesn't need superblock argument

it's always equal to ->d_sb of the second argument (parent dentry),
due to either being literally that, or ->d_sb of parent's parent.
Signed-off-by: default avatarAl Viro <viro@zeniv.linux.org.uk>
parent 40437c71
...@@ -115,7 +115,7 @@ op_axp_create_files(struct dentry *root) ...@@ -115,7 +115,7 @@ op_axp_create_files(struct dentry *root)
char buf[4]; char buf[4];
snprintf(buf, sizeof buf, "%d", i); snprintf(buf, sizeof buf, "%d", i);
dir = oprofilefs_mkdir(root->d_sb, root, buf); dir = oprofilefs_mkdir(root, buf);
oprofilefs_create_ulong(root->d_sb, dir, "enabled", &ctr[i].enabled); oprofilefs_create_ulong(root->d_sb, dir, "enabled", &ctr[i].enabled);
oprofilefs_create_ulong(root->d_sb, dir, "event", &ctr[i].event); oprofilefs_create_ulong(root->d_sb, dir, "event", &ctr[i].event);
......
...@@ -105,7 +105,7 @@ static int avr32_perf_counter_create_files(struct dentry *root) ...@@ -105,7 +105,7 @@ static int avr32_perf_counter_create_files(struct dentry *root)
for (i = 0; i < NR_counter; i++) { for (i = 0; i < NR_counter; i++) {
snprintf(filename, sizeof(filename), "%u", i); snprintf(filename, sizeof(filename), "%u", i);
dir = oprofilefs_mkdir(root->d_sb, root, filename); dir = oprofilefs_mkdir(root, filename);
oprofilefs_create_ulong(root->d_sb, dir, "enabled", oprofilefs_create_ulong(root->d_sb, dir, "enabled",
&counter[i].enabled); &counter[i].enabled);
......
...@@ -42,7 +42,7 @@ static int op_mips_create_files(struct dentry *root) ...@@ -42,7 +42,7 @@ static int op_mips_create_files(struct dentry *root)
char buf[4]; char buf[4];
snprintf(buf, sizeof buf, "%d", i); snprintf(buf, sizeof buf, "%d", i);
dir = oprofilefs_mkdir(root->d_sb, root, buf); dir = oprofilefs_mkdir(root, buf);
oprofilefs_create_ulong(root->d_sb, dir, "enabled", &ctr[i].enabled); oprofilefs_create_ulong(root->d_sb, dir, "enabled", &ctr[i].enabled);
oprofilefs_create_ulong(root->d_sb, dir, "event", &ctr[i].event); oprofilefs_create_ulong(root->d_sb, dir, "event", &ctr[i].event);
......
...@@ -160,7 +160,7 @@ static int op_powerpc_create_files(struct dentry *root) ...@@ -160,7 +160,7 @@ static int op_powerpc_create_files(struct dentry *root)
char buf[4]; char buf[4];
snprintf(buf, sizeof buf, "%d", i); snprintf(buf, sizeof buf, "%d", i);
dir = oprofilefs_mkdir(root->d_sb, root, buf); dir = oprofilefs_mkdir(root, buf);
oprofilefs_create_ulong(root->d_sb, dir, "enabled", &ctr[i].enabled); oprofilefs_create_ulong(root->d_sb, dir, "enabled", &ctr[i].enabled);
oprofilefs_create_ulong(root->d_sb, dir, "event", &ctr[i].event); oprofilefs_create_ulong(root->d_sb, dir, "event", &ctr[i].event);
......
...@@ -350,7 +350,7 @@ static int oprofile_create_hwsampling_files(struct dentry *root) ...@@ -350,7 +350,7 @@ static int oprofile_create_hwsampling_files(struct dentry *root)
{ {
struct dentry *dir; struct dentry *dir;
dir = oprofilefs_mkdir(root->d_sb, root, "timer"); dir = oprofilefs_mkdir(root, "timer");
if (!dir) if (!dir)
return -EINVAL; return -EINVAL;
...@@ -375,7 +375,7 @@ static int oprofile_create_hwsampling_files(struct dentry *root) ...@@ -375,7 +375,7 @@ static int oprofile_create_hwsampling_files(struct dentry *root)
* and can only be set to 0. * and can only be set to 0.
*/ */
dir = oprofilefs_mkdir(root->d_sb, root, "0"); dir = oprofilefs_mkdir(root, "0");
if (!dir) if (!dir)
return -EINVAL; return -EINVAL;
...@@ -395,7 +395,7 @@ static int oprofile_create_hwsampling_files(struct dentry *root) ...@@ -395,7 +395,7 @@ static int oprofile_create_hwsampling_files(struct dentry *root)
* space tools. The /dev/oprofile/hwsampling fs is * space tools. The /dev/oprofile/hwsampling fs is
* provided in that case. * provided in that case.
*/ */
dir = oprofilefs_mkdir(root->d_sb, root, "hwsampling"); dir = oprofilefs_mkdir(root, "hwsampling");
if (!dir) if (!dir)
return -EINVAL; return -EINVAL;
......
...@@ -420,7 +420,7 @@ static int nmi_create_files(struct dentry *root) ...@@ -420,7 +420,7 @@ static int nmi_create_files(struct dentry *root)
continue; continue;
snprintf(buf, sizeof(buf), "%d", i); snprintf(buf, sizeof(buf), "%d", i);
dir = oprofilefs_mkdir(root->d_sb, root, buf); dir = oprofilefs_mkdir(root, buf);
oprofilefs_create_ulong(root->d_sb, dir, "enabled", &counter_config[i].enabled); oprofilefs_create_ulong(root->d_sb, dir, "enabled", &counter_config[i].enabled);
oprofilefs_create_ulong(root->d_sb, dir, "event", &counter_config[i].event); oprofilefs_create_ulong(root->d_sb, dir, "event", &counter_config[i].event);
oprofilefs_create_ulong(root->d_sb, dir, "count", &counter_config[i].count); oprofilefs_create_ulong(root->d_sb, dir, "count", &counter_config[i].count);
......
...@@ -479,7 +479,7 @@ static int setup_ibs_files(struct dentry *root) ...@@ -479,7 +479,7 @@ static int setup_ibs_files(struct dentry *root)
ibs_config.max_cnt_op = 250000; ibs_config.max_cnt_op = 250000;
if (ibs_caps & IBS_CAPS_FETCHSAM) { if (ibs_caps & IBS_CAPS_FETCHSAM) {
dir = oprofilefs_mkdir(root->d_sb, root, "ibs_fetch"); dir = oprofilefs_mkdir(root, "ibs_fetch");
oprofilefs_create_ulong(root->d_sb, dir, "enable", oprofilefs_create_ulong(root->d_sb, dir, "enable",
&ibs_config.fetch_enabled); &ibs_config.fetch_enabled);
oprofilefs_create_ulong(root->d_sb, dir, "max_count", oprofilefs_create_ulong(root->d_sb, dir, "max_count",
...@@ -489,7 +489,7 @@ static int setup_ibs_files(struct dentry *root) ...@@ -489,7 +489,7 @@ static int setup_ibs_files(struct dentry *root)
} }
if (ibs_caps & IBS_CAPS_OPSAM) { if (ibs_caps & IBS_CAPS_OPSAM) {
dir = oprofilefs_mkdir(root->d_sb, root, "ibs_op"); dir = oprofilefs_mkdir(root, "ibs_op");
oprofilefs_create_ulong(root->d_sb, dir, "enable", oprofilefs_create_ulong(root->d_sb, dir, "enable",
&ibs_config.op_enabled); &ibs_config.op_enabled);
oprofilefs_create_ulong(root->d_sb, dir, "max_count", oprofilefs_create_ulong(root->d_sb, dir, "max_count",
......
...@@ -147,7 +147,7 @@ static int oprofile_perf_create_files(struct dentry *root) ...@@ -147,7 +147,7 @@ static int oprofile_perf_create_files(struct dentry *root)
char buf[4]; char buf[4];
snprintf(buf, sizeof buf, "%d", i); snprintf(buf, sizeof buf, "%d", i);
dir = oprofilefs_mkdir(root->d_sb, root, buf); dir = oprofilefs_mkdir(root, buf);
oprofilefs_create_ulong(root->d_sb, dir, "enabled", &counter_config[i].enabled); oprofilefs_create_ulong(root->d_sb, dir, "enabled", &counter_config[i].enabled);
oprofilefs_create_ulong(root->d_sb, dir, "event", &counter_config[i].event); oprofilefs_create_ulong(root->d_sb, dir, "event", &counter_config[i].event);
oprofilefs_create_ulong(root->d_sb, dir, "count", &counter_config[i].count); oprofilefs_create_ulong(root->d_sb, dir, "count", &counter_config[i].count);
......
...@@ -46,14 +46,14 @@ void oprofile_create_stats_files(struct dentry *root) ...@@ -46,14 +46,14 @@ void oprofile_create_stats_files(struct dentry *root)
char buf[10]; char buf[10];
int i; int i;
dir = oprofilefs_mkdir(root->d_sb, root, "stats"); dir = oprofilefs_mkdir(root, "stats");
if (!dir) if (!dir)
return; return;
for_each_possible_cpu(i) { for_each_possible_cpu(i) {
cpu_buf = &per_cpu(op_cpu_buffer, i); cpu_buf = &per_cpu(op_cpu_buffer, i);
snprintf(buf, 10, "cpu%d", i); snprintf(buf, 10, "cpu%d", i);
cpudir = oprofilefs_mkdir(root->d_sb, dir, buf); cpudir = oprofilefs_mkdir(dir, buf);
/* Strictly speaking access to these ulongs is racy, /* Strictly speaking access to these ulongs is racy,
* but we can't simply lock them, and they are * but we can't simply lock them, and they are
......
...@@ -211,28 +211,27 @@ int oprofilefs_create_file_perm(struct super_block *sb, struct dentry *root, ...@@ -211,28 +211,27 @@ int oprofilefs_create_file_perm(struct super_block *sb, struct dentry *root,
} }
struct dentry *oprofilefs_mkdir(struct super_block *sb, struct dentry *oprofilefs_mkdir(struct dentry *parent, char const *name)
struct dentry *root, char const *name)
{ {
struct dentry *dentry; struct dentry *dentry;
struct inode *inode; struct inode *inode;
mutex_lock(&root->d_inode->i_mutex); mutex_lock(&parent->d_inode->i_mutex);
dentry = d_alloc_name(root, name); dentry = d_alloc_name(parent, name);
if (!dentry) { if (!dentry) {
mutex_unlock(&root->d_inode->i_mutex); mutex_unlock(&parent->d_inode->i_mutex);
return NULL; return NULL;
} }
inode = oprofilefs_get_inode(sb, S_IFDIR | 0755); inode = oprofilefs_get_inode(parent->d_sb, S_IFDIR | 0755);
if (!inode) { if (!inode) {
dput(dentry); dput(dentry);
mutex_unlock(&root->d_inode->i_mutex); mutex_unlock(&parent->d_inode->i_mutex);
return NULL; return NULL;
} }
inode->i_op = &simple_dir_inode_operations; inode->i_op = &simple_dir_inode_operations;
inode->i_fop = &simple_dir_operations; inode->i_fop = &simple_dir_operations;
d_add(dentry, inode); d_add(dentry, inode);
mutex_unlock(&root->d_inode->i_mutex); mutex_unlock(&parent->d_inode->i_mutex);
return dentry; return dentry;
} }
......
...@@ -144,8 +144,7 @@ int oprofilefs_create_ro_atomic(struct super_block * sb, struct dentry * root, ...@@ -144,8 +144,7 @@ int oprofilefs_create_ro_atomic(struct super_block * sb, struct dentry * root,
char const * name, atomic_t * val); char const * name, atomic_t * val);
/** create a directory */ /** create a directory */
struct dentry * oprofilefs_mkdir(struct super_block * sb, struct dentry * root, struct dentry *oprofilefs_mkdir(struct dentry *parent, char const *name);
char const * name);
/** /**
* Write the given asciz string to the given user buffer @buf, updating *offset * Write the given asciz string to the given user buffer @buf, updating *offset
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment