]>
git.ipfire.org Git - thirdparty/xfsprogs-dev.git/blob - include/gnukfreebsd.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_KFREEBSD_H__
19 #define __XFS_KFREEBSD_H__
21 #include <uuid/uuid.h>
23 #include <sys/ioctl.h>
24 #include <sys/sysmacros.h>
29 #include <sys/param.h>
30 #include <sys/mount.h>
36 #define EFSCORRUPTED 990 /* Filesystem is corrupted */
37 #define EFSBADCRC 991 /* Bad CRC detected */
39 typedef unsigned char __u8
;
40 typedef signed char __s8
;
41 typedef unsigned short __u16
;
42 typedef signed short __s16
;
43 typedef unsigned int __u32
;
44 typedef signed int __s32
;
45 typedef unsigned long long int __u64
;
46 typedef signed long long int __s64
;
48 typedef off_t xfs_off_t
;
49 typedef uint64_t xfs_ino_t
;
50 typedef uint32_t xfs_dev_t
;
51 typedef int64_t xfs_daddr_t
;
52 typedef __u32 xfs_nlink_t
;
56 static __inline__
int xfsctl(const char *path
, int fd
, int cmd
, void *p
)
58 return ioctl(fd
, cmd
, p
);
61 static __inline__
int platform_test_xfs_fd(int fd
)
64 if (fstatfs(fd
, &buf
) < 0)
66 return strncmp(buf
.f_fstypename
, "xfs", 4) == 0;
69 static __inline__
int platform_test_xfs_path(const char *path
)
72 if (statfs(path
, &buf
) < 0)
74 return strncmp(buf
.f_fstypename
, "xfs", 4) == 0;
77 static __inline__
int platform_fstatfs(int fd
, struct statfs
*buf
)
79 return fstatfs(fd
, buf
);
82 static __inline__
void platform_getoptreset(void)
88 static __inline__
int platform_uuid_compare(uuid_t
*uu1
, uuid_t
*uu2
)
90 return uuid_compare(*uu1
, *uu2
);
93 static __inline__
void platform_uuid_unparse(uuid_t
*uu
, char *buffer
)
95 uuid_unparse(*uu
, buffer
);
98 static __inline__
int platform_uuid_parse(char *buffer
, uuid_t
*uu
)
100 return uuid_parse(buffer
, *uu
);
103 static __inline__
int platform_uuid_is_null(uuid_t
*uu
)
105 return uuid_is_null(*uu
);
108 static __inline__
void platform_uuid_generate(uuid_t
*uu
)
113 static __inline__
void platform_uuid_clear(uuid_t
*uu
)
118 static __inline__
void platform_uuid_copy(uuid_t
*dst
, uuid_t
*src
)
120 uuid_copy(*dst
, *src
);
123 static __inline__
int
124 platform_discard_blocks(int fd
, uint64_t start
, uint64_t len
)
130 * Abstraction of mountpoints.
132 struct mntent_cursor
{
136 static inline int platform_mntent_open(struct mntent_cursor
* cursor
, char *mtab
)
138 cursor
->mtabp
= setmntent(mtab
, "r");
139 if (!cursor
->mtabp
) {
140 fprintf(stderr
, "Error: cannot read %s\n", mtab
);
146 static inline struct mntent
* platform_mntent_next(struct mntent_cursor
* cursor
)
148 return getmntent(cursor
->mtabp
);
151 static inline void platform_mntent_close(struct mntent_cursor
* cursor
)
153 endmntent(cursor
->mtabp
);
156 #endif /* __XFS_KFREEBSD_H__ */