diff options
-rw-r--r-- | fs/xfs/xfs_attr_leaf.c | 18 | ||||
-rw-r--r-- | fs/xfs/xfs_attr_leaf.h | 6 |
2 files changed, 11 insertions, 13 deletions
diff --git a/fs/xfs/xfs_attr_leaf.c b/fs/xfs/xfs_attr_leaf.c index 319285c24e42..3adfc5dcfe7d 100644 --- a/fs/xfs/xfs_attr_leaf.c +++ b/fs/xfs/xfs_attr_leaf.c | |||
@@ -732,11 +732,11 @@ xfs_attr_shortform_allfit(xfs_dabuf_t *bp, xfs_inode_t *dp) | |||
732 | name_loc = XFS_ATTR_LEAF_NAME_LOCAL(leaf, i); | 732 | name_loc = XFS_ATTR_LEAF_NAME_LOCAL(leaf, i); |
733 | if (name_loc->namelen >= XFS_ATTR_SF_ENTSIZE_MAX) | 733 | if (name_loc->namelen >= XFS_ATTR_SF_ENTSIZE_MAX) |
734 | return(0); | 734 | return(0); |
735 | if (INT_GET(name_loc->valuelen, ARCH_CONVERT) >= XFS_ATTR_SF_ENTSIZE_MAX) | 735 | if (be16_to_cpu(name_loc->valuelen) >= XFS_ATTR_SF_ENTSIZE_MAX) |
736 | return(0); | 736 | return(0); |
737 | bytes += sizeof(struct xfs_attr_sf_entry)-1 | 737 | bytes += sizeof(struct xfs_attr_sf_entry)-1 |
738 | + name_loc->namelen | 738 | + name_loc->namelen |
739 | + INT_GET(name_loc->valuelen, ARCH_CONVERT); | 739 | + be16_to_cpu(name_loc->valuelen); |
740 | } | 740 | } |
741 | if ((dp->i_mount->m_flags & XFS_MOUNT_ATTR2) && | 741 | if ((dp->i_mount->m_flags & XFS_MOUNT_ATTR2) && |
742 | (bytes == sizeof(struct xfs_attr_sf_hdr))) | 742 | (bytes == sizeof(struct xfs_attr_sf_hdr))) |
@@ -818,7 +818,7 @@ xfs_attr_leaf_to_shortform(xfs_dabuf_t *bp, xfs_da_args_t *args, int forkoff) | |||
818 | nargs.name = (char *)name_loc->nameval; | 818 | nargs.name = (char *)name_loc->nameval; |
819 | nargs.namelen = name_loc->namelen; | 819 | nargs.namelen = name_loc->namelen; |
820 | nargs.value = (char *)&name_loc->nameval[nargs.namelen]; | 820 | nargs.value = (char *)&name_loc->nameval[nargs.namelen]; |
821 | nargs.valuelen = INT_GET(name_loc->valuelen, ARCH_CONVERT); | 821 | nargs.valuelen = be16_to_cpu(name_loc->valuelen); |
822 | nargs.hashval = be32_to_cpu(entry->hashval); | 822 | nargs.hashval = be32_to_cpu(entry->hashval); |
823 | nargs.flags = (entry->flags & XFS_ATTR_SECURE) ? ATTR_SECURE : | 823 | nargs.flags = (entry->flags & XFS_ATTR_SECURE) ? ATTR_SECURE : |
824 | ((entry->flags & XFS_ATTR_ROOT) ? ATTR_ROOT : 0); | 824 | ((entry->flags & XFS_ATTR_ROOT) ? ATTR_ROOT : 0); |
@@ -1136,10 +1136,10 @@ xfs_attr_leaf_add_work(xfs_dabuf_t *bp, xfs_da_args_t *args, int mapindex) | |||
1136 | if (entry->flags & XFS_ATTR_LOCAL) { | 1136 | if (entry->flags & XFS_ATTR_LOCAL) { |
1137 | name_loc = XFS_ATTR_LEAF_NAME_LOCAL(leaf, args->index); | 1137 | name_loc = XFS_ATTR_LEAF_NAME_LOCAL(leaf, args->index); |
1138 | name_loc->namelen = args->namelen; | 1138 | name_loc->namelen = args->namelen; |
1139 | INT_SET(name_loc->valuelen, ARCH_CONVERT, args->valuelen); | 1139 | name_loc->valuelen = cpu_to_be16(args->valuelen); |
1140 | memcpy((char *)name_loc->nameval, args->name, args->namelen); | 1140 | memcpy((char *)name_loc->nameval, args->name, args->namelen); |
1141 | memcpy((char *)&name_loc->nameval[args->namelen], args->value, | 1141 | memcpy((char *)&name_loc->nameval[args->namelen], args->value, |
1142 | INT_GET(name_loc->valuelen, ARCH_CONVERT)); | 1142 | be16_to_cpu(name_loc->valuelen)); |
1143 | } else { | 1143 | } else { |
1144 | name_rmt = XFS_ATTR_LEAF_NAME_REMOTE(leaf, args->index); | 1144 | name_rmt = XFS_ATTR_LEAF_NAME_REMOTE(leaf, args->index); |
1145 | name_rmt->namelen = args->namelen; | 1145 | name_rmt->namelen = args->namelen; |
@@ -2042,7 +2042,7 @@ xfs_attr_leaf_getvalue(xfs_dabuf_t *bp, xfs_da_args_t *args) | |||
2042 | name_loc = XFS_ATTR_LEAF_NAME_LOCAL(leaf, args->index); | 2042 | name_loc = XFS_ATTR_LEAF_NAME_LOCAL(leaf, args->index); |
2043 | ASSERT(name_loc->namelen == args->namelen); | 2043 | ASSERT(name_loc->namelen == args->namelen); |
2044 | ASSERT(memcmp(args->name, name_loc->nameval, args->namelen) == 0); | 2044 | ASSERT(memcmp(args->name, name_loc->nameval, args->namelen) == 0); |
2045 | valuelen = INT_GET(name_loc->valuelen, ARCH_CONVERT); | 2045 | valuelen = be16_to_cpu(name_loc->valuelen); |
2046 | if (args->flags & ATTR_KERNOVAL) { | 2046 | if (args->flags & ATTR_KERNOVAL) { |
2047 | args->valuelen = valuelen; | 2047 | args->valuelen = valuelen; |
2048 | return(0); | 2048 | return(0); |
@@ -2282,8 +2282,7 @@ xfs_attr_leaf_entsize(xfs_attr_leafblock_t *leaf, int index) | |||
2282 | if (leaf->entries[index].flags & XFS_ATTR_LOCAL) { | 2282 | if (leaf->entries[index].flags & XFS_ATTR_LOCAL) { |
2283 | name_loc = XFS_ATTR_LEAF_NAME_LOCAL(leaf, index); | 2283 | name_loc = XFS_ATTR_LEAF_NAME_LOCAL(leaf, index); |
2284 | size = XFS_ATTR_LEAF_ENTSIZE_LOCAL(name_loc->namelen, | 2284 | size = XFS_ATTR_LEAF_ENTSIZE_LOCAL(name_loc->namelen, |
2285 | INT_GET(name_loc->valuelen, | 2285 | be16_to_cpu(name_loc->valuelen)); |
2286 | ARCH_CONVERT)); | ||
2287 | } else { | 2286 | } else { |
2288 | name_rmt = XFS_ATTR_LEAF_NAME_REMOTE(leaf, index); | 2287 | name_rmt = XFS_ATTR_LEAF_NAME_REMOTE(leaf, index); |
2289 | size = XFS_ATTR_LEAF_ENTSIZE_REMOTE(name_rmt->namelen); | 2288 | size = XFS_ATTR_LEAF_ENTSIZE_REMOTE(name_rmt->namelen); |
@@ -2402,8 +2401,7 @@ xfs_attr_leaf_list_int(xfs_dabuf_t *bp, xfs_attr_list_context_t *context) | |||
2402 | retval = xfs_attr_put_listent(context, namesp, | 2401 | retval = xfs_attr_put_listent(context, namesp, |
2403 | (char *)name_loc->nameval, | 2402 | (char *)name_loc->nameval, |
2404 | (int)name_loc->namelen, | 2403 | (int)name_loc->namelen, |
2405 | (int)INT_GET(name_loc->valuelen, | 2404 | be16_to_cpu(name_loc->valuelen)); |
2406 | ARCH_CONVERT)); | ||
2407 | } | 2405 | } |
2408 | } else { | 2406 | } else { |
2409 | name_rmt = XFS_ATTR_LEAF_NAME_REMOTE(leaf, i); | 2407 | name_rmt = XFS_ATTR_LEAF_NAME_REMOTE(leaf, i); |
diff --git a/fs/xfs/xfs_attr_leaf.h b/fs/xfs/xfs_attr_leaf.h index 7fbe4880bb83..ad6f791ec58a 100644 --- a/fs/xfs/xfs_attr_leaf.h +++ b/fs/xfs/xfs_attr_leaf.h | |||
@@ -96,9 +96,9 @@ typedef struct xfs_attr_leaf_entry { /* sorted on key, not name */ | |||
96 | } xfs_attr_leaf_entry_t; | 96 | } xfs_attr_leaf_entry_t; |
97 | 97 | ||
98 | typedef struct xfs_attr_leaf_name_local { | 98 | typedef struct xfs_attr_leaf_name_local { |
99 | __uint16_t valuelen; /* number of bytes in value */ | 99 | __be16 valuelen; /* number of bytes in value */ |
100 | __uint8_t namelen; /* length of name bytes */ | 100 | __u8 namelen; /* length of name bytes */ |
101 | __uint8_t nameval[1]; /* name/value bytes */ | 101 | __u8 nameval[1]; /* name/value bytes */ |
102 | } xfs_attr_leaf_name_local_t; | 102 | } xfs_attr_leaf_name_local_t; |
103 | 103 | ||
104 | typedef struct xfs_attr_leaf_name_remote { | 104 | typedef struct xfs_attr_leaf_name_remote { |