aboutsummaryrefslogtreecommitdiffstats
path: root/fs/xfs/xfs_dir2_data.h
diff options
context:
space:
mode:
Diffstat (limited to 'fs/xfs/xfs_dir2_data.h')
-rw-r--r--fs/xfs/xfs_dir2_data.h26
1 files changed, 12 insertions, 14 deletions
diff --git a/fs/xfs/xfs_dir2_data.h b/fs/xfs/xfs_dir2_data.h
index 5e3a7f9ec735..0847cbb53e17 100644
--- a/fs/xfs/xfs_dir2_data.h
+++ b/fs/xfs/xfs_dir2_data.h
@@ -65,8 +65,8 @@ struct xfs_trans;
65 * The freespace will be formatted as a xfs_dir2_data_unused_t. 65 * The freespace will be formatted as a xfs_dir2_data_unused_t.
66 */ 66 */
67typedef struct xfs_dir2_data_free { 67typedef struct xfs_dir2_data_free {
68 xfs_dir2_data_off_t offset; /* start of freespace */ 68 __be16 offset; /* start of freespace */
69 xfs_dir2_data_off_t length; /* length of freespace */ 69 __be16 length; /* length of freespace */
70} xfs_dir2_data_free_t; 70} xfs_dir2_data_free_t;
71 71
72/* 72/*
@@ -75,7 +75,7 @@ typedef struct xfs_dir2_data_free {
75 * The code knows that XFS_DIR2_DATA_FD_COUNT is 3. 75 * The code knows that XFS_DIR2_DATA_FD_COUNT is 3.
76 */ 76 */
77typedef struct xfs_dir2_data_hdr { 77typedef struct xfs_dir2_data_hdr {
78 __uint32_t magic; /* XFS_DIR2_DATA_MAGIC */ 78 __be32 magic; /* XFS_DIR2_DATA_MAGIC */
79 /* or XFS_DIR2_BLOCK_MAGIC */ 79 /* or XFS_DIR2_BLOCK_MAGIC */
80 xfs_dir2_data_free_t bestfree[XFS_DIR2_DATA_FD_COUNT]; 80 xfs_dir2_data_free_t bestfree[XFS_DIR2_DATA_FD_COUNT];
81} xfs_dir2_data_hdr_t; 81} xfs_dir2_data_hdr_t;
@@ -97,10 +97,10 @@ typedef struct xfs_dir2_data_entry {
97 * Tag appears as the last 2 bytes. 97 * Tag appears as the last 2 bytes.
98 */ 98 */
99typedef struct xfs_dir2_data_unused { 99typedef struct xfs_dir2_data_unused {
100 __uint16_t freetag; /* XFS_DIR2_DATA_FREE_TAG */ 100 __be16 freetag; /* XFS_DIR2_DATA_FREE_TAG */
101 xfs_dir2_data_off_t length; /* total free length */ 101 __be16 length; /* total free length */
102 /* variable offset */ 102 /* variable offset */
103 xfs_dir2_data_off_t tag; /* starting offset of us */ 103 __be16 tag; /* starting offset of us */
104} xfs_dir2_data_unused_t; 104} xfs_dir2_data_unused_t;
105 105
106typedef union { 106typedef union {
@@ -134,12 +134,11 @@ static inline int xfs_dir2_data_entsize(int n)
134 * Pointer to an entry's tag word. 134 * Pointer to an entry's tag word.
135 */ 135 */
136#define XFS_DIR2_DATA_ENTRY_TAG_P(dep) xfs_dir2_data_entry_tag_p(dep) 136#define XFS_DIR2_DATA_ENTRY_TAG_P(dep) xfs_dir2_data_entry_tag_p(dep)
137static inline xfs_dir2_data_off_t * 137static inline __be16 *
138xfs_dir2_data_entry_tag_p(xfs_dir2_data_entry_t *dep) 138xfs_dir2_data_entry_tag_p(xfs_dir2_data_entry_t *dep)
139{ 139{
140 return (xfs_dir2_data_off_t *) \ 140 return (__be16 *)((char *)dep +
141 ((char *)(dep) + XFS_DIR2_DATA_ENTSIZE((dep)->namelen) - \ 141 XFS_DIR2_DATA_ENTSIZE(dep->namelen) - sizeof(__be16));
142 (uint)sizeof(xfs_dir2_data_off_t));
143} 142}
144 143
145/* 144/*
@@ -147,12 +146,11 @@ xfs_dir2_data_entry_tag_p(xfs_dir2_data_entry_t *dep)
147 */ 146 */
148#define XFS_DIR2_DATA_UNUSED_TAG_P(dup) \ 147#define XFS_DIR2_DATA_UNUSED_TAG_P(dup) \
149 xfs_dir2_data_unused_tag_p(dup) 148 xfs_dir2_data_unused_tag_p(dup)
150static inline xfs_dir2_data_off_t * 149static inline __be16 *
151xfs_dir2_data_unused_tag_p(xfs_dir2_data_unused_t *dup) 150xfs_dir2_data_unused_tag_p(xfs_dir2_data_unused_t *dup)
152{ 151{
153 return (xfs_dir2_data_off_t *) \ 152 return (__be16 *)((char *)dup +
154 ((char *)(dup) + INT_GET((dup)->length, ARCH_CONVERT) \ 153 be16_to_cpu(dup->length) - sizeof(__be16));
155 - (uint)sizeof(xfs_dir2_data_off_t));
156} 154}
157 155
158/* 156/*