diff options
Diffstat (limited to 'fs/ufs/inode.c')
-rw-r--r-- | fs/ufs/inode.c | 39 |
1 files changed, 18 insertions, 21 deletions
diff --git a/fs/ufs/inode.c b/fs/ufs/inode.c index 39f877898565..3d2512c21f05 100644 --- a/fs/ufs/inode.c +++ b/fs/ufs/inode.c | |||
@@ -622,7 +622,6 @@ static int ufs1_read_inode(struct inode *inode, struct ufs_inode *ufs_inode) | |||
622 | struct ufs_inode_info *ufsi = UFS_I(inode); | 622 | struct ufs_inode_info *ufsi = UFS_I(inode); |
623 | struct super_block *sb = inode->i_sb; | 623 | struct super_block *sb = inode->i_sb; |
624 | mode_t mode; | 624 | mode_t mode; |
625 | unsigned i; | ||
626 | 625 | ||
627 | /* | 626 | /* |
628 | * Copy data to the in-core inode. | 627 | * Copy data to the in-core inode. |
@@ -655,11 +654,12 @@ static int ufs1_read_inode(struct inode *inode, struct ufs_inode *ufs_inode) | |||
655 | 654 | ||
656 | 655 | ||
657 | if (S_ISCHR(mode) || S_ISBLK(mode) || inode->i_blocks) { | 656 | if (S_ISCHR(mode) || S_ISBLK(mode) || inode->i_blocks) { |
658 | for (i = 0; i < (UFS_NDADDR + UFS_NINDIR); i++) | 657 | memcpy(ufsi->i_u1.i_data, &ufs_inode->ui_u2.ui_addr, |
659 | ufsi->i_u1.i_data[i] = ufs_inode->ui_u2.ui_addr.ui_db[i]; | 658 | sizeof(ufs_inode->ui_u2.ui_addr)); |
660 | } else { | 659 | } else { |
661 | for (i = 0; i < (UFS_NDADDR + UFS_NINDIR) * 4; i++) | 660 | memcpy(ufsi->i_u1.i_symlink, ufs_inode->ui_u2.ui_symlink, |
662 | ufsi->i_u1.i_symlink[i] = ufs_inode->ui_u2.ui_symlink[i]; | 661 | sizeof(ufs_inode->ui_u2.ui_symlink) - 1); |
662 | ufsi->i_u1.i_symlink[sizeof(ufs_inode->ui_u2.ui_symlink) - 1] = 0; | ||
663 | } | 663 | } |
664 | return 0; | 664 | return 0; |
665 | } | 665 | } |
@@ -669,7 +669,6 @@ static int ufs2_read_inode(struct inode *inode, struct ufs2_inode *ufs2_inode) | |||
669 | struct ufs_inode_info *ufsi = UFS_I(inode); | 669 | struct ufs_inode_info *ufsi = UFS_I(inode); |
670 | struct super_block *sb = inode->i_sb; | 670 | struct super_block *sb = inode->i_sb; |
671 | mode_t mode; | 671 | mode_t mode; |
672 | unsigned i; | ||
673 | 672 | ||
674 | UFSD("Reading ufs2 inode, ino %lu\n", inode->i_ino); | 673 | UFSD("Reading ufs2 inode, ino %lu\n", inode->i_ino); |
675 | /* | 674 | /* |
@@ -704,12 +703,12 @@ static int ufs2_read_inode(struct inode *inode, struct ufs2_inode *ufs2_inode) | |||
704 | */ | 703 | */ |
705 | 704 | ||
706 | if (S_ISCHR(mode) || S_ISBLK(mode) || inode->i_blocks) { | 705 | if (S_ISCHR(mode) || S_ISBLK(mode) || inode->i_blocks) { |
707 | for (i = 0; i < (UFS_NDADDR + UFS_NINDIR); i++) | 706 | memcpy(ufsi->i_u1.u2_i_data, &ufs2_inode->ui_u2.ui_addr, |
708 | ufsi->i_u1.u2_i_data[i] = | 707 | sizeof(ufs2_inode->ui_u2.ui_addr)); |
709 | ufs2_inode->ui_u2.ui_addr.ui_db[i]; | ||
710 | } else { | 708 | } else { |
711 | for (i = 0; i < (UFS_NDADDR + UFS_NINDIR) * 4; i++) | 709 | memcpy(ufsi->i_u1.i_symlink, ufs2_inode->ui_u2.ui_symlink, |
712 | ufsi->i_u1.i_symlink[i] = ufs2_inode->ui_u2.ui_symlink[i]; | 710 | sizeof(ufs2_inode->ui_u2.ui_symlink) - 1); |
711 | ufsi->i_u1.i_symlink[sizeof(ufs2_inode->ui_u2.ui_symlink) - 1] = 0; | ||
713 | } | 712 | } |
714 | return 0; | 713 | return 0; |
715 | } | 714 | } |
@@ -781,7 +780,6 @@ static void ufs1_update_inode(struct inode *inode, struct ufs_inode *ufs_inode) | |||
781 | { | 780 | { |
782 | struct super_block *sb = inode->i_sb; | 781 | struct super_block *sb = inode->i_sb; |
783 | struct ufs_inode_info *ufsi = UFS_I(inode); | 782 | struct ufs_inode_info *ufsi = UFS_I(inode); |
784 | unsigned i; | ||
785 | 783 | ||
786 | ufs_inode->ui_mode = cpu_to_fs16(sb, inode->i_mode); | 784 | ufs_inode->ui_mode = cpu_to_fs16(sb, inode->i_mode); |
787 | ufs_inode->ui_nlink = cpu_to_fs16(sb, inode->i_nlink); | 785 | ufs_inode->ui_nlink = cpu_to_fs16(sb, inode->i_nlink); |
@@ -809,12 +807,12 @@ static void ufs1_update_inode(struct inode *inode, struct ufs_inode *ufs_inode) | |||
809 | /* ufs_inode->ui_u2.ui_addr.ui_db[0] = cpu_to_fs32(sb, inode->i_rdev); */ | 807 | /* ufs_inode->ui_u2.ui_addr.ui_db[0] = cpu_to_fs32(sb, inode->i_rdev); */ |
810 | ufs_inode->ui_u2.ui_addr.ui_db[0] = ufsi->i_u1.i_data[0]; | 808 | ufs_inode->ui_u2.ui_addr.ui_db[0] = ufsi->i_u1.i_data[0]; |
811 | } else if (inode->i_blocks) { | 809 | } else if (inode->i_blocks) { |
812 | for (i = 0; i < (UFS_NDADDR + UFS_NINDIR); i++) | 810 | memcpy(&ufs_inode->ui_u2.ui_addr, ufsi->i_u1.i_data, |
813 | ufs_inode->ui_u2.ui_addr.ui_db[i] = ufsi->i_u1.i_data[i]; | 811 | sizeof(ufs_inode->ui_u2.ui_addr)); |
814 | } | 812 | } |
815 | else { | 813 | else { |
816 | for (i = 0; i < (UFS_NDADDR + UFS_NINDIR) * 4; i++) | 814 | memcpy(&ufs_inode->ui_u2.ui_symlink, ufsi->i_u1.i_symlink, |
817 | ufs_inode->ui_u2.ui_symlink[i] = ufsi->i_u1.i_symlink[i]; | 815 | sizeof(ufs_inode->ui_u2.ui_symlink)); |
818 | } | 816 | } |
819 | 817 | ||
820 | if (!inode->i_nlink) | 818 | if (!inode->i_nlink) |
@@ -825,7 +823,6 @@ static void ufs2_update_inode(struct inode *inode, struct ufs2_inode *ufs_inode) | |||
825 | { | 823 | { |
826 | struct super_block *sb = inode->i_sb; | 824 | struct super_block *sb = inode->i_sb; |
827 | struct ufs_inode_info *ufsi = UFS_I(inode); | 825 | struct ufs_inode_info *ufsi = UFS_I(inode); |
828 | unsigned i; | ||
829 | 826 | ||
830 | UFSD("ENTER\n"); | 827 | UFSD("ENTER\n"); |
831 | ufs_inode->ui_mode = cpu_to_fs16(sb, inode->i_mode); | 828 | ufs_inode->ui_mode = cpu_to_fs16(sb, inode->i_mode); |
@@ -850,11 +847,11 @@ static void ufs2_update_inode(struct inode *inode, struct ufs2_inode *ufs_inode) | |||
850 | /* ufs_inode->ui_u2.ui_addr.ui_db[0] = cpu_to_fs32(sb, inode->i_rdev); */ | 847 | /* ufs_inode->ui_u2.ui_addr.ui_db[0] = cpu_to_fs32(sb, inode->i_rdev); */ |
851 | ufs_inode->ui_u2.ui_addr.ui_db[0] = ufsi->i_u1.u2_i_data[0]; | 848 | ufs_inode->ui_u2.ui_addr.ui_db[0] = ufsi->i_u1.u2_i_data[0]; |
852 | } else if (inode->i_blocks) { | 849 | } else if (inode->i_blocks) { |
853 | for (i = 0; i < (UFS_NDADDR + UFS_NINDIR); i++) | 850 | memcpy(&ufs_inode->ui_u2.ui_addr, ufsi->i_u1.u2_i_data, |
854 | ufs_inode->ui_u2.ui_addr.ui_db[i] = ufsi->i_u1.u2_i_data[i]; | 851 | sizeof(ufs_inode->ui_u2.ui_addr)); |
855 | } else { | 852 | } else { |
856 | for (i = 0; i < (UFS_NDADDR + UFS_NINDIR) * 4; i++) | 853 | memcpy(&ufs_inode->ui_u2.ui_symlink, ufsi->i_u1.i_symlink, |
857 | ufs_inode->ui_u2.ui_symlink[i] = ufsi->i_u1.i_symlink[i]; | 854 | sizeof(ufs_inode->ui_u2.ui_symlink)); |
858 | } | 855 | } |
859 | 856 | ||
860 | if (!inode->i_nlink) | 857 | if (!inode->i_nlink) |