aboutsummaryrefslogtreecommitdiffstats
path: root/fs/xfs/xfs_dinode.h
diff options
context:
space:
mode:
authorChristoph Hellwig <hch@infradead.org>2007-08-27 23:57:51 -0400
committerTim Shimmin <tes@chook.melbourne.sgi.com>2007-10-15 02:48:30 -0400
commit347d1c01956d567c18afef0cc253eb235cafacd8 (patch)
tree55c61ae9390e013978cef21099a65965b2bb0ab5 /fs/xfs/xfs_dinode.h
parentddc6d3b32a8a732c343dc225048fae06c129e48a (diff)
[XFS] dinode endianess annotations
Biggest bit is duplicating the dinode structure so we have one annotated for native endianess and one for disk endianess. The other significant change is that xfs_xlate_dinode_core is split into one helper per direction to allow for proper annotations, everything else is trivial. As a sidenode splitting out the incore dinode means we can move it into xfs_inode.h in a later patch and severely improving on the include hell in xfs. SGI-PV: 968563 SGI-Modid: xfs-linux-melb:xfs-kern:29476a Signed-off-by: Christoph Hellwig <hch@infradead.org> Signed-off-by: David Chinner <dgc@sgi.com> Signed-off-by: Tim Shimmin <tes@sgi.com>
Diffstat (limited to 'fs/xfs/xfs_dinode.h')
-rw-r--r--fs/xfs/xfs_dinode.h65
1 files changed, 32 insertions, 33 deletions
diff --git a/fs/xfs/xfs_dinode.h b/fs/xfs/xfs_dinode.h
index fefd0116bac9..dedd713574e1 100644
--- a/fs/xfs/xfs_dinode.h
+++ b/fs/xfs/xfs_dinode.h
@@ -34,41 +34,41 @@ struct xfs_mount;
34 * because we only need the core part in the in-core inode. 34 * because we only need the core part in the in-core inode.
35 */ 35 */
36typedef struct xfs_timestamp { 36typedef struct xfs_timestamp {
37 __int32_t t_sec; /* timestamp seconds */ 37 __be32 t_sec; /* timestamp seconds */
38 __int32_t t_nsec; /* timestamp nanoseconds */ 38 __be32 t_nsec; /* timestamp nanoseconds */
39} xfs_timestamp_t; 39} xfs_timestamp_t;
40 40
41/* 41/*
42 * Note: Coordinate changes to this structure with the XFS_DI_* #defines 42 * Note: Coordinate changes to this structure with the XFS_DI_* #defines
43 * below and the offsets table in xfs_ialloc_log_di(). 43 * below, the offsets table in xfs_ialloc_log_di() and struct xfs_icdinode
44 * in xfs_inode.h.
44 */ 45 */
45typedef struct xfs_dinode_core 46typedef struct xfs_dinode_core {
46{ 47 __be16 di_magic; /* inode magic # = XFS_DINODE_MAGIC */
47 __uint16_t di_magic; /* inode magic # = XFS_DINODE_MAGIC */ 48 __be16 di_mode; /* mode and type of file */
48 __uint16_t di_mode; /* mode and type of file */ 49 __u8 di_version; /* inode version */
49 __int8_t di_version; /* inode version */ 50 __u8 di_format; /* format of di_c data */
50 __int8_t di_format; /* format of di_c data */ 51 __be16 di_onlink; /* old number of links to file */
51 __uint16_t di_onlink; /* old number of links to file */ 52 __be32 di_uid; /* owner's user id */
52 __uint32_t di_uid; /* owner's user id */ 53 __be32 di_gid; /* owner's group id */
53 __uint32_t di_gid; /* owner's group id */ 54 __be32 di_nlink; /* number of links to file */
54 __uint32_t di_nlink; /* number of links to file */ 55 __be16 di_projid; /* owner's project id */
55 __uint16_t di_projid; /* owner's project id */ 56 __u8 di_pad[8]; /* unused, zeroed space */
56 __uint8_t di_pad[8]; /* unused, zeroed space */ 57 __be16 di_flushiter; /* incremented on flush */
57 __uint16_t di_flushiter; /* incremented on flush */
58 xfs_timestamp_t di_atime; /* time last accessed */ 58 xfs_timestamp_t di_atime; /* time last accessed */
59 xfs_timestamp_t di_mtime; /* time last modified */ 59 xfs_timestamp_t di_mtime; /* time last modified */
60 xfs_timestamp_t di_ctime; /* time created/inode modified */ 60 xfs_timestamp_t di_ctime; /* time created/inode modified */
61 xfs_fsize_t di_size; /* number of bytes in file */ 61 __be64 di_size; /* number of bytes in file */
62 xfs_drfsbno_t di_nblocks; /* # of direct & btree blocks used */ 62 __be64 di_nblocks; /* # of direct & btree blocks used */
63 xfs_extlen_t di_extsize; /* basic/minimum extent size for file */ 63 __be32 di_extsize; /* basic/minimum extent size for file */
64 xfs_extnum_t di_nextents; /* number of extents in data fork */ 64 __be32 di_nextents; /* number of extents in data fork */
65 xfs_aextnum_t di_anextents; /* number of extents in attribute fork*/ 65 __be16 di_anextents; /* number of extents in attribute fork*/
66 __uint8_t di_forkoff; /* attr fork offs, <<3 for 64b align */ 66 __u8 di_forkoff; /* attr fork offs, <<3 for 64b align */
67 __int8_t di_aformat; /* format of attr fork's data */ 67 __s8 di_aformat; /* format of attr fork's data */
68 __uint32_t di_dmevmask; /* DMIG event mask */ 68 __be32 di_dmevmask; /* DMIG event mask */
69 __uint16_t di_dmstate; /* DMIG state info */ 69 __be16 di_dmstate; /* DMIG state info */
70 __uint16_t di_flags; /* random flags, XFS_DIFLAG_... */ 70 __be16 di_flags; /* random flags, XFS_DIFLAG_... */
71 __uint32_t di_gen; /* generation number */ 71 __be32 di_gen; /* generation number */
72} xfs_dinode_core_t; 72} xfs_dinode_core_t;
73 73
74#define DI_MAX_FLUSH 0xffff 74#define DI_MAX_FLUSH 0xffff
@@ -81,13 +81,13 @@ typedef struct xfs_dinode
81 * sure to update the macros like XFS_LITINO below and 81 * sure to update the macros like XFS_LITINO below and
82 * XFS_BMAP_RBLOCK_DSIZE in xfs_bmap_btree.h. 82 * XFS_BMAP_RBLOCK_DSIZE in xfs_bmap_btree.h.
83 */ 83 */
84 xfs_agino_t di_next_unlinked;/* agi unlinked list ptr */ 84 __be32 di_next_unlinked;/* agi unlinked list ptr */
85 union { 85 union {
86 xfs_bmdr_block_t di_bmbt; /* btree root block */ 86 xfs_bmdr_block_t di_bmbt; /* btree root block */
87 xfs_bmbt_rec_32_t di_bmx[1]; /* extent list */ 87 xfs_bmbt_rec_32_t di_bmx[1]; /* extent list */
88 xfs_dir2_sf_t di_dir2sf; /* shortform directory v2 */ 88 xfs_dir2_sf_t di_dir2sf; /* shortform directory v2 */
89 char di_c[1]; /* local contents */ 89 char di_c[1]; /* local contents */
90 xfs_dev_t di_dev; /* device for S_IFCHR/S_IFBLK */ 90 __be32 di_dev; /* device for S_IFCHR/S_IFBLK */
91 uuid_t di_muuid; /* mount point value */ 91 uuid_t di_muuid; /* mount point value */
92 char di_symlink[1]; /* local symbolic link */ 92 char di_symlink[1]; /* local symbolic link */
93 } di_u; 93 } di_u;
@@ -175,8 +175,7 @@ typedef enum xfs_dinode_fmt
175#define XFS_CFORK_Q_DISK(dcp) ((dcp)->di_forkoff != 0) 175#define XFS_CFORK_Q_DISK(dcp) ((dcp)->di_forkoff != 0)
176 176
177#define XFS_CFORK_BOFF(dcp) ((int)((dcp)->di_forkoff << 3)) 177#define XFS_CFORK_BOFF(dcp) ((int)((dcp)->di_forkoff << 3))
178#define XFS_CFORK_BOFF_DISK(dcp) \ 178#define XFS_CFORK_BOFF_DISK(dcp) ((int)((dcp)->di_forkoff << 3))
179 ((int)(INT_GET((dcp)->di_forkoff, ARCH_CONVERT) << 3))
180 179
181#define XFS_CFORK_DSIZE_DISK(dcp,mp) \ 180#define XFS_CFORK_DSIZE_DISK(dcp,mp) \
182 (XFS_CFORK_Q_DISK(dcp) ? XFS_CFORK_BOFF_DISK(dcp) : XFS_LITINO(mp)) 181 (XFS_CFORK_Q_DISK(dcp) ? XFS_CFORK_BOFF_DISK(dcp) : XFS_LITINO(mp))
@@ -225,8 +224,8 @@ typedef enum xfs_dinode_fmt
225 224
226#define XFS_CFORK_NEXTENTS_DISK(dcp,w) \ 225#define XFS_CFORK_NEXTENTS_DISK(dcp,w) \
227 ((w) == XFS_DATA_FORK ? \ 226 ((w) == XFS_DATA_FORK ? \
228 INT_GET((dcp)->di_nextents, ARCH_CONVERT) : \ 227 be32_to_cpu((dcp)->di_nextents) : \
229 INT_GET((dcp)->di_anextents, ARCH_CONVERT)) 228 be16_to_cpu((dcp)->di_anextents))
230#define XFS_CFORK_NEXTENTS(dcp,w) \ 229#define XFS_CFORK_NEXTENTS(dcp,w) \
231 ((w) == XFS_DATA_FORK ? (dcp)->di_nextents : (dcp)->di_anextents) 230 ((w) == XFS_DATA_FORK ? (dcp)->di_nextents : (dcp)->di_anextents)
232#define XFS_DFORK_NEXTENTS(dip,w) XFS_CFORK_NEXTENTS_DISK(&(dip)->di_core, w) 231#define XFS_DFORK_NEXTENTS(dip,w) XFS_CFORK_NEXTENTS_DISK(&(dip)->di_core, w)