]> git.ipfire.org Git - thirdparty/xfsprogs-dev.git/blob - include/darwin.h
Merge back recent changes from xfs kernel headers.
[thirdparty/xfsprogs-dev.git] / include / darwin.h
1 /*
2 * Copyright (c) 2004-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 #ifndef __XFS_DARWIN_H__
19 #define __XFS_DARWIN_H__
20
21 #include <uuid/uuid.h>
22 #include <libgen.h>
23 #include <sys/vm.h>
24 #include <sys/stat.h>
25 #include <sys/ioctl.h>
26 #include <sys/mount.h>
27
28 #include <sys/syscall.h>
29 # ifndef SYS_fsctl
30 # define SYS_fsctl 242
31 # endif
32 static __inline__ int xfsctl(const char *path, int fd, int cmd, void *p)
33 {
34 return syscall(SYS_fsctl, path, cmd, p, 0);
35 }
36
37 static __inline__ int platform_test_xfs_fd(int fd)
38 {
39 struct statfs buf;
40 if (fstatfs(fd, &buf) < 0)
41 return 0;
42 return (strcmp(buf.f_fstypename, "xfs") == 0);
43 }
44
45 static __inline__ int platform_test_xfs_path(const char *path)
46 {
47 struct statfs buf;
48 if (statfs(path, &buf) < 0)
49 return 0;
50 return (strcmp(buf.f_fstypename, "xfs") == 0);
51 }
52
53 static __inline__ int platform_fstatfs(int fd, struct statfs *buf)
54 {
55 return fstatfs(fd, buf);
56 }
57
58 static __inline__ void platform_getoptreset(void)
59 {
60 extern int optreset;
61 optreset = 0;
62 }
63
64 #define __int8_t int8_t
65 #define __int16_t int16_t
66 #define __int32_t int32_t
67 #define __int32_t int32_t
68 #define __int64_t int64_t
69 #define __uint8_t u_int8_t
70 #define __uint16_t u_int16_t
71 #define __uint32_t u_int32_t
72 #define __uint64_t u_int64_t
73 #define __s8 int8_t
74 #define __s16 int16_t
75 #define __s32 int32_t
76 #define __s64 int64_t
77 #define __u8 u_int8_t
78 #define __u16 u_int16_t
79 #define __u32 u_int32_t
80 #define __u64 u_int64_t
81 #define loff_t off_t
82 #define off64_t off_t
83
84 typedef off_t xfs_off_t;
85 typedef u_int64_t xfs_ino_t;
86 typedef u_int32_t xfs_dev_t;
87 typedef int64_t xfs_daddr_t;
88 typedef char* xfs_caddr_t;
89
90 typedef unsigned char uchar_t;
91 #define stat64 stat
92 #define fstat64 fstat
93 #define lseek64 lseek
94 #define pread64 pread
95 #define pwrite64 pwrite
96 #define ftruncate64 ftruncate
97 #define fdatasync fsync
98 #define memalign(a,sz) valloc(sz)
99
100 #include <machine/endian.h>
101 #define __BYTE_ORDER BYTE_ORDER
102 #define __BIG_ENDIAN BIG_ENDIAN
103 #define __LITTLE_ENDIAN LITTLE_ENDIAN
104 #include <xfs/swab.h>
105
106 #define O_LARGEFILE 0
107 #ifndef O_DIRECT
108 #define O_DIRECT 0
109 #endif
110 #ifndef O_SYNC
111 #define O_SYNC 0
112 #endif
113
114 #define B_FALSE 0
115 #define B_TRUE 1
116
117 #define ENOATTR 989 /* Attribute not found */
118 #define EFSCORRUPTED 990 /* Filesystem is corrupted */
119 #define constpp char * const *
120
121 #define HAVE_FID 1
122
123 #endif /* __XFS_DARWIN_H__ */