Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1 | /* |
| 2 | * Copyright (c) 2000-2003 Silicon Graphics, Inc. All Rights Reserved. |
| 3 | * |
| 4 | * This program is free software; you can redistribute it and/or modify it |
| 5 | * under the terms of version 2 of the GNU General Public License as |
| 6 | * published by the Free Software Foundation. |
| 7 | * |
| 8 | * This program is distributed in the hope that it would be useful, but |
| 9 | * WITHOUT ANY WARRANTY; without even the implied warranty of |
| 10 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. |
| 11 | * |
| 12 | * Further, this software is distributed without any warranty that it is |
| 13 | * free of the rightful claim of any third person regarding infringement |
| 14 | * or the like. Any license provided herein, whether implied or |
| 15 | * otherwise, applies only to this software file. Patent licenses, if |
| 16 | * any, provided herein do not apply to combinations of this program with |
| 17 | * other software, or any other product whatsoever. |
| 18 | * |
| 19 | * You should have received a copy of the GNU General Public License along |
| 20 | * with this program; if not, write the Free Software Foundation, Inc., 59 |
| 21 | * Temple Place - Suite 330, Boston MA 02111-1307, USA. |
| 22 | * |
| 23 | * Contact information: Silicon Graphics, Inc., 1600 Amphitheatre Pkwy, |
| 24 | * Mountain View, CA 94043, or: |
| 25 | * |
| 26 | * http://www.sgi.com |
| 27 | * |
| 28 | * For further information regarding this notice, see: |
| 29 | * |
| 30 | * http://oss.sgi.com/projects/GenInfo/SGIGPLNoticeExplan/ |
| 31 | */ |
| 32 | #ifndef __XFS_TYPES_H__ |
| 33 | #define __XFS_TYPES_H__ |
| 34 | |
| 35 | #ifdef __KERNEL__ |
| 36 | |
| 37 | /* |
| 38 | * POSIX Extensions |
| 39 | */ |
| 40 | typedef unsigned char uchar_t; |
| 41 | typedef unsigned short ushort_t; |
| 42 | typedef unsigned int uint_t; |
| 43 | typedef unsigned long ulong_t; |
| 44 | |
| 45 | /* |
| 46 | * Additional type declarations for XFS |
| 47 | */ |
| 48 | typedef signed char __int8_t; |
| 49 | typedef unsigned char __uint8_t; |
| 50 | typedef signed short int __int16_t; |
| 51 | typedef unsigned short int __uint16_t; |
| 52 | typedef signed int __int32_t; |
| 53 | typedef unsigned int __uint32_t; |
| 54 | typedef signed long long int __int64_t; |
| 55 | typedef unsigned long long int __uint64_t; |
| 56 | |
| 57 | typedef enum { B_FALSE,B_TRUE } boolean_t; |
Nathan Scott | b74e215 | 2005-06-21 13:21:49 +1000 | [diff] [blame] | 58 | typedef __uint32_t prid_t; /* project ID */ |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 59 | typedef __uint32_t inst_t; /* an instruction */ |
| 60 | |
| 61 | typedef __s64 xfs_off_t; /* <file offset> type */ |
| 62 | typedef __u64 xfs_ino_t; /* <inode> type */ |
| 63 | typedef __s64 xfs_daddr_t; /* <disk address> type */ |
| 64 | typedef char * xfs_caddr_t; /* <core address> type */ |
| 65 | typedef __u32 xfs_dev_t; |
Nathan Scott | 31b084a | 2005-05-05 13:25:00 -0700 | [diff] [blame] | 66 | typedef __u32 xfs_nlink_t; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 67 | |
| 68 | /* __psint_t is the same size as a pointer */ |
| 69 | #if (BITS_PER_LONG == 32) |
| 70 | typedef __int32_t __psint_t; |
| 71 | typedef __uint32_t __psunsigned_t; |
| 72 | #elif (BITS_PER_LONG == 64) |
| 73 | typedef __int64_t __psint_t; |
| 74 | typedef __uint64_t __psunsigned_t; |
| 75 | #else |
| 76 | #error BITS_PER_LONG must be 32 or 64 |
| 77 | #endif |
| 78 | |
| 79 | #endif /* __KERNEL__ */ |
| 80 | |
| 81 | typedef __uint32_t xfs_agblock_t; /* blockno in alloc. group */ |
| 82 | typedef __uint32_t xfs_extlen_t; /* extent length in blocks */ |
| 83 | typedef __uint32_t xfs_agnumber_t; /* allocation group number */ |
| 84 | typedef __int32_t xfs_extnum_t; /* # of extents in a file */ |
| 85 | typedef __int16_t xfs_aextnum_t; /* # extents in an attribute fork */ |
| 86 | typedef __int64_t xfs_fsize_t; /* bytes in a file */ |
| 87 | typedef __uint64_t xfs_ufsize_t; /* unsigned bytes in a file */ |
| 88 | |
| 89 | typedef __int32_t xfs_suminfo_t; /* type of bitmap summary info */ |
| 90 | typedef __int32_t xfs_rtword_t; /* word type for bitmap manipulations */ |
| 91 | |
| 92 | typedef __int64_t xfs_lsn_t; /* log sequence number */ |
| 93 | typedef __int32_t xfs_tid_t; /* transaction identifier */ |
| 94 | |
| 95 | typedef __uint32_t xfs_dablk_t; /* dir/attr block number (in file) */ |
| 96 | typedef __uint32_t xfs_dahash_t; /* dir/attr hash value */ |
| 97 | |
| 98 | typedef __uint16_t xfs_prid_t; /* prid_t truncated to 16bits in XFS */ |
| 99 | |
| 100 | /* |
| 101 | * These types are 64 bits on disk but are either 32 or 64 bits in memory. |
| 102 | * Disk based types: |
| 103 | */ |
| 104 | typedef __uint64_t xfs_dfsbno_t; /* blockno in filesystem (agno|agbno) */ |
| 105 | typedef __uint64_t xfs_drfsbno_t; /* blockno in filesystem (raw) */ |
| 106 | typedef __uint64_t xfs_drtbno_t; /* extent (block) in realtime area */ |
| 107 | typedef __uint64_t xfs_dfiloff_t; /* block number in a file */ |
| 108 | typedef __uint64_t xfs_dfilblks_t; /* number of blocks in a file */ |
| 109 | |
| 110 | /* |
| 111 | * Memory based types are conditional. |
| 112 | */ |
| 113 | #if XFS_BIG_BLKNOS |
| 114 | typedef __uint64_t xfs_fsblock_t; /* blockno in filesystem (agno|agbno) */ |
| 115 | typedef __uint64_t xfs_rfsblock_t; /* blockno in filesystem (raw) */ |
| 116 | typedef __uint64_t xfs_rtblock_t; /* extent (block) in realtime area */ |
| 117 | typedef __int64_t xfs_srtblock_t; /* signed version of xfs_rtblock_t */ |
| 118 | #else |
| 119 | typedef __uint32_t xfs_fsblock_t; /* blockno in filesystem (agno|agbno) */ |
| 120 | typedef __uint32_t xfs_rfsblock_t; /* blockno in filesystem (raw) */ |
| 121 | typedef __uint32_t xfs_rtblock_t; /* extent (block) in realtime area */ |
| 122 | typedef __int32_t xfs_srtblock_t; /* signed version of xfs_rtblock_t */ |
| 123 | #endif |
| 124 | typedef __uint64_t xfs_fileoff_t; /* block number in a file */ |
| 125 | typedef __int64_t xfs_sfiloff_t; /* signed block number in a file */ |
| 126 | typedef __uint64_t xfs_filblks_t; /* number of blocks in a file */ |
| 127 | |
| 128 | typedef __uint8_t xfs_arch_t; /* architecture of an xfs fs */ |
| 129 | |
| 130 | /* |
| 131 | * Null values for the types. |
| 132 | */ |
| 133 | #define NULLDFSBNO ((xfs_dfsbno_t)-1) |
| 134 | #define NULLDRFSBNO ((xfs_drfsbno_t)-1) |
| 135 | #define NULLDRTBNO ((xfs_drtbno_t)-1) |
| 136 | #define NULLDFILOFF ((xfs_dfiloff_t)-1) |
| 137 | |
| 138 | #define NULLFSBLOCK ((xfs_fsblock_t)-1) |
| 139 | #define NULLRFSBLOCK ((xfs_rfsblock_t)-1) |
| 140 | #define NULLRTBLOCK ((xfs_rtblock_t)-1) |
| 141 | #define NULLFILEOFF ((xfs_fileoff_t)-1) |
| 142 | |
| 143 | #define NULLAGBLOCK ((xfs_agblock_t)-1) |
| 144 | #define NULLAGNUMBER ((xfs_agnumber_t)-1) |
| 145 | #define NULLEXTNUM ((xfs_extnum_t)-1) |
| 146 | |
| 147 | #define NULLCOMMITLSN ((xfs_lsn_t)-1) |
| 148 | |
| 149 | /* |
| 150 | * Max values for extlen, extnum, aextnum. |
| 151 | */ |
| 152 | #define MAXEXTLEN ((xfs_extlen_t)0x001fffff) /* 21 bits */ |
| 153 | #define MAXEXTNUM ((xfs_extnum_t)0x7fffffff) /* signed int */ |
| 154 | #define MAXAEXTNUM ((xfs_aextnum_t)0x7fff) /* signed short */ |
| 155 | |
| 156 | /* |
| 157 | * MAXNAMELEN is the length (including the terminating null) of |
| 158 | * the longest permissible file (component) name. |
| 159 | */ |
| 160 | #define MAXNAMELEN 256 |
| 161 | |
| 162 | typedef struct xfs_dirent { /* data from readdir() */ |
| 163 | xfs_ino_t d_ino; /* inode number of entry */ |
| 164 | xfs_off_t d_off; /* offset of disk directory entry */ |
| 165 | unsigned short d_reclen; /* length of this record */ |
| 166 | char d_name[1]; /* name of file */ |
| 167 | } xfs_dirent_t; |
| 168 | |
| 169 | #define DIRENTBASESIZE (((xfs_dirent_t *)0)->d_name - (char *)0) |
| 170 | #define DIRENTSIZE(namelen) \ |
| 171 | ((DIRENTBASESIZE + (namelen) + \ |
| 172 | sizeof(xfs_off_t)) & ~(sizeof(xfs_off_t) - 1)) |
| 173 | |
| 174 | typedef enum { |
| 175 | XFS_LOOKUP_EQi, XFS_LOOKUP_LEi, XFS_LOOKUP_GEi |
| 176 | } xfs_lookup_t; |
| 177 | |
| 178 | typedef enum { |
| 179 | XFS_BTNUM_BNOi, XFS_BTNUM_CNTi, XFS_BTNUM_BMAPi, XFS_BTNUM_INOi, |
| 180 | XFS_BTNUM_MAX |
| 181 | } xfs_btnum_t; |
| 182 | |
| 183 | #endif /* __XFS_TYPES_H__ */ |