Commit e334cf4f authored by Al Viro's avatar Al Viro

don't pass superblock to hypfs_diag_create_files

Signed-off-by: default avatarAl Viro <viro@zeniv.linux.org.uk>
parent f78e41e3
...@@ -32,7 +32,7 @@ extern struct dentry *hypfs_create_str(struct super_block *sb, ...@@ -32,7 +32,7 @@ extern struct dentry *hypfs_create_str(struct super_block *sb,
/* LPAR Hypervisor */ /* LPAR Hypervisor */
extern int hypfs_diag_init(void); extern int hypfs_diag_init(void);
extern void hypfs_diag_exit(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 */ /* VM Hypervisor */
extern int hypfs_vm_init(void); extern int hypfs_vm_init(void);
......
...@@ -623,8 +623,7 @@ void hypfs_diag_exit(void) ...@@ -623,8 +623,7 @@ void hypfs_diag_exit(void)
* ******************************************* * *******************************************
*/ */
static int hypfs_create_cpu_files(struct super_block *sb, static int hypfs_create_cpu_files(struct dentry *cpus_dir, void *cpu_info)
struct dentry *cpus_dir, void *cpu_info)
{ {
struct dentry *cpu_dir; struct dentry *cpu_dir;
char buffer[TMP_SIZE]; char buffer[TMP_SIZE];
...@@ -632,30 +631,29 @@ static int hypfs_create_cpu_files(struct super_block *sb, ...@@ -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, snprintf(buffer, TMP_SIZE, "%d", cpu_info__cpu_addr(diag204_info_type,
cpu_info)); cpu_info));
cpu_dir = hypfs_mkdir(sb, cpus_dir, buffer); cpu_dir = hypfs_mkdir(cpus_dir->d_sb, cpus_dir, buffer);
rc = hypfs_create_u64(sb, cpu_dir, "mgmtime", rc = hypfs_create_u64(cpu_dir->d_sb, cpu_dir, "mgmtime",
cpu_info__acc_time(diag204_info_type, cpu_info) - cpu_info__acc_time(diag204_info_type, cpu_info) -
cpu_info__lp_time(diag204_info_type, cpu_info)); cpu_info__lp_time(diag204_info_type, cpu_info));
if (IS_ERR(rc)) if (IS_ERR(rc))
return PTR_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)); cpu_info__lp_time(diag204_info_type, cpu_info));
if (IS_ERR(rc)) if (IS_ERR(rc))
return PTR_ERR(rc); return PTR_ERR(rc);
if (diag204_info_type == INFO_EXT) { 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__online_time(diag204_info_type,
cpu_info)); cpu_info));
if (IS_ERR(rc)) if (IS_ERR(rc))
return PTR_ERR(rc); return PTR_ERR(rc);
} }
diag224_idx2name(cpu_info__ctidx(diag204_info_type, cpu_info), buffer); 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); return PTR_RET(rc);
} }
static void *hypfs_create_lpar_files(struct super_block *sb, static void *hypfs_create_lpar_files(struct dentry *systems_dir, void *part_hdr)
struct dentry *systems_dir, void *part_hdr)
{ {
struct dentry *cpus_dir; struct dentry *cpus_dir;
struct dentry *lpar_dir; struct dentry *lpar_dir;
...@@ -665,16 +663,16 @@ static void *hypfs_create_lpar_files(struct super_block *sb, ...@@ -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); part_hdr__part_name(diag204_info_type, part_hdr, lpar_name);
lpar_name[LPAR_NAME_LEN] = 0; 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)) if (IS_ERR(lpar_dir))
return 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)) if (IS_ERR(cpus_dir))
return cpus_dir; return cpus_dir;
cpu_info = part_hdr + part_hdr__size(diag204_info_type); cpu_info = part_hdr + part_hdr__size(diag204_info_type);
for (i = 0; i < part_hdr__rcpus(diag204_info_type, part_hdr); i++) { for (i = 0; i < part_hdr__rcpus(diag204_info_type, part_hdr); i++) {
int rc; int rc;
rc = hypfs_create_cpu_files(sb, cpus_dir, cpu_info); rc = hypfs_create_cpu_files(cpus_dir, cpu_info);
if (rc) if (rc)
return ERR_PTR(rc); return ERR_PTR(rc);
cpu_info += cpu_info__size(diag204_info_type); cpu_info += cpu_info__size(diag204_info_type);
...@@ -682,8 +680,7 @@ static void *hypfs_create_lpar_files(struct super_block *sb, ...@@ -682,8 +680,7 @@ static void *hypfs_create_lpar_files(struct super_block *sb,
return cpu_info; return cpu_info;
} }
static int hypfs_create_phys_cpu_files(struct super_block *sb, static int hypfs_create_phys_cpu_files(struct dentry *cpus_dir, void *cpu_info)
struct dentry *cpus_dir, void *cpu_info)
{ {
struct dentry *cpu_dir; struct dentry *cpu_dir;
char buffer[TMP_SIZE]; char buffer[TMP_SIZE];
...@@ -691,32 +688,31 @@ static int hypfs_create_phys_cpu_files(struct super_block *sb, ...@@ -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, snprintf(buffer, TMP_SIZE, "%i", phys_cpu__cpu_addr(diag204_info_type,
cpu_info)); 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)) if (IS_ERR(cpu_dir))
return PTR_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)); phys_cpu__mgm_time(diag204_info_type, cpu_info));
if (IS_ERR(rc)) if (IS_ERR(rc))
return PTR_ERR(rc); return PTR_ERR(rc);
diag224_idx2name(phys_cpu__ctidx(diag204_info_type, cpu_info), buffer); 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); return PTR_RET(rc);
} }
static void *hypfs_create_phys_files(struct super_block *sb, static void *hypfs_create_phys_files(struct dentry *parent_dir, void *phys_hdr)
struct dentry *parent_dir, void *phys_hdr)
{ {
int i; int i;
void *cpu_info; void *cpu_info;
struct dentry *cpus_dir; 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)) if (IS_ERR(cpus_dir))
return cpus_dir; return cpus_dir;
cpu_info = phys_hdr + phys_hdr__size(diag204_info_type); cpu_info = phys_hdr + phys_hdr__size(diag204_info_type);
for (i = 0; i < phys_hdr__cpus(diag204_info_type, phys_hdr); i++) { for (i = 0; i < phys_hdr__cpus(diag204_info_type, phys_hdr); i++) {
int rc; 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) if (rc)
return ERR_PTR(rc); return ERR_PTR(rc);
cpu_info += phys_cpu__size(diag204_info_type); cpu_info += phys_cpu__size(diag204_info_type);
...@@ -724,7 +720,7 @@ static void *hypfs_create_phys_files(struct super_block *sb, ...@@ -724,7 +720,7 @@ static void *hypfs_create_phys_files(struct super_block *sb,
return cpu_info; 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; struct dentry *systems_dir, *hyp_dir;
void *time_hdr, *part_hdr; void *time_hdr, *part_hdr;
...@@ -735,7 +731,7 @@ int hypfs_diag_create_files(struct super_block *sb, struct dentry *root) ...@@ -735,7 +731,7 @@ int hypfs_diag_create_files(struct super_block *sb, struct dentry *root)
if (IS_ERR(buffer)) if (IS_ERR(buffer))
return PTR_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)) { if (IS_ERR(systems_dir)) {
rc = PTR_ERR(systems_dir); rc = PTR_ERR(systems_dir);
goto err_out; goto err_out;
...@@ -743,25 +739,25 @@ int hypfs_diag_create_files(struct super_block *sb, struct dentry *root) ...@@ -743,25 +739,25 @@ int hypfs_diag_create_files(struct super_block *sb, struct dentry *root)
time_hdr = (struct x_info_blk_hdr *)buffer; time_hdr = (struct x_info_blk_hdr *)buffer;
part_hdr = time_hdr + info_blk_hdr__size(diag204_info_type); 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++) { 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)) { if (IS_ERR(part_hdr)) {
rc = PTR_ERR(part_hdr); rc = PTR_ERR(part_hdr);
goto err_out; goto err_out;
} }
} }
if (info_blk_hdr__flags(diag204_info_type, time_hdr) & LPAR_PHYS_FLG) { 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)) { if (IS_ERR(ptr)) {
rc = PTR_ERR(ptr); rc = PTR_ERR(ptr);
goto err_out; goto err_out;
} }
} }
hyp_dir = hypfs_mkdir(sb, root, "hyp"); hyp_dir = hypfs_mkdir(root->d_sb, root, "hyp");
if (IS_ERR(hyp_dir)) { if (IS_ERR(hyp_dir)) {
rc = PTR_ERR(hyp_dir); rc = PTR_ERR(hyp_dir);
goto err_out; 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)) { if (IS_ERR(ptr)) {
rc = PTR_ERR(ptr); rc = PTR_ERR(ptr);
goto err_out; goto err_out;
......
...@@ -195,7 +195,7 @@ static ssize_t hypfs_aio_write(struct kiocb *iocb, const struct iovec *iov, ...@@ -195,7 +195,7 @@ static ssize_t hypfs_aio_write(struct kiocb *iocb, const struct iovec *iov,
if (MACHINE_IS_VM) if (MACHINE_IS_VM)
rc = hypfs_vm_create_files(sb->s_root); rc = hypfs_vm_create_files(sb->s_root);
else else
rc = hypfs_diag_create_files(sb, sb->s_root); rc = hypfs_diag_create_files(sb->s_root);
if (rc) { if (rc) {
pr_err("Updating the hypfs tree failed\n"); pr_err("Updating the hypfs tree failed\n");
hypfs_delete_tree(sb->s_root); hypfs_delete_tree(sb->s_root);
...@@ -304,7 +304,7 @@ static int hypfs_fill_super(struct super_block *sb, void *data, int silent) ...@@ -304,7 +304,7 @@ static int hypfs_fill_super(struct super_block *sb, void *data, int silent)
if (MACHINE_IS_VM) if (MACHINE_IS_VM)
rc = hypfs_vm_create_files(root_dentry); rc = hypfs_vm_create_files(root_dentry);
else else
rc = hypfs_diag_create_files(sb, root_dentry); rc = hypfs_diag_create_files(root_dentry);
if (rc) if (rc)
return rc; return rc;
sbi->update_file = hypfs_create_update_file(sb, root_dentry); sbi->update_file = hypfs_create_update_file(sb, root_dentry);
......
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