All of lore.kernel.org
 help / color / mirror / Atom feed
* [f2fs-dev] [PATCH] fsck.f2fs: quick fix of CLOCK_BOOTTIME in mac
@ 2020-04-13 16:19 Jaegeuk Kim
  2020-04-15  6:24 ` Chao Yu
  0 siblings, 1 reply; 3+ messages in thread
From: Jaegeuk Kim @ 2020-04-13 16:19 UTC (permalink / raw)
  To: linux-f2fs-devel; +Cc: Jaegeuk Kim

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

^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [f2fs-dev] [PATCH] fsck.f2fs: quick fix of CLOCK_BOOTTIME in mac
  2020-04-13 16:19 [f2fs-dev] [PATCH] fsck.f2fs: quick fix of CLOCK_BOOTTIME in mac Jaegeuk Kim
@ 2020-04-15  6:24 ` Chao Yu
  0 siblings, 0 replies; 3+ messages in thread
From: Chao Yu @ 2020-04-15  6:24 UTC (permalink / raw)
  To: Jaegeuk Kim, linux-f2fs-devel

On 2020/4/14 0:19, Jaegeuk Kim wrote:
> This fixes build error on mac.
> 
> Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>

Reviewed-by: Chao Yu <yuchao0@huawei.com>

Thanks,


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

^ permalink raw reply	[flat|nested] 3+ messages in thread

* [f2fs-dev] [PATCH] fsck.f2fs: quick fix of CLOCK_BOOTTIME in mac
@ 2020-04-01 20:33 Jaegeuk Kim
  0 siblings, 0 replies; 3+ messages in thread
From: Jaegeuk Kim @ 2020-04-01 20:33 UTC (permalink / raw)
  To: linux-f2fs-devel; +Cc: Jaegeuk Kim

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.rc2.310.g2932bb562d-goog



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

^ permalink raw reply related	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2020-04-15  6:24 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-04-13 16:19 [f2fs-dev] [PATCH] fsck.f2fs: quick fix of CLOCK_BOOTTIME in mac Jaegeuk Kim
2020-04-15  6:24 ` Chao Yu
  -- strict thread matches above, loose matches on Subject: below --
2020-04-01 20:33 Jaegeuk Kim

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.