mirror of
https://gitee.com/openharmony/third_party_f2fs-tools
synced 2024-11-26 19:51:32 +00:00
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:
parent
9a31cefa29
commit
46df2dff65
@ -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
|
||||
|
@ -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>
|
||||
|
14
fsck/main.c
14
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)
|
||||
{
|
||||
|
Loading…
Reference in New Issue
Block a user