]>
git.ipfire.org Git - thirdparty/xfsprogs-dev.git/blob - include/linux.h
2 * Copyright (c) 2004-2005 Silicon Graphics, Inc. All Rights Reserved.
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.
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.
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
17 #ifndef __XFS_LINUX_H__
18 #define __XFS_LINUX_H__
20 #include <uuid/uuid.h>
22 #include <sys/ioctl.h>
23 #include <sys/param.h>
24 #include <sys/sysmacros.h>
29 static __inline__
int xfsctl(const char *path
, int fd
, int cmd
, void *p
)
31 return ioctl(fd
, cmd
, p
);
34 static __inline__
int platform_test_xfs_fd(int fd
)
37 if (fstatfs(fd
, &buf
) < 0)
39 return (buf
.f_type
== 0x58465342); /* XFSB */
42 static __inline__
int platform_test_xfs_path(const char *path
)
45 if (statfs(path
, &buf
) < 0)
47 return (buf
.f_type
== 0x58465342); /* XFSB */
50 static __inline__
int platform_fstatfs(int fd
, struct statfs
*buf
)
52 return fstatfs(fd
, buf
);
55 static __inline__
void platform_getoptreset(void)
61 static __inline__
int platform_uuid_compare(uuid_t
*uu1
, uuid_t
*uu2
)
63 return uuid_compare(*uu1
, *uu2
);
66 static __inline__
void platform_uuid_unparse(uuid_t
*uu
, char *buffer
)
68 uuid_unparse(*uu
, buffer
);
71 static __inline__
int platform_uuid_parse(char *buffer
, uuid_t
*uu
)
73 return uuid_parse(buffer
, *uu
);
76 static __inline__
int platform_uuid_is_null(uuid_t
*uu
)
78 return uuid_is_null(*uu
);
81 static __inline__
void platform_uuid_generate(uuid_t
*uu
)
86 static __inline__
void platform_uuid_clear(uuid_t
*uu
)
91 static __inline__
void platform_uuid_copy(uuid_t
*dst
, uuid_t
*src
)
93 uuid_copy(*dst
, *src
);
97 #define BLKDISCARD _IO(0x12,119)
100 static __inline__
int
101 platform_discard_blocks(int fd
, uint64_t start
, uint64_t len
)
103 __uint64_t range
[2] = { start
, len
};
105 if (ioctl(fd
, BLKDISCARD
, &range
) < 0)
110 #if (__GLIBC__ < 2) || ((__GLIBC__ == 2) && (__GLIBC_MINOR__ <= 1))
111 # define constpp const char * const *
113 # define constpp char * const *
116 #define ENOATTR ENODATA /* Attribute not found */
117 #define EFSCORRUPTED EUCLEAN /* Filesystem is corrupted */
119 typedef loff_t xfs_off_t
;
120 typedef __uint64_t xfs_ino_t
;
121 typedef __uint32_t xfs_dev_t
;
122 typedef __int64_t xfs_daddr_t
;
123 typedef char* xfs_caddr_t
;
125 #ifndef _UCHAR_T_DEFINED
126 typedef unsigned char uchar_t
;
127 #define _UCHAR_T_DEFINED 1
130 #ifndef _BOOLEAN_T_DEFINED
131 typedef enum {B_FALSE
, B_TRUE
} boolean_t
;
132 #define _BOOLEAN_T_DEFINED 1
135 #endif /* __XFS_LINUX_H__ */