Commit ff9901c1 authored by Christoph Hellwig's avatar Christoph Hellwig Committed by Nathan Scott

[XFS] endianess annotations for xfs_dir2_data_entry_t

SGI-PV: 943272
SGI-Modid: xfs-linux-melb:xfs-kern:25806a
Signed-off-by: default avatarChristoph Hellwig <hch@lst.de>
Signed-off-by: default avatarAl Viro <viro@zeniv.linux.org.uk>
Signed-off-by: default avatarNathan Scott <nathans@sgi.com>
parent 3e57ecf6
...@@ -400,7 +400,7 @@ xfs_dir2_block_addname( ...@@ -400,7 +400,7 @@ xfs_dir2_block_addname(
/* /*
* Create the new data entry. * Create the new data entry.
*/ */
INT_SET(dep->inumber, ARCH_CONVERT, args->inumber); dep->inumber = cpu_to_be64(args->inumber);
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);
...@@ -508,7 +508,7 @@ xfs_dir2_block_getdents( ...@@ -508,7 +508,7 @@ xfs_dir2_block_getdents(
p.cook = XFS_DIR2_DB_OFF_TO_DATAPTR(mp, mp->m_dirdatablk, p.cook = XFS_DIR2_DB_OFF_TO_DATAPTR(mp, mp->m_dirdatablk,
ptr - (char *)block); ptr - (char *)block);
p.ino = INT_GET(dep->inumber, ARCH_CONVERT); p.ino = be64_to_cpu(dep->inumber);
#if XFS_BIG_INUMS #if XFS_BIG_INUMS
p.ino += mp->m_inoadd; p.ino += mp->m_inoadd;
#endif #endif
...@@ -626,7 +626,7 @@ xfs_dir2_block_lookup( ...@@ -626,7 +626,7 @@ xfs_dir2_block_lookup(
/* /*
* Fill in inode number, release the block. * Fill in inode number, release the block.
*/ */
args->inumber = INT_GET(dep->inumber, ARCH_CONVERT); args->inumber = be64_to_cpu(dep->inumber);
xfs_da_brelse(args->trans, bp); xfs_da_brelse(args->trans, bp);
return XFS_ERROR(EEXIST); return XFS_ERROR(EEXIST);
} }
...@@ -844,11 +844,11 @@ xfs_dir2_block_replace( ...@@ -844,11 +844,11 @@ xfs_dir2_block_replace(
*/ */
dep = (xfs_dir2_data_entry_t *) dep = (xfs_dir2_data_entry_t *)
((char *)block + XFS_DIR2_DATAPTR_TO_OFF(mp, be32_to_cpu(blp[ent].address))); ((char *)block + XFS_DIR2_DATAPTR_TO_OFF(mp, be32_to_cpu(blp[ent].address)));
ASSERT(INT_GET(dep->inumber, ARCH_CONVERT) != args->inumber); ASSERT(be64_to_cpu(dep->inumber) != args->inumber);
/* /*
* Change the inode number to the new value. * Change the inode number to the new value.
*/ */
INT_SET(dep->inumber, ARCH_CONVERT, args->inumber); dep->inumber = cpu_to_be64(args->inumber);
xfs_dir2_data_log_entry(args->trans, bp, dep); xfs_dir2_data_log_entry(args->trans, bp, dep);
xfs_dir2_data_check(dp, bp); xfs_dir2_data_check(dp, bp);
xfs_da_buf_done(bp); xfs_da_buf_done(bp);
...@@ -1130,7 +1130,7 @@ xfs_dir2_sf_to_block( ...@@ -1130,7 +1130,7 @@ xfs_dir2_sf_to_block(
*/ */
dep = (xfs_dir2_data_entry_t *) dep = (xfs_dir2_data_entry_t *)
((char *)block + XFS_DIR2_DATA_DOT_OFFSET); ((char *)block + XFS_DIR2_DATA_DOT_OFFSET);
INT_SET(dep->inumber, ARCH_CONVERT, dp->i_ino); dep->inumber = cpu_to_be64(dp->i_ino);
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);
...@@ -1144,7 +1144,7 @@ xfs_dir2_sf_to_block( ...@@ -1144,7 +1144,7 @@ xfs_dir2_sf_to_block(
*/ */
dep = (xfs_dir2_data_entry_t *) dep = (xfs_dir2_data_entry_t *)
((char *)block + XFS_DIR2_DATA_DOTDOT_OFFSET); ((char *)block + XFS_DIR2_DATA_DOTDOT_OFFSET);
INT_SET(dep->inumber, ARCH_CONVERT, XFS_DIR2_SF_GET_INUMBER(sfp, &sfp->hdr.parent)); dep->inumber = cpu_to_be64(XFS_DIR2_SF_GET_INUMBER(sfp, &sfp->hdr.parent));
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);
...@@ -1193,7 +1193,7 @@ xfs_dir2_sf_to_block( ...@@ -1193,7 +1193,7 @@ xfs_dir2_sf_to_block(
* Copy a real entry. * Copy a real entry.
*/ */
dep = (xfs_dir2_data_entry_t *)((char *)block + newoffset); dep = (xfs_dir2_data_entry_t *)((char *)block + newoffset);
INT_SET(dep->inumber, ARCH_CONVERT, XFS_DIR2_SF_GET_INUMBER(sfp, dep->inumber = cpu_to_be64(XFS_DIR2_SF_GET_INUMBER(sfp,
XFS_DIR2_SF_INUMBERP(sfep))); XFS_DIR2_SF_INUMBERP(sfep)));
dep->namelen = sfep->namelen; dep->namelen = sfep->namelen;
memcpy(dep->name, sfep->name, dep->namelen); memcpy(dep->name, sfep->name, dep->namelen);
......
...@@ -133,7 +133,7 @@ xfs_dir2_data_check( ...@@ -133,7 +133,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, be64_to_cpu(dep->inumber)) == 0);
ASSERT(be16_to_cpu(*XFS_DIR2_DATA_ENTRY_TAG_P(dep)) == ASSERT(be16_to_cpu(*XFS_DIR2_DATA_ENTRY_TAG_P(dep)) ==
(char *)dep - (char *)d); (char *)dep - (char *)d);
count++; count++;
......
...@@ -85,11 +85,11 @@ typedef struct xfs_dir2_data_hdr { ...@@ -85,11 +85,11 @@ typedef struct xfs_dir2_data_hdr {
* Tag appears as the last 2 bytes. * Tag appears as the last 2 bytes.
*/ */
typedef struct xfs_dir2_data_entry { typedef struct xfs_dir2_data_entry {
xfs_ino_t inumber; /* inode number */ __be64 inumber; /* inode number */
__uint8_t namelen; /* name length */ __u8 namelen; /* name length */
__uint8_t name[1]; /* name bytes, no null */ __u8 name[1]; /* name bytes, no null */
/* variable offset */ /* variable offset */
xfs_dir2_data_off_t tag; /* starting offset of us */ __be16 tag; /* starting offset of us */
} xfs_dir2_data_entry_t; } xfs_dir2_data_entry_t;
/* /*
......
...@@ -407,7 +407,7 @@ xfs_dir2_leaf_addname( ...@@ -407,7 +407,7 @@ xfs_dir2_leaf_addname(
* Initialize our new entry (at last). * Initialize our new entry (at last).
*/ */
dep = (xfs_dir2_data_entry_t *)dup; dep = (xfs_dir2_data_entry_t *)dup;
INT_SET(dep->inumber, ARCH_CONVERT, args->inumber); dep->inumber = cpu_to_be64(args->inumber);
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);
...@@ -1098,7 +1098,7 @@ xfs_dir2_leaf_getdents( ...@@ -1098,7 +1098,7 @@ xfs_dir2_leaf_getdents(
p->cook = XFS_DIR2_BYTE_TO_DATAPTR(mp, curoff + length); p->cook = XFS_DIR2_BYTE_TO_DATAPTR(mp, curoff + length);
p->ino = INT_GET(dep->inumber, ARCH_CONVERT); p->ino = be64_to_cpu(dep->inumber);
#if XFS_BIG_INUMS #if XFS_BIG_INUMS
p->ino += mp->m_inoadd; p->ino += mp->m_inoadd;
#endif #endif
...@@ -1319,7 +1319,7 @@ xfs_dir2_leaf_lookup( ...@@ -1319,7 +1319,7 @@ xfs_dir2_leaf_lookup(
/* /*
* Return the found inode number. * Return the found inode number.
*/ */
args->inumber = INT_GET(dep->inumber, ARCH_CONVERT); args->inumber = be64_to_cpu(dep->inumber);
xfs_da_brelse(tp, dbp); xfs_da_brelse(tp, dbp);
xfs_da_brelse(tp, lbp); xfs_da_brelse(tp, lbp);
return XFS_ERROR(EEXIST); return XFS_ERROR(EEXIST);
...@@ -1606,11 +1606,11 @@ xfs_dir2_leaf_replace( ...@@ -1606,11 +1606,11 @@ xfs_dir2_leaf_replace(
dep = (xfs_dir2_data_entry_t *) dep = (xfs_dir2_data_entry_t *)
((char *)dbp->data + ((char *)dbp->data +
XFS_DIR2_DATAPTR_TO_OFF(dp->i_mount, be32_to_cpu(lep->address))); XFS_DIR2_DATAPTR_TO_OFF(dp->i_mount, be32_to_cpu(lep->address)));
ASSERT(args->inumber != INT_GET(dep->inumber, ARCH_CONVERT)); ASSERT(args->inumber != be64_to_cpu(dep->inumber));
/* /*
* Put the new inode number in, log it. * Put the new inode number in, log it.
*/ */
INT_SET(dep->inumber, ARCH_CONVERT, args->inumber); dep->inumber = cpu_to_be64(args->inumber);
tp = args->trans; tp = args->trans;
xfs_dir2_data_log_entry(tp, dbp, dep); xfs_dir2_data_log_entry(tp, dbp, dep);
xfs_da_buf_done(dbp); xfs_da_buf_done(dbp);
......
...@@ -580,7 +580,7 @@ xfs_dir2_leafn_lookup_int( ...@@ -580,7 +580,7 @@ xfs_dir2_leafn_lookup_int(
if (dep->namelen == args->namelen && if (dep->namelen == args->namelen &&
dep->name[0] == args->name[0] && dep->name[0] == args->name[0] &&
memcmp(dep->name, args->name, args->namelen) == 0) { memcmp(dep->name, args->name, args->namelen) == 0) {
args->inumber = INT_GET(dep->inumber, ARCH_CONVERT); args->inumber = be64_to_cpu(dep->inumber);
*indexp = index; *indexp = index;
state->extravalid = 1; state->extravalid = 1;
state->extrablk.bp = curbp; state->extrablk.bp = curbp;
...@@ -1695,7 +1695,7 @@ xfs_dir2_node_addname_int( ...@@ -1695,7 +1695,7 @@ xfs_dir2_node_addname_int(
* Fill in the new entry and log it. * Fill in the new entry and log it.
*/ */
dep = (xfs_dir2_data_entry_t *)dup; dep = (xfs_dir2_data_entry_t *)dup;
INT_SET(dep->inumber, ARCH_CONVERT, args->inumber); dep->inumber = cpu_to_be64(args->inumber);
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);
...@@ -1905,11 +1905,11 @@ xfs_dir2_node_replace( ...@@ -1905,11 +1905,11 @@ xfs_dir2_node_replace(
dep = (xfs_dir2_data_entry_t *) dep = (xfs_dir2_data_entry_t *)
((char *)data + ((char *)data +
XFS_DIR2_DATAPTR_TO_OFF(state->mp, be32_to_cpu(lep->address))); XFS_DIR2_DATAPTR_TO_OFF(state->mp, be32_to_cpu(lep->address)));
ASSERT(inum != INT_GET(dep->inumber, ARCH_CONVERT)); ASSERT(inum != be64_to_cpu(dep->inumber));
/* /*
* Fill in the new inode number and log the entry. * Fill in the new inode number and log the entry.
*/ */
INT_SET(dep->inumber, ARCH_CONVERT, inum); dep->inumber = cpu_to_be64(inum);
xfs_dir2_data_log_entry(args->trans, state->extrablk.bp, dep); xfs_dir2_data_log_entry(args->trans, state->extrablk.bp, dep);
rval = 0; rval = 0;
} }
......
...@@ -117,13 +117,13 @@ xfs_dir2_block_sfsize( ...@@ -117,13 +117,13 @@ xfs_dir2_block_sfsize(
dep->name[0] == '.' && dep->name[1] == '.'; dep->name[0] == '.' && dep->name[1] == '.';
#if XFS_BIG_INUMS #if XFS_BIG_INUMS
if (!isdot) if (!isdot)
i8count += INT_GET(dep->inumber, ARCH_CONVERT) > XFS_DIR2_MAX_SHORT_INUM; i8count += be64_to_cpu(dep->inumber) > XFS_DIR2_MAX_SHORT_INUM;
#endif #endif
if (!isdot && !isdotdot) { if (!isdot && !isdotdot) {
count++; count++;
namelen += dep->namelen; namelen += dep->namelen;
} else if (isdotdot) } else if (isdotdot)
parent = INT_GET(dep->inumber, ARCH_CONVERT); parent = be64_to_cpu(dep->inumber);
/* /*
* Calculate the new size, see if we should give up yet. * Calculate the new size, see if we should give up yet.
*/ */
...@@ -229,13 +229,13 @@ xfs_dir2_block_to_sf( ...@@ -229,13 +229,13 @@ xfs_dir2_block_to_sf(
* Skip . * Skip .
*/ */
if (dep->namelen == 1 && dep->name[0] == '.') if (dep->namelen == 1 && dep->name[0] == '.')
ASSERT(INT_GET(dep->inumber, ARCH_CONVERT) == dp->i_ino); ASSERT(be64_to_cpu(dep->inumber) == dp->i_ino);
/* /*
* Skip .., but make sure the inode number is right. * Skip .., but make sure the inode number is right.
*/ */
else if (dep->namelen == 2 && else if (dep->namelen == 2 &&
dep->name[0] == '.' && dep->name[1] == '.') dep->name[0] == '.' && dep->name[1] == '.')
ASSERT(INT_GET(dep->inumber, ARCH_CONVERT) == ASSERT(be64_to_cpu(dep->inumber) ==
XFS_DIR2_SF_GET_INUMBER(sfp, &sfp->hdr.parent)); XFS_DIR2_SF_GET_INUMBER(sfp, &sfp->hdr.parent));
/* /*
* Normal entry, copy it into shortform. * Normal entry, copy it into shortform.
...@@ -246,7 +246,7 @@ xfs_dir2_block_to_sf( ...@@ -246,7 +246,7 @@ xfs_dir2_block_to_sf(
(xfs_dir2_data_aoff_t) (xfs_dir2_data_aoff_t)
((char *)dep - (char *)block)); ((char *)dep - (char *)block));
memcpy(sfep->name, dep->name, dep->namelen); memcpy(sfep->name, dep->name, dep->namelen);
temp=INT_GET(dep->inumber, ARCH_CONVERT); temp = be64_to_cpu(dep->inumber);
XFS_DIR2_SF_PUT_INUMBER(sfp, &temp, XFS_DIR2_SF_PUT_INUMBER(sfp, &temp,
XFS_DIR2_SF_INUMBERP(sfep)); XFS_DIR2_SF_INUMBERP(sfep));
sfep = XFS_DIR2_SF_NEXTENTRY(sfp, sfep); sfep = XFS_DIR2_SF_NEXTENTRY(sfp, sfep);
......
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