diff options
author | Nathan Scott <nathans@sgi.com> | 2006-03-17 01:27:28 -0500 |
---|---|---|
committer | Nathan Scott <nathans@sgi.com> | 2006-03-17 01:27:28 -0500 |
commit | afbcb3f91903bcd34d470efe64b3738257178667 (patch) | |
tree | e2dbfefdd7c711e8335079096c0f4f713a28630e /fs | |
parent | 68b3a1024a7cda4afaacb3d25e6ac234ddfc0834 (diff) |
[XFS] endianess annotations for xfs_dir2_leaf_tail_t
SGI-PV: 943272
SGI-Modid: xfs-linux-melb:xfs-kern:25487a
Signed-off-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: Nathan Scott <nathans@sgi.com>
Diffstat (limited to 'fs')
-rw-r--r-- | fs/xfs/xfs_dir2_block.c | 4 | ||||
-rw-r--r-- | fs/xfs/xfs_dir2_leaf.c | 34 | ||||
-rw-r--r-- | fs/xfs/xfs_dir2_leaf.h | 4 | ||||
-rw-r--r-- | fs/xfs/xfs_dir2_node.c | 4 |
4 files changed, 23 insertions, 23 deletions
diff --git a/fs/xfs/xfs_dir2_block.c b/fs/xfs/xfs_dir2_block.c index e9d298f06ca2..f70640c6b703 100644 --- a/fs/xfs/xfs_dir2_block.c +++ b/fs/xfs/xfs_dir2_block.c | |||
@@ -914,11 +914,11 @@ 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 (be16_to_cpu(bestsp[INT_GET(ltp->bestcount, ARCH_CONVERT) - 1]) == | 917 | if (be16_to_cpu(bestsp[be32_to_cpu(ltp->bestcount) - 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, |
921 | (xfs_dir2_db_t)(INT_GET(ltp->bestcount, ARCH_CONVERT) - 1)))) | 921 | (xfs_dir2_db_t)(be32_to_cpu(ltp->bestcount) - 1)))) |
922 | goto out; | 922 | goto out; |
923 | } else { | 923 | } else { |
924 | error = 0; | 924 | error = 0; |
diff --git a/fs/xfs/xfs_dir2_leaf.c b/fs/xfs/xfs_dir2_leaf.c index 568e0feca034..9abecd207c4e 100644 --- a/fs/xfs/xfs_dir2_leaf.c +++ b/fs/xfs/xfs_dir2_leaf.c | |||
@@ -141,7 +141,7 @@ xfs_dir2_block_to_leaf( | |||
141 | * Set up leaf tail and bests table. | 141 | * Set up leaf tail and bests table. |
142 | */ | 142 | */ |
143 | ltp = XFS_DIR2_LEAF_TAIL_P(mp, leaf); | 143 | ltp = XFS_DIR2_LEAF_TAIL_P(mp, leaf); |
144 | INT_SET(ltp->bestcount, ARCH_CONVERT, 1); | 144 | ltp->bestcount = cpu_to_be32(1); |
145 | bestsp = XFS_DIR2_LEAF_BESTS_P(ltp); | 145 | bestsp = XFS_DIR2_LEAF_BESTS_P(ltp); |
146 | bestsp[0] = block->hdr.bestfree[0].length; | 146 | bestsp[0] = block->hdr.bestfree[0].length; |
147 | /* | 147 | /* |
@@ -227,7 +227,7 @@ xfs_dir2_leaf_addname( | |||
227 | if (INT_GET(lep->address, ARCH_CONVERT) == XFS_DIR2_NULL_DATAPTR) | 227 | if (INT_GET(lep->address, ARCH_CONVERT) == XFS_DIR2_NULL_DATAPTR) |
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 < be32_to_cpu(ltp->bestcount)); |
231 | ASSERT(be16_to_cpu(bestsp[i]) != NULLDATAOFF); | 231 | ASSERT(be16_to_cpu(bestsp[i]) != NULLDATAOFF); |
232 | if (be16_to_cpu(bestsp[i]) >= length) { | 232 | if (be16_to_cpu(bestsp[i]) >= length) { |
233 | use_block = i; | 233 | use_block = i; |
@@ -238,7 +238,7 @@ xfs_dir2_leaf_addname( | |||
238 | * Didn't find a block yet, linear search all the data blocks. | 238 | * Didn't find a block yet, linear search all the data blocks. |
239 | */ | 239 | */ |
240 | if (use_block == -1) { | 240 | if (use_block == -1) { |
241 | for (i = 0; i < INT_GET(ltp->bestcount, ARCH_CONVERT); i++) { | 241 | for (i = 0; i < be32_to_cpu(ltp->bestcount); i++) { |
242 | /* | 242 | /* |
243 | * Remember a block we see that's missing. | 243 | * Remember a block we see that's missing. |
244 | */ | 244 | */ |
@@ -358,13 +358,13 @@ xfs_dir2_leaf_addname( | |||
358 | * If we're adding a new data block on the end we need to | 358 | * If we're adding a new data block on the end we need to |
359 | * extend the bests table. Copy it up one entry. | 359 | * extend the bests table. Copy it up one entry. |
360 | */ | 360 | */ |
361 | if (use_block >= INT_GET(ltp->bestcount, ARCH_CONVERT)) { | 361 | if (use_block >= be32_to_cpu(ltp->bestcount)) { |
362 | bestsp--; | 362 | bestsp--; |
363 | memmove(&bestsp[0], &bestsp[1], | 363 | memmove(&bestsp[0], &bestsp[1], |
364 | INT_GET(ltp->bestcount, ARCH_CONVERT) * sizeof(bestsp[0])); | 364 | be32_to_cpu(ltp->bestcount) * sizeof(bestsp[0])); |
365 | INT_MOD(ltp->bestcount, ARCH_CONVERT, +1); | 365 | be32_add(<p->bestcount, 1); |
366 | xfs_dir2_leaf_log_tail(tp, lbp); | 366 | xfs_dir2_leaf_log_tail(tp, lbp); |
367 | xfs_dir2_leaf_log_bests(tp, lbp, 0, INT_GET(ltp->bestcount, ARCH_CONVERT) - 1); | 367 | xfs_dir2_leaf_log_bests(tp, lbp, 0, be32_to_cpu(ltp->bestcount) - 1); |
368 | } | 368 | } |
369 | /* | 369 | /* |
370 | * If we're filling in a previously empty block just log it. | 370 | * If we're filling in a previously empty block just log it. |
@@ -1537,7 +1537,7 @@ xfs_dir2_leaf_removename( | |||
1537 | * If this is the last data block then compact the | 1537 | * If this is the last data block then compact the |
1538 | * bests table by getting rid of entries. | 1538 | * bests table by getting rid of entries. |
1539 | */ | 1539 | */ |
1540 | if (db == INT_GET(ltp->bestcount, ARCH_CONVERT) - 1) { | 1540 | if (db == be32_to_cpu(ltp->bestcount) - 1) { |
1541 | /* | 1541 | /* |
1542 | * Look for the last active entry (i). | 1542 | * Look for the last active entry (i). |
1543 | */ | 1543 | */ |
@@ -1550,10 +1550,10 @@ xfs_dir2_leaf_removename( | |||
1550 | * end are removed. | 1550 | * end are removed. |
1551 | */ | 1551 | */ |
1552 | memmove(&bestsp[db - i], bestsp, | 1552 | memmove(&bestsp[db - i], bestsp, |
1553 | (INT_GET(ltp->bestcount, ARCH_CONVERT) - (db - i)) * sizeof(*bestsp)); | 1553 | (be32_to_cpu(ltp->bestcount) - (db - i)) * sizeof(*bestsp)); |
1554 | INT_MOD(ltp->bestcount, ARCH_CONVERT, -(db - i)); | 1554 | be32_add(<p->bestcount, -(db - i)); |
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, be32_to_cpu(ltp->bestcount) - 1); |
1557 | } else | 1557 | } else |
1558 | bestsp[db] = cpu_to_be16(NULLDATAOFF); | 1558 | bestsp[db] = cpu_to_be16(NULLDATAOFF); |
1559 | } | 1559 | } |
@@ -1719,7 +1719,7 @@ xfs_dir2_leaf_trim_data( | |||
1719 | ltp = XFS_DIR2_LEAF_TAIL_P(mp, leaf); | 1719 | ltp = XFS_DIR2_LEAF_TAIL_P(mp, leaf); |
1720 | ASSERT(be16_to_cpu(data->hdr.bestfree[0].length) == | 1720 | ASSERT(be16_to_cpu(data->hdr.bestfree[0].length) == |
1721 | mp->m_dirblksize - (uint)sizeof(data->hdr)); | 1721 | mp->m_dirblksize - (uint)sizeof(data->hdr)); |
1722 | ASSERT(db == INT_GET(ltp->bestcount, ARCH_CONVERT) - 1); | 1722 | ASSERT(db == be32_to_cpu(ltp->bestcount) - 1); |
1723 | /* | 1723 | /* |
1724 | * Get rid of the data block. | 1724 | * Get rid of the data block. |
1725 | */ | 1725 | */ |
@@ -1732,10 +1732,10 @@ xfs_dir2_leaf_trim_data( | |||
1732 | * Eliminate the last bests entry from the table. | 1732 | * Eliminate the last bests entry from the table. |
1733 | */ | 1733 | */ |
1734 | bestsp = XFS_DIR2_LEAF_BESTS_P(ltp); | 1734 | bestsp = XFS_DIR2_LEAF_BESTS_P(ltp); |
1735 | INT_MOD(ltp->bestcount, ARCH_CONVERT, -1); | 1735 | be32_add(<p->bestcount, -1); |
1736 | memmove(&bestsp[1], &bestsp[0], INT_GET(ltp->bestcount, ARCH_CONVERT) * sizeof(*bestsp)); | 1736 | memmove(&bestsp[1], &bestsp[0], be32_to_cpu(ltp->bestcount) * sizeof(*bestsp)); |
1737 | xfs_dir2_leaf_log_tail(tp, lbp); | 1737 | xfs_dir2_leaf_log_tail(tp, lbp); |
1738 | xfs_dir2_leaf_log_bests(tp, lbp, 0, INT_GET(ltp->bestcount, ARCH_CONVERT) - 1); | 1738 | xfs_dir2_leaf_log_bests(tp, lbp, 0, be32_to_cpu(ltp->bestcount) - 1); |
1739 | return 0; | 1739 | return 0; |
1740 | } | 1740 | } |
1741 | 1741 | ||
@@ -1848,8 +1848,8 @@ xfs_dir2_node_to_leaf( | |||
1848 | * Set up the leaf bests table. | 1848 | * Set up the leaf bests table. |
1849 | */ | 1849 | */ |
1850 | memcpy(XFS_DIR2_LEAF_BESTS_P(ltp), free->bests, | 1850 | memcpy(XFS_DIR2_LEAF_BESTS_P(ltp), free->bests, |
1851 | INT_GET(ltp->bestcount, ARCH_CONVERT) * sizeof(leaf->bests[0])); | 1851 | be32_to_cpu(ltp->bestcount) * sizeof(leaf->bests[0])); |
1852 | xfs_dir2_leaf_log_bests(tp, lbp, 0, INT_GET(ltp->bestcount, ARCH_CONVERT) - 1); | 1852 | xfs_dir2_leaf_log_bests(tp, lbp, 0, be32_to_cpu(ltp->bestcount) - 1); |
1853 | xfs_dir2_leaf_log_tail(tp, lbp); | 1853 | xfs_dir2_leaf_log_tail(tp, lbp); |
1854 | xfs_dir2_leaf_check(dp, lbp); | 1854 | xfs_dir2_leaf_check(dp, lbp); |
1855 | /* | 1855 | /* |
diff --git a/fs/xfs/xfs_dir2_leaf.h b/fs/xfs/xfs_dir2_leaf.h index 7fb32e954ce3..fcd3b7dea0f6 100644 --- a/fs/xfs/xfs_dir2_leaf.h +++ b/fs/xfs/xfs_dir2_leaf.h | |||
@@ -62,7 +62,7 @@ typedef struct xfs_dir2_leaf_entry { | |||
62 | * Leaf block tail. | 62 | * Leaf block tail. |
63 | */ | 63 | */ |
64 | typedef struct xfs_dir2_leaf_tail { | 64 | typedef struct xfs_dir2_leaf_tail { |
65 | __uint32_t bestcount; | 65 | __be32 bestcount; |
66 | } xfs_dir2_leaf_tail_t; | 66 | } xfs_dir2_leaf_tail_t; |
67 | 67 | ||
68 | /* | 68 | /* |
@@ -108,7 +108,7 @@ xfs_dir2_leaf_tail_p(struct xfs_mount *mp, xfs_dir2_leaf_t *lp) | |||
108 | static inline __be16 * | 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 (__be16 *)(ltp) - INT_GET((ltp)->bestcount, ARCH_CONVERT); | 111 | return (__be16 *)ltp - be32_to_cpu(ltp->bestcount); |
112 | } | 112 | } |
113 | 113 | ||
114 | /* | 114 | /* |
diff --git a/fs/xfs/xfs_dir2_node.c b/fs/xfs/xfs_dir2_node.c index ddbe453fade2..c32894cb6223 100644 --- a/fs/xfs/xfs_dir2_node.c +++ b/fs/xfs/xfs_dir2_node.c | |||
@@ -151,14 +151,14 @@ xfs_dir2_leaf_to_node( | |||
151 | */ | 151 | */ |
152 | free->hdr.magic = cpu_to_be32(XFS_DIR2_FREE_MAGIC); | 152 | free->hdr.magic = cpu_to_be32(XFS_DIR2_FREE_MAGIC); |
153 | free->hdr.firstdb = 0; | 153 | free->hdr.firstdb = 0; |
154 | ASSERT(INT_GET(ltp->bestcount, ARCH_CONVERT) <= (uint)dp->i_d.di_size / mp->m_dirblksize); | 154 | ASSERT(be32_to_cpu(ltp->bestcount) <= (uint)dp->i_d.di_size / mp->m_dirblksize); |
155 | free->hdr.nvalid = ltp->bestcount; | 155 | free->hdr.nvalid = ltp->bestcount; |
156 | /* | 156 | /* |
157 | * Copy freespace entries from the leaf block to the new block. | 157 | * Copy freespace entries from the leaf block to the new block. |
158 | * Count active entries. | 158 | * Count active entries. |
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 < be32_to_cpu(ltp->bestcount); i++, from++, to++) { |
162 | if ((off = be16_to_cpu(*from)) != 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); |