eCryptfs: Fix lockdep warning in miscdev operations
[GitHub/mt8127/android_kernel_alcatel_ttab.git] / fs / xfs / xfs_types.h
CommitLineData
1da177e4 1/*
7b718769
NS
2 * Copyright (c) 2000-2005 Silicon Graphics, Inc.
3 * All Rights Reserved.
1da177e4 4 *
7b718769
NS
5 * This program is free software; you can redistribute it and/or
6 * modify it under the terms of the GNU General Public License as
1da177e4
LT
7 * published by the Free Software Foundation.
8 *
7b718769
NS
9 * 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.
1da177e4 13 *
7b718769
NS
14 * 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
1da177e4
LT
17 */
18#ifndef __XFS_TYPES_H__
19#define __XFS_TYPES_H__
20
21#ifdef __KERNEL__
22
1da177e4
LT
23/*
24 * 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
35typedef enum { B_FALSE,B_TRUE } boolean_t;
b74e2159 36typedef __uint32_t prid_t; /* project ID */
1da177e4
LT
37typedef __uint32_t inst_t; /* an instruction */
38
39typedef __s64 xfs_off_t; /* <file offset> type */
058652a3 40typedef unsigned long long xfs_ino_t; /* <inode> type */
1da177e4
LT
41typedef __s64 xfs_daddr_t; /* <disk address> type */
42typedef char * xfs_caddr_t; /* <core address> type */
43typedef __u32 xfs_dev_t;
31b084ae 44typedef __u32 xfs_nlink_t;
1da177e4
LT
45
46/* __psint_t is the same size as a pointer */
47#if (BITS_PER_LONG == 32)
48typedef __int32_t __psint_t;
49typedef __uint32_t __psunsigned_t;
50#elif (BITS_PER_LONG == 64)
51typedef __int64_t __psint_t;
52typedef __uint64_t __psunsigned_t;
53#else
54#error BITS_PER_LONG must be 32 or 64
55#endif
56
57#endif /* __KERNEL__ */
58
59typedef __uint32_t xfs_agblock_t; /* blockno in alloc. group */
60a34607 60typedef __uint32_t xfs_agino_t; /* inode # within allocation grp */
1da177e4
LT
61typedef __uint32_t xfs_extlen_t; /* extent length in blocks */
62typedef __uint32_t xfs_agnumber_t; /* allocation group number */
63typedef __int32_t xfs_extnum_t; /* # of extents in a file */
64typedef __int16_t xfs_aextnum_t; /* # extents in an attribute fork */
65typedef __int64_t xfs_fsize_t; /* bytes in a file */
66typedef __uint64_t xfs_ufsize_t; /* unsigned bytes in a file */
67
68typedef __int32_t xfs_suminfo_t; /* type of bitmap summary info */
69typedef __int32_t xfs_rtword_t; /* word type for bitmap manipulations */
70
71typedef __int64_t xfs_lsn_t; /* log sequence number */
72typedef __int32_t xfs_tid_t; /* transaction identifier */
73
74typedef __uint32_t xfs_dablk_t; /* dir/attr block number (in file) */
75typedef __uint32_t xfs_dahash_t; /* dir/attr hash value */
76
1da177e4
LT
77/*
78 * These types are 64 bits on disk but are either 32 or 64 bits in memory.
79 * Disk based types:
80 */
81typedef __uint64_t xfs_dfsbno_t; /* blockno in filesystem (agno|agbno) */
82typedef __uint64_t xfs_drfsbno_t; /* blockno in filesystem (raw) */
83typedef __uint64_t xfs_drtbno_t; /* extent (block) in realtime area */
84typedef __uint64_t xfs_dfiloff_t; /* block number in a file */
85typedef __uint64_t xfs_dfilblks_t; /* number of blocks in a file */
86
87/*
88 * Memory based types are conditional.
89 */
90#if XFS_BIG_BLKNOS
91typedef __uint64_t xfs_fsblock_t; /* blockno in filesystem (agno|agbno) */
92typedef __uint64_t xfs_rfsblock_t; /* blockno in filesystem (raw) */
93typedef __uint64_t xfs_rtblock_t; /* extent (block) in realtime area */
94typedef __int64_t xfs_srtblock_t; /* signed version of xfs_rtblock_t */
95#else
96typedef __uint32_t xfs_fsblock_t; /* blockno in filesystem (agno|agbno) */
97typedef __uint32_t xfs_rfsblock_t; /* blockno in filesystem (raw) */
98typedef __uint32_t xfs_rtblock_t; /* extent (block) in realtime area */
99typedef __int32_t xfs_srtblock_t; /* signed version of xfs_rtblock_t */
100#endif
101typedef __uint64_t xfs_fileoff_t; /* block number in a file */
102typedef __int64_t xfs_sfiloff_t; /* signed block number in a file */
103typedef __uint64_t xfs_filblks_t; /* number of blocks in a file */
104
60a34607 105
1da177e4
LT
106/*
107 * Null values for the types.
108 */
109#define NULLDFSBNO ((xfs_dfsbno_t)-1)
110#define NULLDRFSBNO ((xfs_drfsbno_t)-1)
111#define NULLDRTBNO ((xfs_drtbno_t)-1)
112#define NULLDFILOFF ((xfs_dfiloff_t)-1)
113
114#define NULLFSBLOCK ((xfs_fsblock_t)-1)
115#define NULLRFSBLOCK ((xfs_rfsblock_t)-1)
116#define NULLRTBLOCK ((xfs_rtblock_t)-1)
117#define NULLFILEOFF ((xfs_fileoff_t)-1)
118
119#define NULLAGBLOCK ((xfs_agblock_t)-1)
120#define NULLAGNUMBER ((xfs_agnumber_t)-1)
121#define NULLEXTNUM ((xfs_extnum_t)-1)
122
123#define NULLCOMMITLSN ((xfs_lsn_t)-1)
124
60a34607
DC
125#define NULLFSINO ((xfs_ino_t)-1)
126#define NULLAGINO ((xfs_agino_t)-1)
127
1da177e4
LT
128/*
129 * Max values for extlen, extnum, aextnum.
130 */
131#define MAXEXTLEN ((xfs_extlen_t)0x001fffff) /* 21 bits */
132#define MAXEXTNUM ((xfs_extnum_t)0x7fffffff) /* signed int */
133#define MAXAEXTNUM ((xfs_aextnum_t)0x7fff) /* signed short */
134
d8cc890d
NS
135/*
136 * Min numbers of data/attr fork btree root pointers.
137 */
138#define MINDBTPTRS 3
139#define MINABTPTRS 2
140
1da177e4
LT
141/*
142 * MAXNAMELEN is the length (including the terminating null) of
143 * the longest permissible file (component) name.
144 */
145#define MAXNAMELEN 256
146
1da177e4
LT
147typedef enum {
148 XFS_LOOKUP_EQi, XFS_LOOKUP_LEi, XFS_LOOKUP_GEi
149} xfs_lookup_t;
150
151typedef enum {
152 XFS_BTNUM_BNOi, XFS_BTNUM_CNTi, XFS_BTNUM_BMAPi, XFS_BTNUM_INOi,
153 XFS_BTNUM_MAX
154} xfs_btnum_t;
155
556b8b16 156struct xfs_name {
e2bcd936
DC
157 const unsigned char *name;
158 int len;
556b8b16
BN
159};
160
1da177e4 161#endif /* __XFS_TYPES_H__ */