xfs_inode_buf.h 3.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293
  1. /*
  2. * Copyright (c) 2000-2003,2005 Silicon Graphics, Inc.
  3. * All Rights Reserved.
  4. *
  5. * This program is free software; you can redistribute it and/or
  6. * modify it under the terms of the GNU General Public License as
  7. * published by the Free Software Foundation.
  8. *
  9. * This program is distributed in the hope that it would be useful,
  10. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  11. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  12. * GNU General Public License for more details.
  13. *
  14. * You should have received a copy of the GNU General Public License
  15. * along with this program; if not, write the Free Software Foundation,
  16. * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
  17. */
  18. #ifndef __XFS_INODE_BUF_H__
  19. #define __XFS_INODE_BUF_H__
  20. struct xfs_inode;
  21. struct xfs_dinode;
  22. /*
  23. * In memory representation of the XFS inode. This is held in the in-core struct
  24. * xfs_inode and represents the current on disk values but the structure is not
  25. * in on-disk format. That is, this structure is always translated to on-disk
  26. * format specific structures at the appropriate time.
  27. */
  28. struct xfs_icdinode {
  29. int8_t di_version; /* inode version */
  30. int8_t di_format; /* format of di_c data */
  31. uint16_t di_flushiter; /* incremented on flush */
  32. uint32_t di_uid; /* owner's user id */
  33. uint32_t di_gid; /* owner's group id */
  34. uint16_t di_projid_lo; /* lower part of owner's project id */
  35. uint16_t di_projid_hi; /* higher part of owner's project id */
  36. xfs_fsize_t di_size; /* number of bytes in file */
  37. xfs_rfsblock_t di_nblocks; /* # of direct & btree blocks used */
  38. xfs_extlen_t di_extsize; /* basic/minimum extent size for file */
  39. xfs_extnum_t di_nextents; /* number of extents in data fork */
  40. xfs_aextnum_t di_anextents; /* number of extents in attribute fork*/
  41. uint8_t di_forkoff; /* attr fork offs, <<3 for 64b align */
  42. int8_t di_aformat; /* format of attr fork's data */
  43. uint32_t di_dmevmask; /* DMIG event mask */
  44. uint16_t di_dmstate; /* DMIG state info */
  45. uint16_t di_flags; /* random flags, XFS_DIFLAG_... */
  46. uint64_t di_flags2; /* more random flags */
  47. uint32_t di_cowextsize; /* basic cow extent size for file */
  48. xfs_ictimestamp_t di_crtime; /* time created */
  49. };
  50. /*
  51. * Inode location information. Stored in the inode and passed to
  52. * xfs_imap_to_bp() to get a buffer and dinode for a given inode.
  53. */
  54. struct xfs_imap {
  55. xfs_daddr_t im_blkno; /* starting BB of inode chunk */
  56. unsigned short im_len; /* length in BBs of inode chunk */
  57. unsigned short im_boffset; /* inode offset in block in bytes */
  58. };
  59. int xfs_imap_to_bp(struct xfs_mount *, struct xfs_trans *,
  60. struct xfs_imap *, struct xfs_dinode **,
  61. struct xfs_buf **, uint, uint);
  62. int xfs_iread(struct xfs_mount *, struct xfs_trans *,
  63. struct xfs_inode *, uint);
  64. void xfs_dinode_calc_crc(struct xfs_mount *, struct xfs_dinode *);
  65. void xfs_inode_to_disk(struct xfs_inode *ip, struct xfs_dinode *to,
  66. xfs_lsn_t lsn);
  67. void xfs_inode_from_disk(struct xfs_inode *ip, struct xfs_dinode *from);
  68. void xfs_log_dinode_to_disk(struct xfs_log_dinode *from,
  69. struct xfs_dinode *to);
  70. bool xfs_dinode_good_version(struct xfs_mount *mp, __u8 version);
  71. #if defined(DEBUG)
  72. void xfs_inobp_check(struct xfs_mount *, struct xfs_buf *);
  73. #else
  74. #define xfs_inobp_check(mp, bp)
  75. #endif /* DEBUG */
  76. xfs_failaddr_t xfs_dinode_verify(struct xfs_mount *mp, xfs_ino_t ino,
  77. struct xfs_dinode *dip);
  78. xfs_failaddr_t xfs_inode_validate_extsize(struct xfs_mount *mp,
  79. uint32_t extsize, uint16_t mode, uint16_t flags);
  80. xfs_failaddr_t xfs_inode_validate_cowextsize(struct xfs_mount *mp,
  81. uint32_t cowextsize, uint16_t mode, uint16_t flags,
  82. uint64_t flags2);
  83. #endif /* __XFS_INODE_BUF_H__ */