diff options
author | Christoph Hellwig <hch@infradead.org> | 2007-12-06 22:07:20 -0500 |
---|---|---|
committer | Lachlan McIlroy <lachlan@redback.melbourne.sgi.com> | 2008-02-07 02:19:24 -0500 |
commit | 45ba598e56fa9f77801e06432b50580d97994fa4 (patch) | |
tree | 4c0bd022cbdc705426e6d2fba19ab7c23edefb55 /fs/xfs/xfs_inode.h | |
parent | a9759f2de38a3443d5107bddde03b4f3f550060e (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_inode.h')
-rw-r--r-- | fs/xfs/xfs_inode.h | 47 |
1 files changed, 36 insertions, 11 deletions
diff --git a/fs/xfs/xfs_inode.h b/fs/xfs/xfs_inode.h index b2d7b2cd7851..a8d6f5e251aa 100644 --- a/fs/xfs/xfs_inode.h +++ b/fs/xfs/xfs_inode.h | |||
@@ -341,17 +341,42 @@ xfs_iflags_test_and_clear(xfs_inode_t *ip, unsigned short flags) | |||
341 | /* | 341 | /* |
342 | * Fork handling. | 342 | * Fork handling. |
343 | */ | 343 | */ |
344 | #define XFS_IFORK_PTR(ip,w) \ | ||
345 | ((w) == XFS_DATA_FORK ? &(ip)->i_df : (ip)->i_afp) | ||
346 | #define XFS_IFORK_Q(ip) XFS_CFORK_Q(&(ip)->i_d) | ||
347 | #define XFS_IFORK_DSIZE(ip) XFS_CFORK_DSIZE(&ip->i_d, ip->i_mount) | ||
348 | #define XFS_IFORK_ASIZE(ip) XFS_CFORK_ASIZE(&ip->i_d, ip->i_mount) | ||
349 | #define XFS_IFORK_SIZE(ip,w) XFS_CFORK_SIZE(&ip->i_d, ip->i_mount, w) | ||
350 | #define XFS_IFORK_FORMAT(ip,w) XFS_CFORK_FORMAT(&ip->i_d, w) | ||
351 | #define XFS_IFORK_FMT_SET(ip,w,n) XFS_CFORK_FMT_SET(&ip->i_d, w, n) | ||
352 | #define XFS_IFORK_NEXTENTS(ip,w) XFS_CFORK_NEXTENTS(&ip->i_d, w) | ||
353 | #define XFS_IFORK_NEXT_SET(ip,w,n) XFS_CFORK_NEXT_SET(&ip->i_d, w, n) | ||
354 | 344 | ||
345 | #define XFS_IFORK_Q(ip) ((ip)->i_d.di_forkoff != 0) | ||
346 | #define XFS_IFORK_BOFF(ip) ((int)((ip)->i_d.di_forkoff << 3)) | ||
347 | |||
348 | #define XFS_IFORK_PTR(ip,w) \ | ||
349 | ((w) == XFS_DATA_FORK ? \ | ||
350 | &(ip)->i_df : \ | ||
351 | (ip)->i_afp) | ||
352 | #define XFS_IFORK_DSIZE(ip) \ | ||
353 | (XFS_IFORK_Q(ip) ? \ | ||
354 | XFS_IFORK_BOFF(ip) : \ | ||
355 | XFS_LITINO((ip)->i_mount)) | ||
356 | #define XFS_IFORK_ASIZE(ip) \ | ||
357 | (XFS_IFORK_Q(ip) ? \ | ||
358 | XFS_LITINO((ip)->i_mount) - XFS_IFORK_BOFF(ip) : \ | ||
359 | 0) | ||
360 | #define XFS_IFORK_SIZE(ip,w) \ | ||
361 | ((w) == XFS_DATA_FORK ? \ | ||
362 | XFS_IFORK_DSIZE(ip) : \ | ||
363 | XFS_IFORK_ASIZE(ip)) | ||
364 | #define XFS_IFORK_FORMAT(ip,w) \ | ||
365 | ((w) == XFS_DATA_FORK ? \ | ||
366 | (ip)->i_d.di_format : \ | ||
367 | (ip)->i_d.di_aformat) | ||
368 | #define XFS_IFORK_FMT_SET(ip,w,n) \ | ||
369 | ((w) == XFS_DATA_FORK ? \ | ||
370 | ((ip)->i_d.di_format = (n)) : \ | ||
371 | ((ip)->i_d.di_aformat = (n))) | ||
372 | #define XFS_IFORK_NEXTENTS(ip,w) \ | ||
373 | ((w) == XFS_DATA_FORK ? \ | ||
374 | (ip)->i_d.di_nextents : \ | ||
375 | (ip)->i_d.di_anextents) | ||
376 | #define XFS_IFORK_NEXT_SET(ip,w,n) \ | ||
377 | ((w) == XFS_DATA_FORK ? \ | ||
378 | ((ip)->i_d.di_nextents = (n)) : \ | ||
379 | ((ip)->i_d.di_anextents = (n))) | ||
355 | 380 | ||
356 | #ifdef __KERNEL__ | 381 | #ifdef __KERNEL__ |
357 | 382 | ||
@@ -503,7 +528,7 @@ void xfs_dinode_to_disk(struct xfs_dinode_core *, | |||
503 | struct xfs_icdinode *); | 528 | struct xfs_icdinode *); |
504 | 529 | ||
505 | uint xfs_ip2xflags(struct xfs_inode *); | 530 | uint xfs_ip2xflags(struct xfs_inode *); |
506 | uint xfs_dic2xflags(struct xfs_dinode_core *); | 531 | uint xfs_dic2xflags(struct xfs_dinode *); |
507 | int xfs_ifree(struct xfs_trans *, xfs_inode_t *, | 532 | int xfs_ifree(struct xfs_trans *, xfs_inode_t *, |
508 | struct xfs_bmap_free *); | 533 | struct xfs_bmap_free *); |
509 | int xfs_itruncate_start(xfs_inode_t *, uint, xfs_fsize_t); | 534 | int xfs_itruncate_start(xfs_inode_t *, uint, xfs_fsize_t); |