blob: e4bf711e48ff80f3b1fc9241b12c9bffc94dc348 [file] [log] [blame]
Linus Torvalds1da177e2005-04-16 15:20:36 -07001/*
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 */
40typedef unsigned char uchar_t;
41typedef unsigned short ushort_t;
42typedef unsigned int uint_t;
43typedef unsigned long ulong_t;
44
45/*
46 * Additional type declarations for XFS
47 */
48typedef signed char __int8_t;
49typedef unsigned char __uint8_t;
50typedef signed short int __int16_t;
51typedef unsigned short int __uint16_t;
52typedef signed int __int32_t;
53typedef unsigned int __uint32_t;
54typedef signed long long int __int64_t;
55typedef unsigned long long int __uint64_t;
56
57typedef enum { B_FALSE,B_TRUE } boolean_t;
58typedef __int64_t prid_t; /* project ID */
59typedef __uint32_t inst_t; /* an instruction */
60
61typedef __s64 xfs_off_t; /* <file offset> type */
62typedef __u64 xfs_ino_t; /* <inode> type */
63typedef __s64 xfs_daddr_t; /* <disk address> type */
64typedef char * xfs_caddr_t; /* <core address> type */
65typedef __u32 xfs_dev_t;
Nathan Scott31b084a2005-05-05 13:25:00 -070066typedef __u32 xfs_nlink_t;
Linus Torvalds1da177e2005-04-16 15:20:36 -070067
68/* __psint_t is the same size as a pointer */
69#if (BITS_PER_LONG == 32)
70typedef __int32_t __psint_t;
71typedef __uint32_t __psunsigned_t;
72#elif (BITS_PER_LONG == 64)
73typedef __int64_t __psint_t;
74typedef __uint64_t __psunsigned_t;
75#else
76#error BITS_PER_LONG must be 32 or 64
77#endif
78
79#endif /* __KERNEL__ */
80
81typedef __uint32_t xfs_agblock_t; /* blockno in alloc. group */
82typedef __uint32_t xfs_extlen_t; /* extent length in blocks */
83typedef __uint32_t xfs_agnumber_t; /* allocation group number */
84typedef __int32_t xfs_extnum_t; /* # of extents in a file */
85typedef __int16_t xfs_aextnum_t; /* # extents in an attribute fork */
86typedef __int64_t xfs_fsize_t; /* bytes in a file */
87typedef __uint64_t xfs_ufsize_t; /* unsigned bytes in a file */
88
89typedef __int32_t xfs_suminfo_t; /* type of bitmap summary info */
90typedef __int32_t xfs_rtword_t; /* word type for bitmap manipulations */
91
92typedef __int64_t xfs_lsn_t; /* log sequence number */
93typedef __int32_t xfs_tid_t; /* transaction identifier */
94
95typedef __uint32_t xfs_dablk_t; /* dir/attr block number (in file) */
96typedef __uint32_t xfs_dahash_t; /* dir/attr hash value */
97
98typedef __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 */
104typedef __uint64_t xfs_dfsbno_t; /* blockno in filesystem (agno|agbno) */
105typedef __uint64_t xfs_drfsbno_t; /* blockno in filesystem (raw) */
106typedef __uint64_t xfs_drtbno_t; /* extent (block) in realtime area */
107typedef __uint64_t xfs_dfiloff_t; /* block number in a file */
108typedef __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
114typedef __uint64_t xfs_fsblock_t; /* blockno in filesystem (agno|agbno) */
115typedef __uint64_t xfs_rfsblock_t; /* blockno in filesystem (raw) */
116typedef __uint64_t xfs_rtblock_t; /* extent (block) in realtime area */
117typedef __int64_t xfs_srtblock_t; /* signed version of xfs_rtblock_t */
118#else
119typedef __uint32_t xfs_fsblock_t; /* blockno in filesystem (agno|agbno) */
120typedef __uint32_t xfs_rfsblock_t; /* blockno in filesystem (raw) */
121typedef __uint32_t xfs_rtblock_t; /* extent (block) in realtime area */
122typedef __int32_t xfs_srtblock_t; /* signed version of xfs_rtblock_t */
123#endif
124typedef __uint64_t xfs_fileoff_t; /* block number in a file */
125typedef __int64_t xfs_sfiloff_t; /* signed block number in a file */
126typedef __uint64_t xfs_filblks_t; /* number of blocks in a file */
127
128typedef __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
162typedef 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
174typedef enum {
175 XFS_LOOKUP_EQi, XFS_LOOKUP_LEi, XFS_LOOKUP_GEi
176} xfs_lookup_t;
177
178typedef 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__ */