* [PATCH] f2fs-tools: fall back to the original version check when clock_gettime is not supported
@ 2021-09-28 20:46 Daeho Jeong
2021-09-28 20:58 ` Jaegeuk Kim
2021-10-13 15:22 ` [f2fs-dev] " Chao Yu
0 siblings, 2 replies; 3+ messages in thread
From: Daeho Jeong @ 2021-09-28 20:46 UTC (permalink / raw)
To: linux-kernel, linux-f2fs-devel, kernel-team; +Cc: Daeho Jeong
From: Daeho Jeong <daehojeong@google.com>
In lower versions than macOS 10.12, they don't support clock_gettime
function. It breaks the build, so we need to fall back to the original
kernel version check algorithm, in that case.
Signed-off-by: Daeho Jeong <daehojeong@google.com>
---
fsck/mount.c | 11 +++++++++++
1 file changed, 11 insertions(+)
diff --git a/fsck/mount.c b/fsck/mount.c
index 7c4c681..c928a15 100644
--- a/fsck/mount.c
+++ b/fsck/mount.c
@@ -975,6 +975,16 @@ int validate_super_block(struct f2fs_sb_info *sbi, enum SB_ADDR sb_addr)
MSG(0, "Info: MKFS version\n \"%s\"\n", c.init_version);
MSG(0, "Info: FSCK version\n from \"%s\"\n to \"%s\"\n",
c.sb_version, c.version);
+#if defined(__APPLE__)
+ if (!c.no_kernel_check &&
+ memcmp(c.sb_version, c.version, VERSION_NAME_LEN)) {
+ c.auto_fix = 0;
+ c.fix_on = 1;
+ memcpy(sbi->raw_super->version,
+ c.version, VERSION_NAME_LEN);
+ update_superblock(sbi->raw_super, SB_MASK(sb_addr));
+ }
+#else
if (!c.no_kernel_check) {
struct timespec t;
u32 prev_time, cur_time, time_diff;
@@ -1007,6 +1017,7 @@ int validate_super_block(struct f2fs_sb_info *sbi, enum SB_ADDR sb_addr)
update_superblock(sbi->raw_super, SB_MASK(sb_addr));
}
out:
+#endif
print_sb_state(sbi->raw_super);
return 0;
}
--
2.33.0.685.g46640cef36-goog
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH] f2fs-tools: fall back to the original version check when clock_gettime is not supported
2021-09-28 20:46 [PATCH] f2fs-tools: fall back to the original version check when clock_gettime is not supported Daeho Jeong
@ 2021-09-28 20:58 ` Jaegeuk Kim
2021-10-13 15:22 ` [f2fs-dev] " Chao Yu
1 sibling, 0 replies; 3+ messages in thread
From: Jaegeuk Kim @ 2021-09-28 20:58 UTC (permalink / raw)
To: Daeho Jeong; +Cc: linux-kernel, linux-f2fs-devel, kernel-team, Daeho Jeong
Merged to address android build breakage.
On 09/28, Daeho Jeong wrote:
> From: Daeho Jeong <daehojeong@google.com>
>
> In lower versions than macOS 10.12, they don't support clock_gettime
> function. It breaks the build, so we need to fall back to the original
> kernel version check algorithm, in that case.
>
> Signed-off-by: Daeho Jeong <daehojeong@google.com>
> ---
> fsck/mount.c | 11 +++++++++++
> 1 file changed, 11 insertions(+)
>
> diff --git a/fsck/mount.c b/fsck/mount.c
> index 7c4c681..c928a15 100644
> --- a/fsck/mount.c
> +++ b/fsck/mount.c
> @@ -975,6 +975,16 @@ int validate_super_block(struct f2fs_sb_info *sbi, enum SB_ADDR sb_addr)
> MSG(0, "Info: MKFS version\n \"%s\"\n", c.init_version);
> MSG(0, "Info: FSCK version\n from \"%s\"\n to \"%s\"\n",
> c.sb_version, c.version);
> +#if defined(__APPLE__)
> + if (!c.no_kernel_check &&
> + memcmp(c.sb_version, c.version, VERSION_NAME_LEN)) {
> + c.auto_fix = 0;
> + c.fix_on = 1;
> + memcpy(sbi->raw_super->version,
> + c.version, VERSION_NAME_LEN);
> + update_superblock(sbi->raw_super, SB_MASK(sb_addr));
> + }
> +#else
> if (!c.no_kernel_check) {
> struct timespec t;
> u32 prev_time, cur_time, time_diff;
> @@ -1007,6 +1017,7 @@ int validate_super_block(struct f2fs_sb_info *sbi, enum SB_ADDR sb_addr)
> update_superblock(sbi->raw_super, SB_MASK(sb_addr));
> }
> out:
> +#endif
> print_sb_state(sbi->raw_super);
> return 0;
> }
> --
> 2.33.0.685.g46640cef36-goog
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [f2fs-dev] [PATCH] f2fs-tools: fall back to the original version check when clock_gettime is not supported
2021-09-28 20:46 [PATCH] f2fs-tools: fall back to the original version check when clock_gettime is not supported Daeho Jeong
2021-09-28 20:58 ` Jaegeuk Kim
@ 2021-10-13 15:22 ` Chao Yu
1 sibling, 0 replies; 3+ messages in thread
From: Chao Yu @ 2021-10-13 15:22 UTC (permalink / raw)
To: Daeho Jeong, linux-kernel, linux-f2fs-devel, kernel-team; +Cc: Daeho Jeong
On 2021/9/29 4:46, Daeho Jeong wrote:
> From: Daeho Jeong <daehojeong@google.com>
>
> In lower versions than macOS 10.12, they don't support clock_gettime
> function. It breaks the build, so we need to fall back to the original
> kernel version check algorithm, in that case.
>
> Signed-off-by: Daeho Jeong <daehojeong@google.com>
Reviewed-by: Chao Yu <chao@kernel.org>
Thanks,
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2021-10-13 15:22 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-09-28 20:46 [PATCH] f2fs-tools: fall back to the original version check when clock_gettime is not supported Daeho Jeong
2021-09-28 20:58 ` Jaegeuk Kim
2021-10-13 15:22 ` [f2fs-dev] " Chao Yu
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).