diff options
author | Evgeniy Dushistov <dushistov@mail.ru> | 2006-06-25 08:47:22 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@g5.osdl.org> | 2006-06-25 13:01:02 -0400 |
commit | 9695ef16ed4e00b59303f39f9a4a422a2c6a3b89 (patch) | |
tree | fba8946e86a523a5d53936cf5ec9e0a150037f73 /fs/ufs/cylinder.c | |
parent | b71034e5e67d1577424cebe7bbb7d0ce134a4cd8 (diff) |
[PATCH] ufs: wrong type cast
There are two ugly macros in ufs code:
#define UCPI_UBH ((struct ufs_buffer_head *)ucpi)
#define USPI_UBH ((struct ufs_buffer_head *)uspi)
when uspi looks like
struct {
struct ufs_buffer_head ;
}
and USPI_UBH has some sence,
ucpi looks like
struct {
struct not_ufs_buffer_head;
}
To prevent bugs in future, this patch convert macros to inline function and
fix "ucpi" structure.
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/cylinder.c')
-rw-r--r-- | fs/ufs/cylinder.c | 18 |
1 files changed, 9 insertions, 9 deletions
diff --git a/fs/ufs/cylinder.c b/fs/ufs/cylinder.c index 14abb8b835f7..65fe06810172 100644 --- a/fs/ufs/cylinder.c +++ b/fs/ufs/cylinder.c | |||
@@ -47,14 +47,14 @@ static void ufs_read_cylinder (struct super_block * sb, | |||
47 | ucpi = sbi->s_ucpi[bitmap_nr]; | 47 | ucpi = sbi->s_ucpi[bitmap_nr]; |
48 | ucg = (struct ufs_cylinder_group *)sbi->s_ucg[cgno]->b_data; | 48 | ucg = (struct ufs_cylinder_group *)sbi->s_ucg[cgno]->b_data; |
49 | 49 | ||
50 | UCPI_UBH->fragment = ufs_cgcmin(cgno); | 50 | UCPI_UBH(ucpi)->fragment = ufs_cgcmin(cgno); |
51 | UCPI_UBH->count = uspi->s_cgsize >> sb->s_blocksize_bits; | 51 | UCPI_UBH(ucpi)->count = uspi->s_cgsize >> sb->s_blocksize_bits; |
52 | /* | 52 | /* |
53 | * We have already the first fragment of cylinder group block in buffer | 53 | * We have already the first fragment of cylinder group block in buffer |
54 | */ | 54 | */ |
55 | UCPI_UBH->bh[0] = sbi->s_ucg[cgno]; | 55 | UCPI_UBH(ucpi)->bh[0] = sbi->s_ucg[cgno]; |
56 | for (i = 1; i < UCPI_UBH->count; i++) | 56 | for (i = 1; i < UCPI_UBH(ucpi)->count; i++) |
57 | if (!(UCPI_UBH->bh[i] = sb_bread(sb, UCPI_UBH->fragment + i))) | 57 | if (!(UCPI_UBH(ucpi)->bh[i] = sb_bread(sb, UCPI_UBH(ucpi)->fragment + i))) |
58 | goto failed; | 58 | goto failed; |
59 | sbi->s_cgno[bitmap_nr] = cgno; | 59 | sbi->s_cgno[bitmap_nr] = cgno; |
60 | 60 | ||
@@ -103,7 +103,7 @@ void ufs_put_cylinder (struct super_block * sb, unsigned bitmap_nr) | |||
103 | return; | 103 | return; |
104 | } | 104 | } |
105 | ucpi = sbi->s_ucpi[bitmap_nr]; | 105 | ucpi = sbi->s_ucpi[bitmap_nr]; |
106 | ucg = ubh_get_ucg(UCPI_UBH); | 106 | ucg = ubh_get_ucg(UCPI_UBH(ucpi)); |
107 | 107 | ||
108 | if (uspi->s_ncg > UFS_MAX_GROUP_LOADED && bitmap_nr >= sbi->s_cg_loaded) { | 108 | if (uspi->s_ncg > UFS_MAX_GROUP_LOADED && bitmap_nr >= sbi->s_cg_loaded) { |
109 | ufs_panic (sb, "ufs_put_cylinder", "internal error"); | 109 | ufs_panic (sb, "ufs_put_cylinder", "internal error"); |
@@ -116,9 +116,9 @@ void ufs_put_cylinder (struct super_block * sb, unsigned bitmap_nr) | |||
116 | ucg->cg_rotor = cpu_to_fs32(sb, ucpi->c_rotor); | 116 | ucg->cg_rotor = cpu_to_fs32(sb, ucpi->c_rotor); |
117 | ucg->cg_frotor = cpu_to_fs32(sb, ucpi->c_frotor); | 117 | ucg->cg_frotor = cpu_to_fs32(sb, ucpi->c_frotor); |
118 | ucg->cg_irotor = cpu_to_fs32(sb, ucpi->c_irotor); | 118 | ucg->cg_irotor = cpu_to_fs32(sb, ucpi->c_irotor); |
119 | ubh_mark_buffer_dirty (UCPI_UBH); | 119 | ubh_mark_buffer_dirty (UCPI_UBH(ucpi)); |
120 | for (i = 1; i < UCPI_UBH->count; i++) { | 120 | for (i = 1; i < UCPI_UBH(ucpi)->count; i++) { |
121 | brelse (UCPI_UBH->bh[i]); | 121 | brelse (UCPI_UBH(ucpi)->bh[i]); |
122 | } | 122 | } |
123 | 123 | ||
124 | sbi->s_cgno[bitmap_nr] = UFS_CGNO_EMPTY; | 124 | sbi->s_cgno[bitmap_nr] = UFS_CGNO_EMPTY; |