aboutsummaryrefslogtreecommitdiffstats
path: root/arch/s390/hypfs/hypfs_diag.c
diff options
context:
space:
mode:
Diffstat (limited to 'arch/s390/hypfs/hypfs_diag.c')
-rw-r--r--arch/s390/hypfs/hypfs_diag.c50
1 files changed, 23 insertions, 27 deletions
diff --git a/arch/s390/hypfs/hypfs_diag.c b/arch/s390/hypfs/hypfs_diag.c
index 138893e5f736..42bb152512e6 100644
--- a/arch/s390/hypfs/hypfs_diag.c
+++ b/arch/s390/hypfs/hypfs_diag.c
@@ -623,8 +623,7 @@ void hypfs_diag_exit(void)
623 * ******************************************* 623 * *******************************************
624 */ 624 */
625 625
626static int hypfs_create_cpu_files(struct super_block *sb, 626static int hypfs_create_cpu_files(struct dentry *cpus_dir, void *cpu_info)
627 struct dentry *cpus_dir, void *cpu_info)
628{ 627{
629 struct dentry *cpu_dir; 628 struct dentry *cpu_dir;
630 char buffer[TMP_SIZE]; 629 char buffer[TMP_SIZE];
@@ -632,30 +631,29 @@ static int hypfs_create_cpu_files(struct super_block *sb,
632 631
633 snprintf(buffer, TMP_SIZE, "%d", cpu_info__cpu_addr(diag204_info_type, 632 snprintf(buffer, TMP_SIZE, "%d", cpu_info__cpu_addr(diag204_info_type,
634 cpu_info)); 633 cpu_info));
635 cpu_dir = hypfs_mkdir(sb, cpus_dir, buffer); 634 cpu_dir = hypfs_mkdir(cpus_dir->d_sb, cpus_dir, buffer);
636 rc = hypfs_create_u64(sb, cpu_dir, "mgmtime", 635 rc = hypfs_create_u64(cpu_dir->d_sb, cpu_dir, "mgmtime",
637 cpu_info__acc_time(diag204_info_type, cpu_info) - 636 cpu_info__acc_time(diag204_info_type, cpu_info) -
638 cpu_info__lp_time(diag204_info_type, cpu_info)); 637 cpu_info__lp_time(diag204_info_type, cpu_info));
639 if (IS_ERR(rc)) 638 if (IS_ERR(rc))
640 return PTR_ERR(rc); 639 return PTR_ERR(rc);
641 rc = hypfs_create_u64(sb, cpu_dir, "cputime", 640 rc = hypfs_create_u64(cpu_dir->d_sb, cpu_dir, "cputime",
642 cpu_info__lp_time(diag204_info_type, cpu_info)); 641 cpu_info__lp_time(diag204_info_type, cpu_info));
643 if (IS_ERR(rc)) 642 if (IS_ERR(rc))
644 return PTR_ERR(rc); 643 return PTR_ERR(rc);
645 if (diag204_info_type == INFO_EXT) { 644 if (diag204_info_type == INFO_EXT) {
646 rc = hypfs_create_u64(sb, cpu_dir, "onlinetime", 645 rc = hypfs_create_u64(cpu_dir->d_sb, cpu_dir, "onlinetime",
647 cpu_info__online_time(diag204_info_type, 646 cpu_info__online_time(diag204_info_type,
648 cpu_info)); 647 cpu_info));
649 if (IS_ERR(rc)) 648 if (IS_ERR(rc))
650 return PTR_ERR(rc); 649 return PTR_ERR(rc);
651 } 650 }
652 diag224_idx2name(cpu_info__ctidx(diag204_info_type, cpu_info), buffer); 651 diag224_idx2name(cpu_info__ctidx(diag204_info_type, cpu_info), buffer);
653 rc = hypfs_create_str(sb, cpu_dir, "type", buffer); 652 rc = hypfs_create_str(cpu_dir->d_sb, cpu_dir, "type", buffer);
654 return PTR_RET(rc); 653 return PTR_RET(rc);
655} 654}
656 655
657static void *hypfs_create_lpar_files(struct super_block *sb, 656static void *hypfs_create_lpar_files(struct dentry *systems_dir, void *part_hdr)
658 struct dentry *systems_dir, void *part_hdr)
659{ 657{
660 struct dentry *cpus_dir; 658 struct dentry *cpus_dir;
661 struct dentry *lpar_dir; 659 struct dentry *lpar_dir;
@@ -665,16 +663,16 @@ static void *hypfs_create_lpar_files(struct super_block *sb,
665 663
666 part_hdr__part_name(diag204_info_type, part_hdr, lpar_name); 664 part_hdr__part_name(diag204_info_type, part_hdr, lpar_name);
667 lpar_name[LPAR_NAME_LEN] = 0; 665 lpar_name[LPAR_NAME_LEN] = 0;
668 lpar_dir = hypfs_mkdir(sb, systems_dir, lpar_name); 666 lpar_dir = hypfs_mkdir(systems_dir->d_sb, systems_dir, lpar_name);
669 if (IS_ERR(lpar_dir)) 667 if (IS_ERR(lpar_dir))
670 return lpar_dir; 668 return lpar_dir;
671 cpus_dir = hypfs_mkdir(sb, lpar_dir, "cpus"); 669 cpus_dir = hypfs_mkdir(lpar_dir->d_sb, lpar_dir, "cpus");
672 if (IS_ERR(cpus_dir)) 670 if (IS_ERR(cpus_dir))
673 return cpus_dir; 671 return cpus_dir;
674 cpu_info = part_hdr + part_hdr__size(diag204_info_type); 672 cpu_info = part_hdr + part_hdr__size(diag204_info_type);
675 for (i = 0; i < part_hdr__rcpus(diag204_info_type, part_hdr); i++) { 673 for (i = 0; i < part_hdr__rcpus(diag204_info_type, part_hdr); i++) {
676 int rc; 674 int rc;
677 rc = hypfs_create_cpu_files(sb, cpus_dir, cpu_info); 675 rc = hypfs_create_cpu_files(cpus_dir, cpu_info);
678 if (rc) 676 if (rc)
679 return ERR_PTR(rc); 677 return ERR_PTR(rc);
680 cpu_info += cpu_info__size(diag204_info_type); 678 cpu_info += cpu_info__size(diag204_info_type);
@@ -682,8 +680,7 @@ static void *hypfs_create_lpar_files(struct super_block *sb,
682 return cpu_info; 680 return cpu_info;
683} 681}
684 682
685static int hypfs_create_phys_cpu_files(struct super_block *sb, 683static int hypfs_create_phys_cpu_files(struct dentry *cpus_dir, void *cpu_info)
686 struct dentry *cpus_dir, void *cpu_info)
687{ 684{
688 struct dentry *cpu_dir; 685 struct dentry *cpu_dir;
689 char buffer[TMP_SIZE]; 686 char buffer[TMP_SIZE];
@@ -691,32 +688,31 @@ static int hypfs_create_phys_cpu_files(struct super_block *sb,
691 688
692 snprintf(buffer, TMP_SIZE, "%i", phys_cpu__cpu_addr(diag204_info_type, 689 snprintf(buffer, TMP_SIZE, "%i", phys_cpu__cpu_addr(diag204_info_type,
693 cpu_info)); 690 cpu_info));
694 cpu_dir = hypfs_mkdir(sb, cpus_dir, buffer); 691 cpu_dir = hypfs_mkdir(cpus_dir->d_sb, cpus_dir, buffer);
695 if (IS_ERR(cpu_dir)) 692 if (IS_ERR(cpu_dir))
696 return PTR_ERR(cpu_dir); 693 return PTR_ERR(cpu_dir);
697 rc = hypfs_create_u64(sb, cpu_dir, "mgmtime", 694 rc = hypfs_create_u64(cpu_dir->d_sb, cpu_dir, "mgmtime",
698 phys_cpu__mgm_time(diag204_info_type, cpu_info)); 695 phys_cpu__mgm_time(diag204_info_type, cpu_info));
699 if (IS_ERR(rc)) 696 if (IS_ERR(rc))
700 return PTR_ERR(rc); 697 return PTR_ERR(rc);
701 diag224_idx2name(phys_cpu__ctidx(diag204_info_type, cpu_info), buffer); 698 diag224_idx2name(phys_cpu__ctidx(diag204_info_type, cpu_info), buffer);
702 rc = hypfs_create_str(sb, cpu_dir, "type", buffer); 699 rc = hypfs_create_str(cpu_dir->d_sb, cpu_dir, "type", buffer);
703 return PTR_RET(rc); 700 return PTR_RET(rc);
704} 701}
705 702
706static void *hypfs_create_phys_files(struct super_block *sb, 703static void *hypfs_create_phys_files(struct dentry *parent_dir, void *phys_hdr)
707 struct dentry *parent_dir, void *phys_hdr)
708{ 704{
709 int i; 705 int i;
710 void *cpu_info; 706 void *cpu_info;
711 struct dentry *cpus_dir; 707 struct dentry *cpus_dir;
712 708
713 cpus_dir = hypfs_mkdir(sb, parent_dir, "cpus"); 709 cpus_dir = hypfs_mkdir(parent_dir->d_sb, parent_dir, "cpus");
714 if (IS_ERR(cpus_dir)) 710 if (IS_ERR(cpus_dir))
715 return cpus_dir; 711 return cpus_dir;
716 cpu_info = phys_hdr + phys_hdr__size(diag204_info_type); 712 cpu_info = phys_hdr + phys_hdr__size(diag204_info_type);
717 for (i = 0; i < phys_hdr__cpus(diag204_info_type, phys_hdr); i++) { 713 for (i = 0; i < phys_hdr__cpus(diag204_info_type, phys_hdr); i++) {
718 int rc; 714 int rc;
719 rc = hypfs_create_phys_cpu_files(sb, cpus_dir, cpu_info); 715 rc = hypfs_create_phys_cpu_files(cpus_dir, cpu_info);
720 if (rc) 716 if (rc)
721 return ERR_PTR(rc); 717 return ERR_PTR(rc);
722 cpu_info += phys_cpu__size(diag204_info_type); 718 cpu_info += phys_cpu__size(diag204_info_type);
@@ -724,7 +720,7 @@ static void *hypfs_create_phys_files(struct super_block *sb,
724 return cpu_info; 720 return cpu_info;
725} 721}
726 722
727int hypfs_diag_create_files(struct super_block *sb, struct dentry *root) 723int hypfs_diag_create_files(struct dentry *root)
728{ 724{
729 struct dentry *systems_dir, *hyp_dir; 725 struct dentry *systems_dir, *hyp_dir;
730 void *time_hdr, *part_hdr; 726 void *time_hdr, *part_hdr;
@@ -735,7 +731,7 @@ int hypfs_diag_create_files(struct super_block *sb, struct dentry *root)
735 if (IS_ERR(buffer)) 731 if (IS_ERR(buffer))
736 return PTR_ERR(buffer); 732 return PTR_ERR(buffer);
737 733
738 systems_dir = hypfs_mkdir(sb, root, "systems"); 734 systems_dir = hypfs_mkdir(root->d_sb, root, "systems");
739 if (IS_ERR(systems_dir)) { 735 if (IS_ERR(systems_dir)) {
740 rc = PTR_ERR(systems_dir); 736 rc = PTR_ERR(systems_dir);
741 goto err_out; 737 goto err_out;
@@ -743,25 +739,25 @@ int hypfs_diag_create_files(struct super_block *sb, struct dentry *root)
743 time_hdr = (struct x_info_blk_hdr *)buffer; 739 time_hdr = (struct x_info_blk_hdr *)buffer;
744 part_hdr = time_hdr + info_blk_hdr__size(diag204_info_type); 740 part_hdr = time_hdr + info_blk_hdr__size(diag204_info_type);
745 for (i = 0; i < info_blk_hdr__npar(diag204_info_type, time_hdr); i++) { 741 for (i = 0; i < info_blk_hdr__npar(diag204_info_type, time_hdr); i++) {
746 part_hdr = hypfs_create_lpar_files(sb, systems_dir, part_hdr); 742 part_hdr = hypfs_create_lpar_files(systems_dir, part_hdr);
747 if (IS_ERR(part_hdr)) { 743 if (IS_ERR(part_hdr)) {
748 rc = PTR_ERR(part_hdr); 744 rc = PTR_ERR(part_hdr);
749 goto err_out; 745 goto err_out;
750 } 746 }
751 } 747 }
752 if (info_blk_hdr__flags(diag204_info_type, time_hdr) & LPAR_PHYS_FLG) { 748 if (info_blk_hdr__flags(diag204_info_type, time_hdr) & LPAR_PHYS_FLG) {
753 ptr = hypfs_create_phys_files(sb, root, part_hdr); 749 ptr = hypfs_create_phys_files(root, part_hdr);
754 if (IS_ERR(ptr)) { 750 if (IS_ERR(ptr)) {
755 rc = PTR_ERR(ptr); 751 rc = PTR_ERR(ptr);
756 goto err_out; 752 goto err_out;
757 } 753 }
758 } 754 }
759 hyp_dir = hypfs_mkdir(sb, root, "hyp"); 755 hyp_dir = hypfs_mkdir(root->d_sb, root, "hyp");
760 if (IS_ERR(hyp_dir)) { 756 if (IS_ERR(hyp_dir)) {
761 rc = PTR_ERR(hyp_dir); 757 rc = PTR_ERR(hyp_dir);
762 goto err_out; 758 goto err_out;
763 } 759 }
764 ptr = hypfs_create_str(sb, hyp_dir, "type", "LPAR Hypervisor"); 760 ptr = hypfs_create_str(root->d_sb, hyp_dir, "type", "LPAR Hypervisor");
765 if (IS_ERR(ptr)) { 761 if (IS_ERR(ptr)) {
766 rc = PTR_ERR(ptr); 762 rc = PTR_ERR(ptr);
767 goto err_out; 763 goto err_out;