aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--fs/ufs/super.c41
-rw-r--r--fs/ufs/util.h50
-rw-r--r--include/linux/ufs_fs.h55
3 files changed, 123 insertions, 23 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 *);
diff --git a/include/linux/ufs_fs.h b/include/linux/ufs_fs.h
index daeba22b7656..52730d2c9ad9 100644
--- a/include/linux/ufs_fs.h
+++ b/include/linux/ufs_fs.h
@@ -170,8 +170,9 @@ typedef __u16 __bitwise __fs16;
170#define UFS_ST_MASK 0x00000700 /* mask for the following */ 170#define UFS_ST_MASK 0x00000700 /* mask for the following */
171#define UFS_ST_OLD 0x00000000 171#define UFS_ST_OLD 0x00000000
172#define UFS_ST_44BSD 0x00000100 172#define UFS_ST_44BSD 0x00000100
173#define UFS_ST_SUN 0x00000200 173#define UFS_ST_SUN 0x00000200 /* Solaris */
174#define UFS_ST_SUNx86 0x00000400 174#define UFS_ST_SUNOS 0x00000300
175#define UFS_ST_SUNx86 0x00000400 /* Solaris x86 */
175/*cylinder group encoding */ 176/*cylinder group encoding */
176#define UFS_CG_MASK 0x00003000 /* mask for the following */ 177#define UFS_CG_MASK 0x00003000 /* mask for the following */
177#define UFS_CG_OLD 0x00000000 178#define UFS_CG_OLD 0x00000000
@@ -204,6 +205,7 @@ typedef __u16 __bitwise __fs16;
204#define UFS_MOUNT_UFSTYPE_SUNx86 0x00000400 205#define UFS_MOUNT_UFSTYPE_SUNx86 0x00000400
205#define UFS_MOUNT_UFSTYPE_HP 0x00000800 206#define UFS_MOUNT_UFSTYPE_HP 0x00000800
206#define UFS_MOUNT_UFSTYPE_UFS2 0x00001000 207#define UFS_MOUNT_UFSTYPE_UFS2 0x00001000
208#define UFS_MOUNT_UFSTYPE_SUNOS 0x00002000
207 209
208#define ufs_clear_opt(o,opt) o &= ~UFS_MOUNT_##opt 210#define ufs_clear_opt(o,opt) o &= ~UFS_MOUNT_##opt
209#define ufs_set_opt(o,opt) o |= UFS_MOUNT_##opt 211#define ufs_set_opt(o,opt) o |= UFS_MOUNT_##opt
@@ -374,7 +376,14 @@ struct ufs_csum_core {
374 * struct ufs_super_block_(first,second,third) instead. 376 * struct ufs_super_block_(first,second,third) instead.
375 */ 377 */
376struct ufs_super_block { 378struct ufs_super_block {
377 __fs32 fs_link; /* UNUSED */ 379 union {
380 struct {
381 __fs32 fs_link; /* UNUSED */
382 } fs_42;
383 struct {
384 __fs32 fs_state; /* file system state flag */
385 } fs_sun;
386 } fs_u0;
378 __fs32 fs_rlink; /* UNUSED */ 387 __fs32 fs_rlink; /* UNUSED */
379 __fs32 fs_sblkno; /* addr of super-block in filesys */ 388 __fs32 fs_sblkno; /* addr of super-block in filesys */
380 __fs32 fs_cblkno; /* offset of cyl-block in filesys */ 389 __fs32 fs_cblkno; /* offset of cyl-block in filesys */
@@ -545,6 +554,15 @@ struct ufs_super_block {
545#define CG_MAGIC 0x090255 554#define CG_MAGIC 0x090255
546#define ufs_cg_chkmagic(sb, ucg) \ 555#define ufs_cg_chkmagic(sb, ucg) \
547 (fs32_to_cpu((sb), (ucg)->cg_magic) == CG_MAGIC) 556 (fs32_to_cpu((sb), (ucg)->cg_magic) == CG_MAGIC)
557/*
558 * Macros for access to old cylinder group array structures
559 */
560#define ufs_ocg_blktot(sb, ucg) fs32_to_cpu((sb), ((struct ufs_old_cylinder_group *)(ucg))->cg_btot)
561#define ufs_ocg_blks(sb, ucg, cylno) fs32_to_cpu((sb), ((struct ufs_old_cylinder_group *)(ucg))->cg_b[cylno])
562#define ufs_ocg_inosused(sb, ucg) fs32_to_cpu((sb), ((struct ufs_old_cylinder_group *)(ucg))->cg_iused)
563#define ufs_ocg_blksfree(sb, ucg) fs32_to_cpu((sb), ((struct ufs_old_cylinder_group *)(ucg))->cg_free)
564#define ufs_ocg_chkmagic(sb, ucg) \
565 (fs32_to_cpu((sb), ((struct ufs_old_cylinder_group *)(ucg))->cg_magic) == CG_MAGIC)
548 566
549/* 567/*
550 * size of this structure is 172 B 568 * size of this structure is 172 B
@@ -590,6 +608,28 @@ struct ufs_cylinder_group {
590/* actually longer */ 608/* actually longer */
591}; 609};
592 610
611/* Historic Cylinder group info */
612struct ufs_old_cylinder_group {
613 __fs32 cg_link; /* linked list of cyl groups */
614 __fs32 cg_rlink; /* for incore cyl groups */
615 __fs32 cg_time; /* time last written */
616 __fs32 cg_cgx; /* we are the cgx'th cylinder group */
617 __fs16 cg_ncyl; /* number of cyl's this cg */
618 __fs16 cg_niblk; /* number of inode blocks this cg */
619 __fs32 cg_ndblk; /* number of data blocks this cg */
620 struct ufs_csum cg_cs; /* cylinder summary information */
621 __fs32 cg_rotor; /* position of last used block */
622 __fs32 cg_frotor; /* position of last used frag */
623 __fs32 cg_irotor; /* position of last used inode */
624 __fs32 cg_frsum[8]; /* counts of available frags */
625 __fs32 cg_btot[32]; /* block totals per cylinder */
626 __fs16 cg_b[32][8]; /* positions of free blocks */
627 __u8 cg_iused[256]; /* used inode map */
628 __fs32 cg_magic; /* magic number */
629 __u8 cg_free[1]; /* free block map */
630/* actually longer */
631};
632
593/* 633/*
594 * structure of an on-disk inode 634 * structure of an on-disk inode
595 */ 635 */
@@ -796,7 +836,14 @@ struct ufs_sb_private_info {
796 * ufs_super_block_third 356 836 * ufs_super_block_third 356
797 */ 837 */
798struct ufs_super_block_first { 838struct ufs_super_block_first {
799 __fs32 fs_link; 839 union {
840 struct {
841 __fs32 fs_link; /* UNUSED */
842 } fs_42;
843 struct {
844 __fs32 fs_state; /* file system state flag */
845 } fs_sun;
846 } fs_u0;
800 __fs32 fs_rlink; 847 __fs32 fs_rlink;
801 __fs32 fs_sblkno; 848 __fs32 fs_sblkno;
802 __fs32 fs_cblkno; 849 __fs32 fs_cblkno;