diff options
author | Christoph Hellwig <hch@infradead.org> | 2007-10-11 20:59:34 -0400 |
---|---|---|
committer | Lachlan McIlroy <lachlan@redback.melbourne.sgi.com> | 2008-02-07 02:11:47 -0500 |
commit | b53e675dc868c4844ecbcce9149cf68e4299231d (patch) | |
tree | e49928f2faa73d2f59b80647814835343c9379e5 /fs/xfs/xfs_log_priv.h | |
parent | 67fcb7bfb69eb1072c7e2dd6b46fa34db11dd587 (diff) |
[XFS] xlog_rec_header/xlog_rec_ext_header endianess annotations
Mostly trivial conversion with one exceptions: h_num_logops was kept in
native endian previously and only converted to big endian in xlog_sync,
but we always keep it big endian now. With todays cpus fast byteswap
instructions that's not an issue but the new variant keeps the code clean
and maintainable.
SGI-PV: 971186
SGI-Modid: xfs-linux-melb:xfs-kern:29821a
Signed-off-by: Christoph Hellwig <hch@infradead.org>
Signed-off-by: Lachlan McIlroy <lachlan@sgi.com>
Signed-off-by: Tim Shimmin <tes@sgi.com>
Diffstat (limited to 'fs/xfs/xfs_log_priv.h')
-rw-r--r-- | fs/xfs/xfs_log_priv.h | 40 |
1 files changed, 20 insertions, 20 deletions
diff --git a/fs/xfs/xfs_log_priv.h b/fs/xfs/xfs_log_priv.h index d555aebca9bc..e008233ee249 100644 --- a/fs/xfs/xfs_log_priv.h +++ b/fs/xfs/xfs_log_priv.h | |||
@@ -63,10 +63,10 @@ static inline xfs_lsn_t xlog_assign_lsn(uint cycle, uint block) | |||
63 | 63 | ||
64 | static inline uint xlog_get_cycle(char *ptr) | 64 | static inline uint xlog_get_cycle(char *ptr) |
65 | { | 65 | { |
66 | if (INT_GET(*(uint *)ptr, ARCH_CONVERT) == XLOG_HEADER_MAGIC_NUM) | 66 | if (be32_to_cpu(*(__be32 *)ptr) == XLOG_HEADER_MAGIC_NUM) |
67 | return INT_GET(*((uint *)ptr + 1), ARCH_CONVERT); | 67 | return be32_to_cpu(*((__be32 *)ptr + 1)); |
68 | else | 68 | else |
69 | return INT_GET(*(uint *)ptr, ARCH_CONVERT); | 69 | return be32_to_cpu(*(__be32 *)ptr); |
70 | } | 70 | } |
71 | 71 | ||
72 | #define BLK_AVG(blk1, blk2) ((blk1+blk2) >> 1) | 72 | #define BLK_AVG(blk1, blk2) ((blk1+blk2) >> 1) |
@@ -85,9 +85,9 @@ static inline uint xlog_get_cycle(char *ptr) | |||
85 | * | 85 | * |
86 | * this has endian issues, of course. | 86 | * this has endian issues, of course. |
87 | */ | 87 | */ |
88 | static inline uint xlog_get_client_id(uint i) | 88 | static inline uint xlog_get_client_id(__be32 i) |
89 | { | 89 | { |
90 | return INT_GET(i, ARCH_CONVERT) >> 24; | 90 | return be32_to_cpu(i) >> 24; |
91 | } | 91 | } |
92 | 92 | ||
93 | #define xlog_panic(args...) cmn_err(CE_PANIC, ## args) | 93 | #define xlog_panic(args...) cmn_err(CE_PANIC, ## args) |
@@ -287,25 +287,25 @@ typedef struct xlog_op_header { | |||
287 | #endif | 287 | #endif |
288 | 288 | ||
289 | typedef struct xlog_rec_header { | 289 | typedef struct xlog_rec_header { |
290 | uint h_magicno; /* log record (LR) identifier : 4 */ | 290 | __be32 h_magicno; /* log record (LR) identifier : 4 */ |
291 | uint h_cycle; /* write cycle of log : 4 */ | 291 | __be32 h_cycle; /* write cycle of log : 4 */ |
292 | int h_version; /* LR version : 4 */ | 292 | __be32 h_version; /* LR version : 4 */ |
293 | int h_len; /* len in bytes; should be 64-bit aligned: 4 */ | 293 | __be32 h_len; /* len in bytes; should be 64-bit aligned: 4 */ |
294 | xfs_lsn_t h_lsn; /* lsn of this LR : 8 */ | 294 | __be64 h_lsn; /* lsn of this LR : 8 */ |
295 | xfs_lsn_t h_tail_lsn; /* lsn of 1st LR w/ buffers not committed: 8 */ | 295 | __be64 h_tail_lsn; /* lsn of 1st LR w/ buffers not committed: 8 */ |
296 | uint h_chksum; /* may not be used; non-zero if used : 4 */ | 296 | __be32 h_chksum; /* may not be used; non-zero if used : 4 */ |
297 | int h_prev_block; /* block number to previous LR : 4 */ | 297 | __be32 h_prev_block; /* block number to previous LR : 4 */ |
298 | int h_num_logops; /* number of log operations in this LR : 4 */ | 298 | __be32 h_num_logops; /* number of log operations in this LR : 4 */ |
299 | uint h_cycle_data[XLOG_HEADER_CYCLE_SIZE / BBSIZE]; | 299 | __be32 h_cycle_data[XLOG_HEADER_CYCLE_SIZE / BBSIZE]; |
300 | /* new fields */ | 300 | /* new fields */ |
301 | int h_fmt; /* format of log record : 4 */ | 301 | __be32 h_fmt; /* format of log record : 4 */ |
302 | uuid_t h_fs_uuid; /* uuid of FS : 16 */ | 302 | uuid_t h_fs_uuid; /* uuid of FS : 16 */ |
303 | int h_size; /* iclog size : 4 */ | 303 | __be32 h_size; /* iclog size : 4 */ |
304 | } xlog_rec_header_t; | 304 | } xlog_rec_header_t; |
305 | 305 | ||
306 | typedef struct xlog_rec_ext_header { | 306 | typedef struct xlog_rec_ext_header { |
307 | uint xh_cycle; /* write cycle of log : 4 */ | 307 | __be32 xh_cycle; /* write cycle of log : 4 */ |
308 | uint xh_cycle_data[XLOG_HEADER_CYCLE_SIZE / BBSIZE]; /* : 256 */ | 308 | __be32 xh_cycle_data[XLOG_HEADER_CYCLE_SIZE / BBSIZE]; /* : 256 */ |
309 | } xlog_rec_ext_header_t; | 309 | } xlog_rec_ext_header_t; |
310 | 310 | ||
311 | #ifdef __KERNEL__ | 311 | #ifdef __KERNEL__ |