Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1 | /* |
Nathan Scott | 7b71876 | 2005-11-02 14:58:39 +1100 | [diff] [blame] | 2 | * Copyright (c) 2000-2005 Silicon Graphics, Inc. |
| 3 | * All Rights Reserved. |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 4 | * |
Nathan Scott | 7b71876 | 2005-11-02 14:58:39 +1100 | [diff] [blame] | 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 |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 7 | * published by the Free Software Foundation. |
| 8 | * |
Nathan Scott | 7b71876 | 2005-11-02 14:58:39 +1100 | [diff] [blame] | 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. |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 13 | * |
Nathan Scott | 7b71876 | 2005-11-02 14:58:39 +1100 | [diff] [blame] | 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 |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 17 | */ |
| 18 | #ifndef __XFS_TYPES_H__ |
| 19 | #define __XFS_TYPES_H__ |
| 20 | |
Dave Chinner | d386b32 | 2013-08-12 20:49:31 +1000 | [diff] [blame] | 21 | typedef __uint32_t prid_t; /* project ID */ |
| 22 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 23 | typedef __uint32_t xfs_agblock_t; /* blockno in alloc. group */ |
Dave Chinner | 60a3460 | 2012-04-23 15:58:58 +1000 | [diff] [blame] | 24 | typedef __uint32_t xfs_agino_t; /* inode # within allocation grp */ |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 25 | typedef __uint32_t xfs_extlen_t; /* extent length in blocks */ |
| 26 | typedef __uint32_t xfs_agnumber_t; /* allocation group number */ |
| 27 | typedef __int32_t xfs_extnum_t; /* # of extents in a file */ |
| 28 | typedef __int16_t xfs_aextnum_t; /* # extents in an attribute fork */ |
| 29 | typedef __int64_t xfs_fsize_t; /* bytes in a file */ |
| 30 | typedef __uint64_t xfs_ufsize_t; /* unsigned bytes in a file */ |
| 31 | |
| 32 | typedef __int32_t xfs_suminfo_t; /* type of bitmap summary info */ |
| 33 | typedef __int32_t xfs_rtword_t; /* word type for bitmap manipulations */ |
| 34 | |
| 35 | typedef __int64_t xfs_lsn_t; /* log sequence number */ |
| 36 | typedef __int32_t xfs_tid_t; /* transaction identifier */ |
| 37 | |
| 38 | typedef __uint32_t xfs_dablk_t; /* dir/attr block number (in file) */ |
| 39 | typedef __uint32_t xfs_dahash_t; /* dir/attr hash value */ |
| 40 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 41 | typedef __uint64_t xfs_fsblock_t; /* blockno in filesystem (agno|agbno) */ |
| 42 | typedef __uint64_t xfs_rfsblock_t; /* blockno in filesystem (raw) */ |
| 43 | typedef __uint64_t xfs_rtblock_t; /* extent (block) in realtime area */ |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 44 | typedef __uint64_t xfs_fileoff_t; /* block number in a file */ |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 45 | typedef __uint64_t xfs_filblks_t; /* number of blocks in a file */ |
| 46 | |
Christoph Hellwig | d5cf09b | 2014-07-30 09:12:05 +1000 | [diff] [blame] | 47 | typedef __int64_t xfs_srtblock_t; /* signed version of xfs_rtblock_t */ |
| 48 | typedef __int64_t xfs_sfiloff_t; /* signed block number in a file */ |
Dave Chinner | 60a3460 | 2012-04-23 15:58:58 +1000 | [diff] [blame] | 49 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 50 | /* |
| 51 | * Null values for the types. |
| 52 | */ |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 53 | #define NULLFSBLOCK ((xfs_fsblock_t)-1) |
| 54 | #define NULLRFSBLOCK ((xfs_rfsblock_t)-1) |
| 55 | #define NULLRTBLOCK ((xfs_rtblock_t)-1) |
| 56 | #define NULLFILEOFF ((xfs_fileoff_t)-1) |
| 57 | |
| 58 | #define NULLAGBLOCK ((xfs_agblock_t)-1) |
| 59 | #define NULLAGNUMBER ((xfs_agnumber_t)-1) |
| 60 | #define NULLEXTNUM ((xfs_extnum_t)-1) |
| 61 | |
| 62 | #define NULLCOMMITLSN ((xfs_lsn_t)-1) |
| 63 | |
Dave Chinner | 60a3460 | 2012-04-23 15:58:58 +1000 | [diff] [blame] | 64 | #define NULLFSINO ((xfs_ino_t)-1) |
| 65 | #define NULLAGINO ((xfs_agino_t)-1) |
| 66 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 67 | /* |
| 68 | * Max values for extlen, extnum, aextnum. |
| 69 | */ |
| 70 | #define MAXEXTLEN ((xfs_extlen_t)0x001fffff) /* 21 bits */ |
| 71 | #define MAXEXTNUM ((xfs_extnum_t)0x7fffffff) /* signed int */ |
| 72 | #define MAXAEXTNUM ((xfs_aextnum_t)0x7fff) /* signed short */ |
| 73 | |
| 74 | /* |
Dave Chinner | 77c1a08 | 2012-06-22 18:50:07 +1000 | [diff] [blame] | 75 | * Minimum and maximum blocksize and sectorsize. |
| 76 | * The blocksize upper limit is pretty much arbitrary. |
| 77 | * The sectorsize upper limit is due to sizeof(sb_sectsize). |
Darrick J. Wong | 63fa793 | 2017-01-09 16:38:37 +0100 | [diff] [blame] | 78 | * CRC enable filesystems use 512 byte inodes, meaning 512 byte block sizes |
| 79 | * cannot be used. |
Dave Chinner | 77c1a08 | 2012-06-22 18:50:07 +1000 | [diff] [blame] | 80 | */ |
| 81 | #define XFS_MIN_BLOCKSIZE_LOG 9 /* i.e. 512 bytes */ |
| 82 | #define XFS_MAX_BLOCKSIZE_LOG 16 /* i.e. 65536 bytes */ |
| 83 | #define XFS_MIN_BLOCKSIZE (1 << XFS_MIN_BLOCKSIZE_LOG) |
| 84 | #define XFS_MAX_BLOCKSIZE (1 << XFS_MAX_BLOCKSIZE_LOG) |
Darrick J. Wong | 63fa793 | 2017-01-09 16:38:37 +0100 | [diff] [blame] | 85 | #define XFS_MIN_CRC_BLOCKSIZE (1 << (XFS_MIN_BLOCKSIZE_LOG + 1)) |
Dave Chinner | 77c1a08 | 2012-06-22 18:50:07 +1000 | [diff] [blame] | 86 | #define XFS_MIN_SECTORSIZE_LOG 9 /* i.e. 512 bytes */ |
| 87 | #define XFS_MAX_SECTORSIZE_LOG 15 /* i.e. 32768 bytes */ |
| 88 | #define XFS_MIN_SECTORSIZE (1 << XFS_MIN_SECTORSIZE_LOG) |
| 89 | #define XFS_MAX_SECTORSIZE (1 << XFS_MAX_SECTORSIZE_LOG) |
| 90 | |
| 91 | /* |
Dave Chinner | 6943283 | 2013-08-12 20:49:23 +1000 | [diff] [blame] | 92 | * Inode fork identifiers. |
| 93 | */ |
| 94 | #define XFS_DATA_FORK 0 |
| 95 | #define XFS_ATTR_FORK 1 |
Darrick J. Wong | 3993bae | 2016-10-03 09:11:32 -0700 | [diff] [blame] | 96 | #define XFS_COW_FORK 2 |
Dave Chinner | 6943283 | 2013-08-12 20:49:23 +1000 | [diff] [blame] | 97 | |
| 98 | /* |
Nathan Scott | d8cc890 | 2005-11-02 10:34:53 +1100 | [diff] [blame] | 99 | * Min numbers of data/attr fork btree root pointers. |
| 100 | */ |
| 101 | #define MINDBTPTRS 3 |
| 102 | #define MINABTPTRS 2 |
| 103 | |
| 104 | /* |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 105 | * MAXNAMELEN is the length (including the terminating null) of |
| 106 | * the longest permissible file (component) name. |
| 107 | */ |
| 108 | #define MAXNAMELEN 256 |
| 109 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 110 | typedef enum { |
| 111 | XFS_LOOKUP_EQi, XFS_LOOKUP_LEi, XFS_LOOKUP_GEi |
| 112 | } xfs_lookup_t; |
| 113 | |
| 114 | typedef enum { |
Darrick J. Wong | b870494 | 2016-08-03 11:30:32 +1000 | [diff] [blame] | 115 | XFS_BTNUM_BNOi, XFS_BTNUM_CNTi, XFS_BTNUM_RMAPi, XFS_BTNUM_BMAPi, |
Darrick J. Wong | 46eeb52 | 2016-10-03 09:11:16 -0700 | [diff] [blame] | 116 | XFS_BTNUM_INOi, XFS_BTNUM_FINOi, XFS_BTNUM_REFCi, XFS_BTNUM_MAX |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 117 | } xfs_btnum_t; |
| 118 | |
Barry Naujok | 556b8b1 | 2008-04-10 12:22:07 +1000 | [diff] [blame] | 119 | struct xfs_name { |
Dave Chinner | e2bcd93 | 2010-01-20 10:44:58 +1100 | [diff] [blame] | 120 | const unsigned char *name; |
| 121 | int len; |
Dave Chinner | 0cb9776 | 2013-08-12 20:50:09 +1000 | [diff] [blame] | 122 | int type; |
Barry Naujok | 556b8b1 | 2008-04-10 12:22:07 +1000 | [diff] [blame] | 123 | }; |
| 124 | |
Dave Chinner | 6ca1c90 | 2013-08-12 20:49:26 +1000 | [diff] [blame] | 125 | /* |
| 126 | * uid_t and gid_t are hard-coded to 32 bits in the inode. |
| 127 | * Hence, an 'id' in a dquot is 32 bits.. |
| 128 | */ |
| 129 | typedef __uint32_t xfs_dqid_t; |
| 130 | |
Dave Chinner | c729820 | 2013-08-12 20:49:29 +1000 | [diff] [blame] | 131 | /* |
| 132 | * Constants for bit manipulations. |
| 133 | */ |
| 134 | #define XFS_NBBYLOG 3 /* log2(NBBY) */ |
| 135 | #define XFS_WORDLOG 2 /* log2(sizeof(xfs_rtword_t)) */ |
| 136 | #define XFS_NBWORDLOG (XFS_NBBYLOG + XFS_WORDLOG) |
| 137 | #define XFS_NBWORD (1 << XFS_NBWORDLOG) |
| 138 | #define XFS_WORDMASK ((1 << XFS_WORDLOG) - 1) |
| 139 | |
| 140 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 141 | #endif /* __XFS_TYPES_H__ */ |