aboutsummaryrefslogtreecommitdiffstats
path: root/fs/ufs
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@linux-foundation.org>2009-03-27 19:23:12 -0400
committerLinus Torvalds <torvalds@linux-foundation.org>2009-03-27 19:23:12 -0400
commit3ae5080f4c2e293229508dabe7c8a90af4e4c460 (patch)
tree9cb11f26905a82b7fac9d3b8f9d61d58bc5c94b0 /fs/ufs
parent2c9e15a011c55ff96b2b8d2b126d1b9a96abba20 (diff)
parentaabb8fdb41128705fd1627f56fdd571e45fdbcdb (diff)
Merge branch 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/viro/vfs-2.6
* 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/viro/vfs-2.6: (37 commits) fs: avoid I_NEW inodes Merge code for single and multiple-instance mounts Remove get_init_pts_sb() Move common mknod_ptmx() calls into caller Parse mount options just once and copy them to super block Unroll essentials of do_remount_sb() into devpts vfs: simple_set_mnt() should return void fs: move bdev code out of buffer.c constify dentry_operations: rest constify dentry_operations: configfs constify dentry_operations: sysfs constify dentry_operations: JFS constify dentry_operations: OCFS2 constify dentry_operations: GFS2 constify dentry_operations: FAT constify dentry_operations: FUSE constify dentry_operations: procfs constify dentry_operations: ecryptfs constify dentry_operations: CIFS constify dentry_operations: AFS ...
Diffstat (limited to 'fs/ufs')
-rw-r--r--fs/ufs/inode.c39
-rw-r--r--fs/ufs/namei.c2
-rw-r--r--fs/ufs/super.c11
-rw-r--r--fs/ufs/ufs.h2
4 files changed, 31 insertions, 23 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)
diff --git a/fs/ufs/namei.c b/fs/ufs/namei.c
index e3a9b1fac75a..23119fe7ad62 100644
--- a/fs/ufs/namei.c
+++ b/fs/ufs/namei.c
@@ -147,7 +147,7 @@ static int ufs_symlink (struct inode * dir, struct dentry * dentry,
147 } else { 147 } else {
148 /* fast symlink */ 148 /* fast symlink */
149 inode->i_op = &ufs_fast_symlink_inode_operations; 149 inode->i_op = &ufs_fast_symlink_inode_operations;
150 memcpy((char*)&UFS_I(inode)->i_u1.i_data,symname,l); 150 memcpy(UFS_I(inode)->i_u1.i_symlink, symname, l);
151 inode->i_size = l-1; 151 inode->i_size = l-1;
152 } 152 }
153 mark_inode_dirty(inode); 153 mark_inode_dirty(inode);
diff --git a/fs/ufs/super.c b/fs/ufs/super.c
index 261a1c2f22dd..e1c1fc5ee239 100644
--- a/fs/ufs/super.c
+++ b/fs/ufs/super.c
@@ -636,6 +636,7 @@ static int ufs_fill_super(struct super_block *sb, void *data, int silent)
636 unsigned block_size, super_block_size; 636 unsigned block_size, super_block_size;
637 unsigned flags; 637 unsigned flags;
638 unsigned super_block_offset; 638 unsigned super_block_offset;
639 unsigned maxsymlen;
639 int ret = -EINVAL; 640 int ret = -EINVAL;
640 641
641 uspi = NULL; 642 uspi = NULL;
@@ -1069,6 +1070,16 @@ magic_found:
1069 uspi->s_maxsymlinklen = 1070 uspi->s_maxsymlinklen =
1070 fs32_to_cpu(sb, usb3->fs_un2.fs_44.fs_maxsymlinklen); 1071 fs32_to_cpu(sb, usb3->fs_un2.fs_44.fs_maxsymlinklen);
1071 1072
1073 if (uspi->fs_magic == UFS2_MAGIC)
1074 maxsymlen = 2 * 4 * (UFS_NDADDR + UFS_NINDIR);
1075 else
1076 maxsymlen = 4 * (UFS_NDADDR + UFS_NINDIR);
1077 if (uspi->s_maxsymlinklen > maxsymlen) {
1078 ufs_warning(sb, __func__, "ufs_read_super: excessive maximum "
1079 "fast symlink size (%u)\n", uspi->s_maxsymlinklen);
1080 uspi->s_maxsymlinklen = maxsymlen;
1081 }
1082
1072 inode = ufs_iget(sb, UFS_ROOTINO); 1083 inode = ufs_iget(sb, UFS_ROOTINO);
1073 if (IS_ERR(inode)) { 1084 if (IS_ERR(inode)) {
1074 ret = PTR_ERR(inode); 1085 ret = PTR_ERR(inode);
diff --git a/fs/ufs/ufs.h b/fs/ufs/ufs.h
index 11c035168ea6..69b3427d7885 100644
--- a/fs/ufs/ufs.h
+++ b/fs/ufs/ufs.h
@@ -23,7 +23,7 @@ struct ufs_sb_info {
23struct ufs_inode_info { 23struct ufs_inode_info {
24 union { 24 union {
25 __fs32 i_data[15]; 25 __fs32 i_data[15];
26 __u8 i_symlink[4*15]; 26 __u8 i_symlink[2 * 4 * 15];
27 __fs64 u2_i_data[15]; 27 __fs64 u2_i_data[15];
28 } i_u1; 28 } i_u1;
29 __u32 i_flags; 29 __u32 i_flags;