]>
git.ipfire.org Git - thirdparty/xfsprogs-dev.git/blob - include/gnukfreebsd.h
1 // SPDX-License-Identifier: LGPL-2.1
3 * Copyright (c) 2004-2006 Silicon Graphics, Inc.
6 #ifndef __XFS_KFREEBSD_H__
7 #define __XFS_KFREEBSD_H__
11 #include <sys/ioctl.h>
12 #include <sys/sysmacros.h>
17 #include <sys/param.h>
18 #include <sys/mount.h>
24 #define EFSCORRUPTED 990 /* Filesystem is corrupted */
25 #define EFSBADCRC 991 /* Bad CRC detected */
27 typedef unsigned char __u8
;
28 typedef signed char __s8
;
29 typedef unsigned short __u16
;
30 typedef signed short __s16
;
31 typedef unsigned int __u32
;
32 typedef signed int __s32
;
33 typedef unsigned long long int __u64
;
34 typedef signed long long int __s64
;
36 typedef off_t xfs_off_t
;
37 typedef uint64_t xfs_ino_t
;
38 typedef uint32_t xfs_dev_t
;
39 typedef int64_t xfs_daddr_t
;
40 typedef __u32 xfs_nlink_t
;
44 static __inline__
int xfsctl(const char *path
, int fd
, int cmd
, void *p
)
46 return ioctl(fd
, cmd
, p
);
49 static __inline__
int platform_test_xfs_fd(int fd
)
52 if (fstatfs(fd
, &buf
) < 0)
54 return strncmp(buf
.f_fstypename
, "xfs", 4) == 0;
57 static __inline__
int platform_test_xfs_path(const char *path
)
60 if (statfs(path
, &buf
) < 0)
62 return strncmp(buf
.f_fstypename
, "xfs", 4) == 0;
65 static __inline__
int platform_fstatfs(int fd
, struct statfs
*buf
)
67 return fstatfs(fd
, buf
);
70 static __inline__
void platform_getoptreset(void)
76 static __inline__
int platform_uuid_compare(uuid_t
*uu1
, uuid_t
*uu2
)
78 return uuid_compare(*uu1
, *uu2
);
81 static __inline__
void platform_uuid_unparse(uuid_t
*uu
, char *buffer
)
83 uuid_unparse(*uu
, buffer
);
86 static __inline__
int platform_uuid_parse(char *buffer
, uuid_t
*uu
)
88 return uuid_parse(buffer
, *uu
);
91 static __inline__
int platform_uuid_is_null(uuid_t
*uu
)
93 return uuid_is_null(*uu
);
96 static __inline__
void platform_uuid_generate(uuid_t
*uu
)
101 static __inline__
void platform_uuid_clear(uuid_t
*uu
)
106 static __inline__
void platform_uuid_copy(uuid_t
*dst
, uuid_t
*src
)
108 uuid_copy(*dst
, *src
);
111 static __inline__
int
112 platform_discard_blocks(int fd
, uint64_t start
, uint64_t len
)
118 * Abstraction of mountpoints.
120 struct mntent_cursor
{
124 static inline int platform_mntent_open(struct mntent_cursor
* cursor
, char *mtab
)
126 cursor
->mtabp
= setmntent(mtab
, "r");
127 if (!cursor
->mtabp
) {
128 fprintf(stderr
, "Error: cannot read %s\n", mtab
);
134 static inline struct mntent
* platform_mntent_next(struct mntent_cursor
* cursor
)
136 return getmntent(cursor
->mtabp
);
139 static inline void platform_mntent_close(struct mntent_cursor
* cursor
)
141 endmntent(cursor
->mtabp
);
144 #endif /* __XFS_KFREEBSD_H__ */