Blame view

fs/xfs/xfs_types.h 5.14 KB
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
1
  /*
7b7187698   Nathan Scott   [XFS] Update lice...
2
3
   * Copyright (c) 2000-2005 Silicon Graphics, Inc.
   * All Rights Reserved.
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
4
   *
7b7187698   Nathan Scott   [XFS] Update lice...
5
6
   * This program is free software; you can redistribute it and/or
   * modify it under the terms of the GNU General Public License as
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
7
8
   * published by the Free Software Foundation.
   *
7b7187698   Nathan Scott   [XFS] Update lice...
9
10
11
12
   * This program is distributed in the hope that it would be useful,
   * but WITHOUT ANY WARRANTY; without even the implied warranty of
   * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
   * GNU General Public License for more details.
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
13
   *
7b7187698   Nathan Scott   [XFS] Update lice...
14
15
16
   * You should have received a copy of the GNU General Public License
   * along with this program; if not, write the Free Software Foundation,
   * Inc.,  51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
17
18
19
20
21
22
23
   */
  #ifndef __XFS_TYPES_H__
  #define	__XFS_TYPES_H__
  
  #ifdef __KERNEL__
  
  /*
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
24
25
26
27
28
29
30
31
32
33
34
35
   * Additional type declarations for XFS
   */
  typedef signed char		__int8_t;
  typedef unsigned char		__uint8_t;
  typedef signed short int	__int16_t;
  typedef unsigned short int	__uint16_t;
  typedef signed int		__int32_t;
  typedef unsigned int		__uint32_t;
  typedef signed long long int	__int64_t;
  typedef unsigned long long int	__uint64_t;
  
  typedef enum { B_FALSE,B_TRUE }	boolean_t;
b74e2159c   Nathan Scott   [XFS] Add a get/s...
36
  typedef __uint32_t		prid_t;		/* project ID */
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
37
38
39
  typedef __uint32_t		inst_t;		/* an instruction */
  
  typedef __s64			xfs_off_t;	/* <file offset> type */
058652a37   Christoph Hellwig   [XFS] make xfs_in...
40
  typedef unsigned long long	xfs_ino_t;	/* <inode> type */
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
41
42
43
  typedef __s64			xfs_daddr_t;	/* <disk address> type */
  typedef char *			xfs_caddr_t;	/* <core address> type */
  typedef __u32			xfs_dev_t;
31b084aef   Nathan Scott   [XFS] Fix up uses...
44
  typedef __u32			xfs_nlink_t;
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
  
  /* __psint_t is the same size as a pointer */
  #if (BITS_PER_LONG == 32)
  typedef __int32_t __psint_t;
  typedef __uint32_t __psunsigned_t;
  #elif (BITS_PER_LONG == 64)
  typedef __int64_t __psint_t;
  typedef __uint64_t __psunsigned_t;
  #else
  #error BITS_PER_LONG must be 32 or 64
  #endif
  
  #endif	/* __KERNEL__ */
  
  typedef __uint32_t	xfs_agblock_t;	/* blockno in alloc. group */
  typedef	__uint32_t	xfs_extlen_t;	/* extent length in blocks */
  typedef	__uint32_t	xfs_agnumber_t;	/* allocation group number */
  typedef __int32_t	xfs_extnum_t;	/* # of extents in a file */
  typedef __int16_t	xfs_aextnum_t;	/* # extents in an attribute fork */
  typedef	__int64_t	xfs_fsize_t;	/* bytes in a file */
  typedef __uint64_t	xfs_ufsize_t;	/* unsigned bytes in a file */
  
  typedef	__int32_t	xfs_suminfo_t;	/* type of bitmap summary info */
  typedef	__int32_t	xfs_rtword_t;	/* word type for bitmap manipulations */
  
  typedef	__int64_t	xfs_lsn_t;	/* log sequence number */
  typedef	__int32_t	xfs_tid_t;	/* transaction identifier */
  
  typedef	__uint32_t	xfs_dablk_t;	/* dir/attr block number (in file) */
  typedef	__uint32_t	xfs_dahash_t;	/* dir/attr hash value */
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
  /*
   * These types are 64 bits on disk but are either 32 or 64 bits in memory.
   * Disk based types:
   */
  typedef __uint64_t	xfs_dfsbno_t;	/* blockno in filesystem (agno|agbno) */
  typedef __uint64_t	xfs_drfsbno_t;	/* blockno in filesystem (raw) */
  typedef	__uint64_t	xfs_drtbno_t;	/* extent (block) in realtime area */
  typedef	__uint64_t	xfs_dfiloff_t;	/* block number in a file */
  typedef	__uint64_t	xfs_dfilblks_t;	/* number of blocks in a file */
  
  /*
   * Memory based types are conditional.
   */
  #if XFS_BIG_BLKNOS
  typedef	__uint64_t	xfs_fsblock_t;	/* blockno in filesystem (agno|agbno) */
  typedef __uint64_t	xfs_rfsblock_t;	/* blockno in filesystem (raw) */
  typedef __uint64_t	xfs_rtblock_t;	/* extent (block) in realtime area */
  typedef	__int64_t	xfs_srtblock_t;	/* signed version of xfs_rtblock_t */
  #else
  typedef	__uint32_t	xfs_fsblock_t;	/* blockno in filesystem (agno|agbno) */
  typedef __uint32_t	xfs_rfsblock_t;	/* blockno in filesystem (raw) */
  typedef __uint32_t	xfs_rtblock_t;	/* extent (block) in realtime area */
  typedef	__int32_t	xfs_srtblock_t;	/* signed version of xfs_rtblock_t */
  #endif
  typedef __uint64_t	xfs_fileoff_t;	/* block number in a file */
  typedef __int64_t	xfs_sfiloff_t;	/* signed block number in a file */
  typedef __uint64_t	xfs_filblks_t;	/* number of blocks in a file */
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
  /*
   * Null values for the types.
   */
  #define	NULLDFSBNO	((xfs_dfsbno_t)-1)
  #define	NULLDRFSBNO	((xfs_drfsbno_t)-1)
  #define	NULLDRTBNO	((xfs_drtbno_t)-1)
  #define	NULLDFILOFF	((xfs_dfiloff_t)-1)
  
  #define	NULLFSBLOCK	((xfs_fsblock_t)-1)
  #define	NULLRFSBLOCK	((xfs_rfsblock_t)-1)
  #define	NULLRTBLOCK	((xfs_rtblock_t)-1)
  #define	NULLFILEOFF	((xfs_fileoff_t)-1)
  
  #define	NULLAGBLOCK	((xfs_agblock_t)-1)
  #define	NULLAGNUMBER	((xfs_agnumber_t)-1)
  #define	NULLEXTNUM	((xfs_extnum_t)-1)
  
  #define NULLCOMMITLSN	((xfs_lsn_t)-1)
  
  /*
   * Max values for extlen, extnum, aextnum.
   */
  #define	MAXEXTLEN	((xfs_extlen_t)0x001fffff)	/* 21 bits */
  #define	MAXEXTNUM	((xfs_extnum_t)0x7fffffff)	/* signed int */
  #define	MAXAEXTNUM	((xfs_aextnum_t)0x7fff)		/* signed short */
  
  /*
d8cc890d4   Nathan Scott   [XFS] Ondisk form...
129
130
131
132
133
134
   * Min numbers of data/attr fork btree root pointers.
   */
  #define MINDBTPTRS	3
  #define MINABTPTRS	2
  
  /*
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
135
136
137
138
   * MAXNAMELEN is the length (including the terminating null) of
   * the longest permissible file (component) name.
   */
  #define MAXNAMELEN	256
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
139
140
141
142
143
144
145
146
  typedef enum {
  	XFS_LOOKUP_EQi, XFS_LOOKUP_LEi, XFS_LOOKUP_GEi
  } xfs_lookup_t;
  
  typedef enum {
  	XFS_BTNUM_BNOi, XFS_BTNUM_CNTi, XFS_BTNUM_BMAPi, XFS_BTNUM_INOi,
  	XFS_BTNUM_MAX
  } xfs_btnum_t;
556b8b166   Barry Naujok   [XFS] remove bhv_...
147
  struct xfs_name {
e2bcd936e   Dave Chinner   xfs: directory na...
148
149
  	const unsigned char	*name;
  	int			len;
556b8b166   Barry Naujok   [XFS] remove bhv_...
150
  };
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
151
  #endif	/* __XFS_TYPES_H__ */