aboutsummaryrefslogtreecommitdiffstats
path: root/fs/ufs/super.c
diff options
context:
space:
mode:
authorMark Fortescue <mark@mtfhpc.demon.co.uk>2007-10-17 02:26:31 -0400
committerLinus Torvalds <torvalds@woody.linux-foundation.org>2007-10-17 11:42:49 -0400
commit252e211e90ce56bf005cb533ad5a297c18c19407 (patch)
tree9b37f80e1f4c1ec74e150edb3ea7b8d70faea79a /fs/ufs/super.c
parentef2fb67989d30fea475bb01c5b7ca44adbce5dea (diff)
Add in SunOS 4.1.x compatible mode for UFS
Add in support for SunOS 4.1.x flavor of BSD 4.2 UFS filing system Macros have been put in to alow suport for the old static table Cylinder Groups but this implementation does not use them yet. This also fixes Solaris UFS filing system access by disabling fast symbolic links as Sun's version of UFS does not support on-disk fast symbolic links. Tested by: Ppartitioning a new disk using SunOS 4.1.1, creating a UFS filing system on one of the partitions and writing some files to the filing system. Using Linux-2.6.22 (patched) to read the files and then write a shed load of files to the UFS partition. Using SunOS 4.1.1 to verify the filing system is OK and to check the files. The test host is a sun4c SS1 Clone. [akpm@linux-foundation.org: coding style fixes] [adobriyan@gmail.com: fix oops] Signed-off-by: Mark Fortescue <mark@mtfhpc.demon.co.uk> Cc: Evgeniy Dushistov <dushistov@mail.ru> Signed-off-by: Alexey Dobriyan <adobriyan@gmail.com> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'fs/ufs/super.c')
-rw-r--r--fs/ufs/super.c41
1 files changed, 34 insertions, 7 deletions
diff --git a/fs/ufs/super.c b/fs/ufs/super.c
index c5bdea7c23a9..87f6b51a895d 100644
--- a/fs/ufs/super.c
+++ b/fs/ufs/super.c
@@ -286,7 +286,7 @@ void ufs_warning (struct super_block * sb, const char * function,
286} 286}
287 287
288enum { 288enum {
289 Opt_type_old, Opt_type_sunx86, Opt_type_sun, Opt_type_44bsd, 289 Opt_type_old, Opt_type_sunx86, Opt_type_sun, Opt_type_sunos, Opt_type_44bsd,
290 Opt_type_ufs2, Opt_type_hp, Opt_type_nextstepcd, Opt_type_nextstep, 290 Opt_type_ufs2, Opt_type_hp, Opt_type_nextstepcd, Opt_type_nextstep,
291 Opt_type_openstep, Opt_onerror_panic, Opt_onerror_lock, 291 Opt_type_openstep, Opt_onerror_panic, Opt_onerror_lock,
292 Opt_onerror_umount, Opt_onerror_repair, Opt_err 292 Opt_onerror_umount, Opt_onerror_repair, Opt_err
@@ -296,6 +296,7 @@ static match_table_t tokens = {
296 {Opt_type_old, "ufstype=old"}, 296 {Opt_type_old, "ufstype=old"},
297 {Opt_type_sunx86, "ufstype=sunx86"}, 297 {Opt_type_sunx86, "ufstype=sunx86"},
298 {Opt_type_sun, "ufstype=sun"}, 298 {Opt_type_sun, "ufstype=sun"},
299 {Opt_type_sunos, "ufstype=sunos"},
299 {Opt_type_44bsd, "ufstype=44bsd"}, 300 {Opt_type_44bsd, "ufstype=44bsd"},
300 {Opt_type_ufs2, "ufstype=ufs2"}, 301 {Opt_type_ufs2, "ufstype=ufs2"},
301 {Opt_type_ufs2, "ufstype=5xbsd"}, 302 {Opt_type_ufs2, "ufstype=5xbsd"},
@@ -339,6 +340,10 @@ static int ufs_parse_options (char * options, unsigned * mount_options)
339 ufs_clear_opt (*mount_options, UFSTYPE); 340 ufs_clear_opt (*mount_options, UFSTYPE);
340 ufs_set_opt (*mount_options, UFSTYPE_SUN); 341 ufs_set_opt (*mount_options, UFSTYPE_SUN);
341 break; 342 break;
343 case Opt_type_sunos:
344 ufs_clear_opt(*mount_options, UFSTYPE);
345 ufs_set_opt(*mount_options, UFSTYPE_SUNOS);
346 break;
342 case Opt_type_44bsd: 347 case Opt_type_44bsd:
343 ufs_clear_opt (*mount_options, UFSTYPE); 348 ufs_clear_opt (*mount_options, UFSTYPE);
344 ufs_set_opt (*mount_options, UFSTYPE_44BSD); 349 ufs_set_opt (*mount_options, UFSTYPE_44BSD);
@@ -654,8 +659,8 @@ static int ufs_fill_super(struct super_block *sb, void *data, int silent)
654 ufs_set_opt (sbi->s_mount_opt, UFSTYPE_OLD); 659 ufs_set_opt (sbi->s_mount_opt, UFSTYPE_OLD);
655 } 660 }
656 661
657 sbi->s_uspi = uspi = 662 uspi = kzalloc(sizeof(struct ufs_sb_private_info), GFP_KERNEL);
658 kmalloc (sizeof(struct ufs_sb_private_info), GFP_KERNEL); 663 sbi->s_uspi = uspi;
659 if (!uspi) 664 if (!uspi)
660 goto failed; 665 goto failed;
661 uspi->s_dirblksize = UFS_SECTOR_SIZE; 666 uspi->s_dirblksize = UFS_SECTOR_SIZE;
@@ -692,10 +697,22 @@ static int ufs_fill_super(struct super_block *sb, void *data, int silent)
692 uspi->s_fshift = 10; 697 uspi->s_fshift = 10;
693 uspi->s_sbsize = super_block_size = 2048; 698 uspi->s_sbsize = super_block_size = 2048;
694 uspi->s_sbbase = 0; 699 uspi->s_sbbase = 0;
695 uspi->s_maxsymlinklen = 56; 700 uspi->s_maxsymlinklen = 0; /* Not supported on disk */
696 flags |= UFS_DE_OLD | UFS_UID_EFT | UFS_ST_SUN | UFS_CG_SUN; 701 flags |= UFS_DE_OLD | UFS_UID_EFT | UFS_ST_SUN | UFS_CG_SUN;
697 break; 702 break;
698 703
704 case UFS_MOUNT_UFSTYPE_SUNOS:
705 UFSD(("ufstype=sunos\n"))
706 uspi->s_fsize = block_size = 1024;
707 uspi->s_fmask = ~(1024 - 1);
708 uspi->s_fshift = 10;
709 uspi->s_sbsize = 2048;
710 super_block_size = 2048;
711 uspi->s_sbbase = 0;
712 uspi->s_maxsymlinklen = 0; /* Not supported on disk */
713 flags |= UFS_DE_OLD | UFS_UID_OLD | UFS_ST_SUNOS | UFS_CG_SUN;
714 break;
715
699 case UFS_MOUNT_UFSTYPE_SUNx86: 716 case UFS_MOUNT_UFSTYPE_SUNx86:
700 UFSD("ufstype=sunx86\n"); 717 UFSD("ufstype=sunx86\n");
701 uspi->s_fsize = block_size = 1024; 718 uspi->s_fsize = block_size = 1024;
@@ -703,7 +720,7 @@ static int ufs_fill_super(struct super_block *sb, void *data, int silent)
703 uspi->s_fshift = 10; 720 uspi->s_fshift = 10;
704 uspi->s_sbsize = super_block_size = 2048; 721 uspi->s_sbsize = super_block_size = 2048;
705 uspi->s_sbbase = 0; 722 uspi->s_sbbase = 0;
706 uspi->s_maxsymlinklen = 56; 723 uspi->s_maxsymlinklen = 0; /* Not supported on disk */
707 flags |= UFS_DE_OLD | UFS_UID_EFT | UFS_ST_SUNx86 | UFS_CG_SUN; 724 flags |= UFS_DE_OLD | UFS_UID_EFT | UFS_ST_SUNx86 | UFS_CG_SUN;
708 break; 725 break;
709 726
@@ -805,11 +822,18 @@ again:
805 if (!ubh) 822 if (!ubh)
806 goto failed; 823 goto failed;
807 824
808
809 usb1 = ubh_get_usb_first(uspi); 825 usb1 = ubh_get_usb_first(uspi);
810 usb2 = ubh_get_usb_second(uspi); 826 usb2 = ubh_get_usb_second(uspi);
811 usb3 = ubh_get_usb_third(uspi); 827 usb3 = ubh_get_usb_third(uspi);
812 828
829 /* Sort out mod used on SunOS 4.1.3 for fs_state */
830 uspi->s_postblformat = fs32_to_cpu(sb, usb3->fs_postblformat);
831 if (((flags & UFS_ST_MASK) == UFS_ST_SUNOS) &&
832 (uspi->s_postblformat != UFS_42POSTBLFMT)) {
833 flags &= ~UFS_ST_MASK;
834 flags |= UFS_ST_SUN;
835 }
836
813 /* 837 /*
814 * Check ufs magic number 838 * Check ufs magic number
815 */ 839 */
@@ -904,6 +928,7 @@ magic_found:
904 if (((flags & UFS_ST_MASK) == UFS_ST_44BSD) || 928 if (((flags & UFS_ST_MASK) == UFS_ST_44BSD) ||
905 ((flags & UFS_ST_MASK) == UFS_ST_OLD) || 929 ((flags & UFS_ST_MASK) == UFS_ST_OLD) ||
906 (((flags & UFS_ST_MASK) == UFS_ST_SUN || 930 (((flags & UFS_ST_MASK) == UFS_ST_SUN ||
931 (flags & UFS_ST_MASK) == UFS_ST_SUNOS ||
907 (flags & UFS_ST_MASK) == UFS_ST_SUNx86) && 932 (flags & UFS_ST_MASK) == UFS_ST_SUNx86) &&
908 (ufs_get_fs_state(sb, usb1, usb3) == (UFS_FSOK - fs32_to_cpu(sb, usb1->fs_time))))) { 933 (ufs_get_fs_state(sb, usb1, usb3) == (UFS_FSOK - fs32_to_cpu(sb, usb1->fs_time))))) {
909 switch(usb1->fs_clean) { 934 switch(usb1->fs_clean) {
@@ -995,7 +1020,6 @@ magic_found:
995 uspi->s_contigsumsize = fs32_to_cpu(sb, usb3->fs_un2.fs_44.fs_contigsumsize); 1020 uspi->s_contigsumsize = fs32_to_cpu(sb, usb3->fs_un2.fs_44.fs_contigsumsize);
996 uspi->s_qbmask = ufs_get_fs_qbmask(sb, usb3); 1021 uspi->s_qbmask = ufs_get_fs_qbmask(sb, usb3);
997 uspi->s_qfmask = ufs_get_fs_qfmask(sb, usb3); 1022 uspi->s_qfmask = ufs_get_fs_qfmask(sb, usb3);
998 uspi->s_postblformat = fs32_to_cpu(sb, usb3->fs_postblformat);
999 uspi->s_nrpos = fs32_to_cpu(sb, usb3->fs_nrpos); 1023 uspi->s_nrpos = fs32_to_cpu(sb, usb3->fs_nrpos);
1000 uspi->s_postbloff = fs32_to_cpu(sb, usb3->fs_postbloff); 1024 uspi->s_postbloff = fs32_to_cpu(sb, usb3->fs_postbloff);
1001 uspi->s_rotbloff = fs32_to_cpu(sb, usb3->fs_rotbloff); 1025 uspi->s_rotbloff = fs32_to_cpu(sb, usb3->fs_rotbloff);
@@ -1077,6 +1101,7 @@ static void ufs_write_super(struct super_block *sb)
1077 if (!(sb->s_flags & MS_RDONLY)) { 1101 if (!(sb->s_flags & MS_RDONLY)) {
1078 usb1->fs_time = cpu_to_fs32(sb, get_seconds()); 1102 usb1->fs_time = cpu_to_fs32(sb, get_seconds());
1079 if ((flags & UFS_ST_MASK) == UFS_ST_SUN 1103 if ((flags & UFS_ST_MASK) == UFS_ST_SUN
1104 || (flags & UFS_ST_MASK) == UFS_ST_SUNOS
1080 || (flags & UFS_ST_MASK) == UFS_ST_SUNx86) 1105 || (flags & UFS_ST_MASK) == UFS_ST_SUNx86)
1081 ufs_set_fs_state(sb, usb1, usb3, 1106 ufs_set_fs_state(sb, usb1, usb3,
1082 UFS_FSOK - fs32_to_cpu(sb, usb1->fs_time)); 1107 UFS_FSOK - fs32_to_cpu(sb, usb1->fs_time));
@@ -1146,6 +1171,7 @@ static int ufs_remount (struct super_block *sb, int *mount_flags, char *data)
1146 ufs_put_super_internal(sb); 1171 ufs_put_super_internal(sb);
1147 usb1->fs_time = cpu_to_fs32(sb, get_seconds()); 1172 usb1->fs_time = cpu_to_fs32(sb, get_seconds());
1148 if ((flags & UFS_ST_MASK) == UFS_ST_SUN 1173 if ((flags & UFS_ST_MASK) == UFS_ST_SUN
1174 || (flags & UFS_ST_MASK) == UFS_ST_SUNOS
1149 || (flags & UFS_ST_MASK) == UFS_ST_SUNx86) 1175 || (flags & UFS_ST_MASK) == UFS_ST_SUNx86)
1150 ufs_set_fs_state(sb, usb1, usb3, 1176 ufs_set_fs_state(sb, usb1, usb3,
1151 UFS_FSOK - fs32_to_cpu(sb, usb1->fs_time)); 1177 UFS_FSOK - fs32_to_cpu(sb, usb1->fs_time));
@@ -1162,6 +1188,7 @@ static int ufs_remount (struct super_block *sb, int *mount_flags, char *data)
1162 return -EINVAL; 1188 return -EINVAL;
1163#else 1189#else
1164 if (ufstype != UFS_MOUNT_UFSTYPE_SUN && 1190 if (ufstype != UFS_MOUNT_UFSTYPE_SUN &&
1191 ufstype != UFS_MOUNT_UFSTYPE_SUNOS &&
1165 ufstype != UFS_MOUNT_UFSTYPE_44BSD && 1192 ufstype != UFS_MOUNT_UFSTYPE_44BSD &&
1166 ufstype != UFS_MOUNT_UFSTYPE_SUNx86 && 1193 ufstype != UFS_MOUNT_UFSTYPE_SUNx86 &&
1167 ufstype != UFS_MOUNT_UFSTYPE_UFS2) { 1194 ufstype != UFS_MOUNT_UFSTYPE_UFS2) {