From ef7bca1456e7f65e66b9466c3b149601fe32eec0 Mon Sep 17 00:00:00 2001 From: Al Viro Date: Fri, 19 Jul 2013 15:52:42 +0400 Subject: oprofile: don't bother with passing superblock to ->create_files() Signed-off-by: Al Viro --- arch/alpha/oprofile/common.c | 22 +++++++++++----------- arch/avr32/oprofile/op_model_avr32.c | 17 ++++++++--------- arch/mips/oprofile/common.c | 20 ++++++++++---------- arch/powerpc/oprofile/common.c | 28 ++++++++++++++-------------- arch/s390/oprofile/init.c | 35 +++++++++++++++++------------------ arch/x86/oprofile/nmi_int.c | 18 +++++++++--------- arch/x86/oprofile/op_model_amd.c | 24 ++++++++++++------------ 7 files changed, 81 insertions(+), 83 deletions(-) (limited to 'arch') diff --git a/arch/alpha/oprofile/common.c b/arch/alpha/oprofile/common.c index b8ce18f485d..d79bf68caee 100644 --- a/arch/alpha/oprofile/common.c +++ b/arch/alpha/oprofile/common.c @@ -106,7 +106,7 @@ op_axp_stop(void) } static int -op_axp_create_files(struct super_block *sb, struct dentry *root) +op_axp_create_files(struct dentry *root) { int i; @@ -115,23 +115,23 @@ op_axp_create_files(struct super_block *sb, struct dentry *root) char buf[4]; snprintf(buf, sizeof buf, "%d", i); - dir = oprofilefs_mkdir(sb, root, buf); + dir = oprofilefs_mkdir(root->d_sb, root, buf); - oprofilefs_create_ulong(sb, dir, "enabled", &ctr[i].enabled); - oprofilefs_create_ulong(sb, dir, "event", &ctr[i].event); - oprofilefs_create_ulong(sb, dir, "count", &ctr[i].count); + 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, "count", &ctr[i].count); /* Dummies. */ - oprofilefs_create_ulong(sb, dir, "kernel", &ctr[i].kernel); - oprofilefs_create_ulong(sb, dir, "user", &ctr[i].user); - oprofilefs_create_ulong(sb, dir, "unit_mask", &ctr[i].unit_mask); + oprofilefs_create_ulong(root->d_sb, dir, "kernel", &ctr[i].kernel); + oprofilefs_create_ulong(root->d_sb, dir, "user", &ctr[i].user); + oprofilefs_create_ulong(root->d_sb, dir, "unit_mask", &ctr[i].unit_mask); } if (model->can_set_proc_mode) { - oprofilefs_create_ulong(sb, root, "enable_pal", + oprofilefs_create_ulong(root->d_sb, root, "enable_pal", &sys.enable_pal); - oprofilefs_create_ulong(sb, root, "enable_kernel", + oprofilefs_create_ulong(root->d_sb, root, "enable_kernel", &sys.enable_kernel); - oprofilefs_create_ulong(sb, root, "enable_user", + oprofilefs_create_ulong(root->d_sb, root, "enable_user", &sys.enable_user); } diff --git a/arch/avr32/oprofile/op_model_avr32.c b/arch/avr32/oprofile/op_model_avr32.c index f74b7809e08..80a06158da8 100644 --- a/arch/avr32/oprofile/op_model_avr32.c +++ b/arch/avr32/oprofile/op_model_avr32.c @@ -97,8 +97,7 @@ static irqreturn_t avr32_perf_counter_interrupt(int irq, void *dev_id) return IRQ_HANDLED; } -static int avr32_perf_counter_create_files(struct super_block *sb, - struct dentry *root) +static int avr32_perf_counter_create_files(struct dentry *root) { struct dentry *dir; unsigned int i; @@ -106,21 +105,21 @@ static int avr32_perf_counter_create_files(struct super_block *sb, for (i = 0; i < NR_counter; i++) { snprintf(filename, sizeof(filename), "%u", i); - dir = oprofilefs_mkdir(sb, root, filename); + dir = oprofilefs_mkdir(root->d_sb, root, filename); - oprofilefs_create_ulong(sb, dir, "enabled", + oprofilefs_create_ulong(root->d_sb, dir, "enabled", &counter[i].enabled); - oprofilefs_create_ulong(sb, dir, "event", + oprofilefs_create_ulong(root->d_sb, dir, "event", &counter[i].event); - oprofilefs_create_ulong(sb, dir, "count", + oprofilefs_create_ulong(root->d_sb, dir, "count", &counter[i].count); /* Dummy entries */ - oprofilefs_create_ulong(sb, dir, "kernel", + oprofilefs_create_ulong(root->d_sb, dir, "kernel", &counter[i].kernel); - oprofilefs_create_ulong(sb, dir, "user", + oprofilefs_create_ulong(root->d_sb, dir, "user", &counter[i].user); - oprofilefs_create_ulong(sb, dir, "unit_mask", + oprofilefs_create_ulong(root->d_sb, dir, "unit_mask", &counter[i].unit_mask); } diff --git a/arch/mips/oprofile/common.c b/arch/mips/oprofile/common.c index af763e838fd..7439ae2df05 100644 --- a/arch/mips/oprofile/common.c +++ b/arch/mips/oprofile/common.c @@ -33,7 +33,7 @@ static int op_mips_setup(void) return 0; } -static int op_mips_create_files(struct super_block *sb, struct dentry *root) +static int op_mips_create_files(struct dentry *root) { int i; @@ -42,16 +42,16 @@ static int op_mips_create_files(struct super_block *sb, struct dentry *root) char buf[4]; snprintf(buf, sizeof buf, "%d", i); - dir = oprofilefs_mkdir(sb, root, buf); - - oprofilefs_create_ulong(sb, dir, "enabled", &ctr[i].enabled); - oprofilefs_create_ulong(sb, dir, "event", &ctr[i].event); - oprofilefs_create_ulong(sb, dir, "count", &ctr[i].count); - oprofilefs_create_ulong(sb, dir, "kernel", &ctr[i].kernel); - oprofilefs_create_ulong(sb, dir, "user", &ctr[i].user); - oprofilefs_create_ulong(sb, dir, "exl", &ctr[i].exl); + dir = oprofilefs_mkdir(root->d_sb, root, buf); + + 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, "count", &ctr[i].count); + oprofilefs_create_ulong(root->d_sb, dir, "kernel", &ctr[i].kernel); + oprofilefs_create_ulong(root->d_sb, dir, "user", &ctr[i].user); + oprofilefs_create_ulong(root->d_sb, dir, "exl", &ctr[i].exl); /* Dummy. */ - oprofilefs_create_ulong(sb, dir, "unit_mask", &ctr[i].unit_mask); + oprofilefs_create_ulong(root->d_sb, dir, "unit_mask", &ctr[i].unit_mask); } return 0; diff --git a/arch/powerpc/oprofile/common.c b/arch/powerpc/oprofile/common.c index 4f51025f5b0..addc62317f4 100644 --- a/arch/powerpc/oprofile/common.c +++ b/arch/powerpc/oprofile/common.c @@ -119,7 +119,7 @@ static void op_powerpc_stop(void) model->global_stop(); } -static int op_powerpc_create_files(struct super_block *sb, struct dentry *root) +static int op_powerpc_create_files(struct dentry *root) { int i; @@ -128,9 +128,9 @@ static int op_powerpc_create_files(struct super_block *sb, struct dentry *root) * There is one mmcr0, mmcr1 and mmcra for setting the events for * all of the counters. */ - oprofilefs_create_ulong(sb, root, "mmcr0", &sys.mmcr0); - oprofilefs_create_ulong(sb, root, "mmcr1", &sys.mmcr1); - oprofilefs_create_ulong(sb, root, "mmcra", &sys.mmcra); + oprofilefs_create_ulong(root->d_sb, root, "mmcr0", &sys.mmcr0); + oprofilefs_create_ulong(root->d_sb, root, "mmcr1", &sys.mmcr1); + oprofilefs_create_ulong(root->d_sb, root, "mmcra", &sys.mmcra); #ifdef CONFIG_OPROFILE_CELL /* create a file the user tool can check to see what level of profiling * support exits with this kernel. Initialize bit mask to indicate @@ -142,7 +142,7 @@ static int op_powerpc_create_files(struct super_block *sb, struct dentry *root) * If the file does not exist, then the kernel only supports SPU * cycle profiling, PPU event and cycle profiling. */ - oprofilefs_create_ulong(sb, root, "cell_support", &sys.cell_support); + oprofilefs_create_ulong(root->d_sb, root, "cell_support", &sys.cell_support); sys.cell_support = 0x1; /* Note, the user OProfile tool must check * that this bit is set before attempting to * user SPU event profiling. Older kernels @@ -160,11 +160,11 @@ static int op_powerpc_create_files(struct super_block *sb, struct dentry *root) char buf[4]; snprintf(buf, sizeof buf, "%d", i); - dir = oprofilefs_mkdir(sb, root, buf); + dir = oprofilefs_mkdir(root->d_sb, root, buf); - oprofilefs_create_ulong(sb, dir, "enabled", &ctr[i].enabled); - oprofilefs_create_ulong(sb, dir, "event", &ctr[i].event); - oprofilefs_create_ulong(sb, dir, "count", &ctr[i].count); + 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, "count", &ctr[i].count); /* * Classic PowerPC doesn't support per-counter @@ -173,14 +173,14 @@ static int op_powerpc_create_files(struct super_block *sb, struct dentry *root) * Book-E style performance monitors, we do * support them. */ - oprofilefs_create_ulong(sb, dir, "kernel", &ctr[i].kernel); - oprofilefs_create_ulong(sb, dir, "user", &ctr[i].user); + oprofilefs_create_ulong(root->d_sb, dir, "kernel", &ctr[i].kernel); + oprofilefs_create_ulong(root->d_sb, dir, "user", &ctr[i].user); - oprofilefs_create_ulong(sb, dir, "unit_mask", &ctr[i].unit_mask); + oprofilefs_create_ulong(root->d_sb, dir, "unit_mask", &ctr[i].unit_mask); } - oprofilefs_create_ulong(sb, root, "enable_kernel", &sys.enable_kernel); - oprofilefs_create_ulong(sb, root, "enable_user", &sys.enable_user); + oprofilefs_create_ulong(root->d_sb, root, "enable_kernel", &sys.enable_kernel); + oprofilefs_create_ulong(root->d_sb, root, "enable_user", &sys.enable_user); /* Default to tracing both kernel and user */ sys.enable_kernel = 1; diff --git a/arch/s390/oprofile/init.c b/arch/s390/oprofile/init.c index 930783d2c99..712d57bb783 100644 --- a/arch/s390/oprofile/init.c +++ b/arch/s390/oprofile/init.c @@ -346,16 +346,15 @@ static const struct file_operations timer_enabled_fops = { }; -static int oprofile_create_hwsampling_files(struct super_block *sb, - struct dentry *root) +static int oprofile_create_hwsampling_files(struct dentry *root) { struct dentry *dir; - dir = oprofilefs_mkdir(sb, root, "timer"); + dir = oprofilefs_mkdir(root->d_sb, root, "timer"); if (!dir) return -EINVAL; - oprofilefs_create_file(sb, dir, "enabled", &timer_enabled_fops); + oprofilefs_create_file(root->d_sb, dir, "enabled", &timer_enabled_fops); if (!hwsampler_available) return 0; @@ -376,17 +375,17 @@ static int oprofile_create_hwsampling_files(struct super_block *sb, * and can only be set to 0. */ - dir = oprofilefs_mkdir(sb, root, "0"); + dir = oprofilefs_mkdir(root->d_sb, root, "0"); if (!dir) return -EINVAL; - oprofilefs_create_file(sb, dir, "enabled", &hwsampler_fops); - oprofilefs_create_file(sb, dir, "event", &zero_fops); - oprofilefs_create_file(sb, dir, "count", &hw_interval_fops); - oprofilefs_create_file(sb, dir, "unit_mask", &zero_fops); - oprofilefs_create_file(sb, dir, "kernel", &kernel_fops); - oprofilefs_create_file(sb, dir, "user", &user_fops); - oprofilefs_create_ulong(sb, dir, "hw_sdbt_blocks", + oprofilefs_create_file(root->d_sb, dir, "enabled", &hwsampler_fops); + oprofilefs_create_file(root->d_sb, dir, "event", &zero_fops); + oprofilefs_create_file(root->d_sb, dir, "count", &hw_interval_fops); + oprofilefs_create_file(root->d_sb, dir, "unit_mask", &zero_fops); + oprofilefs_create_file(root->d_sb, dir, "kernel", &kernel_fops); + oprofilefs_create_file(root->d_sb, dir, "user", &user_fops); + oprofilefs_create_ulong(root->d_sb, dir, "hw_sdbt_blocks", &oprofile_sdbt_blocks); } else { @@ -396,19 +395,19 @@ static int oprofile_create_hwsampling_files(struct super_block *sb, * space tools. The /dev/oprofile/hwsampling fs is * provided in that case. */ - dir = oprofilefs_mkdir(sb, root, "hwsampling"); + dir = oprofilefs_mkdir(root->d_sb, root, "hwsampling"); if (!dir) return -EINVAL; - oprofilefs_create_file(sb, dir, "hwsampler", + oprofilefs_create_file(root->d_sb, dir, "hwsampler", &hwsampler_fops); - oprofilefs_create_file(sb, dir, "hw_interval", + oprofilefs_create_file(root->d_sb, dir, "hw_interval", &hw_interval_fops); - oprofilefs_create_ro_ulong(sb, dir, "hw_min_interval", + oprofilefs_create_ro_ulong(root->d_sb, dir, "hw_min_interval", &oprofile_min_interval); - oprofilefs_create_ro_ulong(sb, dir, "hw_max_interval", + oprofilefs_create_ro_ulong(root->d_sb, dir, "hw_max_interval", &oprofile_max_interval); - oprofilefs_create_ulong(sb, dir, "hw_sdbt_blocks", + oprofilefs_create_ulong(root->d_sb, dir, "hw_sdbt_blocks", &oprofile_sdbt_blocks); } return 0; diff --git a/arch/x86/oprofile/nmi_int.c b/arch/x86/oprofile/nmi_int.c index 48768df2471..483f02b8c1a 100644 --- a/arch/x86/oprofile/nmi_int.c +++ b/arch/x86/oprofile/nmi_int.c @@ -403,7 +403,7 @@ static void nmi_cpu_down(void *dummy) nmi_cpu_shutdown(dummy); } -static int nmi_create_files(struct super_block *sb, struct dentry *root) +static int nmi_create_files(struct dentry *root) { unsigned int i; @@ -420,14 +420,14 @@ static int nmi_create_files(struct super_block *sb, struct dentry *root) continue; snprintf(buf, sizeof(buf), "%d", i); - dir = oprofilefs_mkdir(sb, root, buf); - oprofilefs_create_ulong(sb, dir, "enabled", &counter_config[i].enabled); - oprofilefs_create_ulong(sb, dir, "event", &counter_config[i].event); - oprofilefs_create_ulong(sb, dir, "count", &counter_config[i].count); - oprofilefs_create_ulong(sb, dir, "unit_mask", &counter_config[i].unit_mask); - oprofilefs_create_ulong(sb, dir, "kernel", &counter_config[i].kernel); - oprofilefs_create_ulong(sb, dir, "user", &counter_config[i].user); - oprofilefs_create_ulong(sb, dir, "extra", &counter_config[i].extra); + dir = oprofilefs_mkdir(root->d_sb, root, buf); + 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, "count", &counter_config[i].count); + oprofilefs_create_ulong(root->d_sb, dir, "unit_mask", &counter_config[i].unit_mask); + oprofilefs_create_ulong(root->d_sb, dir, "kernel", &counter_config[i].kernel); + oprofilefs_create_ulong(root->d_sb, dir, "user", &counter_config[i].user); + oprofilefs_create_ulong(root->d_sb, dir, "extra", &counter_config[i].extra); } return 0; diff --git a/arch/x86/oprofile/op_model_amd.c b/arch/x86/oprofile/op_model_amd.c index b2b94438ff0..34e16c2fe35 100644 --- a/arch/x86/oprofile/op_model_amd.c +++ b/arch/x86/oprofile/op_model_amd.c @@ -454,16 +454,16 @@ static void init_ibs(void) printk(KERN_INFO "oprofile: AMD IBS detected (0x%08x)\n", ibs_caps); } -static int (*create_arch_files)(struct super_block *sb, struct dentry *root); +static int (*create_arch_files)(struct dentry *root); -static int setup_ibs_files(struct super_block *sb, struct dentry *root) +static int setup_ibs_files(struct dentry *root) { struct dentry *dir; int ret = 0; /* architecture specific files */ if (create_arch_files) - ret = create_arch_files(sb, root); + ret = create_arch_files(root); if (ret) return ret; @@ -479,26 +479,26 @@ static int setup_ibs_files(struct super_block *sb, struct dentry *root) ibs_config.max_cnt_op = 250000; if (ibs_caps & IBS_CAPS_FETCHSAM) { - dir = oprofilefs_mkdir(sb, root, "ibs_fetch"); - oprofilefs_create_ulong(sb, dir, "enable", + dir = oprofilefs_mkdir(root->d_sb, root, "ibs_fetch"); + oprofilefs_create_ulong(root->d_sb, dir, "enable", &ibs_config.fetch_enabled); - oprofilefs_create_ulong(sb, dir, "max_count", + oprofilefs_create_ulong(root->d_sb, dir, "max_count", &ibs_config.max_cnt_fetch); - oprofilefs_create_ulong(sb, dir, "rand_enable", + oprofilefs_create_ulong(root->d_sb, dir, "rand_enable", &ibs_config.rand_en); } if (ibs_caps & IBS_CAPS_OPSAM) { - dir = oprofilefs_mkdir(sb, root, "ibs_op"); - oprofilefs_create_ulong(sb, dir, "enable", + dir = oprofilefs_mkdir(root->d_sb, root, "ibs_op"); + oprofilefs_create_ulong(root->d_sb, dir, "enable", &ibs_config.op_enabled); - oprofilefs_create_ulong(sb, dir, "max_count", + oprofilefs_create_ulong(root->d_sb, dir, "max_count", &ibs_config.max_cnt_op); if (ibs_caps & IBS_CAPS_OPCNT) - oprofilefs_create_ulong(sb, dir, "dispatched_ops", + oprofilefs_create_ulong(root->d_sb, dir, "dispatched_ops", &ibs_config.dispatched_ops); if (ibs_caps & IBS_CAPS_BRNTRGT) - oprofilefs_create_ulong(sb, dir, "branch_target", + oprofilefs_create_ulong(root->d_sb, dir, "branch_target", &ibs_config.branch_target); } -- cgit v1.2.3-70-g09d2 From ecde28237e10de3750a97579f42bc2ec65b8a0e1 Mon Sep 17 00:00:00 2001 From: Al Viro Date: Fri, 19 Jul 2013 15:58:27 +0400 Subject: 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: Al Viro --- arch/alpha/oprofile/common.c | 2 +- arch/avr32/oprofile/op_model_avr32.c | 2 +- arch/mips/oprofile/common.c | 2 +- arch/powerpc/oprofile/common.c | 2 +- arch/s390/oprofile/init.c | 6 +++--- arch/x86/oprofile/nmi_int.c | 2 +- arch/x86/oprofile/op_model_amd.c | 4 ++-- drivers/oprofile/oprofile_perf.c | 2 +- drivers/oprofile/oprofile_stats.c | 4 ++-- drivers/oprofile/oprofilefs.c | 15 +++++++-------- include/linux/oprofile.h | 3 +-- 11 files changed, 21 insertions(+), 23 deletions(-) (limited to 'arch') diff --git a/arch/alpha/oprofile/common.c b/arch/alpha/oprofile/common.c index d79bf68caee..a44608b697a 100644 --- a/arch/alpha/oprofile/common.c +++ b/arch/alpha/oprofile/common.c @@ -115,7 +115,7 @@ op_axp_create_files(struct dentry *root) char buf[4]; 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, "event", &ctr[i].event); diff --git a/arch/avr32/oprofile/op_model_avr32.c b/arch/avr32/oprofile/op_model_avr32.c index 80a06158da8..7d920a41b44 100644 --- a/arch/avr32/oprofile/op_model_avr32.c +++ b/arch/avr32/oprofile/op_model_avr32.c @@ -105,7 +105,7 @@ static int avr32_perf_counter_create_files(struct dentry *root) for (i = 0; i < NR_counter; 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", &counter[i].enabled); diff --git a/arch/mips/oprofile/common.c b/arch/mips/oprofile/common.c index 7439ae2df05..755caf04656 100644 --- a/arch/mips/oprofile/common.c +++ b/arch/mips/oprofile/common.c @@ -42,7 +42,7 @@ static int op_mips_create_files(struct dentry *root) char buf[4]; 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, "event", &ctr[i].event); diff --git a/arch/powerpc/oprofile/common.c b/arch/powerpc/oprofile/common.c index addc62317f4..60a286b367f 100644 --- a/arch/powerpc/oprofile/common.c +++ b/arch/powerpc/oprofile/common.c @@ -160,7 +160,7 @@ static int op_powerpc_create_files(struct dentry *root) char buf[4]; 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, "event", &ctr[i].event); diff --git a/arch/s390/oprofile/init.c b/arch/s390/oprofile/init.c index 712d57bb783..5ae06db7ec5 100644 --- a/arch/s390/oprofile/init.c +++ b/arch/s390/oprofile/init.c @@ -350,7 +350,7 @@ static int oprofile_create_hwsampling_files(struct dentry *root) { struct dentry *dir; - dir = oprofilefs_mkdir(root->d_sb, root, "timer"); + dir = oprofilefs_mkdir(root, "timer"); if (!dir) return -EINVAL; @@ -375,7 +375,7 @@ static int oprofile_create_hwsampling_files(struct dentry *root) * and can only be set to 0. */ - dir = oprofilefs_mkdir(root->d_sb, root, "0"); + dir = oprofilefs_mkdir(root, "0"); if (!dir) return -EINVAL; @@ -395,7 +395,7 @@ static int oprofile_create_hwsampling_files(struct dentry *root) * space tools. The /dev/oprofile/hwsampling fs is * provided in that case. */ - dir = oprofilefs_mkdir(root->d_sb, root, "hwsampling"); + dir = oprofilefs_mkdir(root, "hwsampling"); if (!dir) return -EINVAL; diff --git a/arch/x86/oprofile/nmi_int.c b/arch/x86/oprofile/nmi_int.c index 483f02b8c1a..8bb2de6e103 100644 --- a/arch/x86/oprofile/nmi_int.c +++ b/arch/x86/oprofile/nmi_int.c @@ -420,7 +420,7 @@ static int nmi_create_files(struct dentry *root) continue; 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, "event", &counter_config[i].event); oprofilefs_create_ulong(root->d_sb, dir, "count", &counter_config[i].count); diff --git a/arch/x86/oprofile/op_model_amd.c b/arch/x86/oprofile/op_model_amd.c index 34e16c2fe35..99131435ea3 100644 --- a/arch/x86/oprofile/op_model_amd.c +++ b/arch/x86/oprofile/op_model_amd.c @@ -479,7 +479,7 @@ static int setup_ibs_files(struct dentry *root) ibs_config.max_cnt_op = 250000; 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", &ibs_config.fetch_enabled); oprofilefs_create_ulong(root->d_sb, dir, "max_count", @@ -489,7 +489,7 @@ static int setup_ibs_files(struct dentry *root) } 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", &ibs_config.op_enabled); oprofilefs_create_ulong(root->d_sb, dir, "max_count", diff --git a/drivers/oprofile/oprofile_perf.c b/drivers/oprofile/oprofile_perf.c index 52ad942df04..923a245774f 100644 --- a/drivers/oprofile/oprofile_perf.c +++ b/drivers/oprofile/oprofile_perf.c @@ -147,7 +147,7 @@ static int oprofile_perf_create_files(struct dentry *root) char buf[4]; 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, "event", &counter_config[i].event); oprofilefs_create_ulong(root->d_sb, dir, "count", &counter_config[i].count); diff --git a/drivers/oprofile/oprofile_stats.c b/drivers/oprofile/oprofile_stats.c index 627dce47831..8cf2fa9710a 100644 --- a/drivers/oprofile/oprofile_stats.c +++ b/drivers/oprofile/oprofile_stats.c @@ -46,14 +46,14 @@ void oprofile_create_stats_files(struct dentry *root) char buf[10]; int i; - dir = oprofilefs_mkdir(root->d_sb, root, "stats"); + dir = oprofilefs_mkdir(root, "stats"); if (!dir) return; for_each_possible_cpu(i) { cpu_buf = &per_cpu(op_cpu_buffer, 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, * but we can't simply lock them, and they are diff --git a/drivers/oprofile/oprofilefs.c b/drivers/oprofile/oprofilefs.c index 2e2dd5ca721..6a345724637 100644 --- a/drivers/oprofile/oprofilefs.c +++ b/drivers/oprofile/oprofilefs.c @@ -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 *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; } diff --git a/include/linux/oprofile.h b/include/linux/oprofile.h index 8a906b4034a..957877e7a40 100644 --- a/include/linux/oprofile.h +++ b/include/linux/oprofile.h @@ -144,8 +144,7 @@ int oprofilefs_create_ro_atomic(struct super_block * sb, struct dentry * root, char const * name, atomic_t * val); /** create a directory */ -struct dentry * oprofilefs_mkdir(struct super_block * sb, struct dentry * root, - char const * name); +struct dentry *oprofilefs_mkdir(struct dentry *parent, char const *name); /** * Write the given asciz string to the given user buffer @buf, updating *offset -- cgit v1.2.3-70-g09d2 From 6af4ea0ba708172be8caf1ba5047b2b8a9d2fea3 Mon Sep 17 00:00:00 2001 From: Al Viro Date: Fri, 19 Jul 2013 16:10:36 +0400 Subject: oprofilefs_create_...() do not need superblock argument same story as with oprofilefs_mkdir() Signed-off-by: Al Viro --- arch/alpha/oprofile/common.c | 18 +++++++++--------- arch/avr32/oprofile/op_model_avr32.c | 12 ++++++------ arch/mips/oprofile/common.c | 14 +++++++------- arch/powerpc/oprofile/common.c | 24 ++++++++++++------------ arch/s390/oprofile/init.c | 26 +++++++++++++------------- arch/x86/oprofile/nmi_int.c | 14 +++++++------- arch/x86/oprofile/op_model_amd.c | 14 +++++++------- drivers/oprofile/oprofile_files.c | 20 ++++++++++---------- drivers/oprofile/oprofile_perf.c | 12 ++++++------ drivers/oprofile/oprofile_stats.c | 18 +++++++++--------- drivers/oprofile/oprofilefs.c | 27 +++++++++++++-------------- include/linux/oprofile.h | 10 +++++----- 12 files changed, 104 insertions(+), 105 deletions(-) (limited to 'arch') diff --git a/arch/alpha/oprofile/common.c b/arch/alpha/oprofile/common.c index a44608b697a..310a4ce1dcc 100644 --- a/arch/alpha/oprofile/common.c +++ b/arch/alpha/oprofile/common.c @@ -117,21 +117,21 @@ op_axp_create_files(struct dentry *root) snprintf(buf, sizeof buf, "%d", i); dir = oprofilefs_mkdir(root, buf); - 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, "count", &ctr[i].count); + oprofilefs_create_ulong(dir, "enabled", &ctr[i].enabled); + oprofilefs_create_ulong(dir, "event", &ctr[i].event); + oprofilefs_create_ulong(dir, "count", &ctr[i].count); /* Dummies. */ - oprofilefs_create_ulong(root->d_sb, dir, "kernel", &ctr[i].kernel); - oprofilefs_create_ulong(root->d_sb, dir, "user", &ctr[i].user); - oprofilefs_create_ulong(root->d_sb, dir, "unit_mask", &ctr[i].unit_mask); + oprofilefs_create_ulong(dir, "kernel", &ctr[i].kernel); + oprofilefs_create_ulong(dir, "user", &ctr[i].user); + oprofilefs_create_ulong(dir, "unit_mask", &ctr[i].unit_mask); } if (model->can_set_proc_mode) { - oprofilefs_create_ulong(root->d_sb, root, "enable_pal", + oprofilefs_create_ulong(root, "enable_pal", &sys.enable_pal); - oprofilefs_create_ulong(root->d_sb, root, "enable_kernel", + oprofilefs_create_ulong(root, "enable_kernel", &sys.enable_kernel); - oprofilefs_create_ulong(root->d_sb, root, "enable_user", + oprofilefs_create_ulong(root, "enable_user", &sys.enable_user); } diff --git a/arch/avr32/oprofile/op_model_avr32.c b/arch/avr32/oprofile/op_model_avr32.c index 7d920a41b44..08308be2c02 100644 --- a/arch/avr32/oprofile/op_model_avr32.c +++ b/arch/avr32/oprofile/op_model_avr32.c @@ -107,19 +107,19 @@ static int avr32_perf_counter_create_files(struct dentry *root) snprintf(filename, sizeof(filename), "%u", i); dir = oprofilefs_mkdir(root, filename); - oprofilefs_create_ulong(root->d_sb, dir, "enabled", + oprofilefs_create_ulong(dir, "enabled", &counter[i].enabled); - oprofilefs_create_ulong(root->d_sb, dir, "event", + oprofilefs_create_ulong(dir, "event", &counter[i].event); - oprofilefs_create_ulong(root->d_sb, dir, "count", + oprofilefs_create_ulong(dir, "count", &counter[i].count); /* Dummy entries */ - oprofilefs_create_ulong(root->d_sb, dir, "kernel", + oprofilefs_create_ulong(dir, "kernel", &counter[i].kernel); - oprofilefs_create_ulong(root->d_sb, dir, "user", + oprofilefs_create_ulong(dir, "user", &counter[i].user); - oprofilefs_create_ulong(root->d_sb, dir, "unit_mask", + oprofilefs_create_ulong(dir, "unit_mask", &counter[i].unit_mask); } diff --git a/arch/mips/oprofile/common.c b/arch/mips/oprofile/common.c index 755caf04656..5e5424753b5 100644 --- a/arch/mips/oprofile/common.c +++ b/arch/mips/oprofile/common.c @@ -44,14 +44,14 @@ static int op_mips_create_files(struct dentry *root) snprintf(buf, sizeof buf, "%d", i); dir = oprofilefs_mkdir(root, buf); - 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, "count", &ctr[i].count); - oprofilefs_create_ulong(root->d_sb, dir, "kernel", &ctr[i].kernel); - oprofilefs_create_ulong(root->d_sb, dir, "user", &ctr[i].user); - oprofilefs_create_ulong(root->d_sb, dir, "exl", &ctr[i].exl); + oprofilefs_create_ulong(dir, "enabled", &ctr[i].enabled); + oprofilefs_create_ulong(dir, "event", &ctr[i].event); + oprofilefs_create_ulong(dir, "count", &ctr[i].count); + oprofilefs_create_ulong(dir, "kernel", &ctr[i].kernel); + oprofilefs_create_ulong(dir, "user", &ctr[i].user); + oprofilefs_create_ulong(dir, "exl", &ctr[i].exl); /* Dummy. */ - oprofilefs_create_ulong(root->d_sb, dir, "unit_mask", &ctr[i].unit_mask); + oprofilefs_create_ulong(dir, "unit_mask", &ctr[i].unit_mask); } return 0; diff --git a/arch/powerpc/oprofile/common.c b/arch/powerpc/oprofile/common.c index 60a286b367f..c77348c5d46 100644 --- a/arch/powerpc/oprofile/common.c +++ b/arch/powerpc/oprofile/common.c @@ -128,9 +128,9 @@ static int op_powerpc_create_files(struct dentry *root) * There is one mmcr0, mmcr1 and mmcra for setting the events for * all of the counters. */ - oprofilefs_create_ulong(root->d_sb, root, "mmcr0", &sys.mmcr0); - oprofilefs_create_ulong(root->d_sb, root, "mmcr1", &sys.mmcr1); - oprofilefs_create_ulong(root->d_sb, root, "mmcra", &sys.mmcra); + oprofilefs_create_ulong(root, "mmcr0", &sys.mmcr0); + oprofilefs_create_ulong(root, "mmcr1", &sys.mmcr1); + oprofilefs_create_ulong(root, "mmcra", &sys.mmcra); #ifdef CONFIG_OPROFILE_CELL /* create a file the user tool can check to see what level of profiling * support exits with this kernel. Initialize bit mask to indicate @@ -142,7 +142,7 @@ static int op_powerpc_create_files(struct dentry *root) * If the file does not exist, then the kernel only supports SPU * cycle profiling, PPU event and cycle profiling. */ - oprofilefs_create_ulong(root->d_sb, root, "cell_support", &sys.cell_support); + oprofilefs_create_ulong(root, "cell_support", &sys.cell_support); sys.cell_support = 0x1; /* Note, the user OProfile tool must check * that this bit is set before attempting to * user SPU event profiling. Older kernels @@ -162,9 +162,9 @@ static int op_powerpc_create_files(struct dentry *root) snprintf(buf, sizeof buf, "%d", i); dir = oprofilefs_mkdir(root, buf); - 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, "count", &ctr[i].count); + oprofilefs_create_ulong(dir, "enabled", &ctr[i].enabled); + oprofilefs_create_ulong(dir, "event", &ctr[i].event); + oprofilefs_create_ulong(dir, "count", &ctr[i].count); /* * Classic PowerPC doesn't support per-counter @@ -173,14 +173,14 @@ static int op_powerpc_create_files(struct dentry *root) * Book-E style performance monitors, we do * support them. */ - oprofilefs_create_ulong(root->d_sb, dir, "kernel", &ctr[i].kernel); - oprofilefs_create_ulong(root->d_sb, dir, "user", &ctr[i].user); + oprofilefs_create_ulong(dir, "kernel", &ctr[i].kernel); + oprofilefs_create_ulong(dir, "user", &ctr[i].user); - oprofilefs_create_ulong(root->d_sb, dir, "unit_mask", &ctr[i].unit_mask); + oprofilefs_create_ulong(dir, "unit_mask", &ctr[i].unit_mask); } - oprofilefs_create_ulong(root->d_sb, root, "enable_kernel", &sys.enable_kernel); - oprofilefs_create_ulong(root->d_sb, root, "enable_user", &sys.enable_user); + oprofilefs_create_ulong(root, "enable_kernel", &sys.enable_kernel); + oprofilefs_create_ulong(root, "enable_user", &sys.enable_user); /* Default to tracing both kernel and user */ sys.enable_kernel = 1; diff --git a/arch/s390/oprofile/init.c b/arch/s390/oprofile/init.c index 5ae06db7ec5..04e1b6a8536 100644 --- a/arch/s390/oprofile/init.c +++ b/arch/s390/oprofile/init.c @@ -354,7 +354,7 @@ static int oprofile_create_hwsampling_files(struct dentry *root) if (!dir) return -EINVAL; - oprofilefs_create_file(root->d_sb, dir, "enabled", &timer_enabled_fops); + oprofilefs_create_file(dir, "enabled", &timer_enabled_fops); if (!hwsampler_available) return 0; @@ -379,13 +379,13 @@ static int oprofile_create_hwsampling_files(struct dentry *root) if (!dir) return -EINVAL; - oprofilefs_create_file(root->d_sb, dir, "enabled", &hwsampler_fops); - oprofilefs_create_file(root->d_sb, dir, "event", &zero_fops); - oprofilefs_create_file(root->d_sb, dir, "count", &hw_interval_fops); - oprofilefs_create_file(root->d_sb, dir, "unit_mask", &zero_fops); - oprofilefs_create_file(root->d_sb, dir, "kernel", &kernel_fops); - oprofilefs_create_file(root->d_sb, dir, "user", &user_fops); - oprofilefs_create_ulong(root->d_sb, dir, "hw_sdbt_blocks", + oprofilefs_create_file(dir, "enabled", &hwsampler_fops); + oprofilefs_create_file(dir, "event", &zero_fops); + oprofilefs_create_file(dir, "count", &hw_interval_fops); + oprofilefs_create_file(dir, "unit_mask", &zero_fops); + oprofilefs_create_file(dir, "kernel", &kernel_fops); + oprofilefs_create_file(dir, "user", &user_fops); + oprofilefs_create_ulong(dir, "hw_sdbt_blocks", &oprofile_sdbt_blocks); } else { @@ -399,15 +399,15 @@ static int oprofile_create_hwsampling_files(struct dentry *root) if (!dir) return -EINVAL; - oprofilefs_create_file(root->d_sb, dir, "hwsampler", + oprofilefs_create_file(dir, "hwsampler", &hwsampler_fops); - oprofilefs_create_file(root->d_sb, dir, "hw_interval", + oprofilefs_create_file(dir, "hw_interval", &hw_interval_fops); - oprofilefs_create_ro_ulong(root->d_sb, dir, "hw_min_interval", + oprofilefs_create_ro_ulong(dir, "hw_min_interval", &oprofile_min_interval); - oprofilefs_create_ro_ulong(root->d_sb, dir, "hw_max_interval", + oprofilefs_create_ro_ulong(dir, "hw_max_interval", &oprofile_max_interval); - oprofilefs_create_ulong(root->d_sb, dir, "hw_sdbt_blocks", + oprofilefs_create_ulong(dir, "hw_sdbt_blocks", &oprofile_sdbt_blocks); } return 0; diff --git a/arch/x86/oprofile/nmi_int.c b/arch/x86/oprofile/nmi_int.c index 8bb2de6e103..6890d8498e0 100644 --- a/arch/x86/oprofile/nmi_int.c +++ b/arch/x86/oprofile/nmi_int.c @@ -421,13 +421,13 @@ static int nmi_create_files(struct dentry *root) snprintf(buf, sizeof(buf), "%d", i); dir = oprofilefs_mkdir(root, buf); - 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, "count", &counter_config[i].count); - oprofilefs_create_ulong(root->d_sb, dir, "unit_mask", &counter_config[i].unit_mask); - oprofilefs_create_ulong(root->d_sb, dir, "kernel", &counter_config[i].kernel); - oprofilefs_create_ulong(root->d_sb, dir, "user", &counter_config[i].user); - oprofilefs_create_ulong(root->d_sb, dir, "extra", &counter_config[i].extra); + oprofilefs_create_ulong(dir, "enabled", &counter_config[i].enabled); + oprofilefs_create_ulong(dir, "event", &counter_config[i].event); + oprofilefs_create_ulong(dir, "count", &counter_config[i].count); + oprofilefs_create_ulong(dir, "unit_mask", &counter_config[i].unit_mask); + oprofilefs_create_ulong(dir, "kernel", &counter_config[i].kernel); + oprofilefs_create_ulong(dir, "user", &counter_config[i].user); + oprofilefs_create_ulong(dir, "extra", &counter_config[i].extra); } return 0; diff --git a/arch/x86/oprofile/op_model_amd.c b/arch/x86/oprofile/op_model_amd.c index 99131435ea3..50d86c0e9ba 100644 --- a/arch/x86/oprofile/op_model_amd.c +++ b/arch/x86/oprofile/op_model_amd.c @@ -480,25 +480,25 @@ static int setup_ibs_files(struct dentry *root) if (ibs_caps & IBS_CAPS_FETCHSAM) { dir = oprofilefs_mkdir(root, "ibs_fetch"); - oprofilefs_create_ulong(root->d_sb, dir, "enable", + oprofilefs_create_ulong(dir, "enable", &ibs_config.fetch_enabled); - oprofilefs_create_ulong(root->d_sb, dir, "max_count", + oprofilefs_create_ulong(dir, "max_count", &ibs_config.max_cnt_fetch); - oprofilefs_create_ulong(root->d_sb, dir, "rand_enable", + oprofilefs_create_ulong(dir, "rand_enable", &ibs_config.rand_en); } if (ibs_caps & IBS_CAPS_OPSAM) { dir = oprofilefs_mkdir(root, "ibs_op"); - oprofilefs_create_ulong(root->d_sb, dir, "enable", + oprofilefs_create_ulong(dir, "enable", &ibs_config.op_enabled); - oprofilefs_create_ulong(root->d_sb, dir, "max_count", + oprofilefs_create_ulong(dir, "max_count", &ibs_config.max_cnt_op); if (ibs_caps & IBS_CAPS_OPCNT) - oprofilefs_create_ulong(root->d_sb, dir, "dispatched_ops", + oprofilefs_create_ulong(dir, "dispatched_ops", &ibs_config.dispatched_ops); if (ibs_caps & IBS_CAPS_BRNTRGT) - oprofilefs_create_ulong(root->d_sb, dir, "branch_target", + oprofilefs_create_ulong(dir, "branch_target", &ibs_config.branch_target); } diff --git a/drivers/oprofile/oprofile_files.c b/drivers/oprofile/oprofile_files.c index 07462a9af61..ee2cfce358b 100644 --- a/drivers/oprofile/oprofile_files.c +++ b/drivers/oprofile/oprofile_files.c @@ -183,17 +183,17 @@ void oprofile_create_files(struct dentry *root) oprofile_buffer_watershed = BUFFER_WATERSHED_DEFAULT; oprofile_time_slice = msecs_to_jiffies(TIME_SLICE_DEFAULT); - oprofilefs_create_file(root->d_sb, root, "enable", &enable_fops); - oprofilefs_create_file_perm(root->d_sb, root, "dump", &dump_fops, 0666); - oprofilefs_create_file(root->d_sb, root, "buffer", &event_buffer_fops); - oprofilefs_create_ulong(root->d_sb, root, "buffer_size", &oprofile_buffer_size); - oprofilefs_create_ulong(root->d_sb, root, "buffer_watershed", &oprofile_buffer_watershed); - oprofilefs_create_ulong(root->d_sb, root, "cpu_buffer_size", &oprofile_cpu_buffer_size); - oprofilefs_create_file(root->d_sb, root, "cpu_type", &cpu_type_fops); - oprofilefs_create_file(root->d_sb, root, "backtrace_depth", &depth_fops); - oprofilefs_create_file(root->d_sb, root, "pointer_size", &pointer_size_fops); + oprofilefs_create_file(root, "enable", &enable_fops); + oprofilefs_create_file_perm(root, "dump", &dump_fops, 0666); + oprofilefs_create_file(root, "buffer", &event_buffer_fops); + oprofilefs_create_ulong(root, "buffer_size", &oprofile_buffer_size); + oprofilefs_create_ulong(root, "buffer_watershed", &oprofile_buffer_watershed); + oprofilefs_create_ulong(root, "cpu_buffer_size", &oprofile_cpu_buffer_size); + oprofilefs_create_file(root, "cpu_type", &cpu_type_fops); + oprofilefs_create_file(root, "backtrace_depth", &depth_fops); + oprofilefs_create_file(root, "pointer_size", &pointer_size_fops); #ifdef CONFIG_OPROFILE_EVENT_MULTIPLEX - oprofilefs_create_file(root->d_sb, root, "time_slice", &timeout_fops); + oprofilefs_create_file(root, "time_slice", &timeout_fops); #endif oprofile_create_stats_files(root); if (oprofile_ops.create_files) diff --git a/drivers/oprofile/oprofile_perf.c b/drivers/oprofile/oprofile_perf.c index 923a245774f..d5b2732b1b8 100644 --- a/drivers/oprofile/oprofile_perf.c +++ b/drivers/oprofile/oprofile_perf.c @@ -148,12 +148,12 @@ static int oprofile_perf_create_files(struct dentry *root) snprintf(buf, sizeof buf, "%d", i); dir = oprofilefs_mkdir(root, buf); - 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, "count", &counter_config[i].count); - oprofilefs_create_ulong(root->d_sb, dir, "unit_mask", &counter_config[i].unit_mask); - oprofilefs_create_ulong(root->d_sb, dir, "kernel", &counter_config[i].kernel); - oprofilefs_create_ulong(root->d_sb, dir, "user", &counter_config[i].user); + oprofilefs_create_ulong(dir, "enabled", &counter_config[i].enabled); + oprofilefs_create_ulong(dir, "event", &counter_config[i].event); + oprofilefs_create_ulong(dir, "count", &counter_config[i].count); + oprofilefs_create_ulong(dir, "unit_mask", &counter_config[i].unit_mask); + oprofilefs_create_ulong(dir, "kernel", &counter_config[i].kernel); + oprofilefs_create_ulong(dir, "user", &counter_config[i].user); } return 0; diff --git a/drivers/oprofile/oprofile_stats.c b/drivers/oprofile/oprofile_stats.c index 8cf2fa9710a..59659cea458 100644 --- a/drivers/oprofile/oprofile_stats.c +++ b/drivers/oprofile/oprofile_stats.c @@ -59,26 +59,26 @@ void oprofile_create_stats_files(struct dentry *root) * but we can't simply lock them, and they are * informational only. */ - oprofilefs_create_ro_ulong(root->d_sb, cpudir, "sample_received", + oprofilefs_create_ro_ulong(cpudir, "sample_received", &cpu_buf->sample_received); - oprofilefs_create_ro_ulong(root->d_sb, cpudir, "sample_lost_overflow", + oprofilefs_create_ro_ulong(cpudir, "sample_lost_overflow", &cpu_buf->sample_lost_overflow); - oprofilefs_create_ro_ulong(root->d_sb, cpudir, "backtrace_aborted", + oprofilefs_create_ro_ulong(cpudir, "backtrace_aborted", &cpu_buf->backtrace_aborted); - oprofilefs_create_ro_ulong(root->d_sb, cpudir, "sample_invalid_eip", + oprofilefs_create_ro_ulong(cpudir, "sample_invalid_eip", &cpu_buf->sample_invalid_eip); } - oprofilefs_create_ro_atomic(root->d_sb, dir, "sample_lost_no_mm", + oprofilefs_create_ro_atomic(dir, "sample_lost_no_mm", &oprofile_stats.sample_lost_no_mm); - oprofilefs_create_ro_atomic(root->d_sb, dir, "sample_lost_no_mapping", + oprofilefs_create_ro_atomic(dir, "sample_lost_no_mapping", &oprofile_stats.sample_lost_no_mapping); - oprofilefs_create_ro_atomic(root->d_sb, dir, "event_lost_overflow", + oprofilefs_create_ro_atomic(dir, "event_lost_overflow", &oprofile_stats.event_lost_overflow); - oprofilefs_create_ro_atomic(root->d_sb, dir, "bt_lost_no_mapping", + oprofilefs_create_ro_atomic(dir, "bt_lost_no_mapping", &oprofile_stats.bt_lost_no_mapping); #ifdef CONFIG_OPROFILE_EVENT_MULTIPLEX - oprofilefs_create_ro_atomic(root->d_sb, dir, "multiplex_counter", + oprofilefs_create_ro_atomic(dir, "multiplex_counter", &oprofile_stats.multiplex_counter); #endif } diff --git a/drivers/oprofile/oprofilefs.c b/drivers/oprofile/oprofilefs.c index 6a345724637..3f493459378 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,25 +188,25 @@ 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); } diff --git a/include/linux/oprofile.h b/include/linux/oprofile.h index 957877e7a40..166ef4fb4b5 100644 --- a/include/linux/oprofile.h +++ b/include/linux/oprofile.h @@ -125,22 +125,22 @@ void oprofile_add_trace(unsigned long eip); * Create a file of the given name as a child of the given root, with * the specified file operations. */ -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); -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); /** Create a file for read/write access to an unsigned long. */ -int oprofilefs_create_ulong(struct super_block * sb, struct dentry * root, +int oprofilefs_create_ulong(struct dentry * root, char const * name, ulong * val); /** Create a file for read-only access to an unsigned long. */ -int oprofilefs_create_ro_ulong(struct super_block * sb, struct dentry * root, +int oprofilefs_create_ro_ulong(struct dentry * root, char const * name, ulong * val); /** Create a file for read-only access to an atomic_t. */ -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); /** create a directory */ -- cgit v1.2.3-70-g09d2 From f78e41e3faca3f8c52a1eadbdd6ae547ae771046 Mon Sep 17 00:00:00 2001 From: Al Viro Date: Fri, 19 Jul 2013 17:03:49 +0400 Subject: don't pass superblock to hypfs_vm_create_files() Signed-off-by: Al Viro --- arch/s390/hypfs/hypfs.h | 2 +- arch/s390/hypfs/hypfs_vm.c | 65 +++++++++++++++++++++++----------------------- arch/s390/hypfs/inode.c | 4 +-- 3 files changed, 35 insertions(+), 36 deletions(-) (limited to 'arch') diff --git a/arch/s390/hypfs/hypfs.h b/arch/s390/hypfs/hypfs.h index f41e0ef7fdf..41a57ceda92 100644 --- a/arch/s390/hypfs/hypfs.h +++ b/arch/s390/hypfs/hypfs.h @@ -37,7 +37,7 @@ extern int hypfs_diag_create_files(struct super_block *sb, struct dentry *root); /* VM Hypervisor */ extern int hypfs_vm_init(void); extern void hypfs_vm_exit(void); -extern int hypfs_vm_create_files(struct super_block *sb, struct dentry *root); +extern int hypfs_vm_create_files(struct dentry *root); /* debugfs interface */ struct hypfs_dbfs_file; diff --git a/arch/s390/hypfs/hypfs_vm.c b/arch/s390/hypfs/hypfs_vm.c index f364dcf77e8..a7c5b57663e 100644 --- a/arch/s390/hypfs/hypfs_vm.c +++ b/arch/s390/hypfs/hypfs_vm.c @@ -107,16 +107,15 @@ static void diag2fc_free(const void *data) vfree(data); } -#define ATTRIBUTE(sb, dir, name, member) \ +#define ATTRIBUTE(dir, name, member) \ do { \ void *rc; \ - rc = hypfs_create_u64(sb, dir, name, member); \ + rc = hypfs_create_u64(dir->d_sb, dir, name, member); \ if (IS_ERR(rc)) \ return PTR_ERR(rc); \ } while(0) -static int hpyfs_vm_create_guest(struct super_block *sb, - struct dentry *systems_dir, +static int hpyfs_vm_create_guest(struct dentry *systems_dir, struct diag2fc_data *data) { char guest_name[NAME_LEN + 1] = {}; @@ -130,46 +129,46 @@ static int hpyfs_vm_create_guest(struct super_block *sb, memcpy(guest_name, data->guest_name, NAME_LEN); EBCASC(guest_name, NAME_LEN); strim(guest_name); - guest_dir = hypfs_mkdir(sb, systems_dir, guest_name); + guest_dir = hypfs_mkdir(systems_dir->d_sb, systems_dir, guest_name); if (IS_ERR(guest_dir)) return PTR_ERR(guest_dir); - ATTRIBUTE(sb, guest_dir, "onlinetime_us", data->el_time); + ATTRIBUTE(guest_dir, "onlinetime_us", data->el_time); /* logical cpu information */ - cpus_dir = hypfs_mkdir(sb, guest_dir, "cpus"); + cpus_dir = hypfs_mkdir(guest_dir->d_sb, guest_dir, "cpus"); if (IS_ERR(cpus_dir)) return PTR_ERR(cpus_dir); - ATTRIBUTE(sb, cpus_dir, "cputime_us", data->used_cpu); - ATTRIBUTE(sb, cpus_dir, "capped", capped_value); - ATTRIBUTE(sb, cpus_dir, "dedicated", dedicated_flag); - ATTRIBUTE(sb, cpus_dir, "count", data->vcpus); - ATTRIBUTE(sb, cpus_dir, "weight_min", data->cpu_min); - ATTRIBUTE(sb, cpus_dir, "weight_max", data->cpu_max); - ATTRIBUTE(sb, cpus_dir, "weight_cur", data->cpu_shares); + ATTRIBUTE(cpus_dir, "cputime_us", data->used_cpu); + ATTRIBUTE(cpus_dir, "capped", capped_value); + ATTRIBUTE(cpus_dir, "dedicated", dedicated_flag); + ATTRIBUTE(cpus_dir, "count", data->vcpus); + ATTRIBUTE(cpus_dir, "weight_min", data->cpu_min); + ATTRIBUTE(cpus_dir, "weight_max", data->cpu_max); + ATTRIBUTE(cpus_dir, "weight_cur", data->cpu_shares); /* memory information */ - mem_dir = hypfs_mkdir(sb, guest_dir, "mem"); + mem_dir = hypfs_mkdir(guest_dir->d_sb, guest_dir, "mem"); if (IS_ERR(mem_dir)) return PTR_ERR(mem_dir); - ATTRIBUTE(sb, mem_dir, "min_KiB", data->mem_min_kb); - ATTRIBUTE(sb, mem_dir, "max_KiB", data->mem_max_kb); - ATTRIBUTE(sb, mem_dir, "used_KiB", data->mem_used_kb); - ATTRIBUTE(sb, mem_dir, "share_KiB", data->mem_share_kb); + ATTRIBUTE(mem_dir, "min_KiB", data->mem_min_kb); + ATTRIBUTE(mem_dir, "max_KiB", data->mem_max_kb); + ATTRIBUTE(mem_dir, "used_KiB", data->mem_used_kb); + ATTRIBUTE(mem_dir, "share_KiB", data->mem_share_kb); /* samples */ - samples_dir = hypfs_mkdir(sb, guest_dir, "samples"); + samples_dir = hypfs_mkdir(guest_dir->d_sb, guest_dir, "samples"); if (IS_ERR(samples_dir)) return PTR_ERR(samples_dir); - ATTRIBUTE(sb, samples_dir, "cpu_using", data->cpu_use_samp); - ATTRIBUTE(sb, samples_dir, "cpu_delay", data->cpu_delay_samp); - ATTRIBUTE(sb, samples_dir, "mem_delay", data->page_wait_samp); - ATTRIBUTE(sb, samples_dir, "idle", data->idle_samp); - ATTRIBUTE(sb, samples_dir, "other", data->other_samp); - ATTRIBUTE(sb, samples_dir, "total", data->total_samp); + ATTRIBUTE(samples_dir, "cpu_using", data->cpu_use_samp); + ATTRIBUTE(samples_dir, "cpu_delay", data->cpu_delay_samp); + ATTRIBUTE(samples_dir, "mem_delay", data->page_wait_samp); + ATTRIBUTE(samples_dir, "idle", data->idle_samp); + ATTRIBUTE(samples_dir, "other", data->other_samp); + ATTRIBUTE(samples_dir, "total", data->total_samp); return 0; } -int hypfs_vm_create_files(struct super_block *sb, struct dentry *root) +int hypfs_vm_create_files(struct dentry *root) { struct dentry *dir, *file; struct diag2fc_data *data; @@ -181,38 +180,38 @@ int hypfs_vm_create_files(struct super_block *sb, struct dentry *root) return PTR_ERR(data); /* Hpervisor Info */ - dir = hypfs_mkdir(sb, root, "hyp"); + dir = hypfs_mkdir(root->d_sb, root, "hyp"); if (IS_ERR(dir)) { rc = PTR_ERR(dir); goto failed; } - file = hypfs_create_str(sb, dir, "type", "z/VM Hypervisor"); + file = hypfs_create_str(root->d_sb, dir, "type", "z/VM Hypervisor"); if (IS_ERR(file)) { rc = PTR_ERR(file); goto failed; } /* physical cpus */ - dir = hypfs_mkdir(sb, root, "cpus"); + dir = hypfs_mkdir(root->d_sb, root, "cpus"); if (IS_ERR(dir)) { rc = PTR_ERR(dir); goto failed; } - file = hypfs_create_u64(sb, dir, "count", data->lcpus); + file = hypfs_create_u64(root->d_sb, dir, "count", data->lcpus); if (IS_ERR(file)) { rc = PTR_ERR(file); goto failed; } /* guests */ - dir = hypfs_mkdir(sb, root, "systems"); + dir = hypfs_mkdir(root->d_sb, root, "systems"); if (IS_ERR(dir)) { rc = PTR_ERR(dir); goto failed; } for (i = 0; i < count; i++) { - rc = hpyfs_vm_create_guest(sb, dir, &(data[i])); + rc = hpyfs_vm_create_guest(dir, &(data[i])); if (rc) goto failed; } diff --git a/arch/s390/hypfs/inode.c b/arch/s390/hypfs/inode.c index 7a539f4f5e3..70627216ab6 100644 --- a/arch/s390/hypfs/inode.c +++ b/arch/s390/hypfs/inode.c @@ -193,7 +193,7 @@ static ssize_t hypfs_aio_write(struct kiocb *iocb, const struct iovec *iov, } hypfs_delete_tree(sb->s_root); if (MACHINE_IS_VM) - rc = hypfs_vm_create_files(sb, sb->s_root); + rc = hypfs_vm_create_files(sb->s_root); else rc = hypfs_diag_create_files(sb, sb->s_root); if (rc) { @@ -302,7 +302,7 @@ static int hypfs_fill_super(struct super_block *sb, void *data, int silent) if (!root_dentry) return -ENOMEM; if (MACHINE_IS_VM) - rc = hypfs_vm_create_files(sb, root_dentry); + rc = hypfs_vm_create_files(root_dentry); else rc = hypfs_diag_create_files(sb, root_dentry); if (rc) -- cgit v1.2.3-70-g09d2 From e334cf4fe8913a8940fc93fd38cef793877b6c79 Mon Sep 17 00:00:00 2001 From: Al Viro Date: Fri, 19 Jul 2013 17:10:21 +0400 Subject: don't pass superblock to hypfs_diag_create_files Signed-off-by: Al Viro --- arch/s390/hypfs/hypfs.h | 2 +- arch/s390/hypfs/hypfs_diag.c | 50 ++++++++++++++++++++------------------------ arch/s390/hypfs/inode.c | 4 ++-- 3 files changed, 26 insertions(+), 30 deletions(-) (limited to 'arch') diff --git a/arch/s390/hypfs/hypfs.h b/arch/s390/hypfs/hypfs.h index 41a57ceda92..6fd0c7e992c 100644 --- a/arch/s390/hypfs/hypfs.h +++ b/arch/s390/hypfs/hypfs.h @@ -32,7 +32,7 @@ extern struct dentry *hypfs_create_str(struct super_block *sb, /* LPAR Hypervisor */ extern int hypfs_diag_init(void); extern void hypfs_diag_exit(void); -extern int hypfs_diag_create_files(struct super_block *sb, struct dentry *root); +extern int hypfs_diag_create_files(struct dentry *root); /* VM Hypervisor */ extern int hypfs_vm_init(void); diff --git a/arch/s390/hypfs/hypfs_diag.c b/arch/s390/hypfs/hypfs_diag.c index 138893e5f73..42bb152512e 100644 --- a/arch/s390/hypfs/hypfs_diag.c +++ b/arch/s390/hypfs/hypfs_diag.c @@ -623,8 +623,7 @@ void hypfs_diag_exit(void) * ******************************************* */ -static int hypfs_create_cpu_files(struct super_block *sb, - struct dentry *cpus_dir, void *cpu_info) +static int hypfs_create_cpu_files(struct dentry *cpus_dir, void *cpu_info) { struct dentry *cpu_dir; char buffer[TMP_SIZE]; @@ -632,30 +631,29 @@ static int hypfs_create_cpu_files(struct super_block *sb, snprintf(buffer, TMP_SIZE, "%d", cpu_info__cpu_addr(diag204_info_type, cpu_info)); - cpu_dir = hypfs_mkdir(sb, cpus_dir, buffer); - rc = hypfs_create_u64(sb, cpu_dir, "mgmtime", + cpu_dir = hypfs_mkdir(cpus_dir->d_sb, cpus_dir, buffer); + rc = hypfs_create_u64(cpu_dir->d_sb, cpu_dir, "mgmtime", cpu_info__acc_time(diag204_info_type, cpu_info) - cpu_info__lp_time(diag204_info_type, cpu_info)); if (IS_ERR(rc)) return PTR_ERR(rc); - rc = hypfs_create_u64(sb, cpu_dir, "cputime", + rc = hypfs_create_u64(cpu_dir->d_sb, cpu_dir, "cputime", cpu_info__lp_time(diag204_info_type, cpu_info)); if (IS_ERR(rc)) return PTR_ERR(rc); if (diag204_info_type == INFO_EXT) { - rc = hypfs_create_u64(sb, cpu_dir, "onlinetime", + rc = hypfs_create_u64(cpu_dir->d_sb, cpu_dir, "onlinetime", cpu_info__online_time(diag204_info_type, cpu_info)); if (IS_ERR(rc)) return PTR_ERR(rc); } diag224_idx2name(cpu_info__ctidx(diag204_info_type, cpu_info), buffer); - rc = hypfs_create_str(sb, cpu_dir, "type", buffer); + rc = hypfs_create_str(cpu_dir->d_sb, cpu_dir, "type", buffer); return PTR_RET(rc); } -static void *hypfs_create_lpar_files(struct super_block *sb, - struct dentry *systems_dir, void *part_hdr) +static void *hypfs_create_lpar_files(struct dentry *systems_dir, void *part_hdr) { struct dentry *cpus_dir; struct dentry *lpar_dir; @@ -665,16 +663,16 @@ static void *hypfs_create_lpar_files(struct super_block *sb, part_hdr__part_name(diag204_info_type, part_hdr, lpar_name); lpar_name[LPAR_NAME_LEN] = 0; - lpar_dir = hypfs_mkdir(sb, systems_dir, lpar_name); + lpar_dir = hypfs_mkdir(systems_dir->d_sb, systems_dir, lpar_name); if (IS_ERR(lpar_dir)) return lpar_dir; - cpus_dir = hypfs_mkdir(sb, lpar_dir, "cpus"); + cpus_dir = hypfs_mkdir(lpar_dir->d_sb, lpar_dir, "cpus"); if (IS_ERR(cpus_dir)) return cpus_dir; cpu_info = part_hdr + part_hdr__size(diag204_info_type); for (i = 0; i < part_hdr__rcpus(diag204_info_type, part_hdr); i++) { int rc; - rc = hypfs_create_cpu_files(sb, cpus_dir, cpu_info); + rc = hypfs_create_cpu_files(cpus_dir, cpu_info); if (rc) return ERR_PTR(rc); cpu_info += cpu_info__size(diag204_info_type); @@ -682,8 +680,7 @@ static void *hypfs_create_lpar_files(struct super_block *sb, return cpu_info; } -static int hypfs_create_phys_cpu_files(struct super_block *sb, - struct dentry *cpus_dir, void *cpu_info) +static int hypfs_create_phys_cpu_files(struct dentry *cpus_dir, void *cpu_info) { struct dentry *cpu_dir; char buffer[TMP_SIZE]; @@ -691,32 +688,31 @@ static int hypfs_create_phys_cpu_files(struct super_block *sb, snprintf(buffer, TMP_SIZE, "%i", phys_cpu__cpu_addr(diag204_info_type, cpu_info)); - cpu_dir = hypfs_mkdir(sb, cpus_dir, buffer); + cpu_dir = hypfs_mkdir(cpus_dir->d_sb, cpus_dir, buffer); if (IS_ERR(cpu_dir)) return PTR_ERR(cpu_dir); - rc = hypfs_create_u64(sb, cpu_dir, "mgmtime", + rc = hypfs_create_u64(cpu_dir->d_sb, cpu_dir, "mgmtime", phys_cpu__mgm_time(diag204_info_type, cpu_info)); if (IS_ERR(rc)) return PTR_ERR(rc); diag224_idx2name(phys_cpu__ctidx(diag204_info_type, cpu_info), buffer); - rc = hypfs_create_str(sb, cpu_dir, "type", buffer); + rc = hypfs_create_str(cpu_dir->d_sb, cpu_dir, "type", buffer); return PTR_RET(rc); } -static void *hypfs_create_phys_files(struct super_block *sb, - struct dentry *parent_dir, void *phys_hdr) +static void *hypfs_create_phys_files(struct dentry *parent_dir, void *phys_hdr) { int i; void *cpu_info; struct dentry *cpus_dir; - cpus_dir = hypfs_mkdir(sb, parent_dir, "cpus"); + cpus_dir = hypfs_mkdir(parent_dir->d_sb, parent_dir, "cpus"); if (IS_ERR(cpus_dir)) return cpus_dir; cpu_info = phys_hdr + phys_hdr__size(diag204_info_type); for (i = 0; i < phys_hdr__cpus(diag204_info_type, phys_hdr); i++) { int rc; - rc = hypfs_create_phys_cpu_files(sb, cpus_dir, cpu_info); + rc = hypfs_create_phys_cpu_files(cpus_dir, cpu_info); if (rc) return ERR_PTR(rc); cpu_info += phys_cpu__size(diag204_info_type); @@ -724,7 +720,7 @@ static void *hypfs_create_phys_files(struct super_block *sb, return cpu_info; } -int hypfs_diag_create_files(struct super_block *sb, struct dentry *root) +int hypfs_diag_create_files(struct dentry *root) { struct dentry *systems_dir, *hyp_dir; void *time_hdr, *part_hdr; @@ -735,7 +731,7 @@ int hypfs_diag_create_files(struct super_block *sb, struct dentry *root) if (IS_ERR(buffer)) return PTR_ERR(buffer); - systems_dir = hypfs_mkdir(sb, root, "systems"); + systems_dir = hypfs_mkdir(root->d_sb, root, "systems"); if (IS_ERR(systems_dir)) { rc = PTR_ERR(systems_dir); goto err_out; @@ -743,25 +739,25 @@ int hypfs_diag_create_files(struct super_block *sb, struct dentry *root) time_hdr = (struct x_info_blk_hdr *)buffer; part_hdr = time_hdr + info_blk_hdr__size(diag204_info_type); for (i = 0; i < info_blk_hdr__npar(diag204_info_type, time_hdr); i++) { - part_hdr = hypfs_create_lpar_files(sb, systems_dir, part_hdr); + part_hdr = hypfs_create_lpar_files(systems_dir, part_hdr); if (IS_ERR(part_hdr)) { rc = PTR_ERR(part_hdr); goto err_out; } } if (info_blk_hdr__flags(diag204_info_type, time_hdr) & LPAR_PHYS_FLG) { - ptr = hypfs_create_phys_files(sb, root, part_hdr); + ptr = hypfs_create_phys_files(root, part_hdr); if (IS_ERR(ptr)) { rc = PTR_ERR(ptr); goto err_out; } } - hyp_dir = hypfs_mkdir(sb, root, "hyp"); + hyp_dir = hypfs_mkdir(root->d_sb, root, "hyp"); if (IS_ERR(hyp_dir)) { rc = PTR_ERR(hyp_dir); goto err_out; } - ptr = hypfs_create_str(sb, hyp_dir, "type", "LPAR Hypervisor"); + ptr = hypfs_create_str(root->d_sb, hyp_dir, "type", "LPAR Hypervisor"); if (IS_ERR(ptr)) { rc = PTR_ERR(ptr); goto err_out; diff --git a/arch/s390/hypfs/inode.c b/arch/s390/hypfs/inode.c index 70627216ab6..aa5de3f54ce 100644 --- a/arch/s390/hypfs/inode.c +++ b/arch/s390/hypfs/inode.c @@ -195,7 +195,7 @@ static ssize_t hypfs_aio_write(struct kiocb *iocb, const struct iovec *iov, if (MACHINE_IS_VM) rc = hypfs_vm_create_files(sb->s_root); else - rc = hypfs_diag_create_files(sb, sb->s_root); + rc = hypfs_diag_create_files(sb->s_root); if (rc) { pr_err("Updating the hypfs tree failed\n"); hypfs_delete_tree(sb->s_root); @@ -304,7 +304,7 @@ static int hypfs_fill_super(struct super_block *sb, void *data, int silent) if (MACHINE_IS_VM) rc = hypfs_vm_create_files(root_dentry); else - rc = hypfs_diag_create_files(sb, root_dentry); + rc = hypfs_diag_create_files(root_dentry); if (rc) return rc; sbi->update_file = hypfs_create_update_file(sb, root_dentry); -- cgit v1.2.3-70-g09d2 From a118cfdf993a67a95d9a68452bc10b0604de7177 Mon Sep 17 00:00:00 2001 From: Al Viro Date: Fri, 19 Jul 2013 18:05:21 +0400 Subject: don't pass superblock to hypfs_{mkdir,create*} Signed-off-by: Al Viro --- arch/s390/hypfs/hypfs.h | 9 +++------ arch/s390/hypfs/hypfs_diag.c | 28 ++++++++++++++-------------- arch/s390/hypfs/hypfs_vm.c | 20 ++++++++++---------- arch/s390/hypfs/inode.c | 28 ++++++++++++---------------- 4 files changed, 39 insertions(+), 46 deletions(-) (limited to 'arch') diff --git a/arch/s390/hypfs/hypfs.h b/arch/s390/hypfs/hypfs.h index 6fd0c7e992c..79f2ac55253 100644 --- a/arch/s390/hypfs/hypfs.h +++ b/arch/s390/hypfs/hypfs.h @@ -18,15 +18,12 @@ #define UPDATE_FILE_MODE 0220 #define DIR_MODE 0550 -extern struct dentry *hypfs_mkdir(struct super_block *sb, struct dentry *parent, - const char *name); +extern struct dentry *hypfs_mkdir(struct dentry *parent, const char *name); -extern struct dentry *hypfs_create_u64(struct super_block *sb, - struct dentry *dir, const char *name, +extern struct dentry *hypfs_create_u64(struct dentry *dir, const char *name, __u64 value); -extern struct dentry *hypfs_create_str(struct super_block *sb, - struct dentry *dir, const char *name, +extern struct dentry *hypfs_create_str(struct dentry *dir, const char *name, char *string); /* LPAR Hypervisor */ diff --git a/arch/s390/hypfs/hypfs_diag.c b/arch/s390/hypfs/hypfs_diag.c index 42bb152512e..5eeffeefae0 100644 --- a/arch/s390/hypfs/hypfs_diag.c +++ b/arch/s390/hypfs/hypfs_diag.c @@ -631,25 +631,25 @@ static int hypfs_create_cpu_files(struct dentry *cpus_dir, void *cpu_info) snprintf(buffer, TMP_SIZE, "%d", cpu_info__cpu_addr(diag204_info_type, cpu_info)); - cpu_dir = hypfs_mkdir(cpus_dir->d_sb, cpus_dir, buffer); - rc = hypfs_create_u64(cpu_dir->d_sb, cpu_dir, "mgmtime", + cpu_dir = hypfs_mkdir(cpus_dir, buffer); + rc = hypfs_create_u64(cpu_dir, "mgmtime", cpu_info__acc_time(diag204_info_type, cpu_info) - cpu_info__lp_time(diag204_info_type, cpu_info)); if (IS_ERR(rc)) return PTR_ERR(rc); - rc = hypfs_create_u64(cpu_dir->d_sb, cpu_dir, "cputime", + rc = hypfs_create_u64(cpu_dir, "cputime", cpu_info__lp_time(diag204_info_type, cpu_info)); if (IS_ERR(rc)) return PTR_ERR(rc); if (diag204_info_type == INFO_EXT) { - rc = hypfs_create_u64(cpu_dir->d_sb, cpu_dir, "onlinetime", + rc = hypfs_create_u64(cpu_dir, "onlinetime", cpu_info__online_time(diag204_info_type, cpu_info)); if (IS_ERR(rc)) return PTR_ERR(rc); } diag224_idx2name(cpu_info__ctidx(diag204_info_type, cpu_info), buffer); - rc = hypfs_create_str(cpu_dir->d_sb, cpu_dir, "type", buffer); + rc = hypfs_create_str(cpu_dir, "type", buffer); return PTR_RET(rc); } @@ -663,10 +663,10 @@ static void *hypfs_create_lpar_files(struct dentry *systems_dir, void *part_hdr) part_hdr__part_name(diag204_info_type, part_hdr, lpar_name); lpar_name[LPAR_NAME_LEN] = 0; - lpar_dir = hypfs_mkdir(systems_dir->d_sb, systems_dir, lpar_name); + lpar_dir = hypfs_mkdir(systems_dir, lpar_name); if (IS_ERR(lpar_dir)) return lpar_dir; - cpus_dir = hypfs_mkdir(lpar_dir->d_sb, lpar_dir, "cpus"); + cpus_dir = hypfs_mkdir(lpar_dir, "cpus"); if (IS_ERR(cpus_dir)) return cpus_dir; cpu_info = part_hdr + part_hdr__size(diag204_info_type); @@ -688,15 +688,15 @@ static int hypfs_create_phys_cpu_files(struct dentry *cpus_dir, void *cpu_info) snprintf(buffer, TMP_SIZE, "%i", phys_cpu__cpu_addr(diag204_info_type, cpu_info)); - cpu_dir = hypfs_mkdir(cpus_dir->d_sb, cpus_dir, buffer); + cpu_dir = hypfs_mkdir(cpus_dir, buffer); if (IS_ERR(cpu_dir)) return PTR_ERR(cpu_dir); - rc = hypfs_create_u64(cpu_dir->d_sb, cpu_dir, "mgmtime", + rc = hypfs_create_u64(cpu_dir, "mgmtime", phys_cpu__mgm_time(diag204_info_type, cpu_info)); if (IS_ERR(rc)) return PTR_ERR(rc); diag224_idx2name(phys_cpu__ctidx(diag204_info_type, cpu_info), buffer); - rc = hypfs_create_str(cpu_dir->d_sb, cpu_dir, "type", buffer); + rc = hypfs_create_str(cpu_dir, "type", buffer); return PTR_RET(rc); } @@ -706,7 +706,7 @@ static void *hypfs_create_phys_files(struct dentry *parent_dir, void *phys_hdr) void *cpu_info; struct dentry *cpus_dir; - cpus_dir = hypfs_mkdir(parent_dir->d_sb, parent_dir, "cpus"); + cpus_dir = hypfs_mkdir(parent_dir, "cpus"); if (IS_ERR(cpus_dir)) return cpus_dir; cpu_info = phys_hdr + phys_hdr__size(diag204_info_type); @@ -731,7 +731,7 @@ int hypfs_diag_create_files(struct dentry *root) if (IS_ERR(buffer)) return PTR_ERR(buffer); - systems_dir = hypfs_mkdir(root->d_sb, root, "systems"); + systems_dir = hypfs_mkdir(root, "systems"); if (IS_ERR(systems_dir)) { rc = PTR_ERR(systems_dir); goto err_out; @@ -752,12 +752,12 @@ int hypfs_diag_create_files(struct dentry *root) goto err_out; } } - hyp_dir = hypfs_mkdir(root->d_sb, root, "hyp"); + hyp_dir = hypfs_mkdir(root, "hyp"); if (IS_ERR(hyp_dir)) { rc = PTR_ERR(hyp_dir); goto err_out; } - ptr = hypfs_create_str(root->d_sb, hyp_dir, "type", "LPAR Hypervisor"); + ptr = hypfs_create_str(hyp_dir, "type", "LPAR Hypervisor"); if (IS_ERR(ptr)) { rc = PTR_ERR(ptr); goto err_out; diff --git a/arch/s390/hypfs/hypfs_vm.c b/arch/s390/hypfs/hypfs_vm.c index a7c5b57663e..24908ce149f 100644 --- a/arch/s390/hypfs/hypfs_vm.c +++ b/arch/s390/hypfs/hypfs_vm.c @@ -110,7 +110,7 @@ static void diag2fc_free(const void *data) #define ATTRIBUTE(dir, name, member) \ do { \ void *rc; \ - rc = hypfs_create_u64(dir->d_sb, dir, name, member); \ + rc = hypfs_create_u64(dir, name, member); \ if (IS_ERR(rc)) \ return PTR_ERR(rc); \ } while(0) @@ -129,13 +129,13 @@ static int hpyfs_vm_create_guest(struct dentry *systems_dir, memcpy(guest_name, data->guest_name, NAME_LEN); EBCASC(guest_name, NAME_LEN); strim(guest_name); - guest_dir = hypfs_mkdir(systems_dir->d_sb, systems_dir, guest_name); + guest_dir = hypfs_mkdir(systems_dir, guest_name); if (IS_ERR(guest_dir)) return PTR_ERR(guest_dir); ATTRIBUTE(guest_dir, "onlinetime_us", data->el_time); /* logical cpu information */ - cpus_dir = hypfs_mkdir(guest_dir->d_sb, guest_dir, "cpus"); + cpus_dir = hypfs_mkdir(guest_dir, "cpus"); if (IS_ERR(cpus_dir)) return PTR_ERR(cpus_dir); ATTRIBUTE(cpus_dir, "cputime_us", data->used_cpu); @@ -147,7 +147,7 @@ static int hpyfs_vm_create_guest(struct dentry *systems_dir, ATTRIBUTE(cpus_dir, "weight_cur", data->cpu_shares); /* memory information */ - mem_dir = hypfs_mkdir(guest_dir->d_sb, guest_dir, "mem"); + mem_dir = hypfs_mkdir(guest_dir, "mem"); if (IS_ERR(mem_dir)) return PTR_ERR(mem_dir); ATTRIBUTE(mem_dir, "min_KiB", data->mem_min_kb); @@ -156,7 +156,7 @@ static int hpyfs_vm_create_guest(struct dentry *systems_dir, ATTRIBUTE(mem_dir, "share_KiB", data->mem_share_kb); /* samples */ - samples_dir = hypfs_mkdir(guest_dir->d_sb, guest_dir, "samples"); + samples_dir = hypfs_mkdir(guest_dir, "samples"); if (IS_ERR(samples_dir)) return PTR_ERR(samples_dir); ATTRIBUTE(samples_dir, "cpu_using", data->cpu_use_samp); @@ -180,31 +180,31 @@ int hypfs_vm_create_files(struct dentry *root) return PTR_ERR(data); /* Hpervisor Info */ - dir = hypfs_mkdir(root->d_sb, root, "hyp"); + dir = hypfs_mkdir(root, "hyp"); if (IS_ERR(dir)) { rc = PTR_ERR(dir); goto failed; } - file = hypfs_create_str(root->d_sb, dir, "type", "z/VM Hypervisor"); + file = hypfs_create_str(dir, "type", "z/VM Hypervisor"); if (IS_ERR(file)) { rc = PTR_ERR(file); goto failed; } /* physical cpus */ - dir = hypfs_mkdir(root->d_sb, root, "cpus"); + dir = hypfs_mkdir(root, "cpus"); if (IS_ERR(dir)) { rc = PTR_ERR(dir); goto failed; } - file = hypfs_create_u64(root->d_sb, dir, "count", data->lcpus); + file = hypfs_create_u64(dir, "count", data->lcpus); if (IS_ERR(file)) { rc = PTR_ERR(file); goto failed; } /* guests */ - dir = hypfs_mkdir(root->d_sb, root, "systems"); + dir = hypfs_mkdir(root, "systems"); if (IS_ERR(dir)) { rc = PTR_ERR(dir); goto failed; diff --git a/arch/s390/hypfs/inode.c b/arch/s390/hypfs/inode.c index aa5de3f54ce..ddfe09b4513 100644 --- a/arch/s390/hypfs/inode.c +++ b/arch/s390/hypfs/inode.c @@ -28,8 +28,7 @@ #define HYPFS_MAGIC 0x687970 /* ASCII 'hyp' */ #define TMP_SIZE 64 /* size of temporary buffers */ -static struct dentry *hypfs_create_update_file(struct super_block *sb, - struct dentry *dir); +static struct dentry *hypfs_create_update_file(struct dentry *dir); struct hypfs_sb_info { kuid_t uid; /* uid used for files and dirs */ @@ -307,7 +306,7 @@ static int hypfs_fill_super(struct super_block *sb, void *data, int silent) rc = hypfs_diag_create_files(root_dentry); if (rc) return rc; - sbi->update_file = hypfs_create_update_file(sb, root_dentry); + sbi->update_file = hypfs_create_update_file(root_dentry); if (IS_ERR(sbi->update_file)) return PTR_ERR(sbi->update_file); hypfs_update_update(sb); @@ -334,8 +333,7 @@ static void hypfs_kill_super(struct super_block *sb) kill_litter_super(sb); } -static struct dentry *hypfs_create_file(struct super_block *sb, - struct dentry *parent, const char *name, +static struct dentry *hypfs_create_file(struct dentry *parent, const char *name, char *data, umode_t mode) { struct dentry *dentry; @@ -347,7 +345,7 @@ static struct dentry *hypfs_create_file(struct super_block *sb, dentry = ERR_PTR(-ENOMEM); goto fail; } - inode = hypfs_make_inode(sb, mode); + inode = hypfs_make_inode(parent->d_sb, mode); if (!inode) { dput(dentry); dentry = ERR_PTR(-ENOMEM); @@ -373,24 +371,22 @@ fail: return dentry; } -struct dentry *hypfs_mkdir(struct super_block *sb, struct dentry *parent, - const char *name) +struct dentry *hypfs_mkdir(struct dentry *parent, const char *name) { struct dentry *dentry; - dentry = hypfs_create_file(sb, parent, name, NULL, S_IFDIR | DIR_MODE); + dentry = hypfs_create_file(parent, name, NULL, S_IFDIR | DIR_MODE); if (IS_ERR(dentry)) return dentry; hypfs_add_dentry(dentry); return dentry; } -static struct dentry *hypfs_create_update_file(struct super_block *sb, - struct dentry *dir) +static struct dentry *hypfs_create_update_file(struct dentry *dir) { struct dentry *dentry; - dentry = hypfs_create_file(sb, dir, "update", NULL, + dentry = hypfs_create_file(dir, "update", NULL, S_IFREG | UPDATE_FILE_MODE); /* * We do not put the update file on the 'delete' list with @@ -400,7 +396,7 @@ static struct dentry *hypfs_create_update_file(struct super_block *sb, return dentry; } -struct dentry *hypfs_create_u64(struct super_block *sb, struct dentry *dir, +struct dentry *hypfs_create_u64(struct dentry *dir, const char *name, __u64 value) { char *buffer; @@ -412,7 +408,7 @@ struct dentry *hypfs_create_u64(struct super_block *sb, struct dentry *dir, if (!buffer) return ERR_PTR(-ENOMEM); dentry = - hypfs_create_file(sb, dir, name, buffer, S_IFREG | REG_FILE_MODE); + hypfs_create_file(dir, name, buffer, S_IFREG | REG_FILE_MODE); if (IS_ERR(dentry)) { kfree(buffer); return ERR_PTR(-ENOMEM); @@ -421,7 +417,7 @@ struct dentry *hypfs_create_u64(struct super_block *sb, struct dentry *dir, return dentry; } -struct dentry *hypfs_create_str(struct super_block *sb, struct dentry *dir, +struct dentry *hypfs_create_str(struct dentry *dir, const char *name, char *string) { char *buffer; @@ -432,7 +428,7 @@ struct dentry *hypfs_create_str(struct super_block *sb, struct dentry *dir, return ERR_PTR(-ENOMEM); sprintf(buffer, "%s\n", string); dentry = - hypfs_create_file(sb, dir, name, buffer, S_IFREG | REG_FILE_MODE); + hypfs_create_file(dir, name, buffer, S_IFREG | REG_FILE_MODE); if (IS_ERR(dentry)) { kfree(buffer); return ERR_PTR(-ENOMEM); -- cgit v1.2.3-70-g09d2 From 70abadedab73066fae584488640056f83bce5f95 Mon Sep 17 00:00:00 2001 From: Al Viro Date: Fri, 30 Aug 2013 15:04:22 -0400 Subject: powerpc kvm: use fdget Signed-off-by: Al Viro --- arch/powerpc/kvm/powerpc.c | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) (limited to 'arch') diff --git a/arch/powerpc/kvm/powerpc.c b/arch/powerpc/kvm/powerpc.c index 6316ee336e8..aca2e8f2e33 100644 --- a/arch/powerpc/kvm/powerpc.c +++ b/arch/powerpc/kvm/powerpc.c @@ -823,39 +823,39 @@ static int kvm_vcpu_ioctl_enable_cap(struct kvm_vcpu *vcpu, #endif #ifdef CONFIG_KVM_MPIC case KVM_CAP_IRQ_MPIC: { - struct file *filp; + struct fd f; struct kvm_device *dev; r = -EBADF; - filp = fget(cap->args[0]); - if (!filp) + f = fdget(cap->args[0]); + if (!f.file) break; r = -EPERM; - dev = kvm_device_from_filp(filp); + dev = kvm_device_from_filp(f.file); if (dev) r = kvmppc_mpic_connect_vcpu(dev, vcpu, cap->args[1]); - fput(filp); + fdput(f); break; } #endif #ifdef CONFIG_KVM_XICS case KVM_CAP_IRQ_XICS: { - struct file *filp; + struct fd f; struct kvm_device *dev; r = -EBADF; - filp = fget(cap->args[0]); - if (!filp) + f = fdget(cap->args[0]); + if (!f.file) break; r = -EPERM; - dev = kvm_device_from_filp(filp); + dev = kvm_device_from_filp(f.file); if (dev) r = kvmppc_xics_connect_vcpu(dev, vcpu, cap->args[1]); - fput(filp); + fdput(f); break; } #endif /* CONFIG_KVM_XICS */ -- cgit v1.2.3-70-g09d2