1 /* 2 * Taken from Linux kernel tree (linux/fs/xfs) 3 * 4 * Copyright (c) 2000-2005 Silicon Graphics, Inc. 5 * All Rights Reserved. 6 * 7 * Copyright (c) 2012 Paulo Alcantara <pcacjr (at) zytor.com> 8 * 9 * This program is free software; you can redistribute it and/or 10 * modify it under the terms of the GNU General Public License as 11 * published by the Free Software Foundation. 12 * 13 * This program is distributed in the hope that it would be useful, 14 * but WITHOUT ANY WARRANTY; without even the implied warranty of 15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 16 * GNU General Public License for more details. 17 * 18 * You should have received a copy of the GNU General Public License 19 * along with this program; if not, write the Free Software Foundation, 20 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA 21 */ 22 #ifndef XFS_TYPES_H_ 23 #define XFS_TYPES_H_ 24 25 #include <stddef.h> 26 27 #include <sys/types.h> 28 29 typedef enum { B_FALSE,B_TRUE } boolean_t; 30 typedef uint32_t prid_t; /* project ID */ 31 typedef uint32_t inst_t; /* an instruction */ 32 33 typedef int64_t xfs_off_t; /* <file offset> type */ 34 typedef unsigned long long xfs_ino_t; /* <inode> type */ 35 typedef int64_t xfs_daddr_t; /* <disk address> type */ 36 typedef char * xfs_caddr_t; /* <core address> type */ 37 typedef uint32_t xfs_dev_t; 38 typedef uint32_t xfs_nlink_t; 39 40 /* __psint_t is the same size as a pointer */ 41 typedef int32_t __psint_t; 42 typedef uint32_t __psunsigned_t; 43 44 typedef uint32_t xfs_agblock_t; /* blockno in alloc. group */ 45 typedef uint32_t xfs_extlen_t; /* extent length in blocks */ 46 typedef uint32_t xfs_agnumber_t; /* allocation group number */ 47 typedef int32_t xfs_extnum_t; /* # of extents in a file */ 48 typedef int16_t xfs_aextnum_t; /* # extents in an attribute fork */ 49 typedef int64_t xfs_fsize_t; /* bytes in a file */ 50 typedef uint64_t xfs_ufsize_t; /* unsigned bytes in a file */ 51 52 typedef int32_t xfs_suminfo_t; /* type of bitmap summary info */ 53 typedef int32_t xfs_rtword_t; /* word type for bitmap manipulations */ 54 55 typedef int64_t xfs_lsn_t; /* log sequence number */ 56 typedef int32_t xfs_tid_t; /* transaction identifier */ 57 58 typedef uint32_t xfs_dablk_t; /* dir/attr block number (in file) */ 59 typedef uint32_t xfs_dahash_t; /* dir/attr hash value */ 60 61 /* 62 * These types are 64 bits on disk but are either 32 or 64 bits in memory. 63 * Disk based types: 64 */ 65 typedef uint64_t xfs_dfsbno_t; /* blockno in filesystem (agno|agbno) */ 66 typedef uint64_t xfs_drfsbno_t; /* blockno in filesystem (raw) */ 67 typedef uint64_t xfs_drtbno_t; /* extent (block) in realtime area */ 68 typedef uint64_t xfs_dfiloff_t; /* block number in a file */ 69 typedef uint64_t xfs_dfilblks_t; /* number of blocks in a file */ 70 71 /* 72 * Memory based types are conditional. 73 */ 74 typedef uint64_t xfs_fsblock_t; /* blockno in filesystem (agno|agbno) */ 75 typedef uint64_t xfs_rfsblock_t; /* blockno in filesystem (raw) */ 76 typedef uint64_t xfs_rtblock_t; /* extent (block) in realtime area */ 77 typedef int64_t xfs_srtblock_t; /* signed version of xfs_rtblock_t */ 78 79 typedef uint64_t xfs_fileoff_t; /* block number in a file */ 80 typedef int64_t xfs_sfiloff_t; /* signed block number in a file */ 81 typedef uint64_t xfs_filblks_t; /* number of blocks in a file */ 82 83 /* 84 * Null values for the types. 85 */ 86 #define NULLDFSBNO ((xfs_dfsbno_t)-1) 87 #define NULLDRFSBNO ((xfs_drfsbno_t)-1) 88 #define NULLDRTBNO ((xfs_drtbno_t)-1) 89 #define NULLDFILOFF ((xfs_dfiloff_t)-1) 90 91 #define NULLFSBLOCK ((xfs_fsblock_t)-1) 92 #define NULLRFSBLOCK ((xfs_rfsblock_t)-1) 93 #define NULLRTBLOCK ((xfs_rtblock_t)-1) 94 #define NULLFILEOFF ((xfs_fileoff_t)-1) 95 96 #define NULLAGBLOCK ((xfs_agblock_t)-1) 97 #define NULLAGNUMBER ((xfs_agnumber_t)-1) 98 #define NULLEXTNUM ((xfs_extnum_t)-1) 99 100 #define NULLCOMMITLSN ((xfs_lsn_t)-1) 101 102 /* 103 * Max values for extlen, extnum, aextnum. 104 */ 105 #define MAXEXTLEN ((xfs_extlen_t)0x001fffff) /* 21 bits */ 106 #define MAXEXTNUM ((xfs_extnum_t)0x7fffffff) /* signed int */ 107 #define MAXAEXTNUM ((xfs_aextnum_t)0x7fff) /* signed short */ 108 109 /* 110 * Min numbers of data/attr fork btree root pointers. 111 */ 112 #define MINDBTPTRS 3 113 #define MINABTPTRS 2 114 115 /* 116 * MAXNAMELEN is the length (including the terminating null) of 117 * the longest permissible file (component) name. 118 */ 119 #define MAXNAMELEN 256 120 121 typedef enum { 122 XFS_LOOKUP_EQi, XFS_LOOKUP_LEi, XFS_LOOKUP_GEi 123 } xfs_lookup_t; 124 125 typedef enum { 126 XFS_BTNUM_BNOi, XFS_BTNUM_CNTi, XFS_BTNUM_BMAPi, XFS_BTNUM_INOi, 127 XFS_BTNUM_MAX 128 } xfs_btnum_t; 129 130 struct xfs_name { 131 const unsigned char *name; 132 int len; 133 }; 134 135 #endif /* XFS_TYPES_H_ */ 136