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