]> git.ipfire.org Git - thirdparty/xfsprogs-dev.git/blob - include/linux.h
Merge back recent changes from xfs kernel headers.
[thirdparty/xfsprogs-dev.git] / include / linux.h
1 /*
2 * Copyright (c) 2004-2005 Silicon Graphics, Inc. All Rights Reserved.
3 *
4 * This program is free software; you can redistribute it and/or
5 * modify it under the terms of the GNU Lesser General Public License
6 * as published by the Free Software Foundation.
7 *
8 * This program is distributed in the hope that it would be useful,
9 * but WITHOUT ANY WARRANTY; without even the implied warranty of
10 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 * GNU Lesser General Public License for more details.
12 *
13 * You should have received a copy of the GNU Lesser General Public License
14 * along with this program; if not, write the Free Software Foundation,
15 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
16 */
17 #ifndef __XFS_LINUX_H__
18 #define __XFS_LINUX_H__
19
20 #include <uuid/uuid.h>
21 #include <sys/vfs.h>
22 #include <sys/ioctl.h>
23 #include <sys/param.h>
24 #include <linux/types.h>
25 #include <malloc.h>
26 #include <getopt.h>
27 #include <endian.h>
28 #include <xfs/swab.h>
29
30 static __inline__ int xfsctl(const char *path, int fd, int cmd, void *p)
31 {
32 return ioctl(fd, cmd, p);
33 }
34
35 static __inline__ int platform_test_xfs_fd(int fd)
36 {
37 struct statfs buf;
38 if (fstatfs(fd, &buf) < 0)
39 return 0;
40 return (buf.f_type == 0x58465342); /* XFSB */
41 }
42
43 static __inline__ int platform_test_xfs_path(const char *path)
44 {
45 struct statfs buf;
46 if (statfs(path, &buf) < 0)
47 return 0;
48 return (buf.f_type == 0x58465342); /* XFSB */
49 }
50
51 static __inline__ int platform_fstatfs(int fd, struct statfs *buf)
52 {
53 return fstatfs(fd, buf);
54 }
55
56 static __inline__ void platform_getoptreset(void)
57 {
58 extern int optind;
59 optind = 0;
60 }
61
62 #ifndef O_DIRECT
63 # if defined (__powerpc__)
64 # define O_DIRECT 0400000
65 # elif defined (__sparc__)
66 # define O_DIRECT 0x100000
67 # endif
68 #endif
69
70 #if (__GLIBC__ < 2) || ((__GLIBC__ == 2) && (__GLIBC_MINOR__ <= 1))
71 # define constpp const char * const *
72 #else
73 # define constpp char * const *
74 #endif
75
76 #define ENOATTR ENODATA /* Attribute not found */
77 #define EFSCORRUPTED 990 /* Filesystem is corrupted */
78
79 typedef loff_t xfs_off_t;
80 typedef __uint64_t xfs_ino_t;
81 typedef __uint32_t xfs_dev_t;
82 typedef __int64_t xfs_daddr_t;
83 typedef char* xfs_caddr_t;
84
85 #ifndef _UCHAR_T_DEFINED
86 typedef unsigned char uchar_t;
87 #define _UCHAR_T_DEFINED 1
88 #endif
89
90 #ifndef _BOOLEAN_T_DEFINED
91 typedef enum {B_FALSE, B_TRUE} boolean_t;
92 #define _BOOLEAN_T_DEFINED 1
93 #endif
94
95 #endif /* __XFS_IRIX_H__ */