]> git.ipfire.org Git - thirdparty/xfsprogs-dev.git/blob - include/platform_defs.h.in
xfs: fix off-by-one error in xfs_rtalloc_query_range
[thirdparty/xfsprogs-dev.git] / include / platform_defs.h.in
1 /*
2 * Copyright (c) 2000-2005 Silicon Graphics, Inc.
3 * All Rights Reserved.
4 *
5 * This program is free software; you can redistribute it and/or
6 * modify it under the terms of the GNU Lesser General Public License
7 * as published by the Free Software Foundation.
8 *
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 Lesser General Public License for more details.
13 *
14 * You should have received a copy of the GNU Lesser 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
17 *
18 * @configure_input@
19 */
20 #ifndef __XFS_PLATFORM_DEFS_H__
21 #define __XFS_PLATFORM_DEFS_H__
22
23 #include <stdio.h>
24 #include <errno.h>
25 #include <fcntl.h>
26 #include <stdarg.h>
27 #include <assert.h>
28 #include <stddef.h>
29 #include <stdlib.h>
30 #include <string.h>
31 #include <stdint.h>
32 #include <unistd.h>
33 #include <pthread.h>
34 #include <ctype.h>
35 #include <sys/types.h>
36 #include <limits.h>
37 #include <stdbool.h>
38 #include <libgen.h>
39
40 typedef struct filldir filldir_t;
41
42 /* long and pointer must be either 32 bit or 64 bit */
43 #undef SIZEOF_LONG
44 #undef SIZEOF_CHAR_P
45 #define BITS_PER_LONG (SIZEOF_LONG * CHAR_BIT)
46
47 /* Check whether to define umode_t ourselves. */
48 #ifndef HAVE_UMODE_T
49 typedef unsigned short umode_t;
50 #endif
51
52 /* Define if you want gettext (I18N) support */
53 #undef ENABLE_GETTEXT
54 #ifdef ENABLE_GETTEXT
55 # include <libintl.h>
56 # define _(x) gettext(x)
57 # define N_(x) x
58 #else
59 # define _(x) (x)
60 # define N_(x) x
61 # define textdomain(d) do { } while (0)
62 # define bindtextdomain(d,dir) do { } while (0)
63 #endif
64 #include <locale.h>
65
66 #define IRIX_DEV_BITSMAJOR 14
67 #define IRIX_DEV_BITSMINOR 18
68 #define IRIX_DEV_MAXMAJ 0x1ff
69 #define IRIX_DEV_MAXMIN 0x3ffff
70 #define IRIX_DEV_MAJOR(dev) ((int)(((unsigned)(dev) >> IRIX_DEV_BITSMINOR) \
71 & IRIX_DEV_MAXMAJ))
72 #define IRIX_DEV_MINOR(dev) ((int)((dev) & IRIX_DEV_MAXMIN))
73 #define IRIX_MKDEV(major,minor) ((xfs_dev_t)(((major) << IRIX_DEV_BITSMINOR) \
74 | (minor&IRIX_DEV_MAXMIN)))
75 #define IRIX_DEV_TO_KDEVT(dev) makedev(IRIX_DEV_MAJOR(dev),IRIX_DEV_MINOR(dev))
76
77 #ifndef min
78 #define min(a,b) (((a)<(b))?(a):(b))
79 #define max(a,b) (((a)>(b))?(a):(b))
80 #endif
81
82 #ifndef NBBY
83 #define NBBY 8
84 #endif
85
86 #ifdef DEBUG
87 # define ASSERT(EX) assert(EX)
88 #else
89 # define ASSERT(EX) ((void) 0)
90 #endif
91
92 #endif /* __XFS_PLATFORM_DEFS_H__ */