Commit 3d693c6e authored by Nathan Scott's avatar Nathan Scott

[XFS] endianess annotations for XFS_DIR2_DATA_ENTRY_TAG_P

SGI-PV: 943272
SGI-Modid: xfs-linux-melb:xfs-kern:25494a
Signed-off-by: default avatarChristoph Hellwig <hch@lst.de>
Signed-off-by: default avatarNathan Scott <nathans@sgi.com>
parent 3c1f9c15
...@@ -81,7 +81,7 @@ xfs_dir2_block_addname( ...@@ -81,7 +81,7 @@ xfs_dir2_block_addname(
xfs_mount_t *mp; /* filesystem mount point */ xfs_mount_t *mp; /* filesystem mount point */
int needlog; /* need to log header */ int needlog; /* need to log header */
int needscan; /* need to rescan freespace */ int needscan; /* need to rescan freespace */
xfs_dir2_data_off_t *tagp; /* pointer to tag value */ __be16 *tagp; /* pointer to tag value */
xfs_trans_t *tp; /* transaction structure */ xfs_trans_t *tp; /* transaction structure */
xfs_dir2_trace_args("block_addname", args); xfs_dir2_trace_args("block_addname", args);
...@@ -120,11 +120,11 @@ xfs_dir2_block_addname( ...@@ -120,11 +120,11 @@ xfs_dir2_block_addname(
/* /*
* Tag just before the first leaf entry. * Tag just before the first leaf entry.
*/ */
tagp = (xfs_dir2_data_off_t *)blp - 1; tagp = (__be16 *)blp - 1;
/* /*
* Data object just before the first leaf entry. * Data object just before the first leaf entry.
*/ */
enddup = (xfs_dir2_data_unused_t *)((char *)block + INT_GET(*tagp, ARCH_CONVERT)); enddup = (xfs_dir2_data_unused_t *)((char *)block + be16_to_cpu(*tagp));
/* /*
* If it's not free then can't do this add without cleaning up: * If it's not free then can't do this add without cleaning up:
* the space before the first leaf entry needs to be free so it * the space before the first leaf entry needs to be free so it
...@@ -183,11 +183,11 @@ xfs_dir2_block_addname( ...@@ -183,11 +183,11 @@ xfs_dir2_block_addname(
/* /*
* Tag just before the first leaf entry. * Tag just before the first leaf entry.
*/ */
tagp = (xfs_dir2_data_off_t *)blp - 1; tagp = (__be16 *)blp - 1;
/* /*
* Data object just before the first leaf entry. * Data object just before the first leaf entry.
*/ */
dup = (xfs_dir2_data_unused_t *)((char *)block + INT_GET(*tagp, ARCH_CONVERT)); dup = (xfs_dir2_data_unused_t *)((char *)block + be16_to_cpu(*tagp));
/* /*
* If it's not free then the data will go where the * If it's not free then the data will go where the
* leaf data starts now, if it works at all. * leaf data starts now, if it works at all.
...@@ -404,7 +404,7 @@ xfs_dir2_block_addname( ...@@ -404,7 +404,7 @@ xfs_dir2_block_addname(
dep->namelen = args->namelen; dep->namelen = args->namelen;
memcpy(dep->name, args->name, args->namelen); memcpy(dep->name, args->name, args->namelen);
tagp = XFS_DIR2_DATA_ENTRY_TAG_P(dep); tagp = XFS_DIR2_DATA_ENTRY_TAG_P(dep);
INT_SET(*tagp, ARCH_CONVERT, (xfs_dir2_data_off_t)((char *)dep - (char *)block)); *tagp = cpu_to_be16((char *)dep - (char *)block);
/* /*
* Clean up the bestfree array and log the header, tail, and entry. * Clean up the bestfree array and log the header, tail, and entry.
*/ */
...@@ -896,7 +896,7 @@ xfs_dir2_leaf_to_block( ...@@ -896,7 +896,7 @@ xfs_dir2_leaf_to_block(
int needscan; /* need to scan for bestfree */ int needscan; /* need to scan for bestfree */
xfs_dir2_sf_hdr_t sfh; /* shortform header */ xfs_dir2_sf_hdr_t sfh; /* shortform header */
int size; /* bytes used */ int size; /* bytes used */
xfs_dir2_data_off_t *tagp; /* end of entry (tag) */ __be16 *tagp; /* end of entry (tag) */
int to; /* block/leaf to index */ int to; /* block/leaf to index */
xfs_trans_t *tp; /* transaction pointer */ xfs_trans_t *tp; /* transaction pointer */
...@@ -944,8 +944,8 @@ xfs_dir2_leaf_to_block( ...@@ -944,8 +944,8 @@ xfs_dir2_leaf_to_block(
/* /*
* Look at the last data entry. * Look at the last data entry.
*/ */
tagp = (xfs_dir2_data_off_t *)((char *)block + mp->m_dirblksize) - 1; tagp = (__be16 *)((char *)block + mp->m_dirblksize) - 1;
dup = (xfs_dir2_data_unused_t *)((char *)block + INT_GET(*tagp, ARCH_CONVERT)); dup = (xfs_dir2_data_unused_t *)((char *)block + be16_to_cpu(*tagp));
/* /*
* If it's not free or is too short we can't do it. * If it's not free or is too short we can't do it.
*/ */
...@@ -1044,7 +1044,7 @@ xfs_dir2_sf_to_block( ...@@ -1044,7 +1044,7 @@ xfs_dir2_sf_to_block(
int offset; /* target block offset */ int offset; /* target block offset */
xfs_dir2_sf_entry_t *sfep; /* sf entry pointer */ xfs_dir2_sf_entry_t *sfep; /* sf entry pointer */
xfs_dir2_sf_t *sfp; /* shortform structure */ xfs_dir2_sf_t *sfp; /* shortform structure */
xfs_dir2_data_off_t *tagp; /* end of data entry */ __be16 *tagp; /* end of data entry */
xfs_trans_t *tp; /* transaction pointer */ xfs_trans_t *tp; /* transaction pointer */
xfs_dir2_trace_args("sf_to_block", args); xfs_dir2_trace_args("sf_to_block", args);
...@@ -1134,7 +1134,7 @@ xfs_dir2_sf_to_block( ...@@ -1134,7 +1134,7 @@ xfs_dir2_sf_to_block(
dep->namelen = 1; dep->namelen = 1;
dep->name[0] = '.'; dep->name[0] = '.';
tagp = XFS_DIR2_DATA_ENTRY_TAG_P(dep); tagp = XFS_DIR2_DATA_ENTRY_TAG_P(dep);
INT_SET(*tagp, ARCH_CONVERT, (xfs_dir2_data_off_t)((char *)dep - (char *)block)); *tagp = cpu_to_be16((char *)dep - (char *)block);
xfs_dir2_data_log_entry(tp, bp, dep); xfs_dir2_data_log_entry(tp, bp, dep);
blp[0].hashval = cpu_to_be32(xfs_dir_hash_dot); blp[0].hashval = cpu_to_be32(xfs_dir_hash_dot);
blp[0].address = cpu_to_be32(XFS_DIR2_BYTE_TO_DATAPTR(mp, blp[0].address = cpu_to_be32(XFS_DIR2_BYTE_TO_DATAPTR(mp,
...@@ -1148,7 +1148,7 @@ xfs_dir2_sf_to_block( ...@@ -1148,7 +1148,7 @@ xfs_dir2_sf_to_block(
dep->namelen = 2; dep->namelen = 2;
dep->name[0] = dep->name[1] = '.'; dep->name[0] = dep->name[1] = '.';
tagp = XFS_DIR2_DATA_ENTRY_TAG_P(dep); tagp = XFS_DIR2_DATA_ENTRY_TAG_P(dep);
INT_SET(*tagp, ARCH_CONVERT, (xfs_dir2_data_off_t)((char *)dep - (char *)block)); *tagp = cpu_to_be16((char *)dep - (char *)block);
xfs_dir2_data_log_entry(tp, bp, dep); xfs_dir2_data_log_entry(tp, bp, dep);
blp[1].hashval = cpu_to_be32(xfs_dir_hash_dotdot); blp[1].hashval = cpu_to_be32(xfs_dir_hash_dotdot);
blp[1].address = cpu_to_be32(XFS_DIR2_BYTE_TO_DATAPTR(mp, blp[1].address = cpu_to_be32(XFS_DIR2_BYTE_TO_DATAPTR(mp,
...@@ -1198,7 +1198,7 @@ xfs_dir2_sf_to_block( ...@@ -1198,7 +1198,7 @@ xfs_dir2_sf_to_block(
dep->namelen = sfep->namelen; dep->namelen = sfep->namelen;
memcpy(dep->name, sfep->name, dep->namelen); memcpy(dep->name, sfep->name, dep->namelen);
tagp = XFS_DIR2_DATA_ENTRY_TAG_P(dep); tagp = XFS_DIR2_DATA_ENTRY_TAG_P(dep);
INT_SET(*tagp, ARCH_CONVERT, (xfs_dir2_data_off_t)((char *)dep - (char *)block)); *tagp = cpu_to_be16((char *)dep - (char *)block);
xfs_dir2_data_log_entry(tp, bp, dep); xfs_dir2_data_log_entry(tp, bp, dep);
blp[2 + i].hashval = cpu_to_be32(xfs_da_hashname( blp[2 + i].hashval = cpu_to_be32(xfs_da_hashname(
(char *)sfep->name, sfep->namelen)); (char *)sfep->name, sfep->namelen));
......
...@@ -134,7 +134,7 @@ xfs_dir2_data_check( ...@@ -134,7 +134,7 @@ xfs_dir2_data_check(
dep = (xfs_dir2_data_entry_t *)p; dep = (xfs_dir2_data_entry_t *)p;
ASSERT(dep->namelen != 0); ASSERT(dep->namelen != 0);
ASSERT(xfs_dir_ino_validate(mp, INT_GET(dep->inumber, ARCH_CONVERT)) == 0); ASSERT(xfs_dir_ino_validate(mp, INT_GET(dep->inumber, ARCH_CONVERT)) == 0);
ASSERT(INT_GET(*XFS_DIR2_DATA_ENTRY_TAG_P(dep), ARCH_CONVERT) == ASSERT(be16_to_cpu(*XFS_DIR2_DATA_ENTRY_TAG_P(dep)) ==
(char *)dep - (char *)d); (char *)dep - (char *)d);
count++; count++;
lastfree = 0; lastfree = 0;
...@@ -376,7 +376,7 @@ xfs_dir2_data_freescan( ...@@ -376,7 +376,7 @@ xfs_dir2_data_freescan(
else { else {
dep = (xfs_dir2_data_entry_t *)p; dep = (xfs_dir2_data_entry_t *)p;
ASSERT((char *)dep - (char *)d == ASSERT((char *)dep - (char *)d ==
INT_GET(*XFS_DIR2_DATA_ENTRY_TAG_P(dep), ARCH_CONVERT)); be16_to_cpu(*XFS_DIR2_DATA_ENTRY_TAG_P(dep)));
p += XFS_DIR2_DATA_ENTSIZE(dep->namelen); p += XFS_DIR2_DATA_ENTSIZE(dep->namelen);
} }
} }
...@@ -549,10 +549,10 @@ xfs_dir2_data_make_free( ...@@ -549,10 +549,10 @@ xfs_dir2_data_make_free(
* the previous entry and see if it's free. * the previous entry and see if it's free.
*/ */
if (offset > sizeof(d->hdr)) { if (offset > sizeof(d->hdr)) {
xfs_dir2_data_off_t *tagp; /* tag just before us */ __be16 *tagp; /* tag just before us */
tagp = (xfs_dir2_data_off_t *)((char *)d + offset) - 1; tagp = (__be16 *)((char *)d + offset) - 1;
prevdup = (xfs_dir2_data_unused_t *)((char *)d + INT_GET(*tagp, ARCH_CONVERT)); prevdup = (xfs_dir2_data_unused_t *)((char *)d + be16_to_cpu(*tagp));
if (be16_to_cpu(prevdup->freetag) != XFS_DIR2_DATA_FREE_TAG) if (be16_to_cpu(prevdup->freetag) != XFS_DIR2_DATA_FREE_TAG)
prevdup = NULL; prevdup = NULL;
} else } else
......
...@@ -134,12 +134,11 @@ static inline int xfs_dir2_data_entsize(int n) ...@@ -134,12 +134,11 @@ static inline int xfs_dir2_data_entsize(int n)
* Pointer to an entry's tag word. * Pointer to an entry's tag word.
*/ */
#define XFS_DIR2_DATA_ENTRY_TAG_P(dep) xfs_dir2_data_entry_tag_p(dep) #define XFS_DIR2_DATA_ENTRY_TAG_P(dep) xfs_dir2_data_entry_tag_p(dep)
static inline xfs_dir2_data_off_t * static inline __be16 *
xfs_dir2_data_entry_tag_p(xfs_dir2_data_entry_t *dep) xfs_dir2_data_entry_tag_p(xfs_dir2_data_entry_t *dep)
{ {
return (xfs_dir2_data_off_t *) \ return (__be16 *)((char *)dep +
((char *)(dep) + XFS_DIR2_DATA_ENTSIZE((dep)->namelen) - \ XFS_DIR2_DATA_ENTSIZE(dep->namelen) - sizeof(__be16));
(uint)sizeof(xfs_dir2_data_off_t));
} }
/* /*
......
...@@ -187,7 +187,7 @@ xfs_dir2_leaf_addname( ...@@ -187,7 +187,7 @@ xfs_dir2_leaf_addname(
int needbytes; /* leaf block bytes needed */ int needbytes; /* leaf block bytes needed */
int needlog; /* need to log data header */ int needlog; /* need to log data header */
int needscan; /* need to rescan data free */ int needscan; /* need to rescan data free */
xfs_dir2_data_off_t *tagp; /* end of data entry */ __be16 *tagp; /* end of data entry */
xfs_trans_t *tp; /* transaction pointer */ xfs_trans_t *tp; /* transaction pointer */
xfs_dir2_db_t use_block; /* data block number */ xfs_dir2_db_t use_block; /* data block number */
...@@ -411,7 +411,7 @@ xfs_dir2_leaf_addname( ...@@ -411,7 +411,7 @@ xfs_dir2_leaf_addname(
dep->namelen = args->namelen; dep->namelen = args->namelen;
memcpy(dep->name, args->name, dep->namelen); memcpy(dep->name, args->name, dep->namelen);
tagp = XFS_DIR2_DATA_ENTRY_TAG_P(dep); tagp = XFS_DIR2_DATA_ENTRY_TAG_P(dep);
INT_SET(*tagp, ARCH_CONVERT, (xfs_dir2_data_off_t)((char *)dep - (char *)data)); *tagp = cpu_to_be16((char *)dep - (char *)data);
/* /*
* Need to scan fix up the bestfree table. * Need to scan fix up the bestfree table.
*/ */
...@@ -533,7 +533,7 @@ xfs_dir2_leaf_addname( ...@@ -533,7 +533,7 @@ xfs_dir2_leaf_addname(
*/ */
lep->hashval = cpu_to_be32(args->hashval); lep->hashval = cpu_to_be32(args->hashval);
lep->address = cpu_to_be32(XFS_DIR2_DB_OFF_TO_DATAPTR(mp, use_block, lep->address = cpu_to_be32(XFS_DIR2_DB_OFF_TO_DATAPTR(mp, use_block,
INT_GET(*tagp, ARCH_CONVERT))); be16_to_cpu(*tagp)));
/* /*
* Log the leaf fields and give up the buffers. * Log the leaf fields and give up the buffers.
*/ */
......
...@@ -1379,7 +1379,7 @@ xfs_dir2_node_addname_int( ...@@ -1379,7 +1379,7 @@ xfs_dir2_node_addname_int(
xfs_mount_t *mp; /* filesystem mount point */ xfs_mount_t *mp; /* filesystem mount point */
int needlog; /* need to log data header */ int needlog; /* need to log data header */
int needscan; /* need to rescan data frees */ int needscan; /* need to rescan data frees */
xfs_dir2_data_off_t *tagp; /* data entry tag pointer */ __be16 *tagp; /* data entry tag pointer */
xfs_trans_t *tp; /* transaction pointer */ xfs_trans_t *tp; /* transaction pointer */
dp = args->dp; dp = args->dp;
...@@ -1699,7 +1699,7 @@ xfs_dir2_node_addname_int( ...@@ -1699,7 +1699,7 @@ xfs_dir2_node_addname_int(
dep->namelen = args->namelen; dep->namelen = args->namelen;
memcpy(dep->name, args->name, dep->namelen); memcpy(dep->name, args->name, dep->namelen);
tagp = XFS_DIR2_DATA_ENTRY_TAG_P(dep); tagp = XFS_DIR2_DATA_ENTRY_TAG_P(dep);
INT_SET(*tagp, ARCH_CONVERT, (xfs_dir2_data_off_t)((char *)dep - (char *)data)); *tagp = cpu_to_be16((char *)dep - (char *)data);
xfs_dir2_data_log_entry(tp, dbp, dep); xfs_dir2_data_log_entry(tp, dbp, dep);
/* /*
* Rescan the block for bestfree if needed. * Rescan the block for bestfree if needed.
...@@ -1732,7 +1732,7 @@ xfs_dir2_node_addname_int( ...@@ -1732,7 +1732,7 @@ xfs_dir2_node_addname_int(
* Return the data block and offset in args, then drop the data block. * Return the data block and offset in args, then drop the data block.
*/ */
args->blkno = (xfs_dablk_t)dbno; args->blkno = (xfs_dablk_t)dbno;
args->index = INT_GET(*tagp, ARCH_CONVERT); args->index = be16_to_cpu(*tagp);
xfs_da_buf_done(dbp); xfs_da_buf_done(dbp);
return 0; return 0;
} }
......
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