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>
This commit is contained in:
Jaegeuk Kim 2020-04-01 13:24:38 -07:00
parent 9a31cefa29
commit 46df2dff65
3 changed files with 17 additions and 1 deletions

View File

@ -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

View File

@ -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>

View File

@ -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)
{