libparted 3.6
Loading...
Searching...
No Matches
xfs_types.h
Go to the documentation of this file.
1/*
2 * Copyright (c) 2000 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 3 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, see <http://www.gnu.org/licenses/>.
21 *
22 * Contact information: Silicon Graphics, Inc., 1600 Amphitheatre Pkwy,
23 * Mountain View, CA 94043, or:
24 *
25 * http://www.sgi.com
26 *
27 * For further information regarding this notice, see:
28 *
29 * http://oss.sgi.com/projects/GenInfo/SGIGPLNoticeExplan/
30 */
31#ifndef __XFS_TYPES_H__
32#define __XFS_TYPES_H__
33
34/*
35 * Some types are conditional based on the selected configuration.
36 * Set XFS_BIG_FILES=1 or 0 and XFS_BIG_FILESYSTEMS=1 or 0 depending
37 * on the desired configuration.
38 * XFS_BIG_FILES needs pgno_t to be 64 bits (64-bit kernels).
39 * XFS_BIG_FILESYSTEMS needs daddr_t to be 64 bits (N32 and 64-bit kernels).
40 *
41 * Expect these to be set from klocaldefs, or from the machine-type
42 * defs files for the normal case.
43 */
44
45#define XFS_BIG_FILES 1
46#define XFS_BIG_FILESYSTEMS 1
47
48typedef uint32_t xfs_agblock_t; /* blockno in alloc. group */
49typedef uint32_t xfs_extlen_t; /* extent length in blocks */
50typedef uint32_t xfs_agnumber_t; /* allocation group number */
51typedef int32_t xfs_extnum_t; /* # of extents in a file */
52typedef int16_t xfs_aextnum_t; /* # extents in an attribute fork */
53typedef int64_t xfs_fsize_t; /* bytes in a file */
54typedef uint64_t xfs_ufsize_t; /* unsigned bytes in a file */
55
56typedef int32_t xfs_suminfo_t; /* type of bitmap summary info */
57typedef int32_t xfs_rtword_t; /* word type for bitmap manipulations */
58
59typedef int64_t xfs_lsn_t; /* log sequence number */
60typedef int32_t xfs_tid_t; /* transaction identifier */
61
62typedef uint32_t xfs_dablk_t; /* dir/attr block number (in file) */
63typedef uint32_t xfs_dahash_t; /* dir/attr hash value */
64
65typedef uint16_t xfs_prid_t; /* prid_t truncated to 16bits in XFS */
66
67/*
68 * These types are 64 bits on disk but are either 32 or 64 bits in memory.
69 * Disk based types:
70 */
71typedef uint64_t xfs_dfsbno_t; /* blockno in filesystem (agno|agbno) */
72typedef uint64_t xfs_drfsbno_t; /* blockno in filesystem (raw) */
73typedef uint64_t xfs_drtbno_t; /* extent (block) in realtime area */
74typedef uint64_t xfs_dfiloff_t; /* block number in a file */
75typedef uint64_t xfs_dfilblks_t; /* number of blocks in a file */
76
77/*
78 * Memory based types are conditional.
79 */
80#if XFS_BIG_FILESYSTEMS
81typedef uint64_t xfs_fsblock_t; /* blockno in filesystem (agno|agbno) */
82typedef uint64_t xfs_rfsblock_t; /* blockno in filesystem (raw) */
83typedef uint64_t xfs_rtblock_t; /* extent (block) in realtime area */
84typedef int64_t xfs_srtblock_t; /* signed version of xfs_rtblock_t */
85#else
86typedef uint32_t xfs_fsblock_t; /* blockno in filesystem (agno|agbno) */
87typedef uint32_t xfs_rfsblock_t; /* blockno in filesystem (raw) */
88typedef uint32_t xfs_rtblock_t; /* extent (block) in realtime area */
89typedef int32_t xfs_srtblock_t; /* signed version of xfs_rtblock_t */
90#endif
91#if XFS_BIG_FILES
92typedef uint64_t xfs_fileoff_t; /* block number in a file */
93typedef int64_t xfs_sfiloff_t; /* signed block number in a file */
94typedef uint64_t xfs_filblks_t; /* number of blocks in a file */
95#else
96typedef uint32_t xfs_fileoff_t; /* block number in a file */
97typedef int32_t xfs_sfiloff_t; /* signed block number in a file */
98typedef uint32_t xfs_filblks_t; /* number of blocks in a file */
99#endif
100
101typedef uint8_t xfs_arch_t; /* architecutre of an xfs fs */
102
103/*
104 * Null values for the types.
105 */
106#define NULLDFSBNO ((xfs_dfsbno_t)-1)
107#define NULLDRFSBNO ((xfs_drfsbno_t)-1)
108#define NULLDRTBNO ((xfs_drtbno_t)-1)
109#define NULLDFILOFF ((xfs_dfiloff_t)-1)
110
111#define NULLFSBLOCK ((xfs_fsblock_t)-1)
112#define NULLRFSBLOCK ((xfs_rfsblock_t)-1)
113#define NULLRTBLOCK ((xfs_rtblock_t)-1)
114#define NULLFILEOFF ((xfs_fileoff_t)-1)
115
116#define NULLAGBLOCK ((xfs_agblock_t)-1)
117#define NULLAGNUMBER ((xfs_agnumber_t)-1)
118#define NULLEXTNUM ((xfs_extnum_t)-1)
119
120#define NULLCOMMITLSN ((xfs_lsn_t)-1)
121
122/*
123 * Max values for extlen, extnum, aextnum.
124 */
125#define MAXEXTLEN ((xfs_extlen_t)0x001fffff) /* 21 bits */
126#define MAXEXTNUM ((xfs_extnum_t)0x7fffffff) /* signed int */
127#define MAXAEXTNUM ((xfs_aextnum_t)0x7fff) /* signed short */
128
129/*
130 * MAXNAMELEN is the length (including the terminating null) of
131 * the longest permissible file (component) name.
132 */
133#define MAXNAMELEN 256
134
135typedef enum {
138
139typedef enum {
143
144
145#ifdef CONFIG_PROC_FS
146/*
147 * XFS global statistics
148 */
149struct xfsstats {
150# define XFSSTAT_END_EXTENT_ALLOC 4
151 uint32_t xs_allocx;
152 uint32_t xs_allocb;
153 uint32_t xs_freex;
154 uint32_t xs_freeb;
155# define XFSSTAT_END_ALLOC_BTREE (XFSSTAT_END_EXTENT_ALLOC+4)
156 uint32_t xs_abt_lookup;
157 uint32_t xs_abt_compare;
158 uint32_t xs_abt_insrec;
159 uint32_t xs_abt_delrec;
160# define XFSSTAT_END_BLOCK_MAPPING (XFSSTAT_END_ALLOC_BTREE+7)
161 uint32_t xs_blk_mapr;
162 uint32_t xs_blk_mapw;
163 uint32_t xs_blk_unmap;
164 uint32_t xs_add_exlist;
165 uint32_t xs_del_exlist;
166 uint32_t xs_look_exlist;
167 uint32_t xs_cmp_exlist;
168# define XFSSTAT_END_BLOCK_MAP_BTREE (XFSSTAT_END_BLOCK_MAPPING+4)
169 uint32_t xs_bmbt_lookup;
170 uint32_t xs_bmbt_compare;
171 uint32_t xs_bmbt_insrec;
172 uint32_t xs_bmbt_delrec;
173# define XFSSTAT_END_DIRECTORY_OPS (XFSSTAT_END_BLOCK_MAP_BTREE+4)
174 uint32_t xs_dir_lookup;
175 uint32_t xs_dir_create;
176 uint32_t xs_dir_remove;
177 uint32_t xs_dir_getdents;
178# define XFSSTAT_END_TRANSACTIONS (XFSSTAT_END_DIRECTORY_OPS+3)
179 uint32_t xs_trans_sync;
180 uint32_t xs_trans_async;
181 uint32_t xs_trans_empty;
182# define XFSSTAT_END_INODE_OPS (XFSSTAT_END_TRANSACTIONS+7)
183 uint32_t xs_ig_attempts;
184 uint32_t xs_ig_found;
185 uint32_t xs_ig_frecycle;
186 uint32_t xs_ig_missed;
187 uint32_t xs_ig_dup;
188 uint32_t xs_ig_reclaims;
189 uint32_t xs_ig_attrchg;
190# define XFSSTAT_END_LOG_OPS (XFSSTAT_END_INODE_OPS+5)
191 uint32_t xs_log_writes;
192 uint32_t xs_log_blocks;
193 uint32_t xs_log_noiclogs;
194 uint32_t xs_log_force;
195 uint32_t xs_log_force_sleep;
196# define XFSSTAT_END_TAIL_PUSHING (XFSSTAT_END_LOG_OPS+10)
197 uint32_t xs_try_logspace;
198 uint32_t xs_sleep_logspace;
199 uint32_t xs_push_ail;
200 uint32_t xs_push_ail_success;
201 uint32_t xs_push_ail_pushbuf;
202 uint32_t xs_push_ail_pinned;
203 uint32_t xs_push_ail_locked;
204 uint32_t xs_push_ail_flushing;
205 uint32_t xs_push_ail_restarts;
206 uint32_t xs_push_ail_flush;
207# define XFSSTAT_END_WRITE_CONVERT (XFSSTAT_END_TAIL_PUSHING+2)
208 uint32_t xs_xstrat_quick;
209 uint32_t xs_xstrat_split;
210# define XFSSTAT_END_READ_WRITE_OPS (XFSSTAT_END_WRITE_CONVERT+2)
211 uint32_t xs_write_calls;
212 uint32_t xs_read_calls;
213# define XFSSTAT_END_ATTRIBUTE_OPS (XFSSTAT_END_READ_WRITE_OPS+4)
214 uint32_t xs_attr_get;
215 uint32_t xs_attr_set;
216 uint32_t xs_attr_remove;
217 uint32_t xs_attr_list;
218# define XFSSTAT_END_QUOTA_OPS (XFSSTAT_END_ATTRIBUTE_OPS+8)
219 uint32_t xs_qm_dqreclaims;
220 uint32_t xs_qm_dqreclaim_misses;
221 uint32_t xs_qm_dquot_dups;
222 uint32_t xs_qm_dqcachemisses;
223 uint32_t xs_qm_dqcachehits;
224 uint32_t xs_qm_dqwants;
225 uint32_t xs_qm_dqshake_reclaims;
226 uint32_t xs_qm_dqinact_reclaims;
227# define XFSSTAT_END_INODE_CLUSTER (XFSSTAT_END_QUOTA_OPS+3)
228 uint32_t xs_iflush_count;
229 uint32_t xs_icluster_flushcnt;
230 uint32_t xs_icluster_flushinode;
231# define XFSSTAT_END_VNODE_OPS (XFSSTAT_END_INODE_CLUSTER+8)
232 uint32_t vn_active; /* # vnodes not on free lists */
233 uint32_t vn_alloc; /* # times vn_alloc called */
234 uint32_t vn_get; /* # times vn_get called */
235 uint32_t vn_hold; /* # times vn_hold called */
236 uint32_t vn_rele; /* # times vn_rele called */
237 uint32_t vn_reclaim; /* # times vn_reclaim called */
238 uint32_t vn_remove; /* # times vn_remove called */
239 uint32_t vn_free; /* # times vn_free called */
240 struct xfsstats_xpc {
241 uint64_t xs_xstrat_bytes;
242 uint64_t xs_write_bytes;
243 uint64_t xs_read_bytes;
244 } xpc;
245} xfsstats;
246
247# define XFS_STATS_INC(count) ( xfsstats.##count ++ )
248# define XFS_STATS_DEC(count) ( xfsstats.##count -- )
249# define XFS_STATS_ADD(count, inc) ( xfsstats.##count += (inc) )
250# define XFS_STATS64_INC(count) ( xfsstats.xpc.##count ++ )
251# define XFS_STATS64_ADD(count, inc) ( xfsstats.xpc.##count += (inc) )
252#else /* !CONFIG_PROC_FS */
253# define XFS_STATS_INC(count)
254# define XFS_STATS_DEC(count)
255# define XFS_STATS_ADD(count, inc)
256# define XFS_STATS64_INC(count)
257# define XFS_STATS64_ADD(count, inc)
258#endif /* !CONFIG_PROC_FS */
259
260
261#ifdef __KERNEL__
262
263/* juggle IRIX device numbers - still used in ondisk structures */
264
265#define IRIX_DEV_BITSMAJOR 14
266#define IRIX_DEV_BITSMINOR 18
267#define IRIX_DEV_MAXMAJ 0x1ff
268#define IRIX_DEV_MAXMIN 0x3ffff
269#define IRIX_DEV_MAJOR(dev) ((int)(((unsigned)(dev)>>IRIX_DEV_BITSMINOR) \
270 & IRIX_DEV_MAXMAJ))
271#define IRIX_DEV_MINOR(dev) ((int)((dev)&IRIX_DEV_MAXMIN))
272#define IRIX_MKDEV(major,minor) ((xfs_dev_t)(((major)<<IRIX_DEV_BITSMINOR) \
273 | (minor&IRIX_DEV_MAXMIN)))
274
275#define IRIX_DEV_TO_KDEVT(dev) MKDEV(IRIX_DEV_MAJOR(dev),IRIX_DEV_MINOR(dev))
276#define IRIX_DEV_TO_DEVT(dev) ((IRIX_DEV_MAJOR(dev)<<8)|IRIX_DEV_MINOR(dev))
277
278/* __psint_t is the same size as a pointer */
279#if (BITS_PER_LONG == 32)
280typedef int32_t __psint_t;
281typedef uint32_t __psunsigned_t;
282#elif (BITS_PER_LONG == 64)
283typedef int64_t __psint_t;
284typedef uint64_t __psunsigned_t;
285#else
286#error BITS_PER_LONG must be 32 or 64
287#endif
288
289
290/*
291 * struct for passing owner/requestor id
292 */
293typedef struct flid {
294#ifdef CELL_CAPABLE
295 pid_t fl_pid;
296 sysid_t fl_sysid;
297#endif
298} flid_t;
299
300#endif /* __KERNEL__ */
301
302#endif /* !__XFS_TYPES_H */
unsigned int __psunsigned_t
Definition: platform_defs.h:89
int __psint_t
Definition: platform_defs.h:71
int32_t xfs_extnum_t
Definition: xfs_types.h:51
int64_t xfs_fsize_t
Definition: xfs_types.h:53
uint64_t xfs_dfiloff_t
Definition: xfs_types.h:74
int64_t xfs_sfiloff_t
Definition: xfs_types.h:93
int64_t xfs_srtblock_t
Definition: xfs_types.h:84
int64_t xfs_lsn_t
Definition: xfs_types.h:59
xfs_btnum_t
Definition: xfs_types.h:139
@ XFS_BTNUM_INOi
Definition: xfs_types.h:140
@ XFS_BTNUM_BMAPi
Definition: xfs_types.h:140
@ XFS_BTNUM_CNTi
Definition: xfs_types.h:140
@ XFS_BTNUM_MAX
Definition: xfs_types.h:141
@ XFS_BTNUM_BNOi
Definition: xfs_types.h:140
xfs_lookup_t
Definition: xfs_types.h:135
@ XFS_LOOKUP_LEi
Definition: xfs_types.h:136
@ XFS_LOOKUP_GEi
Definition: xfs_types.h:136
@ XFS_LOOKUP_EQi
Definition: xfs_types.h:136
int16_t xfs_aextnum_t
Definition: xfs_types.h:52
uint32_t xfs_dahash_t
Definition: xfs_types.h:63
uint64_t xfs_drtbno_t
Definition: xfs_types.h:73
int32_t xfs_suminfo_t
Definition: xfs_types.h:56
uint64_t xfs_rfsblock_t
Definition: xfs_types.h:82
uint8_t xfs_arch_t
Definition: xfs_types.h:101
int32_t xfs_rtword_t
Definition: xfs_types.h:57
uint64_t xfs_dfilblks_t
Definition: xfs_types.h:75
int32_t xfs_tid_t
Definition: xfs_types.h:60
uint32_t xfs_agnumber_t
Definition: xfs_types.h:50
uint64_t xfs_ufsize_t
Definition: xfs_types.h:54
uint64_t xfs_dfsbno_t
Definition: xfs_types.h:71
uint64_t xfs_drfsbno_t
Definition: xfs_types.h:72
uint64_t xfs_fsblock_t
Definition: xfs_types.h:81
uint64_t xfs_fileoff_t
Definition: xfs_types.h:92
uint64_t xfs_rtblock_t
Definition: xfs_types.h:83
uint64_t xfs_filblks_t
Definition: xfs_types.h:94
uint32_t xfs_agblock_t
Definition: xfs_types.h:48
uint16_t xfs_prid_t
Definition: xfs_types.h:65
uint32_t xfs_extlen_t
Definition: xfs_types.h:49
uint32_t xfs_dablk_t
Definition: xfs_types.h:62