xfs_types.h 4.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137
  1. /*
  2. * Copyright (c) 2000-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_TYPES_H__
  19. #define __XFS_TYPES_H__
  20. typedef __uint32_t prid_t; /* project ID */
  21. typedef __uint32_t xfs_agblock_t; /* blockno in alloc. group */
  22. typedef __uint32_t xfs_agino_t; /* inode # within allocation grp */
  23. typedef __uint32_t xfs_extlen_t; /* extent length in blocks */
  24. typedef __uint32_t xfs_agnumber_t; /* allocation group number */
  25. typedef __int32_t xfs_extnum_t; /* # of extents in a file */
  26. typedef __int16_t xfs_aextnum_t; /* # extents in an attribute fork */
  27. typedef __int64_t xfs_fsize_t; /* bytes in a file */
  28. typedef __uint64_t xfs_ufsize_t; /* unsigned bytes in a file */
  29. typedef __int32_t xfs_suminfo_t; /* type of bitmap summary info */
  30. typedef __int32_t xfs_rtword_t; /* word type for bitmap manipulations */
  31. typedef __int64_t xfs_lsn_t; /* log sequence number */
  32. typedef __int32_t xfs_tid_t; /* transaction identifier */
  33. typedef __uint32_t xfs_dablk_t; /* dir/attr block number (in file) */
  34. typedef __uint32_t xfs_dahash_t; /* dir/attr hash value */
  35. typedef __uint64_t xfs_fsblock_t; /* blockno in filesystem (agno|agbno) */
  36. typedef __uint64_t xfs_rfsblock_t; /* blockno in filesystem (raw) */
  37. typedef __uint64_t xfs_rtblock_t; /* extent (block) in realtime area */
  38. typedef __uint64_t xfs_fileoff_t; /* block number in a file */
  39. typedef __uint64_t xfs_filblks_t; /* number of blocks in a file */
  40. typedef __int64_t xfs_srtblock_t; /* signed version of xfs_rtblock_t */
  41. typedef __int64_t xfs_sfiloff_t; /* signed block number in a file */
  42. /*
  43. * Null values for the types.
  44. */
  45. #define NULLFSBLOCK ((xfs_fsblock_t)-1)
  46. #define NULLRFSBLOCK ((xfs_rfsblock_t)-1)
  47. #define NULLRTBLOCK ((xfs_rtblock_t)-1)
  48. #define NULLFILEOFF ((xfs_fileoff_t)-1)
  49. #define NULLAGBLOCK ((xfs_agblock_t)-1)
  50. #define NULLAGNUMBER ((xfs_agnumber_t)-1)
  51. #define NULLEXTNUM ((xfs_extnum_t)-1)
  52. #define NULLCOMMITLSN ((xfs_lsn_t)-1)
  53. #define NULLFSINO ((xfs_ino_t)-1)
  54. #define NULLAGINO ((xfs_agino_t)-1)
  55. /*
  56. * Max values for extlen, extnum, aextnum.
  57. */
  58. #define MAXEXTLEN ((xfs_extlen_t)0x001fffff) /* 21 bits */
  59. #define MAXEXTNUM ((xfs_extnum_t)0x7fffffff) /* signed int */
  60. #define MAXAEXTNUM ((xfs_aextnum_t)0x7fff) /* signed short */
  61. /*
  62. * Minimum and maximum blocksize and sectorsize.
  63. * The blocksize upper limit is pretty much arbitrary.
  64. * The sectorsize upper limit is due to sizeof(sb_sectsize).
  65. */
  66. #define XFS_MIN_BLOCKSIZE_LOG 9 /* i.e. 512 bytes */
  67. #define XFS_MAX_BLOCKSIZE_LOG 16 /* i.e. 65536 bytes */
  68. #define XFS_MIN_BLOCKSIZE (1 << XFS_MIN_BLOCKSIZE_LOG)
  69. #define XFS_MAX_BLOCKSIZE (1 << XFS_MAX_BLOCKSIZE_LOG)
  70. #define XFS_MIN_SECTORSIZE_LOG 9 /* i.e. 512 bytes */
  71. #define XFS_MAX_SECTORSIZE_LOG 15 /* i.e. 32768 bytes */
  72. #define XFS_MIN_SECTORSIZE (1 << XFS_MIN_SECTORSIZE_LOG)
  73. #define XFS_MAX_SECTORSIZE (1 << XFS_MAX_SECTORSIZE_LOG)
  74. /*
  75. * Inode fork identifiers.
  76. */
  77. #define XFS_DATA_FORK 0
  78. #define XFS_ATTR_FORK 1
  79. /*
  80. * Min numbers of data/attr fork btree root pointers.
  81. */
  82. #define MINDBTPTRS 3
  83. #define MINABTPTRS 2
  84. /*
  85. * MAXNAMELEN is the length (including the terminating null) of
  86. * the longest permissible file (component) name.
  87. */
  88. #define MAXNAMELEN 256
  89. typedef enum {
  90. XFS_LOOKUP_EQi, XFS_LOOKUP_LEi, XFS_LOOKUP_GEi
  91. } xfs_lookup_t;
  92. typedef enum {
  93. XFS_BTNUM_BNOi, XFS_BTNUM_CNTi, XFS_BTNUM_BMAPi, XFS_BTNUM_INOi,
  94. XFS_BTNUM_FINOi, XFS_BTNUM_MAX
  95. } xfs_btnum_t;
  96. struct xfs_name {
  97. const unsigned char *name;
  98. int len;
  99. int type;
  100. };
  101. /*
  102. * uid_t and gid_t are hard-coded to 32 bits in the inode.
  103. * Hence, an 'id' in a dquot is 32 bits..
  104. */
  105. typedef __uint32_t xfs_dqid_t;
  106. /*
  107. * Constants for bit manipulations.
  108. */
  109. #define XFS_NBBYLOG 3 /* log2(NBBY) */
  110. #define XFS_WORDLOG 2 /* log2(sizeof(xfs_rtword_t)) */
  111. #define XFS_NBWORDLOG (XFS_NBBYLOG + XFS_WORDLOG)
  112. #define XFS_NBWORD (1 << XFS_NBWORDLOG)
  113. #define XFS_WORDMASK ((1 << XFS_WORDLOG) - 1)
  114. #endif /* __XFS_TYPES_H__ */