aboutsummaryrefslogtreecommitdiffstats
path: root/fs/xfs/xfs_attr_leaf.h
diff options
context:
space:
mode:
authorNathan Scott <nathans@sgi.com>2005-11-01 22:38:42 -0500
committerNathan Scott <nathans@sgi.com>2005-11-01 22:38:42 -0500
commita844f4510dce23c07f3923cb42138f5fdd745017 (patch)
treeffb37e9e60f02d5e92bd69bb53b568e1c991c17f /fs/xfs/xfs_attr_leaf.h
parent61c1e689fbde7cb50a76262bba190715d86beab6 (diff)
[XFS] Remove xfs_macros.c, xfs_macros.h, rework headers a whole lot.
SGI-PV: 943122 SGI-Modid: xfs-linux:xfs-kern:23901a Signed-off-by: Nathan Scott <nathans@sgi.com>
Diffstat (limited to 'fs/xfs/xfs_attr_leaf.h')
-rw-r--r--fs/xfs/xfs_attr_leaf.h77
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)
151xfs_attr_leaf_name_remote_t *
152xfs_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 152static inline xfs_attr_leaf_name_remote_t *
156#define XFS_ATTR_LEAF_NAME_REMOTE(leafp,idx) /* remote name struct ptr */ \ 153xfs_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}
161xfs_attr_leaf_name_local_t * 158
162xfs_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 161static inline xfs_attr_leaf_name_local_t *
166#define XFS_ATTR_LEAF_NAME_LOCAL(leafp,idx) /* local name struct ptr */ \ 162xfs_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}
171char *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 169static 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)
184int 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 182static 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
193int 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 190static 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
202int 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 198static 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/*========================================================================