]> git.ipfire.org Git - thirdparty/xfsprogs-dev.git/blob - include/gnukfreebsd.h
xfsprogs: remove xfs_caddr_t
[thirdparty/xfsprogs-dev.git] / include / gnukfreebsd.h
1 /*
2 * Copyright (c) 2004-2006 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_KFREEBSD_H__
19 #define __XFS_KFREEBSD_H__
20
21 #include <uuid/uuid.h>
22 #include <sys/vfs.h>
23 #include <sys/ioctl.h>
24 #include <sys/sysmacros.h>
25 #include <malloc.h>
26 #include <getopt.h>
27 #include <endian.h>
28 #include <sys/stat.h>
29 #include <sys/param.h>
30 #include <sys/mount.h>
31 #include <ctype.h>
32 #include <libgen.h>
33 #include <paths.h>
34 #include "xfs/swab.h"
35
36 #define constpp char * const *
37
38 #define EFSCORRUPTED 990 /* Filesystem is corrupted */
39 #define EFSBADCRC 991 /* Bad CRC detected */
40
41 typedef off_t xfs_off_t;
42 typedef __uint64_t xfs_ino_t;
43 typedef __uint32_t xfs_dev_t;
44 typedef __int64_t xfs_daddr_t;
45
46 #define HAVE_FID 1
47
48 static __inline__ int xfsctl(const char *path, int fd, int cmd, void *p)
49 {
50 return ioctl(fd, cmd, p);
51 }
52
53 static __inline__ int platform_test_xfs_fd(int fd)
54 {
55 struct statfs buf;
56 if (fstatfs(fd, &buf) < 0)
57 return 0;
58 return strncmp(buf.f_fstypename, "xfs", 4) == 0;
59 }
60
61 static __inline__ int platform_test_xfs_path(const char *path)
62 {
63 struct statfs buf;
64 if (statfs(path, &buf) < 0)
65 return 0;
66 return strncmp(buf.f_fstypename, "xfs", 4) == 0;
67 }
68
69 static __inline__ int platform_fstatfs(int fd, struct statfs *buf)
70 {
71 return fstatfs(fd, buf);
72 }
73
74 static __inline__ void platform_getoptreset(void)
75 {
76 extern int optind;
77 optind = 0;
78 }
79
80 static __inline__ int platform_uuid_compare(uuid_t *uu1, uuid_t *uu2)
81 {
82 return uuid_compare(*uu1, *uu2);
83 }
84
85 static __inline__ void platform_uuid_unparse(uuid_t *uu, char *buffer)
86 {
87 uuid_unparse(*uu, buffer);
88 }
89
90 static __inline__ int platform_uuid_parse(char *buffer, uuid_t *uu)
91 {
92 return uuid_parse(buffer, *uu);
93 }
94
95 static __inline__ int platform_uuid_is_null(uuid_t *uu)
96 {
97 return uuid_is_null(*uu);
98 }
99
100 static __inline__ void platform_uuid_generate(uuid_t *uu)
101 {
102 uuid_generate(*uu);
103 }
104
105 static __inline__ void platform_uuid_clear(uuid_t *uu)
106 {
107 uuid_clear(*uu);
108 }
109
110 static __inline__ void platform_uuid_copy(uuid_t *dst, uuid_t *src)
111 {
112 uuid_copy(*dst, *src);
113 }
114
115 static __inline__ int
116 platform_discard_blocks(int fd, uint64_t start, uint64_t len)
117 {
118 return 0;
119 }
120
121 #endif /* __XFS_KFREEBSD_H__ */