0001
0002
0003
0004
0005
0006 #ifndef __XFS_TYPES_H__
0007 #define __XFS_TYPES_H__
0008
0009 typedef uint32_t prid_t;
0010
0011 typedef uint32_t xfs_agblock_t;
0012 typedef uint32_t xfs_agino_t;
0013 typedef uint32_t xfs_extlen_t;
0014 typedef uint32_t xfs_agnumber_t;
0015 typedef uint64_t xfs_extnum_t;
0016 typedef uint32_t xfs_aextnum_t;
0017 typedef int64_t xfs_fsize_t;
0018 typedef uint64_t xfs_ufsize_t;
0019
0020 typedef int32_t xfs_suminfo_t;
0021 typedef uint32_t xfs_rtword_t;
0022
0023 typedef int64_t xfs_lsn_t;
0024 typedef int64_t xfs_csn_t;
0025
0026 typedef uint32_t xfs_dablk_t;
0027 typedef uint32_t xfs_dahash_t;
0028
0029 typedef uint64_t xfs_fsblock_t;
0030 typedef uint64_t xfs_rfsblock_t;
0031 typedef uint64_t xfs_rtblock_t;
0032 typedef uint64_t xfs_fileoff_t;
0033 typedef uint64_t xfs_filblks_t;
0034
0035 typedef int64_t xfs_srtblock_t;
0036
0037
0038
0039
0040
0041 typedef void * xfs_failaddr_t;
0042
0043
0044
0045
0046 #define NULLFSBLOCK ((xfs_fsblock_t)-1)
0047 #define NULLRFSBLOCK ((xfs_rfsblock_t)-1)
0048 #define NULLRTBLOCK ((xfs_rtblock_t)-1)
0049 #define NULLFILEOFF ((xfs_fileoff_t)-1)
0050
0051 #define NULLAGBLOCK ((xfs_agblock_t)-1)
0052 #define NULLAGNUMBER ((xfs_agnumber_t)-1)
0053
0054 #define NULLCOMMITLSN ((xfs_lsn_t)-1)
0055
0056 #define NULLFSINO ((xfs_ino_t)-1)
0057 #define NULLAGINO ((xfs_agino_t)-1)
0058
0059
0060
0061
0062
0063
0064
0065
0066 #define XFS_MIN_BLOCKSIZE_LOG 9
0067 #define XFS_MAX_BLOCKSIZE_LOG 16
0068 #define XFS_MIN_BLOCKSIZE (1 << XFS_MIN_BLOCKSIZE_LOG)
0069 #define XFS_MAX_BLOCKSIZE (1 << XFS_MAX_BLOCKSIZE_LOG)
0070 #define XFS_MIN_CRC_BLOCKSIZE (1 << (XFS_MIN_BLOCKSIZE_LOG + 1))
0071 #define XFS_MIN_SECTORSIZE_LOG 9
0072 #define XFS_MAX_SECTORSIZE_LOG 15
0073 #define XFS_MIN_SECTORSIZE (1 << XFS_MIN_SECTORSIZE_LOG)
0074 #define XFS_MAX_SECTORSIZE (1 << XFS_MAX_SECTORSIZE_LOG)
0075
0076
0077
0078
0079 #define XFS_DATA_FORK 0
0080 #define XFS_ATTR_FORK 1
0081 #define XFS_COW_FORK 2
0082
0083 #define XFS_WHICHFORK_STRINGS \
0084 { XFS_DATA_FORK, "data" }, \
0085 { XFS_ATTR_FORK, "attr" }, \
0086 { XFS_COW_FORK, "cow" }
0087
0088
0089
0090
0091 #define MINDBTPTRS 3
0092 #define MINABTPTRS 2
0093
0094
0095
0096
0097
0098 #define MAXNAMELEN 256
0099
0100
0101
0102
0103
0104 typedef enum {
0105 XFS_LOOKUP_EQi, XFS_LOOKUP_LEi, XFS_LOOKUP_GEi
0106 } xfs_lookup_t;
0107
0108 #define XFS_AG_BTREE_CMP_FORMAT_STR \
0109 { XFS_LOOKUP_EQi, "eq" }, \
0110 { XFS_LOOKUP_LEi, "le" }, \
0111 { XFS_LOOKUP_GEi, "ge" }
0112
0113
0114
0115
0116
0117 typedef enum {
0118 XFS_BTNUM_BNOi, XFS_BTNUM_CNTi, XFS_BTNUM_RMAPi, XFS_BTNUM_BMAPi,
0119 XFS_BTNUM_INOi, XFS_BTNUM_FINOi, XFS_BTNUM_REFCi, XFS_BTNUM_MAX
0120 } xfs_btnum_t;
0121
0122 #define XFS_BTNUM_STRINGS \
0123 { XFS_BTNUM_BNOi, "bnobt" }, \
0124 { XFS_BTNUM_CNTi, "cntbt" }, \
0125 { XFS_BTNUM_RMAPi, "rmapbt" }, \
0126 { XFS_BTNUM_BMAPi, "bmbt" }, \
0127 { XFS_BTNUM_INOi, "inobt" }, \
0128 { XFS_BTNUM_FINOi, "finobt" }, \
0129 { XFS_BTNUM_REFCi, "refcbt" }
0130
0131 struct xfs_name {
0132 const unsigned char *name;
0133 int len;
0134 int type;
0135 };
0136
0137
0138
0139
0140
0141 typedef uint32_t xfs_dqid_t;
0142
0143
0144
0145
0146 #define XFS_NBBYLOG 3
0147 #define XFS_WORDLOG 2
0148 #define XFS_NBWORDLOG (XFS_NBBYLOG + XFS_WORDLOG)
0149 #define XFS_NBWORD (1 << XFS_NBWORDLOG)
0150 #define XFS_WORDMASK ((1 << XFS_WORDLOG) - 1)
0151
0152 struct xfs_iext_cursor {
0153 struct xfs_iext_leaf *leaf;
0154 int pos;
0155 };
0156
0157 typedef enum {
0158 XFS_EXT_NORM, XFS_EXT_UNWRITTEN,
0159 } xfs_exntst_t;
0160
0161 typedef struct xfs_bmbt_irec
0162 {
0163 xfs_fileoff_t br_startoff;
0164 xfs_fsblock_t br_startblock;
0165 xfs_filblks_t br_blockcount;
0166 xfs_exntst_t br_state;
0167 } xfs_bmbt_irec_t;
0168
0169
0170 enum xfs_ag_resv_type {
0171 XFS_AG_RESV_NONE = 0,
0172 XFS_AG_RESV_AGFL,
0173 XFS_AG_RESV_METADATA,
0174 XFS_AG_RESV_RMAPBT,
0175 };
0176
0177
0178
0179
0180 struct xfs_mount;
0181
0182 bool xfs_verify_fsbno(struct xfs_mount *mp, xfs_fsblock_t fsbno);
0183 bool xfs_verify_fsbext(struct xfs_mount *mp, xfs_fsblock_t fsbno,
0184 xfs_fsblock_t len);
0185
0186 bool xfs_verify_ino(struct xfs_mount *mp, xfs_ino_t ino);
0187 bool xfs_internal_inum(struct xfs_mount *mp, xfs_ino_t ino);
0188 bool xfs_verify_dir_ino(struct xfs_mount *mp, xfs_ino_t ino);
0189 bool xfs_verify_rtbno(struct xfs_mount *mp, xfs_rtblock_t rtbno);
0190 bool xfs_verify_rtext(struct xfs_mount *mp, xfs_rtblock_t rtbno,
0191 xfs_rtblock_t len);
0192 bool xfs_verify_icount(struct xfs_mount *mp, unsigned long long icount);
0193 bool xfs_verify_dablk(struct xfs_mount *mp, xfs_fileoff_t off);
0194 void xfs_icount_range(struct xfs_mount *mp, unsigned long long *min,
0195 unsigned long long *max);
0196 bool xfs_verify_fileoff(struct xfs_mount *mp, xfs_fileoff_t off);
0197 bool xfs_verify_fileext(struct xfs_mount *mp, xfs_fileoff_t off,
0198 xfs_fileoff_t len);
0199
0200 #endif