diff options
author | Nathan Scott <nathans@sgi.com> | 2006-03-17 01:27:19 -0500 |
---|---|---|
committer | Nathan Scott <nathans@sgi.com> | 2006-03-17 01:27:19 -0500 |
commit | 68b3a1024a7cda4afaacb3d25e6ac234ddfc0834 (patch) | |
tree | 5f3e54a1d961b32e516e4e539266f6c8b36d8729 /fs/xfs | |
parent | 0ba962ef7128d9276b8f95196382d5b9e2ad841d (diff) |
[XFS] endianess annotations for XFS_DIR2_LEAF_BESTS_P
SGI-PV: 943272
SGI-Modid: xfs-linux-melb:xfs-kern:25486a
Signed-off-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: Nathan Scott <nathans@sgi.com>
Diffstat (limited to 'fs/xfs')
-rw-r--r-- | fs/xfs/xfs_dir2_block.c | 4 | ||||
-rw-r--r-- | fs/xfs/xfs_dir2_leaf.c | 30 | ||||
-rw-r--r-- | fs/xfs/xfs_dir2_leaf.h | 5 | ||||
-rw-r--r-- | fs/xfs/xfs_dir2_node.c | 4 |
4 files changed, 21 insertions, 22 deletions
diff --git a/fs/xfs/xfs_dir2_block.c b/fs/xfs/xfs_dir2_block.c index 35a03f29b2fb..e9d298f06ca2 100644 --- a/fs/xfs/xfs_dir2_block.c +++ b/fs/xfs/xfs_dir2_block.c | |||
@@ -880,7 +880,7 @@ xfs_dir2_leaf_to_block( | |||
880 | xfs_dabuf_t *lbp, /* leaf buffer */ | 880 | xfs_dabuf_t *lbp, /* leaf buffer */ |
881 | xfs_dabuf_t *dbp) /* data buffer */ | 881 | xfs_dabuf_t *dbp) /* data buffer */ |
882 | { | 882 | { |
883 | xfs_dir2_data_off_t *bestsp; /* leaf bests table */ | 883 | __be16 *bestsp; /* leaf bests table */ |
884 | xfs_dir2_block_t *block; /* block structure */ | 884 | xfs_dir2_block_t *block; /* block structure */ |
885 | xfs_dir2_block_tail_t *btp; /* block tail */ | 885 | xfs_dir2_block_tail_t *btp; /* block tail */ |
886 | xfs_inode_t *dp; /* incore directory inode */ | 886 | xfs_inode_t *dp; /* incore directory inode */ |
@@ -914,7 +914,7 @@ xfs_dir2_leaf_to_block( | |||
914 | */ | 914 | */ |
915 | while (dp->i_d.di_size > mp->m_dirblksize) { | 915 | while (dp->i_d.di_size > mp->m_dirblksize) { |
916 | bestsp = XFS_DIR2_LEAF_BESTS_P(ltp); | 916 | bestsp = XFS_DIR2_LEAF_BESTS_P(ltp); |
917 | if (INT_GET(bestsp[INT_GET(ltp->bestcount, ARCH_CONVERT) - 1], ARCH_CONVERT) == | 917 | if (be16_to_cpu(bestsp[INT_GET(ltp->bestcount, ARCH_CONVERT) - 1]) == |
918 | mp->m_dirblksize - (uint)sizeof(block->hdr)) { | 918 | mp->m_dirblksize - (uint)sizeof(block->hdr)) { |
919 | if ((error = | 919 | if ((error = |
920 | xfs_dir2_leaf_trim_data(args, lbp, | 920 | xfs_dir2_leaf_trim_data(args, lbp, |
diff --git a/fs/xfs/xfs_dir2_leaf.c b/fs/xfs/xfs_dir2_leaf.c index bd425925ee24..568e0feca034 100644 --- a/fs/xfs/xfs_dir2_leaf.c +++ b/fs/xfs/xfs_dir2_leaf.c | |||
@@ -66,7 +66,7 @@ xfs_dir2_block_to_leaf( | |||
66 | xfs_da_args_t *args, /* operation arguments */ | 66 | xfs_da_args_t *args, /* operation arguments */ |
67 | xfs_dabuf_t *dbp) /* input block's buffer */ | 67 | xfs_dabuf_t *dbp) /* input block's buffer */ |
68 | { | 68 | { |
69 | xfs_dir2_data_off_t *bestsp; /* leaf's bestsp entries */ | 69 | __be16 *bestsp; /* leaf's bestsp entries */ |
70 | xfs_dablk_t blkno; /* leaf block's bno */ | 70 | xfs_dablk_t blkno; /* leaf block's bno */ |
71 | xfs_dir2_block_t *block; /* block structure */ | 71 | xfs_dir2_block_t *block; /* block structure */ |
72 | xfs_dir2_leaf_entry_t *blp; /* block's leaf entries */ | 72 | xfs_dir2_leaf_entry_t *blp; /* block's leaf entries */ |
@@ -163,7 +163,7 @@ int /* error */ | |||
163 | xfs_dir2_leaf_addname( | 163 | xfs_dir2_leaf_addname( |
164 | xfs_da_args_t *args) /* operation arguments */ | 164 | xfs_da_args_t *args) /* operation arguments */ |
165 | { | 165 | { |
166 | xfs_dir2_data_off_t *bestsp; /* freespace table in leaf */ | 166 | __be16 *bestsp; /* freespace table in leaf */ |
167 | int compact; /* need to compact leaves */ | 167 | int compact; /* need to compact leaves */ |
168 | xfs_dir2_data_t *data; /* data block structure */ | 168 | xfs_dir2_data_t *data; /* data block structure */ |
169 | xfs_dabuf_t *dbp; /* data block buffer */ | 169 | xfs_dabuf_t *dbp; /* data block buffer */ |
@@ -228,8 +228,8 @@ xfs_dir2_leaf_addname( | |||
228 | continue; | 228 | continue; |
229 | i = XFS_DIR2_DATAPTR_TO_DB(mp, INT_GET(lep->address, ARCH_CONVERT)); | 229 | i = XFS_DIR2_DATAPTR_TO_DB(mp, INT_GET(lep->address, ARCH_CONVERT)); |
230 | ASSERT(i < INT_GET(ltp->bestcount, ARCH_CONVERT)); | 230 | ASSERT(i < INT_GET(ltp->bestcount, ARCH_CONVERT)); |
231 | ASSERT(INT_GET(bestsp[i], ARCH_CONVERT) != NULLDATAOFF); | 231 | ASSERT(be16_to_cpu(bestsp[i]) != NULLDATAOFF); |
232 | if (INT_GET(bestsp[i], ARCH_CONVERT) >= length) { | 232 | if (be16_to_cpu(bestsp[i]) >= length) { |
233 | use_block = i; | 233 | use_block = i; |
234 | break; | 234 | break; |
235 | } | 235 | } |
@@ -242,9 +242,9 @@ xfs_dir2_leaf_addname( | |||
242 | /* | 242 | /* |
243 | * Remember a block we see that's missing. | 243 | * Remember a block we see that's missing. |
244 | */ | 244 | */ |
245 | if (INT_GET(bestsp[i], ARCH_CONVERT) == NULLDATAOFF && use_block == -1) | 245 | if (be16_to_cpu(bestsp[i]) == NULLDATAOFF && use_block == -1) |
246 | use_block = i; | 246 | use_block = i; |
247 | else if (INT_GET(bestsp[i], ARCH_CONVERT) >= length) { | 247 | else if (be16_to_cpu(bestsp[i]) >= length) { |
248 | use_block = i; | 248 | use_block = i; |
249 | break; | 249 | break; |
250 | } | 250 | } |
@@ -260,7 +260,7 @@ xfs_dir2_leaf_addname( | |||
260 | * Now kill use_block if it refers to a missing block, so we | 260 | * Now kill use_block if it refers to a missing block, so we |
261 | * can use it as an indication of allocation needed. | 261 | * can use it as an indication of allocation needed. |
262 | */ | 262 | */ |
263 | if (use_block != -1 && INT_GET(bestsp[use_block], ARCH_CONVERT) == NULLDATAOFF) | 263 | if (use_block != -1 && be16_to_cpu(bestsp[use_block]) == NULLDATAOFF) |
264 | use_block = -1; | 264 | use_block = -1; |
265 | /* | 265 | /* |
266 | * If we don't have enough free bytes but we can make enough | 266 | * If we don't have enough free bytes but we can make enough |
@@ -427,7 +427,7 @@ xfs_dir2_leaf_addname( | |||
427 | * If the bests table needs to be changed, do it. | 427 | * If the bests table needs to be changed, do it. |
428 | * Log the change unless we've already done that. | 428 | * Log the change unless we've already done that. |
429 | */ | 429 | */ |
430 | if (INT_GET(bestsp[use_block], ARCH_CONVERT) != be16_to_cpu(data->hdr.bestfree[0].length)) { | 430 | if (be16_to_cpu(bestsp[use_block]) != be16_to_cpu(data->hdr.bestfree[0].length)) { |
431 | bestsp[use_block] = data->hdr.bestfree[0].length; | 431 | bestsp[use_block] = data->hdr.bestfree[0].length; |
432 | if (!grown) | 432 | if (!grown) |
433 | xfs_dir2_leaf_log_bests(tp, lbp, use_block, use_block); | 433 | xfs_dir2_leaf_log_bests(tp, lbp, use_block, use_block); |
@@ -1203,8 +1203,8 @@ xfs_dir2_leaf_log_bests( | |||
1203 | int first, /* first entry to log */ | 1203 | int first, /* first entry to log */ |
1204 | int last) /* last entry to log */ | 1204 | int last) /* last entry to log */ |
1205 | { | 1205 | { |
1206 | xfs_dir2_data_off_t *firstb; /* pointer to first entry */ | 1206 | __be16 *firstb; /* pointer to first entry */ |
1207 | xfs_dir2_data_off_t *lastb; /* pointer to last entry */ | 1207 | __be16 *lastb; /* pointer to last entry */ |
1208 | xfs_dir2_leaf_t *leaf; /* leaf structure */ | 1208 | xfs_dir2_leaf_t *leaf; /* leaf structure */ |
1209 | xfs_dir2_leaf_tail_t *ltp; /* leaf tail structure */ | 1209 | xfs_dir2_leaf_tail_t *ltp; /* leaf tail structure */ |
1210 | 1210 | ||
@@ -1437,7 +1437,7 @@ int /* error */ | |||
1437 | xfs_dir2_leaf_removename( | 1437 | xfs_dir2_leaf_removename( |
1438 | xfs_da_args_t *args) /* operation arguments */ | 1438 | xfs_da_args_t *args) /* operation arguments */ |
1439 | { | 1439 | { |
1440 | xfs_dir2_data_off_t *bestsp; /* leaf block best freespace */ | 1440 | __be16 *bestsp; /* leaf block best freespace */ |
1441 | xfs_dir2_data_t *data; /* data block structure */ | 1441 | xfs_dir2_data_t *data; /* data block structure */ |
1442 | xfs_dir2_db_t db; /* data block number */ | 1442 | xfs_dir2_db_t db; /* data block number */ |
1443 | xfs_dabuf_t *dbp; /* data block buffer */ | 1443 | xfs_dabuf_t *dbp; /* data block buffer */ |
@@ -1480,7 +1480,7 @@ xfs_dir2_leaf_removename( | |||
1480 | oldbest = be16_to_cpu(data->hdr.bestfree[0].length); | 1480 | oldbest = be16_to_cpu(data->hdr.bestfree[0].length); |
1481 | ltp = XFS_DIR2_LEAF_TAIL_P(mp, leaf); | 1481 | ltp = XFS_DIR2_LEAF_TAIL_P(mp, leaf); |
1482 | bestsp = XFS_DIR2_LEAF_BESTS_P(ltp); | 1482 | bestsp = XFS_DIR2_LEAF_BESTS_P(ltp); |
1483 | ASSERT(INT_GET(bestsp[db], ARCH_CONVERT) == oldbest); | 1483 | ASSERT(be16_to_cpu(bestsp[db]) == oldbest); |
1484 | /* | 1484 | /* |
1485 | * Mark the former data entry unused. | 1485 | * Mark the former data entry unused. |
1486 | */ | 1486 | */ |
@@ -1542,7 +1542,7 @@ xfs_dir2_leaf_removename( | |||
1542 | * Look for the last active entry (i). | 1542 | * Look for the last active entry (i). |
1543 | */ | 1543 | */ |
1544 | for (i = db - 1; i > 0; i--) { | 1544 | for (i = db - 1; i > 0; i--) { |
1545 | if (INT_GET(bestsp[i], ARCH_CONVERT) != NULLDATAOFF) | 1545 | if (be16_to_cpu(bestsp[i]) != NULLDATAOFF) |
1546 | break; | 1546 | break; |
1547 | } | 1547 | } |
1548 | /* | 1548 | /* |
@@ -1555,7 +1555,7 @@ xfs_dir2_leaf_removename( | |||
1555 | xfs_dir2_leaf_log_tail(tp, lbp); | 1555 | xfs_dir2_leaf_log_tail(tp, lbp); |
1556 | xfs_dir2_leaf_log_bests(tp, lbp, 0, INT_GET(ltp->bestcount, ARCH_CONVERT) - 1); | 1556 | xfs_dir2_leaf_log_bests(tp, lbp, 0, INT_GET(ltp->bestcount, ARCH_CONVERT) - 1); |
1557 | } else | 1557 | } else |
1558 | INT_SET(bestsp[db], ARCH_CONVERT, NULLDATAOFF); | 1558 | bestsp[db] = cpu_to_be16(NULLDATAOFF); |
1559 | } | 1559 | } |
1560 | /* | 1560 | /* |
1561 | * If the data block was not the first one, drop it. | 1561 | * If the data block was not the first one, drop it. |
@@ -1684,7 +1684,7 @@ xfs_dir2_leaf_trim_data( | |||
1684 | xfs_dabuf_t *lbp, /* leaf buffer */ | 1684 | xfs_dabuf_t *lbp, /* leaf buffer */ |
1685 | xfs_dir2_db_t db) /* data block number */ | 1685 | xfs_dir2_db_t db) /* data block number */ |
1686 | { | 1686 | { |
1687 | xfs_dir2_data_off_t *bestsp; /* leaf bests table */ | 1687 | __be16 *bestsp; /* leaf bests table */ |
1688 | #ifdef DEBUG | 1688 | #ifdef DEBUG |
1689 | xfs_dir2_data_t *data; /* data block structure */ | 1689 | xfs_dir2_data_t *data; /* data block structure */ |
1690 | #endif | 1690 | #endif |
diff --git a/fs/xfs/xfs_dir2_leaf.h b/fs/xfs/xfs_dir2_leaf.h index 1393993d61e9..7fb32e954ce3 100644 --- a/fs/xfs/xfs_dir2_leaf.h +++ b/fs/xfs/xfs_dir2_leaf.h | |||
@@ -105,11 +105,10 @@ xfs_dir2_leaf_tail_p(struct xfs_mount *mp, xfs_dir2_leaf_t *lp) | |||
105 | * Get address of the bests array in the single-leaf block. | 105 | * Get address of the bests array in the single-leaf block. |
106 | */ | 106 | */ |
107 | #define XFS_DIR2_LEAF_BESTS_P(ltp) xfs_dir2_leaf_bests_p(ltp) | 107 | #define XFS_DIR2_LEAF_BESTS_P(ltp) xfs_dir2_leaf_bests_p(ltp) |
108 | static inline xfs_dir2_data_off_t * | 108 | static inline __be16 * |
109 | xfs_dir2_leaf_bests_p(xfs_dir2_leaf_tail_t *ltp) | 109 | xfs_dir2_leaf_bests_p(xfs_dir2_leaf_tail_t *ltp) |
110 | { | 110 | { |
111 | return (xfs_dir2_data_off_t *) | 111 | return (__be16 *)(ltp) - INT_GET((ltp)->bestcount, ARCH_CONVERT); |
112 | (ltp) - INT_GET((ltp)->bestcount, ARCH_CONVERT); | ||
113 | } | 112 | } |
114 | 113 | ||
115 | /* | 114 | /* |
diff --git a/fs/xfs/xfs_dir2_node.c b/fs/xfs/xfs_dir2_node.c index b051e2a09f31..ddbe453fade2 100644 --- a/fs/xfs/xfs_dir2_node.c +++ b/fs/xfs/xfs_dir2_node.c | |||
@@ -114,7 +114,7 @@ xfs_dir2_leaf_to_node( | |||
114 | xfs_dabuf_t *fbp; /* freespace buffer */ | 114 | xfs_dabuf_t *fbp; /* freespace buffer */ |
115 | xfs_dir2_db_t fdb; /* freespace block number */ | 115 | xfs_dir2_db_t fdb; /* freespace block number */ |
116 | xfs_dir2_free_t *free; /* freespace structure */ | 116 | xfs_dir2_free_t *free; /* freespace structure */ |
117 | xfs_dir2_data_off_t *from; /* pointer to freespace entry */ | 117 | __be16 *from; /* pointer to freespace entry */ |
118 | int i; /* leaf freespace index */ | 118 | int i; /* leaf freespace index */ |
119 | xfs_dir2_leaf_t *leaf; /* leaf structure */ | 119 | xfs_dir2_leaf_t *leaf; /* leaf structure */ |
120 | xfs_dir2_leaf_tail_t *ltp; /* leaf tail structure */ | 120 | xfs_dir2_leaf_tail_t *ltp; /* leaf tail structure */ |
@@ -159,7 +159,7 @@ xfs_dir2_leaf_to_node( | |||
159 | */ | 159 | */ |
160 | for (i = n = 0, from = XFS_DIR2_LEAF_BESTS_P(ltp), to = free->bests; | 160 | for (i = n = 0, from = XFS_DIR2_LEAF_BESTS_P(ltp), to = free->bests; |
161 | i < INT_GET(ltp->bestcount, ARCH_CONVERT); i++, from++, to++) { | 161 | i < INT_GET(ltp->bestcount, ARCH_CONVERT); i++, from++, to++) { |
162 | if ((off = INT_GET(*from, ARCH_CONVERT)) != NULLDATAOFF) | 162 | if ((off = be16_to_cpu(*from)) != NULLDATAOFF) |
163 | n++; | 163 | n++; |
164 | *to = cpu_to_be16(off); | 164 | *to = cpu_to_be16(off); |
165 | } | 165 | } |