--- fsr/xfs_fsr.c.orig	2016-12-21 06:36:07.000000000 +0100
+++ fsr/xfs_fsr.c	2017-01-16 15:13:16.077553350 +0100
@@ -36,6 +36,9 @@
 #define _PATH_FSRLAST		"/var/tmp/.fsrlast_xfs"
 #define _PATH_PROC_MOUNTS	"/proc/mounts"
 
+#ifndef _PATH_MOUNTED
+#define _PATH_MOUNTED MOUNTED
+#endif
 
 char *progname;
 
--- include/linux.h.orig	2016-12-21 06:36:07.000000000 +0100
+++ include/linux.h	2017-01-16 15:15:39.600759063 +0100
@@ -40,6 +40,32 @@
 # undef fsxattr
 #endif
 
+#ifndef __uint8_t
+#define __uint8_t uint8_t
+#endif
+#ifndef __uint16_t
+#define __uint16_t uint16_t
+#endif
+#ifndef __uint32_t
+#define __uint32_t uint32_t
+#endif
+#ifndef __uint64_t
+#define __uint64_t uint64_t
+#endif
+
+#ifndef __int8_t
+#define __int8_t int8_t
+#endif
+#ifndef __int16_t
+#define __int16_t int16_t
+#endif
+#ifndef __int32_t
+#define __int32_t int32_t
+#endif
+#ifndef __int64_t
+#define __int64_t int64_t
+#endif
+
 static __inline__ int xfsctl(const char *path, int fd, int cmd, void *p)
 {
 	return ioctl(fd, cmd, p);
--- io/readdir.c.orig	2017-01-05 18:41:55.000000000 +0100
+++ io/readdir.c	2017-01-16 15:19:55.995553687 +0100
@@ -24,6 +24,18 @@
 #include <sys/types.h>
 #include <dirent.h>
 
+#if defined (__linux__)
+#ifndef _DIRENT_HAVE_D_OFF
+#define _DIRENT_HAVE_D_OFF
+#endif
+#ifndef _DIRENT_HAVE_D_RECLEN
+#define _DIRENT_HAVE_D_RECLEN
+#endif
+#ifndef _DIRENT_HAVE_D_TYPE
+#define _DIRENT_HAVE_D_TYPE
+#endif
+#endif
+
 static struct cmdinfo readdir_cmd;
 
 const char *d_type_str(unsigned int type)
