diff options
author | Christoph Hellwig <hch@infradead.org> | 2007-08-27 23:57:51 -0400 |
---|---|---|
committer | Tim Shimmin <tes@chook.melbourne.sgi.com> | 2007-10-15 02:48:30 -0400 |
commit | 347d1c01956d567c18afef0cc253eb235cafacd8 (patch) | |
tree | 55c61ae9390e013978cef21099a65965b2bb0ab5 /fs/xfs/xfs_inode.h | |
parent | ddc6d3b32a8a732c343dc225048fae06c129e48a (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_inode.h')
-rw-r--r-- | fs/xfs/xfs_inode.h | 52 |
1 files changed, 48 insertions, 4 deletions
diff --git a/fs/xfs/xfs_inode.h b/fs/xfs/xfs_inode.h index 6fae71b42922..873b9f783d29 100644 --- a/fs/xfs/xfs_inode.h +++ b/fs/xfs/xfs_inode.h | |||
@@ -18,6 +18,10 @@ | |||
18 | #ifndef __XFS_INODE_H__ | 18 | #ifndef __XFS_INODE_H__ |
19 | #define __XFS_INODE_H__ | 19 | #define __XFS_INODE_H__ |
20 | 20 | ||
21 | struct xfs_dinode; | ||
22 | struct xfs_dinode_core; | ||
23 | |||
24 | |||
21 | /* | 25 | /* |
22 | * Fork identifiers. | 26 | * Fork identifiers. |
23 | */ | 27 | */ |
@@ -227,6 +231,43 @@ typedef struct xfs_chash { | |||
227 | * chain off the mount structure by xfs_sync calls. | 231 | * chain off the mount structure by xfs_sync calls. |
228 | */ | 232 | */ |
229 | 233 | ||
234 | typedef struct xfs_ictimestamp { | ||
235 | __int32_t t_sec; /* timestamp seconds */ | ||
236 | __int32_t t_nsec; /* timestamp nanoseconds */ | ||
237 | } xfs_ictimestamp_t; | ||
238 | |||
239 | /* | ||
240 | * NOTE: This structure must be kept identical to struct xfs_dinode_core | ||
241 | * in xfs_dinode.h except for the endianess annotations. | ||
242 | */ | ||
243 | typedef struct xfs_icdinode { | ||
244 | __uint16_t di_magic; /* inode magic # = XFS_DINODE_MAGIC */ | ||
245 | __uint16_t di_mode; /* mode and type of file */ | ||
246 | __int8_t di_version; /* inode version */ | ||
247 | __int8_t di_format; /* format of di_c data */ | ||
248 | __uint16_t di_onlink; /* old number of links to file */ | ||
249 | __uint32_t di_uid; /* owner's user id */ | ||
250 | __uint32_t di_gid; /* owner's group id */ | ||
251 | __uint32_t di_nlink; /* number of links to file */ | ||
252 | __uint16_t di_projid; /* owner's project id */ | ||
253 | __uint8_t di_pad[8]; /* unused, zeroed space */ | ||
254 | __uint16_t di_flushiter; /* incremented on flush */ | ||
255 | xfs_ictimestamp_t di_atime; /* time last accessed */ | ||
256 | xfs_ictimestamp_t di_mtime; /* time last modified */ | ||
257 | xfs_ictimestamp_t di_ctime; /* time created/inode modified */ | ||
258 | xfs_fsize_t di_size; /* number of bytes in file */ | ||
259 | xfs_drfsbno_t di_nblocks; /* # of direct & btree blocks used */ | ||
260 | xfs_extlen_t di_extsize; /* basic/minimum extent size for file */ | ||
261 | xfs_extnum_t di_nextents; /* number of extents in data fork */ | ||
262 | xfs_aextnum_t di_anextents; /* number of extents in attribute fork*/ | ||
263 | __uint8_t di_forkoff; /* attr fork offs, <<3 for 64b align */ | ||
264 | __int8_t di_aformat; /* format of attr fork's data */ | ||
265 | __uint32_t di_dmevmask; /* DMIG event mask */ | ||
266 | __uint16_t di_dmstate; /* DMIG state info */ | ||
267 | __uint16_t di_flags; /* random flags, XFS_DIFLAG_... */ | ||
268 | __uint32_t di_gen; /* generation number */ | ||
269 | } xfs_icdinode_t; | ||
270 | |||
230 | typedef struct { | 271 | typedef struct { |
231 | struct xfs_ihash *ip_hash; /* pointer to hash header */ | 272 | struct xfs_ihash *ip_hash; /* pointer to hash header */ |
232 | struct xfs_inode *ip_next; /* inode hash link forw */ | 273 | struct xfs_inode *ip_next; /* inode hash link forw */ |
@@ -282,7 +323,7 @@ typedef struct xfs_inode { | |||
282 | unsigned int i_gen; /* generation count */ | 323 | unsigned int i_gen; /* generation count */ |
283 | unsigned int i_delayed_blks; /* count of delay alloc blks */ | 324 | unsigned int i_delayed_blks; /* count of delay alloc blks */ |
284 | 325 | ||
285 | xfs_dinode_core_t i_d; /* most of ondisk inode */ | 326 | xfs_icdinode_t i_d; /* most of ondisk inode */ |
286 | xfs_chashlist_t *i_chash; /* cluster hash list header */ | 327 | xfs_chashlist_t *i_chash; /* cluster hash list header */ |
287 | struct xfs_inode *i_cnext; /* cluster hash link forward */ | 328 | struct xfs_inode *i_cnext; /* cluster hash link forward */ |
288 | struct xfs_inode *i_cprev; /* cluster hash link backward */ | 329 | struct xfs_inode *i_cprev; /* cluster hash link backward */ |
@@ -506,7 +547,7 @@ int xfs_finish_reclaim_all(struct xfs_mount *, int); | |||
506 | * xfs_inode.c prototypes. | 547 | * xfs_inode.c prototypes. |
507 | */ | 548 | */ |
508 | int xfs_itobp(struct xfs_mount *, struct xfs_trans *, | 549 | int xfs_itobp(struct xfs_mount *, struct xfs_trans *, |
509 | xfs_inode_t *, xfs_dinode_t **, struct xfs_buf **, | 550 | xfs_inode_t *, struct xfs_dinode **, struct xfs_buf **, |
510 | xfs_daddr_t, uint); | 551 | xfs_daddr_t, uint); |
511 | int xfs_iread(struct xfs_mount *, struct xfs_trans *, xfs_ino_t, | 552 | int xfs_iread(struct xfs_mount *, struct xfs_trans *, xfs_ino_t, |
512 | xfs_inode_t **, xfs_daddr_t, uint); | 553 | xfs_inode_t **, xfs_daddr_t, uint); |
@@ -514,8 +555,11 @@ int xfs_iread_extents(struct xfs_trans *, xfs_inode_t *, int); | |||
514 | int xfs_ialloc(struct xfs_trans *, xfs_inode_t *, mode_t, | 555 | int xfs_ialloc(struct xfs_trans *, xfs_inode_t *, mode_t, |
515 | xfs_nlink_t, xfs_dev_t, struct cred *, xfs_prid_t, | 556 | xfs_nlink_t, xfs_dev_t, struct cred *, xfs_prid_t, |
516 | int, struct xfs_buf **, boolean_t *, xfs_inode_t **); | 557 | int, struct xfs_buf **, boolean_t *, xfs_inode_t **); |
517 | void xfs_xlate_dinode_core(xfs_caddr_t, struct xfs_dinode_core *, | 558 | void xfs_dinode_from_disk(struct xfs_icdinode *, |
518 | int); | 559 | struct xfs_dinode_core *); |
560 | void xfs_dinode_to_disk(struct xfs_dinode_core *, | ||
561 | struct xfs_icdinode *); | ||
562 | |||
519 | uint xfs_ip2xflags(struct xfs_inode *); | 563 | uint xfs_ip2xflags(struct xfs_inode *); |
520 | uint xfs_dic2xflags(struct xfs_dinode_core *); | 564 | uint xfs_dic2xflags(struct xfs_dinode_core *); |
521 | int xfs_ifree(struct xfs_trans *, xfs_inode_t *, | 565 | int xfs_ifree(struct xfs_trans *, xfs_inode_t *, |