]>
Commit | Line | Data |
---|---|---|
c0211f67 | 1 | /* |
f302e9e4 | 2 | * Copyright (c) 2004-2005 Silicon Graphics, Inc. All Rights Reserved. |
c0211f67 | 3 | * |
f302e9e4 NS |
4 | * This program is free software; you can redistribute it and/or |
5 | * modify it under the terms of the GNU Lesser General Public License | |
6 | * as published by the Free Software Foundation. | |
c0211f67 | 7 | * |
f302e9e4 NS |
8 | * This program is distributed in the hope that it would be useful, |
9 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | |
10 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
11 | * GNU Lesser General Public License for more details. | |
c0211f67 | 12 | * |
f302e9e4 NS |
13 | * You should have received a copy of the GNU Lesser General Public License |
14 | * along with this program; if not, write the Free Software Foundation, | |
15 | * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA | |
c0211f67 NS |
16 | */ |
17 | #ifndef __XFS_LINUX_H__ | |
18 | #define __XFS_LINUX_H__ | |
19 | ||
20 | #include <uuid/uuid.h> | |
21 | #include <sys/vfs.h> | |
22 | #include <sys/ioctl.h> | |
23 | #include <sys/param.h> | |
25d246df | 24 | #include <sys/sysmacros.h> |
c0211f67 NS |
25 | #include <malloc.h> |
26 | #include <getopt.h> | |
27 | #include <endian.h> | |
c0211f67 NS |
28 | |
29 | static __inline__ int xfsctl(const char *path, int fd, int cmd, void *p) | |
30 | { | |
31 | return ioctl(fd, cmd, p); | |
32 | } | |
33 | ||
34 | static __inline__ int platform_test_xfs_fd(int fd) | |
35 | { | |
36 | struct statfs buf; | |
37 | if (fstatfs(fd, &buf) < 0) | |
38 | return 0; | |
39 | return (buf.f_type == 0x58465342); /* XFSB */ | |
40 | } | |
41 | ||
42 | static __inline__ int platform_test_xfs_path(const char *path) | |
43 | { | |
44 | struct statfs buf; | |
45 | if (statfs(path, &buf) < 0) | |
46 | return 0; | |
47 | return (buf.f_type == 0x58465342); /* XFSB */ | |
48 | } | |
49 | ||
50 | static __inline__ int platform_fstatfs(int fd, struct statfs *buf) | |
51 | { | |
52 | return fstatfs(fd, buf); | |
53 | } | |
54 | ||
55 | static __inline__ void platform_getoptreset(void) | |
56 | { | |
57 | extern int optind; | |
58 | optind = 0; | |
59 | } | |
60 | ||
1552a820 NS |
61 | static __inline__ int platform_uuid_compare(uuid_t *uu1, uuid_t *uu2) |
62 | { | |
63 | return uuid_compare(*uu1, *uu2); | |
64 | } | |
65 | ||
4d32d744 | 66 | static __inline__ void platform_uuid_unparse(uuid_t *uu, char *buffer) |
1552a820 | 67 | { |
4d32d744 NS |
68 | uuid_unparse(*uu, buffer); |
69 | } | |
70 | ||
71 | static __inline__ int platform_uuid_parse(char *buffer, uuid_t *uu) | |
72 | { | |
73 | return uuid_parse(buffer, *uu); | |
1552a820 NS |
74 | } |
75 | ||
76 | static __inline__ int platform_uuid_is_null(uuid_t *uu) | |
77 | { | |
78 | return uuid_is_null(*uu); | |
79 | } | |
c0211f67 | 80 | |
4d32d744 NS |
81 | static __inline__ void platform_uuid_generate(uuid_t *uu) |
82 | { | |
83 | uuid_generate(*uu); | |
84 | } | |
85 | ||
86 | static __inline__ void platform_uuid_clear(uuid_t *uu) | |
87 | { | |
88 | uuid_clear(*uu); | |
89 | } | |
90 | ||
91 | static __inline__ void platform_uuid_copy(uuid_t *dst, uuid_t *src) | |
92 | { | |
93 | uuid_copy(*dst, *src); | |
94 | } | |
95 | ||
c0211f67 NS |
96 | #if (__GLIBC__ < 2) || ((__GLIBC__ == 2) && (__GLIBC_MINOR__ <= 1)) |
97 | # define constpp const char * const * | |
98 | #else | |
99 | # define constpp char * const * | |
100 | #endif | |
101 | ||
102 | #define ENOATTR ENODATA /* Attribute not found */ | |
1552a820 | 103 | #define EFSCORRUPTED EUCLEAN /* Filesystem is corrupted */ |
c0211f67 NS |
104 | |
105 | typedef loff_t xfs_off_t; | |
106 | typedef __uint64_t xfs_ino_t; | |
107 | typedef __uint32_t xfs_dev_t; | |
108 | typedef __int64_t xfs_daddr_t; | |
109 | typedef char* xfs_caddr_t; | |
110 | ||
111 | #ifndef _UCHAR_T_DEFINED | |
112 | typedef unsigned char uchar_t; | |
113 | #define _UCHAR_T_DEFINED 1 | |
114 | #endif | |
115 | ||
116 | #ifndef _BOOLEAN_T_DEFINED | |
117 | typedef enum {B_FALSE, B_TRUE} boolean_t; | |
118 | #define _BOOLEAN_T_DEFINED 1 | |
119 | #endif | |
120 | ||
cb5b3ef4 | 121 | #endif /* __XFS_LINUX_H__ */ |