Commit 1fba9f7f authored by Nathan Scott's avatar Nathan Scott

[XFS] endianess annotations for XFS_DIR2_DATA_UNUSED_TAG_P

SGI-PV: 943272
SGI-Modid: xfs-linux-melb:xfs-kern:25490a
Signed-off-by: default avatarChristoph Hellwig <hch@lst.de>
Signed-off-by: default avatarNathan Scott <nathans@sgi.com>
parent ad354eb3
...@@ -1178,8 +1178,7 @@ xfs_dir2_sf_to_block( ...@@ -1178,8 +1178,7 @@ xfs_dir2_sf_to_block(
((char *)block + offset); ((char *)block + offset);
dup->freetag = cpu_to_be16(XFS_DIR2_DATA_FREE_TAG); dup->freetag = cpu_to_be16(XFS_DIR2_DATA_FREE_TAG);
dup->length = cpu_to_be16(newoffset - offset); dup->length = cpu_to_be16(newoffset - offset);
INT_SET(*XFS_DIR2_DATA_UNUSED_TAG_P(dup), ARCH_CONVERT, *XFS_DIR2_DATA_UNUSED_TAG_P(dup) = cpu_to_be16(
(xfs_dir2_data_off_t)
((char *)dup - (char *)block)); ((char *)dup - (char *)block));
xfs_dir2_data_log_unused(tp, bp, dup); xfs_dir2_data_log_unused(tp, bp, dup);
(void)xfs_dir2_data_freeinsert((xfs_dir2_data_t *)block, (void)xfs_dir2_data_freeinsert((xfs_dir2_data_t *)block,
......
...@@ -110,7 +110,7 @@ xfs_dir2_data_check( ...@@ -110,7 +110,7 @@ xfs_dir2_data_check(
*/ */
if (be16_to_cpu(dup->freetag) == XFS_DIR2_DATA_FREE_TAG) { if (be16_to_cpu(dup->freetag) == XFS_DIR2_DATA_FREE_TAG) {
ASSERT(lastfree == 0); ASSERT(lastfree == 0);
ASSERT(INT_GET(*XFS_DIR2_DATA_UNUSED_TAG_P(dup), ARCH_CONVERT) == ASSERT(be16_to_cpu(*XFS_DIR2_DATA_UNUSED_TAG_P(dup)) ==
(char *)dup - (char *)d); (char *)dup - (char *)d);
dfp = xfs_dir2_data_freefind(d, dup); dfp = xfs_dir2_data_freefind(d, dup);
if (dfp) { if (dfp) {
...@@ -366,7 +366,7 @@ xfs_dir2_data_freescan( ...@@ -366,7 +366,7 @@ xfs_dir2_data_freescan(
*/ */
if (be16_to_cpu(dup->freetag) == XFS_DIR2_DATA_FREE_TAG) { if (be16_to_cpu(dup->freetag) == XFS_DIR2_DATA_FREE_TAG) {
ASSERT((char *)dup - (char *)d == ASSERT((char *)dup - (char *)d ==
INT_GET(*XFS_DIR2_DATA_UNUSED_TAG_P(dup), ARCH_CONVERT)); be16_to_cpu(*XFS_DIR2_DATA_UNUSED_TAG_P(dup)));
xfs_dir2_data_freeinsert(d, dup, loghead); xfs_dir2_data_freeinsert(d, dup, loghead);
p += be16_to_cpu(dup->length); p += be16_to_cpu(dup->length);
} }
...@@ -433,8 +433,7 @@ xfs_dir2_data_init( ...@@ -433,8 +433,7 @@ xfs_dir2_data_init(
t=mp->m_dirblksize - (uint)sizeof(d->hdr); t=mp->m_dirblksize - (uint)sizeof(d->hdr);
d->hdr.bestfree[0].length = cpu_to_be16(t); d->hdr.bestfree[0].length = cpu_to_be16(t);
dup->length = cpu_to_be16(t); dup->length = cpu_to_be16(t);
INT_SET(*XFS_DIR2_DATA_UNUSED_TAG_P(dup), ARCH_CONVERT, *XFS_DIR2_DATA_UNUSED_TAG_P(dup) = cpu_to_be16((char *)dup - (char *)d);
(xfs_dir2_data_off_t)((char *)dup - (char *)d));
/* /*
* Log it and return it. * Log it and return it.
*/ */
...@@ -594,8 +593,8 @@ xfs_dir2_data_make_free( ...@@ -594,8 +593,8 @@ xfs_dir2_data_make_free(
* Fix up the new big freespace. * Fix up the new big freespace.
*/ */
be16_add(&prevdup->length, len + be16_to_cpu(postdup->length)); be16_add(&prevdup->length, len + be16_to_cpu(postdup->length));
INT_SET(*XFS_DIR2_DATA_UNUSED_TAG_P(prevdup), ARCH_CONVERT, *XFS_DIR2_DATA_UNUSED_TAG_P(prevdup) =
(xfs_dir2_data_off_t)((char *)prevdup - (char *)d)); cpu_to_be16((char *)prevdup - (char *)d);
xfs_dir2_data_log_unused(tp, bp, prevdup); xfs_dir2_data_log_unused(tp, bp, prevdup);
if (!needscan) { if (!needscan) {
/* /*
...@@ -628,8 +627,8 @@ xfs_dir2_data_make_free( ...@@ -628,8 +627,8 @@ xfs_dir2_data_make_free(
else if (prevdup) { else if (prevdup) {
dfp = xfs_dir2_data_freefind(d, prevdup); dfp = xfs_dir2_data_freefind(d, prevdup);
be16_add(&prevdup->length, len); be16_add(&prevdup->length, len);
INT_SET(*XFS_DIR2_DATA_UNUSED_TAG_P(prevdup), ARCH_CONVERT, *XFS_DIR2_DATA_UNUSED_TAG_P(prevdup) =
(xfs_dir2_data_off_t)((char *)prevdup - (char *)d)); cpu_to_be16((char *)prevdup - (char *)d);
xfs_dir2_data_log_unused(tp, bp, prevdup); xfs_dir2_data_log_unused(tp, bp, prevdup);
/* /*
* If the previous entry was in the table, the new entry * If the previous entry was in the table, the new entry
...@@ -656,8 +655,8 @@ xfs_dir2_data_make_free( ...@@ -656,8 +655,8 @@ xfs_dir2_data_make_free(
newdup = (xfs_dir2_data_unused_t *)((char *)d + offset); newdup = (xfs_dir2_data_unused_t *)((char *)d + offset);
newdup->freetag = cpu_to_be16(XFS_DIR2_DATA_FREE_TAG); newdup->freetag = cpu_to_be16(XFS_DIR2_DATA_FREE_TAG);
newdup->length = cpu_to_be16(len + be16_to_cpu(postdup->length)); newdup->length = cpu_to_be16(len + be16_to_cpu(postdup->length));
INT_SET(*XFS_DIR2_DATA_UNUSED_TAG_P(newdup), ARCH_CONVERT, *XFS_DIR2_DATA_UNUSED_TAG_P(newdup) =
(xfs_dir2_data_off_t)((char *)newdup - (char *)d)); cpu_to_be16((char *)newdup - (char *)d);
xfs_dir2_data_log_unused(tp, bp, newdup); xfs_dir2_data_log_unused(tp, bp, newdup);
/* /*
* If the following entry was in the table, the new entry * If the following entry was in the table, the new entry
...@@ -683,8 +682,8 @@ xfs_dir2_data_make_free( ...@@ -683,8 +682,8 @@ xfs_dir2_data_make_free(
newdup = (xfs_dir2_data_unused_t *)((char *)d + offset); newdup = (xfs_dir2_data_unused_t *)((char *)d + offset);
newdup->freetag = cpu_to_be16(XFS_DIR2_DATA_FREE_TAG); newdup->freetag = cpu_to_be16(XFS_DIR2_DATA_FREE_TAG);
newdup->length = cpu_to_be16(len); newdup->length = cpu_to_be16(len);
INT_SET(*XFS_DIR2_DATA_UNUSED_TAG_P(newdup), ARCH_CONVERT, *XFS_DIR2_DATA_UNUSED_TAG_P(newdup) =
(xfs_dir2_data_off_t)((char *)newdup - (char *)d)); cpu_to_be16((char *)newdup - (char *)d);
xfs_dir2_data_log_unused(tp, bp, newdup); xfs_dir2_data_log_unused(tp, bp, newdup);
(void)xfs_dir2_data_freeinsert(d, newdup, needlogp); (void)xfs_dir2_data_freeinsert(d, newdup, needlogp);
} }
...@@ -719,7 +718,7 @@ xfs_dir2_data_use_free( ...@@ -719,7 +718,7 @@ xfs_dir2_data_use_free(
ASSERT(be16_to_cpu(dup->freetag) == XFS_DIR2_DATA_FREE_TAG); ASSERT(be16_to_cpu(dup->freetag) == XFS_DIR2_DATA_FREE_TAG);
ASSERT(offset >= (char *)dup - (char *)d); ASSERT(offset >= (char *)dup - (char *)d);
ASSERT(offset + len <= (char *)dup + be16_to_cpu(dup->length) - (char *)d); ASSERT(offset + len <= (char *)dup + be16_to_cpu(dup->length) - (char *)d);
ASSERT((char *)dup - (char *)d == INT_GET(*XFS_DIR2_DATA_UNUSED_TAG_P(dup), ARCH_CONVERT)); ASSERT((char *)dup - (char *)d == be16_to_cpu(*XFS_DIR2_DATA_UNUSED_TAG_P(dup)));
/* /*
* Look up the entry in the bestfree table. * Look up the entry in the bestfree table.
*/ */
...@@ -752,8 +751,8 @@ xfs_dir2_data_use_free( ...@@ -752,8 +751,8 @@ xfs_dir2_data_use_free(
newdup = (xfs_dir2_data_unused_t *)((char *)d + offset + len); newdup = (xfs_dir2_data_unused_t *)((char *)d + offset + len);
newdup->freetag = cpu_to_be16(XFS_DIR2_DATA_FREE_TAG); newdup->freetag = cpu_to_be16(XFS_DIR2_DATA_FREE_TAG);
newdup->length = cpu_to_be16(oldlen - len); newdup->length = cpu_to_be16(oldlen - len);
INT_SET(*XFS_DIR2_DATA_UNUSED_TAG_P(newdup), ARCH_CONVERT, *XFS_DIR2_DATA_UNUSED_TAG_P(newdup) =
(xfs_dir2_data_off_t)((char *)newdup - (char *)d)); cpu_to_be16((char *)newdup - (char *)d);
xfs_dir2_data_log_unused(tp, bp, newdup); xfs_dir2_data_log_unused(tp, bp, newdup);
/* /*
* If it was in the table, remove it and add the new one. * If it was in the table, remove it and add the new one.
...@@ -779,8 +778,8 @@ xfs_dir2_data_use_free( ...@@ -779,8 +778,8 @@ xfs_dir2_data_use_free(
else if (matchback) { else if (matchback) {
newdup = dup; newdup = dup;
newdup->length = cpu_to_be16(((char *)d + offset) - (char *)newdup); newdup->length = cpu_to_be16(((char *)d + offset) - (char *)newdup);
INT_SET(*XFS_DIR2_DATA_UNUSED_TAG_P(newdup), ARCH_CONVERT, *XFS_DIR2_DATA_UNUSED_TAG_P(newdup) =
(xfs_dir2_data_off_t)((char *)newdup - (char *)d)); cpu_to_be16((char *)newdup - (char *)d);
xfs_dir2_data_log_unused(tp, bp, newdup); xfs_dir2_data_log_unused(tp, bp, newdup);
/* /*
* If it was in the table, remove it and add the new one. * If it was in the table, remove it and add the new one.
...@@ -806,14 +805,14 @@ xfs_dir2_data_use_free( ...@@ -806,14 +805,14 @@ xfs_dir2_data_use_free(
else { else {
newdup = dup; newdup = dup;
newdup->length = cpu_to_be16(((char *)d + offset) - (char *)newdup); newdup->length = cpu_to_be16(((char *)d + offset) - (char *)newdup);
INT_SET(*XFS_DIR2_DATA_UNUSED_TAG_P(newdup), ARCH_CONVERT, *XFS_DIR2_DATA_UNUSED_TAG_P(newdup) =
(xfs_dir2_data_off_t)((char *)newdup - (char *)d)); cpu_to_be16((char *)newdup - (char *)d);
xfs_dir2_data_log_unused(tp, bp, newdup); xfs_dir2_data_log_unused(tp, bp, newdup);
newdup2 = (xfs_dir2_data_unused_t *)((char *)d + offset + len); newdup2 = (xfs_dir2_data_unused_t *)((char *)d + offset + len);
newdup2->freetag = cpu_to_be16(XFS_DIR2_DATA_FREE_TAG); newdup2->freetag = cpu_to_be16(XFS_DIR2_DATA_FREE_TAG);
newdup2->length = cpu_to_be16(oldlen - len - be16_to_cpu(newdup->length)); newdup2->length = cpu_to_be16(oldlen - len - be16_to_cpu(newdup->length));
INT_SET(*XFS_DIR2_DATA_UNUSED_TAG_P(newdup2), ARCH_CONVERT, *XFS_DIR2_DATA_UNUSED_TAG_P(newdup2) =
(xfs_dir2_data_off_t)((char *)newdup2 - (char *)d)); cpu_to_be16((char *)newdup2 - (char *)d);
xfs_dir2_data_log_unused(tp, bp, newdup2); xfs_dir2_data_log_unused(tp, bp, newdup2);
/* /*
* If the old entry was in the table, we need to scan * If the old entry was in the table, we need to scan
......
...@@ -147,12 +147,11 @@ xfs_dir2_data_entry_tag_p(xfs_dir2_data_entry_t *dep) ...@@ -147,12 +147,11 @@ xfs_dir2_data_entry_tag_p(xfs_dir2_data_entry_t *dep)
*/ */
#define XFS_DIR2_DATA_UNUSED_TAG_P(dup) \ #define XFS_DIR2_DATA_UNUSED_TAG_P(dup) \
xfs_dir2_data_unused_tag_p(dup) xfs_dir2_data_unused_tag_p(dup)
static inline xfs_dir2_data_off_t * static inline __be16 *
xfs_dir2_data_unused_tag_p(xfs_dir2_data_unused_t *dup) xfs_dir2_data_unused_tag_p(xfs_dir2_data_unused_t *dup)
{ {
return (xfs_dir2_data_off_t *) \ return (__be16 *)((char *)dup +
((char *)(dup) + be16_to_cpu((dup)->length) \ be16_to_cpu(dup->length) - sizeof(__be16));
- (uint)sizeof(xfs_dir2_data_off_t));
} }
/* /*
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment