1 // SPDX-License-Identifier: GPL-2.0 2 /* 3 * Copyright (c) 2000-2003,2005 Silicon Graphics, Inc. 4 * All Rights Reserved. 5 */ 6 #ifndef __XFS_INODE_BUF_H__ 7 #define __XFS_INODE_BUF_H__ 8 9 struct xfs_inode; 10 struct xfs_dinode; 11 12 /* 13 * In memory representation of the XFS inode. This is held in the in-core struct 14 * xfs_inode and represents the current on disk values but the structure is not 15 * in on-disk format. That is, this structure is always translated to on-disk 16 * format specific structures at the appropriate time. 17 */ 18 struct xfs_icdinode { 19 int8_t di_format; /* format of di_c data */ 20 uint16_t di_flushiter; /* incremented on flush */ 21 uint32_t di_projid; /* owner's project id */ 22 xfs_fsize_t di_size; /* number of bytes in file */ 23 xfs_rfsblock_t di_nblocks; /* # of direct & btree blocks used */ 24 xfs_extlen_t di_extsize; /* basic/minimum extent size for file */ 25 xfs_extnum_t di_nextents; /* number of extents in data fork */ 26 xfs_aextnum_t di_anextents; /* number of extents in attribute fork*/ 27 uint8_t di_forkoff; /* attr fork offs, <<3 for 64b align */ 28 int8_t di_aformat; /* format of attr fork's data */ 29 uint32_t di_dmevmask; /* DMIG event mask */ 30 uint16_t di_dmstate; /* DMIG state info */ 31 uint16_t di_flags; /* random flags, XFS_DIFLAG_... */ 32 33 uint64_t di_flags2; /* more random flags */ 34 uint32_t di_cowextsize; /* basic cow extent size for file */ 35 36 struct timespec64 di_crtime; /* time created */ 37 }; 38 39 /* 40 * Inode location information. Stored in the inode and passed to 41 * xfs_imap_to_bp() to get a buffer and dinode for a given inode. 42 */ 43 struct xfs_imap { 44 xfs_daddr_t im_blkno; /* starting BB of inode chunk */ 45 unsigned short im_len; /* length in BBs of inode chunk */ 46 unsigned short im_boffset; /* inode offset in block in bytes */ 47 }; 48 49 int xfs_imap_to_bp(struct xfs_mount *, struct xfs_trans *, 50 struct xfs_imap *, struct xfs_dinode **, 51 struct xfs_buf **, uint, uint); 52 int xfs_iread(struct xfs_mount *, struct xfs_trans *, 53 struct xfs_inode *, uint); 54 void xfs_dinode_calc_crc(struct xfs_mount *, struct xfs_dinode *); 55 void xfs_inode_to_disk(struct xfs_inode *ip, struct xfs_dinode *to, 56 xfs_lsn_t lsn); 57 void xfs_inode_from_disk(struct xfs_inode *ip, struct xfs_dinode *from); 58 void xfs_log_dinode_to_disk(struct xfs_log_dinode *from, 59 struct xfs_dinode *to); 60 61 #if defined(DEBUG) 62 void xfs_inobp_check(struct xfs_mount *, struct xfs_buf *); 63 #else 64 #define xfs_inobp_check(mp, bp) 65 #endif /* DEBUG */ 66 67 xfs_failaddr_t xfs_dinode_verify(struct xfs_mount *mp, xfs_ino_t ino, 68 struct xfs_dinode *dip); 69 xfs_failaddr_t xfs_inode_validate_extsize(struct xfs_mount *mp, 70 uint32_t extsize, uint16_t mode, uint16_t flags); 71 xfs_failaddr_t xfs_inode_validate_cowextsize(struct xfs_mount *mp, 72 uint32_t cowextsize, uint16_t mode, uint16_t flags, 73 uint64_t flags2); 74 75 #endif /* __XFS_INODE_BUF_H__ */ 76