Page MenuHomeFreeBSD

restore: Preserve timestamps to the nanosecond
ClosedPublic

Authored by jilles on Mar 6 2015, 11:02 PM.
Tags
None
Referenced Files
Unknown Object (File)
Tue, Apr 30, 8:45 PM
Unknown Object (File)
Tue, Apr 30, 8:42 PM
Unknown Object (File)
Sun, Apr 28, 9:30 PM
Unknown Object (File)
Mar 22 2024, 10:32 PM
Unknown Object (File)
Mar 22 2024, 10:32 PM
Unknown Object (File)
Mar 22 2024, 10:32 PM
Unknown Object (File)
Mar 8 2024, 12:46 PM
Unknown Object (File)
Jan 9 2024, 2:06 PM
Subscribers

Details

Summary

It appears that sbin/restore already knows the full-resolution timestamps,
so the only thing to do is to stop converting the timespecs to timevals
and use futimens() and utimensat().

Test Plan

Dump and restore a small UFS image with a few file types in it.

Diff Detail

Repository
rS FreeBSD src repository - subversion
Lint
Lint Skipped
Unit
Tests Skipped

Event Timeline

jilles retitled this revision from to restore: Preserve timestamps to the nanosecond.
jilles updated this object.
jilles edited the test plan for this revision. (Show Details)

Looks fine to me. I only have one tangential question: have you thought about making convenience wrappers in libc for utimens() and lutimens() that would call utimensat() with the respective flags?

In D2020#3, @jhb wrote:

Looks fine to me.

Thanks.

I only have one tangential question: have you thought about making convenience wrappers in libc for utimens() and lutimens() that would call utimensat() with the respective flags?

I don't think the benefit (fewer parameters to functions) is worth the cost (more functions, non-standard functions) here. Also, utilities like touch actually benefit from the flag parameter, since it replaces multiple function pointers (stat/lstat and utimes/lutimes) with one flag variable (0/AT_SYMLINK_NOFOLLOW).

jilles updated this revision to Diff 4223.

Closed by commit rS279986 (authored by @jilles).