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 | |
| 21 | #ifdef __KERNEL__ |
| 22 | |
| 23 | /* |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 24 | * Additional type declarations for XFS |
| 25 | */ |
| 26 | typedef signed char __int8_t; |
| 27 | typedef unsigned char __uint8_t; |
| 28 | typedef signed short int __int16_t; |
| 29 | typedef unsigned short int __uint16_t; |
| 30 | typedef signed int __int32_t; |
| 31 | typedef unsigned int __uint32_t; |
| 32 | typedef signed long long int __int64_t; |
| 33 | typedef unsigned long long int __uint64_t; |
| 34 | |
| 35 | typedef enum { B_FALSE,B_TRUE } boolean_t; |
Nathan Scott | b74e215 | 2005-06-21 13:21:49 +1000 | [diff] [blame] | 36 | typedef __uint32_t prid_t; /* project ID */ |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 37 | typedef __uint32_t inst_t; /* an instruction */ |
| 38 | |
| 39 | typedef __s64 xfs_off_t; /* <file offset> type */ |
Christoph Hellwig | 058652a | 2009-01-08 13:42:25 -0500 | [diff] [blame] | 40 | typedef unsigned long long xfs_ino_t; /* <inode> type */ |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 41 | typedef __s64 xfs_daddr_t; /* <disk address> type */ |
| 42 | typedef char * xfs_caddr_t; /* <core address> type */ |
| 43 | typedef __u32 xfs_dev_t; |
Nathan Scott | 31b084a | 2005-05-05 13:25:00 -0700 | [diff] [blame] | 44 | typedef __u32 xfs_nlink_t; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 45 | |
| 46 | /* __psint_t is the same size as a pointer */ |
| 47 | #if (BITS_PER_LONG == 32) |
| 48 | typedef __int32_t __psint_t; |
| 49 | typedef __uint32_t __psunsigned_t; |
| 50 | #elif (BITS_PER_LONG == 64) |
| 51 | typedef __int64_t __psint_t; |
| 52 | typedef __uint64_t __psunsigned_t; |
| 53 | #else |
| 54 | #error BITS_PER_LONG must be 32 or 64 |
| 55 | #endif |
| 56 | |
| 57 | #endif /* __KERNEL__ */ |
| 58 | |
| 59 | typedef __uint32_t xfs_agblock_t; /* blockno in alloc. group */ |
| 60 | typedef __uint32_t xfs_extlen_t; /* extent length in blocks */ |
| 61 | typedef __uint32_t xfs_agnumber_t; /* allocation group number */ |
| 62 | typedef __int32_t xfs_extnum_t; /* # of extents in a file */ |
| 63 | typedef __int16_t xfs_aextnum_t; /* # extents in an attribute fork */ |
| 64 | typedef __int64_t xfs_fsize_t; /* bytes in a file */ |
| 65 | typedef __uint64_t xfs_ufsize_t; /* unsigned bytes in a file */ |
| 66 | |
| 67 | typedef __int32_t xfs_suminfo_t; /* type of bitmap summary info */ |
| 68 | typedef __int32_t xfs_rtword_t; /* word type for bitmap manipulations */ |
| 69 | |
| 70 | typedef __int64_t xfs_lsn_t; /* log sequence number */ |
| 71 | typedef __int32_t xfs_tid_t; /* transaction identifier */ |
| 72 | |
| 73 | typedef __uint32_t xfs_dablk_t; /* dir/attr block number (in file) */ |
| 74 | typedef __uint32_t xfs_dahash_t; /* dir/attr hash value */ |
| 75 | |
| 76 | typedef __uint16_t xfs_prid_t; /* prid_t truncated to 16bits in XFS */ |
| 77 | |
| 78 | /* |
| 79 | * These types are 64 bits on disk but are either 32 or 64 bits in memory. |
| 80 | * Disk based types: |
| 81 | */ |
| 82 | typedef __uint64_t xfs_dfsbno_t; /* blockno in filesystem (agno|agbno) */ |
| 83 | typedef __uint64_t xfs_drfsbno_t; /* blockno in filesystem (raw) */ |
| 84 | typedef __uint64_t xfs_drtbno_t; /* extent (block) in realtime area */ |
| 85 | typedef __uint64_t xfs_dfiloff_t; /* block number in a file */ |
| 86 | typedef __uint64_t xfs_dfilblks_t; /* number of blocks in a file */ |
| 87 | |
| 88 | /* |
| 89 | * Memory based types are conditional. |
| 90 | */ |
| 91 | #if XFS_BIG_BLKNOS |
| 92 | typedef __uint64_t xfs_fsblock_t; /* blockno in filesystem (agno|agbno) */ |
| 93 | typedef __uint64_t xfs_rfsblock_t; /* blockno in filesystem (raw) */ |
| 94 | typedef __uint64_t xfs_rtblock_t; /* extent (block) in realtime area */ |
| 95 | typedef __int64_t xfs_srtblock_t; /* signed version of xfs_rtblock_t */ |
| 96 | #else |
| 97 | typedef __uint32_t xfs_fsblock_t; /* blockno in filesystem (agno|agbno) */ |
| 98 | typedef __uint32_t xfs_rfsblock_t; /* blockno in filesystem (raw) */ |
| 99 | typedef __uint32_t xfs_rtblock_t; /* extent (block) in realtime area */ |
| 100 | typedef __int32_t xfs_srtblock_t; /* signed version of xfs_rtblock_t */ |
| 101 | #endif |
| 102 | typedef __uint64_t xfs_fileoff_t; /* block number in a file */ |
| 103 | typedef __int64_t xfs_sfiloff_t; /* signed block number in a file */ |
| 104 | typedef __uint64_t xfs_filblks_t; /* number of blocks in a file */ |
| 105 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 106 | /* |
| 107 | * Null values for the types. |
| 108 | */ |
| 109 | #define NULLDFSBNO ((xfs_dfsbno_t)-1) |
| 110 | #define NULLDRFSBNO ((xfs_drfsbno_t)-1) |
| 111 | #define NULLDRTBNO ((xfs_drtbno_t)-1) |
| 112 | #define NULLDFILOFF ((xfs_dfiloff_t)-1) |
| 113 | |
| 114 | #define NULLFSBLOCK ((xfs_fsblock_t)-1) |
| 115 | #define NULLRFSBLOCK ((xfs_rfsblock_t)-1) |
| 116 | #define NULLRTBLOCK ((xfs_rtblock_t)-1) |
| 117 | #define NULLFILEOFF ((xfs_fileoff_t)-1) |
| 118 | |
| 119 | #define NULLAGBLOCK ((xfs_agblock_t)-1) |
| 120 | #define NULLAGNUMBER ((xfs_agnumber_t)-1) |
| 121 | #define NULLEXTNUM ((xfs_extnum_t)-1) |
| 122 | |
| 123 | #define NULLCOMMITLSN ((xfs_lsn_t)-1) |
| 124 | |
| 125 | /* |
| 126 | * Max values for extlen, extnum, aextnum. |
| 127 | */ |
| 128 | #define MAXEXTLEN ((xfs_extlen_t)0x001fffff) /* 21 bits */ |
| 129 | #define MAXEXTNUM ((xfs_extnum_t)0x7fffffff) /* signed int */ |
| 130 | #define MAXAEXTNUM ((xfs_aextnum_t)0x7fff) /* signed short */ |
| 131 | |
| 132 | /* |
Nathan Scott | d8cc890 | 2005-11-02 10:34:53 +1100 | [diff] [blame] | 133 | * Min numbers of data/attr fork btree root pointers. |
| 134 | */ |
| 135 | #define MINDBTPTRS 3 |
| 136 | #define MINABTPTRS 2 |
| 137 | |
| 138 | /* |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 139 | * MAXNAMELEN is the length (including the terminating null) of |
| 140 | * the longest permissible file (component) name. |
| 141 | */ |
| 142 | #define MAXNAMELEN 256 |
| 143 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 144 | typedef enum { |
| 145 | XFS_LOOKUP_EQi, XFS_LOOKUP_LEi, XFS_LOOKUP_GEi |
| 146 | } xfs_lookup_t; |
| 147 | |
| 148 | typedef enum { |
| 149 | XFS_BTNUM_BNOi, XFS_BTNUM_CNTi, XFS_BTNUM_BMAPi, XFS_BTNUM_INOi, |
| 150 | XFS_BTNUM_MAX |
| 151 | } xfs_btnum_t; |
| 152 | |
Barry Naujok | 556b8b1 | 2008-04-10 12:22:07 +1000 | [diff] [blame] | 153 | struct xfs_name { |
Dave Chinner | e2bcd93 | 2010-01-20 10:44:58 +1100 | [diff] [blame] | 154 | const unsigned char *name; |
| 155 | int len; |
Barry Naujok | 556b8b1 | 2008-04-10 12:22:07 +1000 | [diff] [blame] | 156 | }; |
| 157 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 158 | #endif /* __XFS_TYPES_H__ */ |