This fixes build error on mac.

Signed-off-by: Jaegeuk Kim <jaeg...@kernel.org>
---
 configure.ac |  1 +
 fsck/f2fs.h  |  3 +++
 fsck/main.c  | 14 +++++++++++++-
 3 files changed, 17 insertions(+), 1 deletion(-)

diff --git a/configure.ac b/configure.ac
index 9b0e872..9ac0c24 100644
--- a/configure.ac
+++ b/configure.ac
@@ -93,6 +93,7 @@ AC_CHECK_HEADERS(m4_flatten([
        linux/posix_acl.h
        linux/types.h
        linux/xattr.h
+       mach/mach_time.h
        mntent.h
        scsi/sg.h
        stdlib.h
diff --git a/fsck/f2fs.h b/fsck/f2fs.h
index 55d6b07..2a00d35 100644
--- a/fsck/f2fs.h
+++ b/fsck/f2fs.h
@@ -22,6 +22,9 @@
 #ifdef HAVE_MNTENT_H
 #include <mntent.h>
 #endif
+#ifdef HAVE_MACH_TIME_H
+#include <mach/mach_time.h>
+#endif
 #include <sys/stat.h>
 #include <sys/ioctl.h>
 #include <sys/mount.h>
diff --git a/fsck/main.c b/fsck/main.c
index c481ce4..9a1596f 100644
--- a/fsck/main.c
+++ b/fsck/main.c
@@ -801,12 +801,24 @@ static int do_sload(struct f2fs_sb_info *sbi)
        return f2fs_sload(sbi);
 }
 
-static u64 get_boottime_ns() {
+#if defined(__APPLE__)
+static u64 get_boottime_ns()
+{
+#ifdef HAVE_MACH_TIME_H
+       return mach_absolute_time();
+#else
+       return 0;
+#endif
+}
+#else
+static u64 get_boottime_ns()
+{
        struct timespec t;
        t.tv_sec = t.tv_nsec = 0;
        clock_gettime(CLOCK_BOOTTIME, &t);
        return (u64)t.tv_sec * 1000000000LL + t.tv_nsec;
 }
+#endif
 
 int main(int argc, char **argv)
 {
-- 
2.26.0.rc2.310.g2932bb562d-goog



_______________________________________________
Linux-f2fs-devel mailing list
Linux-f2fs-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/linux-f2fs-devel

Reply via email to