diff options
author | Mark Fortescue <mark@mtfhpc.demon.co.uk> | 2007-10-17 02:26:31 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@woody.linux-foundation.org> | 2007-10-17 11:42:49 -0400 |
commit | 252e211e90ce56bf005cb533ad5a297c18c19407 (patch) | |
tree | 9b37f80e1f4c1ec74e150edb3ea7b8d70faea79a /fs/ufs/util.h | |
parent | ef2fb67989d30fea475bb01c5b7ca44adbce5dea (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/util.h')
-rw-r--r-- | fs/ufs/util.h | 50 |
1 files changed, 38 insertions, 12 deletions
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 | |||
179 | ufs_get_inode_uid(struct super_block *sb, struct ufs_inode *inode) | 191 | ufs_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 | |||
192 | ufs_set_inode_uid(struct super_block *sb, struct ufs_inode *inode, u32 value) | 206 | ufs_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 | ||
205 | static inline u32 | 224 | static inline u32 |
206 | ufs_get_inode_gid(struct super_block *sb, struct ufs_inode *inode) | 225 | ufs_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 | |||
219 | ufs_set_inode_gid(struct super_block *sb, struct ufs_inode *inode, u32 value) | 240 | ufs_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 | ||
232 | extern dev_t ufs_get_inode_dev(struct super_block *, struct ufs_inode_info *); | 258 | extern dev_t ufs_get_inode_dev(struct super_block *, struct ufs_inode_info *); |