aboutsummaryrefslogtreecommitdiffstats
path: root/fs/xfs/xfs_dinode.h
diff options
context:
space:
mode:
authorChristoph Hellwig <hch@infradead.org>2007-12-06 22:07:20 -0500
committerLachlan McIlroy <lachlan@redback.melbourne.sgi.com>2008-02-07 02:19:24 -0500
commit45ba598e56fa9f77801e06432b50580d97994fa4 (patch)
tree4c0bd022cbdc705426e6d2fba19ab7c23edefb55 /fs/xfs/xfs_dinode.h
parenta9759f2de38a3443d5107bddde03b4f3f550060e (diff)
[XFS] Remove CFORK macros and use code directly in IFORK and DFORK macros.
Currently XFS_IFORK_* and XFS_DFORK* are implemented by means of XFS_CFORK* macros. But given that XFS_IFORK_* operates on an xfs_inode that embedds and xfs_icdinode_core and XFS_DFORK_* operates on an xfs_dinode that embedds a xfs_dinode_core one will have to do endian swapping while the other doesn't. Instead of having the current mess with the CFORK macros that have byteswapping and non-byteswapping version (which are inconsistantly named while we're at it) just define each family of the macros to stand by itself and simplify the whole matter. A few direct references to the CFORK variants were cleaned up to use IFORK or DFORK to make this possible. SGI-PV: 971186 SGI-Modid: xfs-linux-melb:xfs-kern:30163a Signed-off-by: Christoph Hellwig <hch@infradead.org> Signed-off-by: Tim Shimmin <tes@sgi.com> Signed-off-by: Lachlan McIlroy <lachlan@sgi.com>
Diffstat (limited to 'fs/xfs/xfs_dinode.h')
-rw-r--r--fs/xfs/xfs_dinode.h76
1 files changed, 21 insertions, 55 deletions
diff --git a/fs/xfs/xfs_dinode.h b/fs/xfs/xfs_dinode.h
index 85030cbcdd87..c9065eaf2a4d 100644
--- a/fs/xfs/xfs_dinode.h
+++ b/fs/xfs/xfs_dinode.h
@@ -171,69 +171,35 @@ typedef enum xfs_dinode_fmt
171/* 171/*
172 * Inode data & attribute fork sizes, per inode. 172 * Inode data & attribute fork sizes, per inode.
173 */ 173 */
174#define XFS_CFORK_Q(dcp) ((dcp)->di_forkoff != 0) 174#define XFS_DFORK_Q(dip) ((dip)->di_core.di_forkoff != 0)
175#define XFS_CFORK_Q_DISK(dcp) ((dcp)->di_forkoff != 0) 175#define XFS_DFORK_BOFF(dip) ((int)((dip)->di_core.di_forkoff << 3))
176
177#define XFS_CFORK_BOFF(dcp) ((int)((dcp)->di_forkoff << 3))
178#define XFS_CFORK_BOFF_DISK(dcp) ((int)((dcp)->di_forkoff << 3))
179
180#define XFS_CFORK_DSIZE_DISK(dcp,mp) \
181 (XFS_CFORK_Q_DISK(dcp) ? XFS_CFORK_BOFF_DISK(dcp) : XFS_LITINO(mp))
182#define XFS_CFORK_DSIZE(dcp,mp) \
183 (XFS_CFORK_Q(dcp) ? XFS_CFORK_BOFF(dcp) : XFS_LITINO(mp))
184
185#define XFS_CFORK_ASIZE_DISK(dcp,mp) \
186 (XFS_CFORK_Q_DISK(dcp) ? XFS_LITINO(mp) - XFS_CFORK_BOFF_DISK(dcp) : 0)
187#define XFS_CFORK_ASIZE(dcp,mp) \
188 (XFS_CFORK_Q(dcp) ? XFS_LITINO(mp) - XFS_CFORK_BOFF(dcp) : 0)
189
190#define XFS_CFORK_SIZE_DISK(dcp,mp,w) \
191 ((w) == XFS_DATA_FORK ? \
192 XFS_CFORK_DSIZE_DISK(dcp, mp) : \
193 XFS_CFORK_ASIZE_DISK(dcp, mp))
194#define XFS_CFORK_SIZE(dcp,mp,w) \
195 ((w) == XFS_DATA_FORK ? \
196 XFS_CFORK_DSIZE(dcp, mp) : XFS_CFORK_ASIZE(dcp, mp))
197 176
198#define XFS_DFORK_DSIZE(dip,mp) \ 177#define XFS_DFORK_DSIZE(dip,mp) \
199 XFS_CFORK_DSIZE_DISK(&(dip)->di_core, mp) 178 (XFS_DFORK_Q(dip) ? \
200#define XFS_DFORK_DSIZE_HOST(dip,mp) \ 179 XFS_DFORK_BOFF(dip) : \
201 XFS_CFORK_DSIZE(&(dip)->di_core, mp) 180 XFS_LITINO(mp))
202#define XFS_DFORK_ASIZE(dip,mp) \ 181#define XFS_DFORK_ASIZE(dip,mp) \
203 XFS_CFORK_ASIZE_DISK(&(dip)->di_core, mp) 182 (XFS_DFORK_Q(dip) ? \
204#define XFS_DFORK_ASIZE_HOST(dip,mp) \ 183 XFS_LITINO(mp) - XFS_DFORK_BOFF(dip) : \
205 XFS_CFORK_ASIZE(&(dip)->di_core, mp) 184 0)
206#define XFS_DFORK_SIZE(dip,mp,w) \ 185#define XFS_DFORK_SIZE(dip,mp,w) \
207 XFS_CFORK_SIZE_DISK(&(dip)->di_core, mp, w) 186 ((w) == XFS_DATA_FORK ? \
208#define XFS_DFORK_SIZE_HOST(dip,mp,w) \ 187 XFS_DFORK_DSIZE(dip, mp) : \
209 XFS_CFORK_SIZE(&(dip)->di_core, mp, w) 188 XFS_DFORK_ASIZE(dip, mp))
210 189
211#define XFS_DFORK_Q(dip) XFS_CFORK_Q_DISK(&(dip)->di_core) 190#define XFS_DFORK_DPTR(dip) ((dip)->di_u.di_c)
212#define XFS_DFORK_BOFF(dip) XFS_CFORK_BOFF_DISK(&(dip)->di_core) 191#define XFS_DFORK_APTR(dip) \
213#define XFS_DFORK_DPTR(dip) ((dip)->di_u.di_c)
214#define XFS_DFORK_APTR(dip) \
215 ((dip)->di_u.di_c + XFS_DFORK_BOFF(dip)) 192 ((dip)->di_u.di_c + XFS_DFORK_BOFF(dip))
216#define XFS_DFORK_PTR(dip,w) \ 193#define XFS_DFORK_PTR(dip,w) \
217 ((w) == XFS_DATA_FORK ? XFS_DFORK_DPTR(dip) : XFS_DFORK_APTR(dip)) 194 ((w) == XFS_DATA_FORK ? XFS_DFORK_DPTR(dip) : XFS_DFORK_APTR(dip))
218#define XFS_CFORK_FORMAT(dcp,w) \ 195#define XFS_DFORK_FORMAT(dip,w) \
219 ((w) == XFS_DATA_FORK ? (dcp)->di_format : (dcp)->di_aformat)
220#define XFS_CFORK_FMT_SET(dcp,w,n) \
221 ((w) == XFS_DATA_FORK ? \ 196 ((w) == XFS_DATA_FORK ? \
222 ((dcp)->di_format = (n)) : ((dcp)->di_aformat = (n))) 197 (dip)->di_core.di_format : \
223#define XFS_DFORK_FORMAT(dip,w) XFS_CFORK_FORMAT(&(dip)->di_core, w) 198 (dip)->di_core.di_aformat)
224 199#define XFS_DFORK_NEXTENTS(dip,w) \
225#define XFS_CFORK_NEXTENTS_DISK(dcp,w) \
226 ((w) == XFS_DATA_FORK ? \
227 be32_to_cpu((dcp)->di_nextents) : \
228 be16_to_cpu((dcp)->di_anextents))
229#define XFS_CFORK_NEXTENTS(dcp,w) \
230 ((w) == XFS_DATA_FORK ? (dcp)->di_nextents : (dcp)->di_anextents)
231#define XFS_DFORK_NEXTENTS(dip,w) XFS_CFORK_NEXTENTS_DISK(&(dip)->di_core, w)
232#define XFS_DFORK_NEXTENTS_HOST(dip,w) XFS_CFORK_NEXTENTS(&(dip)->di_core, w)
233
234#define XFS_CFORK_NEXT_SET(dcp,w,n) \
235 ((w) == XFS_DATA_FORK ? \ 200 ((w) == XFS_DATA_FORK ? \
236 ((dcp)->di_nextents = (n)) : ((dcp)->di_anextents = (n))) 201 be32_to_cpu((dip)->di_core.di_nextents) : \
202 be16_to_cpu((dip)->di_core.di_anextents))
237 203
238#define XFS_BUF_TO_DINODE(bp) ((xfs_dinode_t *)XFS_BUF_PTR(bp)) 204#define XFS_BUF_TO_DINODE(bp) ((xfs_dinode_t *)XFS_BUF_PTR(bp))
239 205