linux-f2fs-devel.lists.sourceforge.net archive mirror
 help / color / mirror / Atom feed
From: Jaegeuk Kim <jaegeuk@kernel.org>
To: linux-f2fs-devel@lists.sourceforge.net
Cc: Jaegeuk Kim <jaegeuk@kernel.org>
Subject: [f2fs-dev] [PATCH] fsck.f2fs: quick fix of CLOCK_BOOTTIME in mac
Date: Mon, 13 Apr 2020 09:19:20 -0700	[thread overview]
Message-ID: <20200413161920.40604-1-jaegeuk@kernel.org> (raw)

This fixes build error on mac.

Signed-off-by: Jaegeuk Kim <jaegeuk@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.110.g2183baf09c-goog



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

             reply	other threads:[~2020-04-13 16:19 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-04-13 16:19 Jaegeuk Kim [this message]
2020-04-15  6:24 ` [f2fs-dev] [PATCH] fsck.f2fs: quick fix of CLOCK_BOOTTIME in mac Chao Yu
  -- strict thread matches above, loose matches on Subject: below --
2020-04-01 20:33 Jaegeuk Kim

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20200413161920.40604-1-jaegeuk@kernel.org \
    --to=jaegeuk@kernel.org \
    --cc=linux-f2fs-devel@lists.sourceforge.net \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).