aboutsummaryrefslogtreecommitdiffstats
path: root/fs/ufs/util.h
diff options
context:
space:
mode:
authorEvgeniy Dushistov <dushistov@mail.ru>2006-06-25 08:47:29 -0400
committerLinus Torvalds <torvalds@g5.osdl.org>2006-06-25 13:01:04 -0400
commit647b7e87b56f594daf648f44abfbeeb5eb6a9457 (patch)
tree2a81679a2a9f7ee0a0ad984fbae4d43be050fd51 /fs/ufs/util.h
parentf391475812ba39afa322c835217ffe936f5e754a (diff)
[PATCH] ufs: one way to access super block
Super block of UFS usually has size >512, because of fragment size may be 512, this cause some problems. Currently, there are two methods to work with ufs super block: 1) split structure which describes ufs super blocks into structures with size <=512 2) use one structure which describes ufs super block, and hope that array of "buffer_head" which holds "super block", has such construction: bh[n]->b_data + bh[n]->b_size == bh[n + 1]->b_data The second variant may cause some problems in the future, and usage of two variants cause unnecessary code duplication. This patch remove the second variant. Also patch contains some CodingStyle fixes. Signed-off-by: Evgeniy Dushistov <dushistov@mail.ru> Signed-off-by: Andrew Morton <akpm@osdl.org> Signed-off-by: Linus Torvalds <torvalds@osdl.org>
Diffstat (limited to 'fs/ufs/util.h')
-rw-r--r--fs/ufs/util.h52
1 files changed, 17 insertions, 35 deletions
diff --git a/fs/ufs/util.h b/fs/ufs/util.h
index e95d1c46461f..eacd5e37b8e6 100644
--- a/fs/ufs/util.h
+++ b/fs/ufs/util.h
@@ -39,12 +39,12 @@ ufs_get_fs_state(struct super_block *sb, struct ufs_super_block_first *usb1,
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_SUN: 41 case UFS_ST_SUN:
42 return fs32_to_cpu(sb, usb3->fs_u2.fs_sun.fs_state); 42 return fs32_to_cpu(sb, usb3->fs_un2.fs_sun.fs_state);
43 case UFS_ST_SUNx86: 43 case UFS_ST_SUNx86:
44 return fs32_to_cpu(sb, usb1->fs_u1.fs_sunx86.fs_state); 44 return fs32_to_cpu(sb, usb1->fs_u1.fs_sunx86.fs_state);
45 case UFS_ST_44BSD: 45 case UFS_ST_44BSD:
46 default: 46 default:
47 return fs32_to_cpu(sb, usb3->fs_u2.fs_44.fs_state); 47 return fs32_to_cpu(sb, usb3->fs_un2.fs_44.fs_state);
48 } 48 }
49} 49}
50 50
@@ -54,13 +54,13 @@ ufs_set_fs_state(struct super_block *sb, struct ufs_super_block_first *usb1,
54{ 54{
55 switch (UFS_SB(sb)->s_flags & UFS_ST_MASK) { 55 switch (UFS_SB(sb)->s_flags & UFS_ST_MASK) {
56 case UFS_ST_SUN: 56 case UFS_ST_SUN:
57 usb3->fs_u2.fs_sun.fs_state = cpu_to_fs32(sb, value); 57 usb3->fs_un2.fs_sun.fs_state = cpu_to_fs32(sb, value);
58 break; 58 break;
59 case UFS_ST_SUNx86: 59 case UFS_ST_SUNx86:
60 usb1->fs_u1.fs_sunx86.fs_state = cpu_to_fs32(sb, value); 60 usb1->fs_u1.fs_sunx86.fs_state = cpu_to_fs32(sb, value);
61 break; 61 break;
62 case UFS_ST_44BSD: 62 case UFS_ST_44BSD:
63 usb3->fs_u2.fs_44.fs_state = cpu_to_fs32(sb, value); 63 usb3->fs_un2.fs_44.fs_state = cpu_to_fs32(sb, value);
64 break; 64 break;
65 } 65 }
66} 66}
@@ -70,7 +70,7 @@ ufs_get_fs_npsect(struct super_block *sb, struct ufs_super_block_first *usb1,
70 struct ufs_super_block_third *usb3) 70 struct ufs_super_block_third *usb3)
71{ 71{
72 if ((UFS_SB(sb)->s_flags & UFS_ST_MASK) == UFS_ST_SUNx86) 72 if ((UFS_SB(sb)->s_flags & UFS_ST_MASK) == UFS_ST_SUNx86)
73 return fs32_to_cpu(sb, usb3->fs_u2.fs_sunx86.fs_npsect); 73 return fs32_to_cpu(sb, usb3->fs_un2.fs_sunx86.fs_npsect);
74 else 74 else
75 return fs32_to_cpu(sb, usb1->fs_u1.fs_sun.fs_npsect); 75 return fs32_to_cpu(sb, usb1->fs_u1.fs_sun.fs_npsect);
76} 76}
@@ -82,16 +82,16 @@ ufs_get_fs_qbmask(struct super_block *sb, struct ufs_super_block_third *usb3)
82 82
83 switch (UFS_SB(sb)->s_flags & UFS_ST_MASK) { 83 switch (UFS_SB(sb)->s_flags & UFS_ST_MASK) {
84 case UFS_ST_SUN: 84 case UFS_ST_SUN:
85 ((__fs32 *)&tmp)[0] = usb3->fs_u2.fs_sun.fs_qbmask[0]; 85 ((__fs32 *)&tmp)[0] = usb3->fs_un2.fs_sun.fs_qbmask[0];
86 ((__fs32 *)&tmp)[1] = usb3->fs_u2.fs_sun.fs_qbmask[1]; 86 ((__fs32 *)&tmp)[1] = usb3->fs_un2.fs_sun.fs_qbmask[1];
87 break; 87 break;
88 case UFS_ST_SUNx86: 88 case UFS_ST_SUNx86:
89 ((__fs32 *)&tmp)[0] = usb3->fs_u2.fs_sunx86.fs_qbmask[0]; 89 ((__fs32 *)&tmp)[0] = usb3->fs_un2.fs_sunx86.fs_qbmask[0];
90 ((__fs32 *)&tmp)[1] = usb3->fs_u2.fs_sunx86.fs_qbmask[1]; 90 ((__fs32 *)&tmp)[1] = usb3->fs_un2.fs_sunx86.fs_qbmask[1];
91 break; 91 break;
92 case UFS_ST_44BSD: 92 case UFS_ST_44BSD:
93 ((__fs32 *)&tmp)[0] = usb3->fs_u2.fs_44.fs_qbmask[0]; 93 ((__fs32 *)&tmp)[0] = usb3->fs_un2.fs_44.fs_qbmask[0];
94 ((__fs32 *)&tmp)[1] = usb3->fs_u2.fs_44.fs_qbmask[1]; 94 ((__fs32 *)&tmp)[1] = usb3->fs_un2.fs_44.fs_qbmask[1];
95 break; 95 break;
96 } 96 }
97 97
@@ -105,16 +105,16 @@ ufs_get_fs_qfmask(struct super_block *sb, struct ufs_super_block_third *usb3)
105 105
106 switch (UFS_SB(sb)->s_flags & UFS_ST_MASK) { 106 switch (UFS_SB(sb)->s_flags & UFS_ST_MASK) {
107 case UFS_ST_SUN: 107 case UFS_ST_SUN:
108 ((__fs32 *)&tmp)[0] = usb3->fs_u2.fs_sun.fs_qfmask[0]; 108 ((__fs32 *)&tmp)[0] = usb3->fs_un2.fs_sun.fs_qfmask[0];
109 ((__fs32 *)&tmp)[1] = usb3->fs_u2.fs_sun.fs_qfmask[1]; 109 ((__fs32 *)&tmp)[1] = usb3->fs_un2.fs_sun.fs_qfmask[1];
110 break; 110 break;
111 case UFS_ST_SUNx86: 111 case UFS_ST_SUNx86:
112 ((__fs32 *)&tmp)[0] = usb3->fs_u2.fs_sunx86.fs_qfmask[0]; 112 ((__fs32 *)&tmp)[0] = usb3->fs_un2.fs_sunx86.fs_qfmask[0];
113 ((__fs32 *)&tmp)[1] = usb3->fs_u2.fs_sunx86.fs_qfmask[1]; 113 ((__fs32 *)&tmp)[1] = usb3->fs_un2.fs_sunx86.fs_qfmask[1];
114 break; 114 break;
115 case UFS_ST_44BSD: 115 case UFS_ST_44BSD:
116 ((__fs32 *)&tmp)[0] = usb3->fs_u2.fs_44.fs_qfmask[0]; 116 ((__fs32 *)&tmp)[0] = usb3->fs_un2.fs_44.fs_qfmask[0];
117 ((__fs32 *)&tmp)[1] = usb3->fs_u2.fs_44.fs_qfmask[1]; 117 ((__fs32 *)&tmp)[1] = usb3->fs_un2.fs_44.fs_qfmask[1];
118 break; 118 break;
119 } 119 }
120 120
@@ -302,24 +302,6 @@ static inline void *get_usb_offset(struct ufs_sb_private_info *uspi,
302#define ubh_blkmap(ubh,begin,bit) \ 302#define ubh_blkmap(ubh,begin,bit) \
303 ((*ubh_get_addr(ubh, (begin) + ((bit) >> 3)) >> ((bit) & 7)) & (0xff >> (UFS_MAXFRAG - uspi->s_fpb))) 303 ((*ubh_get_addr(ubh, (begin) + ((bit) >> 3)) >> ((bit) & 7)) & (0xff >> (UFS_MAXFRAG - uspi->s_fpb)))
304 304
305
306/*
307 * Macros for access to superblock array structures
308 */
309#define ubh_postbl(ubh,cylno,i) \
310 ((uspi->s_postblformat != UFS_DYNAMICPOSTBLFMT) \
311 ? (*(__s16*)(ubh_get_addr(ubh, \
312 (unsigned)(&((struct ufs_super_block *)0)->fs_opostbl) \
313 + (((cylno) * 16 + (i)) << 1) ) )) \
314 : (*(__s16*)(ubh_get_addr(ubh, \
315 uspi->s_postbloff + (((cylno) * uspi->s_nrpos + (i)) << 1) ))))
316
317#define ubh_rotbl(ubh,i) \
318 ((uspi->s_postblformat != UFS_DYNAMICPOSTBLFMT) \
319 ? (*(__u8*)(ubh_get_addr(ubh, \
320 (unsigned)(&((struct ufs_super_block *)0)->fs_space) + (i)))) \
321 : (*(__u8*)(ubh_get_addr(ubh, uspi->s_rotbloff + (i)))))
322
323/* 305/*
324 * Determine the number of available frags given a 306 * Determine the number of available frags given a
325 * percentage to hold in reserve. 307 * percentage to hold in reserve.