Page MenuHomeFreeBSD

kern: rtc: offer an _early and _late split for inittodr()
Needs ReviewPublic

Authored by kevans on Wed, Jun 10, 4:28 PM.

Details

Summary

Some code that runs at VFS_MOUNT() time (explained in the follow-up)
may benefit from having reasonable timestamps if we can offer them. The
existing inittodr() implementation won't touch the clock if we did get
a good time from the RTC, so we'll move the attempt to set the RTC up
in a subsequent change, and fallback to using time from the fs if we
still need to.

The KPI here was designed to try and avoid losing some flexibility from
inittodr(); the cookie is larger than it needs to be in case we want to
pass more context between the two calls later, but it's only used now
to indicate that we actually set the time.

Diff Detail

Repository
rG FreeBSD src repository
Lint
Lint Passed
Unit
No Test Coverage
Build Status
Buildable 73809
Build 70692: arc lint + arc unit

Event Timeline

sys/kern/subr_rtc.c
338

This comment should go into _late? But then, is it accurate at all: whatever error is reported, there is the printf.

374

After the MPASS(tv_sec >= 0) in _early, could this check become == 0?

sys/kern/subr_rtc.c
374

We're assuming here that base is completely different (e.g., sourced from UFS/ZFS) -- the asserted path would have taken the early return here in _late, but maybe the base name could be better. I'm also unsure if the model where we always call _late and let it sort out whether there's any extra work to be done from the cookie is worth doing -- maybe it'd be better to rename these functions altogether, and you only call this one if _early returns non-zero.