]>
git.ipfire.org Git - thirdparty/xfsprogs-dev.git/blob - include/darwin.h
2 * Copyright (c) 2004-2006 Silicon Graphics, Inc.
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.
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.
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
18 #ifndef __XFS_DARWIN_H__
19 #define __XFS_DARWIN_H__
21 #include <uuid/uuid.h>
25 #include <sys/ioctl.h>
26 #include <sys/mount.h>
28 #include <machine/endian.h>
29 #define __BYTE_ORDER BYTE_ORDER
30 #define __BIG_ENDIAN BIG_ENDIAN
31 #define __LITTLE_ENDIAN LITTLE_ENDIAN
33 #include <sys/syscall.h>
35 # define SYS_fsctl 242
37 static __inline__
int xfsctl(const char *path
, int fd
, int cmd
, void *p
)
39 return syscall(SYS_fsctl
, path
, cmd
, p
, 0);
42 static __inline__
int platform_test_xfs_fd(int fd
)
45 if (fstatfs(fd
, &buf
) < 0)
47 return strncmp(buf
.f_fstypename
, "xfs", 4) == 0;
50 static __inline__
int platform_test_xfs_path(const char *path
)
53 if (statfs(path
, &buf
) < 0)
55 return strncmp(buf
.f_fstypename
, "xfs", 4) == 0;
58 static __inline__
int platform_fstatfs(int fd
, struct statfs
*buf
)
60 return fstatfs(fd
, buf
);
63 static __inline__
void platform_getoptreset(void)
69 static __inline__
int platform_uuid_compare(uuid_t
*uu1
, uuid_t
*uu2
)
71 return uuid_compare(uu1
, uu2
, NULL
);
74 static __inline__
void platform_uuid_unparse(uuid_t
*uu
, char *buffer
)
78 uuid_to_string(uu
, &s
, &status
);
79 if (status
== uuid_s_ok
)
81 else buffer
[0] = '\0';
85 static __inline__
int platform_uuid_parse(char *buffer
, uuid_t
*uu
)
88 uuid_from_string(buffer
, uu
, &status
);
89 return (status
== uuid_s_ok
);
92 static __inline__
int platform_uuid_is_null(uuid_t
*uu
)
94 return uuid_is_nil(uu
, NULL
);
97 static __inline__
void platform_uuid_generate(uuid_t
*uu
)
99 uuid_create(uu
, NULL
);
102 static __inline__
void platform_uuid_clear(uuid_t
*uu
)
104 uuid_create_nil(uu
, NULL
);
107 static __inline__
void platform_uuid_copy(uuid_t
*dst
, uuid_t
*src
)
109 memcpy(dst
, src
, sizeof(uuid_t
));
112 #define __int8_t int8_t
113 #define __int16_t int16_t
114 #define __int32_t int32_t
115 #define __int32_t int32_t
116 #define __int64_t int64_t
117 #define __uint8_t u_int8_t
118 #define __uint16_t u_int16_t
119 #define __uint32_t u_int32_t
120 #define __uint64_t u_int64_t
122 #define off64_t off_t
124 typedef off_t xfs_off_t
;
125 typedef u_int64_t xfs_ino_t
;
126 typedef u_int32_t xfs_dev_t
;
127 typedef int64_t xfs_daddr_t
;
128 typedef char* xfs_caddr_t
;
131 #define fstat64 fstat
132 #define lseek64 lseek
133 #define pread64 pread
134 #define pwrite64 pwrite
135 #define ftruncate64 ftruncate
136 #define fdatasync fsync
137 #define memalign(a,sz) valloc(sz)
139 #define O_LARGEFILE 0
147 #define ENOATTR 989 /* Attribute not found */
148 #define EFSCORRUPTED 990 /* Filesystem is corrupted */
149 #define EFSBADCRC 991 /* Bad CRC detected */
150 #define constpp char * const *
154 static __inline__
int
155 platform_discard_blocks(int fd
, uint64_t start
, uint64_t len
)
160 #endif /* __XFS_DARWIN_H__ */