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/util.h | |
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/util.h')
-rw-r--r-- | fs/ufs/util.h | 16 |
1 files changed, 11 insertions, 5 deletions
diff --git a/fs/ufs/util.h b/fs/ufs/util.h index e10362d8f456..6a0b48cf9cef 100644 --- a/fs/ufs/util.h +++ b/fs/ufs/util.h | |||
@@ -17,10 +17,16 @@ | |||
17 | #define in_range(b,first,len) ((b)>=(first)&&(b)<(first)+(len)) | 17 | #define in_range(b,first,len) ((b)>=(first)&&(b)<(first)+(len)) |
18 | 18 | ||
19 | /* | 19 | /* |
20 | * macros used for retyping | 20 | * functions used for retyping |
21 | */ | 21 | */ |
22 | #define UCPI_UBH ((struct ufs_buffer_head *)ucpi) | 22 | static inline struct ufs_buffer_head *UCPI_UBH(struct ufs_cg_private_info *cpi) |
23 | #define USPI_UBH ((struct ufs_buffer_head *)uspi) | 23 | { |
24 | return &cpi->c_ubh; | ||
25 | } | ||
26 | static inline struct ufs_buffer_head *USPI_UBH(struct ufs_sb_private_info *spi) | ||
27 | { | ||
28 | return &spi->s_ubh; | ||
29 | } | ||
24 | 30 | ||
25 | 31 | ||
26 | 32 | ||
@@ -326,10 +332,10 @@ static inline void *get_usb_offset(struct ufs_sb_private_info *uspi, | |||
326 | * Macros to access cylinder group array structures | 332 | * Macros to access cylinder group array structures |
327 | */ | 333 | */ |
328 | #define ubh_cg_blktot(ucpi,cylno) \ | 334 | #define ubh_cg_blktot(ucpi,cylno) \ |
329 | (*((__fs32*)ubh_get_addr(UCPI_UBH, (ucpi)->c_btotoff + ((cylno) << 2)))) | 335 | (*((__fs32*)ubh_get_addr(UCPI_UBH(ucpi), (ucpi)->c_btotoff + ((cylno) << 2)))) |
330 | 336 | ||
331 | #define ubh_cg_blks(ucpi,cylno,rpos) \ | 337 | #define ubh_cg_blks(ucpi,cylno,rpos) \ |
332 | (*((__fs16*)ubh_get_addr(UCPI_UBH, \ | 338 | (*((__fs16*)ubh_get_addr(UCPI_UBH(ucpi), \ |
333 | (ucpi)->c_boff + (((cylno) * uspi->s_nrpos + (rpos)) << 1 )))) | 339 | (ucpi)->c_boff + (((cylno) * uspi->s_nrpos + (rpos)) << 1 )))) |
334 | 340 | ||
335 | /* | 341 | /* |