diff options
Diffstat (limited to 'fs/xfs/xfs_attr_leaf.h')
-rw-r--r-- | fs/xfs/xfs_attr_leaf.h | 77 |
1 files changed, 35 insertions, 42 deletions
diff --git a/fs/xfs/xfs_attr_leaf.h b/fs/xfs/xfs_attr_leaf.h index 326802f80d54..ef5f5eaa60d0 100644 --- a/fs/xfs/xfs_attr_leaf.h +++ b/fs/xfs/xfs_attr_leaf.h | |||
@@ -147,65 +147,58 @@ typedef struct xfs_attr_leaf_name_remote xfs_attr_leaf_name_remote_t; | |||
147 | /* | 147 | /* |
148 | * Cast typed pointers for "local" and "remote" name/value structs. | 148 | * Cast typed pointers for "local" and "remote" name/value structs. |
149 | */ | 149 | */ |
150 | #if XFS_WANT_FUNCS || (XFS_WANT_SPACE && XFSSO_XFS_ATTR_LEAF_NAME_REMOTE) | ||
151 | xfs_attr_leaf_name_remote_t * | ||
152 | xfs_attr_leaf_name_remote(xfs_attr_leafblock_t *leafp, int idx); | ||
153 | #define XFS_ATTR_LEAF_NAME_REMOTE(leafp,idx) \ | 150 | #define XFS_ATTR_LEAF_NAME_REMOTE(leafp,idx) \ |
154 | xfs_attr_leaf_name_remote(leafp,idx) | 151 | xfs_attr_leaf_name_remote(leafp,idx) |
155 | #else | 152 | static inline xfs_attr_leaf_name_remote_t * |
156 | #define XFS_ATTR_LEAF_NAME_REMOTE(leafp,idx) /* remote name struct ptr */ \ | 153 | xfs_attr_leaf_name_remote(xfs_attr_leafblock_t *leafp, int idx) |
157 | ((xfs_attr_leaf_name_remote_t *) \ | 154 | { |
158 | &((char *)(leafp))[ INT_GET((leafp)->entries[idx].nameidx, ARCH_CONVERT) ]) | 155 | return (xfs_attr_leaf_name_remote_t *) &((char *) |
159 | #endif | 156 | (leafp))[INT_GET((leafp)->entries[idx].nameidx, ARCH_CONVERT)]; |
160 | #if XFS_WANT_FUNCS || (XFS_WANT_SPACE && XFSSO_XFS_ATTR_LEAF_NAME_LOCAL) | 157 | } |
161 | xfs_attr_leaf_name_local_t * | 158 | |
162 | xfs_attr_leaf_name_local(xfs_attr_leafblock_t *leafp, int idx); | ||
163 | #define XFS_ATTR_LEAF_NAME_LOCAL(leafp,idx) \ | 159 | #define XFS_ATTR_LEAF_NAME_LOCAL(leafp,idx) \ |
164 | xfs_attr_leaf_name_local(leafp,idx) | 160 | xfs_attr_leaf_name_local(leafp,idx) |
165 | #else | 161 | static inline xfs_attr_leaf_name_local_t * |
166 | #define XFS_ATTR_LEAF_NAME_LOCAL(leafp,idx) /* local name struct ptr */ \ | 162 | xfs_attr_leaf_name_local(xfs_attr_leafblock_t *leafp, int idx) |
167 | ((xfs_attr_leaf_name_local_t *) \ | 163 | { |
168 | &((char *)(leafp))[ INT_GET((leafp)->entries[idx].nameidx, ARCH_CONVERT) ]) | 164 | return (xfs_attr_leaf_name_local_t *) &((char *) |
169 | #endif | 165 | (leafp))[INT_GET((leafp)->entries[idx].nameidx, ARCH_CONVERT)]; |
170 | #if XFS_WANT_FUNCS || (XFS_WANT_SPACE && XFSSO_XFS_ATTR_LEAF_NAME) | 166 | } |
171 | char *xfs_attr_leaf_name(xfs_attr_leafblock_t *leafp, int idx); | 167 | |
172 | #define XFS_ATTR_LEAF_NAME(leafp,idx) xfs_attr_leaf_name(leafp,idx) | 168 | #define XFS_ATTR_LEAF_NAME(leafp,idx) xfs_attr_leaf_name(leafp,idx) |
173 | #else | 169 | static inline char *xfs_attr_leaf_name(xfs_attr_leafblock_t *leafp, int idx) |
174 | #define XFS_ATTR_LEAF_NAME(leafp,idx) /* generic name struct ptr */ \ | 170 | { |
175 | (&((char *)(leafp))[ INT_GET((leafp)->entries[idx].nameidx, ARCH_CONVERT) ]) | 171 | return (&((char *) |
176 | #endif | 172 | (leafp))[INT_GET((leafp)->entries[idx].nameidx, ARCH_CONVERT)]); |
173 | } | ||
177 | 174 | ||
178 | /* | 175 | /* |
179 | * Calculate total bytes used (including trailing pad for alignment) for | 176 | * Calculate total bytes used (including trailing pad for alignment) for |
180 | * a "local" name/value structure, a "remote" name/value structure, and | 177 | * a "local" name/value structure, a "remote" name/value structure, and |
181 | * a pointer which might be either. | 178 | * a pointer which might be either. |
182 | */ | 179 | */ |
183 | #if XFS_WANT_FUNCS || (XFS_WANT_SPACE && XFSSO_XFS_ATTR_LEAF_ENTSIZE_REMOTE) | ||
184 | int xfs_attr_leaf_entsize_remote(int nlen); | ||
185 | #define XFS_ATTR_LEAF_ENTSIZE_REMOTE(nlen) \ | 180 | #define XFS_ATTR_LEAF_ENTSIZE_REMOTE(nlen) \ |
186 | xfs_attr_leaf_entsize_remote(nlen) | 181 | xfs_attr_leaf_entsize_remote(nlen) |
187 | #else | 182 | static inline int xfs_attr_leaf_entsize_remote(int nlen) |
188 | #define XFS_ATTR_LEAF_ENTSIZE_REMOTE(nlen) /* space for remote struct */ \ | 183 | { |
189 | (((uint)sizeof(xfs_attr_leaf_name_remote_t) - 1 + (nlen) + \ | 184 | return ((uint)sizeof(xfs_attr_leaf_name_remote_t) - 1 + (nlen) + \ |
190 | XFS_ATTR_LEAF_NAME_ALIGN - 1) & ~(XFS_ATTR_LEAF_NAME_ALIGN - 1)) | 185 | XFS_ATTR_LEAF_NAME_ALIGN - 1) & ~(XFS_ATTR_LEAF_NAME_ALIGN - 1); |
191 | #endif | 186 | } |
192 | #if XFS_WANT_FUNCS || (XFS_WANT_SPACE && XFSSO_XFS_ATTR_LEAF_ENTSIZE_LOCAL) | 187 | |
193 | int xfs_attr_leaf_entsize_local(int nlen, int vlen); | ||
194 | #define XFS_ATTR_LEAF_ENTSIZE_LOCAL(nlen,vlen) \ | 188 | #define XFS_ATTR_LEAF_ENTSIZE_LOCAL(nlen,vlen) \ |
195 | xfs_attr_leaf_entsize_local(nlen,vlen) | 189 | xfs_attr_leaf_entsize_local(nlen,vlen) |
196 | #else | 190 | static inline int xfs_attr_leaf_entsize_local(int nlen, int vlen) |
197 | #define XFS_ATTR_LEAF_ENTSIZE_LOCAL(nlen,vlen) /* space for local struct */ \ | 191 | { |
198 | (((uint)sizeof(xfs_attr_leaf_name_local_t) - 1 + (nlen) + (vlen) + \ | 192 | return ((uint)sizeof(xfs_attr_leaf_name_local_t) - 1 + (nlen) + (vlen) + |
199 | XFS_ATTR_LEAF_NAME_ALIGN - 1) & ~(XFS_ATTR_LEAF_NAME_ALIGN - 1)) | 193 | XFS_ATTR_LEAF_NAME_ALIGN - 1) & ~(XFS_ATTR_LEAF_NAME_ALIGN - 1); |
200 | #endif | 194 | } |
201 | #if XFS_WANT_FUNCS || (XFS_WANT_SPACE && XFSSO_XFS_ATTR_LEAF_ENTSIZE_LOCAL_MAX) | 195 | |
202 | int xfs_attr_leaf_entsize_local_max(int bsize); | ||
203 | #define XFS_ATTR_LEAF_ENTSIZE_LOCAL_MAX(bsize) \ | 196 | #define XFS_ATTR_LEAF_ENTSIZE_LOCAL_MAX(bsize) \ |
204 | xfs_attr_leaf_entsize_local_max(bsize) | 197 | xfs_attr_leaf_entsize_local_max(bsize) |
205 | #else | 198 | static inline int xfs_attr_leaf_entsize_local_max(int bsize) |
206 | #define XFS_ATTR_LEAF_ENTSIZE_LOCAL_MAX(bsize) /* max local struct size */ \ | 199 | { |
207 | (((bsize) >> 1) + ((bsize) >> 2)) | 200 | return (((bsize) >> 1) + ((bsize) >> 2)); |
208 | #endif | 201 | } |
209 | 202 | ||
210 | 203 | ||
211 | /*======================================================================== | 204 | /*======================================================================== |