aboutsummaryrefslogtreecommitdiffstats
path: root/fs
diff options
context:
space:
mode:
Diffstat (limited to 'fs')
-rw-r--r--fs/ufs/super.c41
-rw-r--r--fs/ufs/util.h50
2 files changed, 72 insertions, 19 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) {
diff --git a/fs/ufs/util.h b/fs/ufs/util.h
index 79a340a1909e..b26fc4dec1e7 100644
--- a/fs/ufs/util.h
+++ b/fs/ufs/util.h
@@ -38,6 +38,10 @@ ufs_get_fs_state(struct super_block *sb, struct ufs_super_block_first *usb1,
38 struct ufs_super_block_third *usb3) 38 struct ufs_super_block_third *usb3)
39{ 39{
40 switch (UFS_SB(sb)->s_flags & UFS_ST_MASK) { 40 switch (UFS_SB(sb)->s_flags & UFS_ST_MASK) {
41 case UFS_ST_SUNOS:
42 if (fs32_to_cpu(sb, usb3->fs_postblformat) == UFS_42POSTBLFMT)
43 return fs32_to_cpu(sb, usb1->fs_u0.fs_sun.fs_state);
44 /* Fall Through to UFS_ST_SUN */
41 case UFS_ST_SUN: 45 case UFS_ST_SUN:
42 return fs32_to_cpu(sb, usb3->fs_un2.fs_sun.fs_state); 46 return fs32_to_cpu(sb, usb3->fs_un2.fs_sun.fs_state);
43 case UFS_ST_SUNx86: 47 case UFS_ST_SUNx86:
@@ -53,6 +57,12 @@ ufs_set_fs_state(struct super_block *sb, struct ufs_super_block_first *usb1,
53 struct ufs_super_block_third *usb3, s32 value) 57 struct ufs_super_block_third *usb3, s32 value)
54{ 58{
55 switch (UFS_SB(sb)->s_flags & UFS_ST_MASK) { 59 switch (UFS_SB(sb)->s_flags & UFS_ST_MASK) {
60 case UFS_ST_SUNOS:
61 if (fs32_to_cpu(sb, usb3->fs_postblformat == UFS_42POSTBLFMT)) {
62 usb1->fs_u0.fs_sun.fs_state = cpu_to_fs32(sb, value);
63 break;
64 }
65 /* Fall Through to UFS_ST_SUN */
56 case UFS_ST_SUN: 66 case UFS_ST_SUN:
57 usb3->fs_un2.fs_sun.fs_state = cpu_to_fs32(sb, value); 67 usb3->fs_un2.fs_sun.fs_state = cpu_to_fs32(sb, value);
58 break; 68 break;
@@ -81,6 +91,7 @@ ufs_get_fs_qbmask(struct super_block *sb, struct ufs_super_block_third *usb3)
81 __fs64 tmp; 91 __fs64 tmp;
82 92
83 switch (UFS_SB(sb)->s_flags & UFS_ST_MASK) { 93 switch (UFS_SB(sb)->s_flags & UFS_ST_MASK) {
94 case UFS_ST_SUNOS:
84 case UFS_ST_SUN: 95 case UFS_ST_SUN:
85 ((__fs32 *)&tmp)[0] = usb3->fs_un2.fs_sun.fs_qbmask[0]; 96 ((__fs32 *)&tmp)[0] = usb3->fs_un2.fs_sun.fs_qbmask[0];
86 ((__fs32 *)&tmp)[1] = usb3->fs_un2.fs_sun.fs_qbmask[1]; 97 ((__fs32 *)&tmp)[1] = usb3->fs_un2.fs_sun.fs_qbmask[1];
@@ -104,6 +115,7 @@ ufs_get_fs_qfmask(struct super_block *sb, struct ufs_super_block_third *usb3)
104 __fs64 tmp; 115 __fs64 tmp;
105 116
106 switch (UFS_SB(sb)->s_flags & UFS_ST_MASK) { 117 switch (UFS_SB(sb)->s_flags & UFS_ST_MASK) {
118 case UFS_ST_SUNOS:
107 case UFS_ST_SUN: 119 case UFS_ST_SUN:
108 ((__fs32 *)&tmp)[0] = usb3->fs_un2.fs_sun.fs_qfmask[0]; 120 ((__fs32 *)&tmp)[0] = usb3->fs_un2.fs_sun.fs_qfmask[0];
109 ((__fs32 *)&tmp)[1] = usb3->fs_un2.fs_sun.fs_qfmask[1]; 121 ((__fs32 *)&tmp)[1] = usb3->fs_un2.fs_sun.fs_qfmask[1];
@@ -179,10 +191,12 @@ static inline u32
179ufs_get_inode_uid(struct super_block *sb, struct ufs_inode *inode) 191ufs_get_inode_uid(struct super_block *sb, struct ufs_inode *inode)
180{ 192{
181 switch (UFS_SB(sb)->s_flags & UFS_UID_MASK) { 193 switch (UFS_SB(sb)->s_flags & UFS_UID_MASK) {
182 case UFS_UID_EFT:
183 return fs32_to_cpu(sb, inode->ui_u3.ui_sun.ui_uid);
184 case UFS_UID_44BSD: 194 case UFS_UID_44BSD:
185 return fs32_to_cpu(sb, inode->ui_u3.ui_44.ui_uid); 195 return fs32_to_cpu(sb, inode->ui_u3.ui_44.ui_uid);
196 case UFS_UID_EFT:
197 if (inode->ui_u1.oldids.ui_suid == 0xFFFF)
198 return fs32_to_cpu(sb, inode->ui_u3.ui_sun.ui_uid);
199 /* Fall through */
186 default: 200 default:
187 return fs16_to_cpu(sb, inode->ui_u1.oldids.ui_suid); 201 return fs16_to_cpu(sb, inode->ui_u1.oldids.ui_suid);
188 } 202 }
@@ -192,24 +206,31 @@ static inline void
192ufs_set_inode_uid(struct super_block *sb, struct ufs_inode *inode, u32 value) 206ufs_set_inode_uid(struct super_block *sb, struct ufs_inode *inode, u32 value)
193{ 207{
194 switch (UFS_SB(sb)->s_flags & UFS_UID_MASK) { 208 switch (UFS_SB(sb)->s_flags & UFS_UID_MASK) {
195 case UFS_UID_EFT:
196 inode->ui_u3.ui_sun.ui_uid = cpu_to_fs32(sb, value);
197 break;
198 case UFS_UID_44BSD: 209 case UFS_UID_44BSD:
199 inode->ui_u3.ui_44.ui_uid = cpu_to_fs32(sb, value); 210 inode->ui_u3.ui_44.ui_uid = cpu_to_fs32(sb, value);
211 inode->ui_u1.oldids.ui_suid = cpu_to_fs16(sb, value);
212 break;
213 case UFS_UID_EFT:
214 inode->ui_u3.ui_sun.ui_uid = cpu_to_fs32(sb, value);
215 if (value > 0xFFFF)
216 value = 0xFFFF;
217 /* Fall through */
218 default:
219 inode->ui_u1.oldids.ui_suid = cpu_to_fs16(sb, value);
200 break; 220 break;
201 } 221 }
202 inode->ui_u1.oldids.ui_suid = cpu_to_fs16(sb, value);
203} 222}
204 223
205static inline u32 224static inline u32
206ufs_get_inode_gid(struct super_block *sb, struct ufs_inode *inode) 225ufs_get_inode_gid(struct super_block *sb, struct ufs_inode *inode)
207{ 226{
208 switch (UFS_SB(sb)->s_flags & UFS_UID_MASK) { 227 switch (UFS_SB(sb)->s_flags & UFS_UID_MASK) {
209 case UFS_UID_EFT:
210 return fs32_to_cpu(sb, inode->ui_u3.ui_sun.ui_gid);
211 case UFS_UID_44BSD: 228 case UFS_UID_44BSD:
212 return fs32_to_cpu(sb, inode->ui_u3.ui_44.ui_gid); 229 return fs32_to_cpu(sb, inode->ui_u3.ui_44.ui_gid);
230 case UFS_UID_EFT:
231 if (inode->ui_u1.oldids.ui_suid == 0xFFFF)
232 return fs32_to_cpu(sb, inode->ui_u3.ui_sun.ui_gid);
233 /* Fall through */
213 default: 234 default:
214 return fs16_to_cpu(sb, inode->ui_u1.oldids.ui_sgid); 235 return fs16_to_cpu(sb, inode->ui_u1.oldids.ui_sgid);
215 } 236 }
@@ -219,14 +240,19 @@ static inline void
219ufs_set_inode_gid(struct super_block *sb, struct ufs_inode *inode, u32 value) 240ufs_set_inode_gid(struct super_block *sb, struct ufs_inode *inode, u32 value)
220{ 241{
221 switch (UFS_SB(sb)->s_flags & UFS_UID_MASK) { 242 switch (UFS_SB(sb)->s_flags & UFS_UID_MASK) {
222 case UFS_UID_EFT:
223 inode->ui_u3.ui_sun.ui_gid = cpu_to_fs32(sb, value);
224 break;
225 case UFS_UID_44BSD: 243 case UFS_UID_44BSD:
226 inode->ui_u3.ui_44.ui_gid = cpu_to_fs32(sb, value); 244 inode->ui_u3.ui_44.ui_gid = cpu_to_fs32(sb, value);
245 inode->ui_u1.oldids.ui_sgid = cpu_to_fs16(sb, value);
246 break;
247 case UFS_UID_EFT:
248 inode->ui_u3.ui_sun.ui_gid = cpu_to_fs32(sb, value);
249 if (value > 0xFFFF)
250 value = 0xFFFF;
251 /* Fall through */
252 default:
253 inode->ui_u1.oldids.ui_sgid = cpu_to_fs16(sb, value);
227 break; 254 break;
228 } 255 }
229 inode->ui_u1.oldids.ui_sgid = cpu_to_fs16(sb, value);
230} 256}
231 257
232extern dev_t ufs_get_inode_dev(struct super_block *, struct ufs_inode_info *); 258extern dev_t ufs_get_inode_dev(struct super_block *, struct ufs_inode_info *);