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)
Wed, Nov 20, 4:26 PM
Unknown Object (File)
Oct 13 2024, 4:03 PM
Unknown Object (File)
Oct 11 2024, 6:17 PM
Unknown Object (File)
Oct 11 2024, 6:16 PM
Unknown Object (File)
Oct 11 2024, 6:16 PM
Unknown Object (File)
Oct 11 2024, 5:55 PM
Unknown Object (File)
Sep 16 2024, 2:08 AM
Unknown Object (File)
Sep 9 2024, 1:14 AM
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).