xfs_inode_buf.h 3.1 KB

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