fec: enable building on Mac
Enable the host libfec and the fec tool to be built on Mac with the
help of <utils/Compat.h>.
Change-Id: I5e7c9fac11f4a00814bad92734e703ec8dc22dc9
diff --git a/libfec/fec_open.cpp b/libfec/fec_open.cpp
index f25aa7f..1923406 100644
--- a/libfec/fec_open.cpp
+++ b/libfec/fec_open.cpp
@@ -14,7 +14,6 @@
* limitations under the License.
*/
-#include <linux/fs.h>
#include <stdlib.h>
#include <sys/ioctl.h>
#include <sys/stat.h>
@@ -24,6 +23,14 @@
#include <ext4_sb.h>
}
+#if defined(__linux__)
+ #include <linux/fs.h>
+#elif defined(__APPLE__)
+ #include <sys/disk.h>
+ #define BLKGETSIZE64 DKIOCGETBLOCKCOUNT
+ #define fdatasync(fd) fcntl((fd), F_FULLFSYNC)
+#endif
+
#include "fec_private.h"
/* used by `find_offset'; returns metadata size for a file size `size' and