diff options
author | Jaegeuk Kim <jaegeuk@kernel.org> | 2020-04-01 13:24:38 -0700 |
---|---|---|
committer | Jaegeuk Kim <jaegeuk@kernel.org> | 2020-04-15 13:56:29 -0700 |
commit | 46df2dff65deec915ae2a5643435da8250fd24ff (patch) | |
tree | 9b56cc33408c23097a4d7211f521467a3b52751b | |
parent | 9a31cefa29666a219f8b4d328074a6afe6265c4e (diff) | |
download | f2fs-tools-46df2dff65deec915ae2a5643435da8250fd24ff.tar.gz |
fsck.f2fs: quick fix of CLOCK_BOOTTIME in mac
This fixes build error on mac.
Reviewed-by: Chao Yu <yuchao0@huawei.com>
Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
-rw-r--r-- | configure.ac | 1 | ||||
-rw-r--r-- | fsck/f2fs.h | 3 | ||||
-rw-r--r-- | fsck/main.c | 14 |
3 files changed, 17 insertions, 1 deletions
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) { |