aboutsummaryrefslogtreecommitdiffstats
path: root/fs/ufs/util.h
diff options
context:
space:
mode:
Diffstat (limited to 'fs/ufs/util.h')
-rw-r--r--fs/ufs/util.h50
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
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 *);