blob: 39c48ca64a607f9c304bf0ae7324b06bd5959d41 [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/*
Linus Torvalds1da177e2005-04-16 15:20:36 -070024 * Additional type declarations for XFS
25 */
26typedef signed char __int8_t;
27typedef unsigned char __uint8_t;
28typedef signed short int __int16_t;
29typedef unsigned short int __uint16_t;
30typedef signed int __int32_t;
31typedef unsigned int __uint32_t;
32typedef signed long long int __int64_t;
33typedef unsigned long long int __uint64_t;
34
Nathan Scottb74e2152005-06-21 13:21:49 +100035typedef __uint32_t prid_t; /* project ID */
Linus Torvalds1da177e2005-04-16 15:20:36 -070036typedef __uint32_t inst_t; /* an instruction */
37
38typedef __s64 xfs_off_t; /* <file offset> type */
Christoph Hellwig058652a2009-01-08 13:42:25 -050039typedef unsigned long long xfs_ino_t; /* <inode> type */
Linus Torvalds1da177e2005-04-16 15:20:36 -070040typedef __s64 xfs_daddr_t; /* <disk address> type */
41typedef char * xfs_caddr_t; /* <core address> type */
42typedef __u32 xfs_dev_t;
Nathan Scott31b084a2005-05-05 13:25:00 -070043typedef __u32 xfs_nlink_t;
Linus Torvalds1da177e2005-04-16 15:20:36 -070044
45/* __psint_t is the same size as a pointer */
46#if (BITS_PER_LONG == 32)
47typedef __int32_t __psint_t;
48typedef __uint32_t __psunsigned_t;
49#elif (BITS_PER_LONG == 64)
50typedef __int64_t __psint_t;
51typedef __uint64_t __psunsigned_t;
52#else
53#error BITS_PER_LONG must be 32 or 64
54#endif
55
56#endif /* __KERNEL__ */
57
58typedef __uint32_t xfs_agblock_t; /* blockno in alloc. group */
Dave Chinner60a34602012-04-23 15:58:58 +100059typedef __uint32_t xfs_agino_t; /* inode # within allocation grp */
Linus Torvalds1da177e2005-04-16 15:20:36 -070060typedef __uint32_t xfs_extlen_t; /* extent length in blocks */
61typedef __uint32_t xfs_agnumber_t; /* allocation group number */
62typedef __int32_t xfs_extnum_t; /* # of extents in a file */
63typedef __int16_t xfs_aextnum_t; /* # extents in an attribute fork */
64typedef __int64_t xfs_fsize_t; /* bytes in a file */
65typedef __uint64_t xfs_ufsize_t; /* unsigned bytes in a file */
66
67typedef __int32_t xfs_suminfo_t; /* type of bitmap summary info */
68typedef __int32_t xfs_rtword_t; /* word type for bitmap manipulations */
69
70typedef __int64_t xfs_lsn_t; /* log sequence number */
71typedef __int32_t xfs_tid_t; /* transaction identifier */
72
73typedef __uint32_t xfs_dablk_t; /* dir/attr block number (in file) */
74typedef __uint32_t xfs_dahash_t; /* dir/attr hash value */
75
Linus Torvalds1da177e2005-04-16 15:20:36 -070076/*
77 * These types are 64 bits on disk but are either 32 or 64 bits in memory.
78 * Disk based types:
79 */
80typedef __uint64_t xfs_dfsbno_t; /* blockno in filesystem (agno|agbno) */
81typedef __uint64_t xfs_drfsbno_t; /* blockno in filesystem (raw) */
82typedef __uint64_t xfs_drtbno_t; /* extent (block) in realtime area */
83typedef __uint64_t xfs_dfiloff_t; /* block number in a file */
84typedef __uint64_t xfs_dfilblks_t; /* number of blocks in a file */
85
86/*
87 * Memory based types are conditional.
88 */
89#if XFS_BIG_BLKNOS
90typedef __uint64_t xfs_fsblock_t; /* blockno in filesystem (agno|agbno) */
91typedef __uint64_t xfs_rfsblock_t; /* blockno in filesystem (raw) */
92typedef __uint64_t xfs_rtblock_t; /* extent (block) in realtime area */
93typedef __int64_t xfs_srtblock_t; /* signed version of xfs_rtblock_t */
94#else
95typedef __uint32_t xfs_fsblock_t; /* blockno in filesystem (agno|agbno) */
96typedef __uint32_t xfs_rfsblock_t; /* blockno in filesystem (raw) */
97typedef __uint32_t xfs_rtblock_t; /* extent (block) in realtime area */
98typedef __int32_t xfs_srtblock_t; /* signed version of xfs_rtblock_t */
99#endif
100typedef __uint64_t xfs_fileoff_t; /* block number in a file */
101typedef __int64_t xfs_sfiloff_t; /* signed block number in a file */
102typedef __uint64_t xfs_filblks_t; /* number of blocks in a file */
103
Dave Chinner60a34602012-04-23 15:58:58 +1000104
Linus Torvalds1da177e2005-04-16 15:20:36 -0700105/*
106 * Null values for the types.
107 */
108#define NULLDFSBNO ((xfs_dfsbno_t)-1)
109#define NULLDRFSBNO ((xfs_drfsbno_t)-1)
110#define NULLDRTBNO ((xfs_drtbno_t)-1)
111#define NULLDFILOFF ((xfs_dfiloff_t)-1)
112
113#define NULLFSBLOCK ((xfs_fsblock_t)-1)
114#define NULLRFSBLOCK ((xfs_rfsblock_t)-1)
115#define NULLRTBLOCK ((xfs_rtblock_t)-1)
116#define NULLFILEOFF ((xfs_fileoff_t)-1)
117
118#define NULLAGBLOCK ((xfs_agblock_t)-1)
119#define NULLAGNUMBER ((xfs_agnumber_t)-1)
120#define NULLEXTNUM ((xfs_extnum_t)-1)
121
122#define NULLCOMMITLSN ((xfs_lsn_t)-1)
123
Dave Chinner60a34602012-04-23 15:58:58 +1000124#define NULLFSINO ((xfs_ino_t)-1)
125#define NULLAGINO ((xfs_agino_t)-1)
126
Linus Torvalds1da177e2005-04-16 15:20:36 -0700127/*
128 * Max values for extlen, extnum, aextnum.
129 */
130#define MAXEXTLEN ((xfs_extlen_t)0x001fffff) /* 21 bits */
131#define MAXEXTNUM ((xfs_extnum_t)0x7fffffff) /* signed int */
132#define MAXAEXTNUM ((xfs_aextnum_t)0x7fff) /* signed short */
133
134/*
Dave Chinner77c1a082012-06-22 18:50:07 +1000135 * Minimum and maximum blocksize and sectorsize.
136 * The blocksize upper limit is pretty much arbitrary.
137 * The sectorsize upper limit is due to sizeof(sb_sectsize).
138 */
139#define XFS_MIN_BLOCKSIZE_LOG 9 /* i.e. 512 bytes */
140#define XFS_MAX_BLOCKSIZE_LOG 16 /* i.e. 65536 bytes */
141#define XFS_MIN_BLOCKSIZE (1 << XFS_MIN_BLOCKSIZE_LOG)
142#define XFS_MAX_BLOCKSIZE (1 << XFS_MAX_BLOCKSIZE_LOG)
143#define XFS_MIN_SECTORSIZE_LOG 9 /* i.e. 512 bytes */
144#define XFS_MAX_SECTORSIZE_LOG 15 /* i.e. 32768 bytes */
145#define XFS_MIN_SECTORSIZE (1 << XFS_MIN_SECTORSIZE_LOG)
146#define XFS_MAX_SECTORSIZE (1 << XFS_MAX_SECTORSIZE_LOG)
147
148/*
Dave Chinner69432832013-08-12 20:49:23 +1000149 * Inode fork identifiers.
150 */
151#define XFS_DATA_FORK 0
152#define XFS_ATTR_FORK 1
153
154/*
Nathan Scottd8cc8902005-11-02 10:34:53 +1100155 * Min numbers of data/attr fork btree root pointers.
156 */
157#define MINDBTPTRS 3
158#define MINABTPTRS 2
159
160/*
Linus Torvalds1da177e2005-04-16 15:20:36 -0700161 * MAXNAMELEN is the length (including the terminating null) of
162 * the longest permissible file (component) name.
163 */
164#define MAXNAMELEN 256
165
Linus Torvalds1da177e2005-04-16 15:20:36 -0700166typedef enum {
167 XFS_LOOKUP_EQi, XFS_LOOKUP_LEi, XFS_LOOKUP_GEi
168} xfs_lookup_t;
169
170typedef enum {
171 XFS_BTNUM_BNOi, XFS_BTNUM_CNTi, XFS_BTNUM_BMAPi, XFS_BTNUM_INOi,
172 XFS_BTNUM_MAX
173} xfs_btnum_t;
174
Barry Naujok556b8b12008-04-10 12:22:07 +1000175struct xfs_name {
Dave Chinnere2bcd932010-01-20 10:44:58 +1100176 const unsigned char *name;
177 int len;
Barry Naujok556b8b12008-04-10 12:22:07 +1000178};
179
Linus Torvalds1da177e2005-04-16 15:20:36 -0700180#endif /* __XFS_TYPES_H__ */