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, Dec 18, 4:11 AM
Unknown Object (File)
Wed, Dec 18, 3:21 AM
Unknown Object (File)
Mon, Dec 9, 2:19 AM
Unknown Object (File)
Mon, Dec 2, 12:05 AM
Unknown Object (File)
Mon, Dec 2, 12:05 AM
Unknown Object (File)
Mon, Dec 2, 12:05 AM
Unknown Object (File)
Sun, Dec 1, 11:43 PM
Unknown Object (File)
Nov 20 2024, 4:26 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
No Lint Coverage
Unit
No Test Coverage

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).