datastore: use libc's timespec constants instead of redefinition

Use the UTIME_NOW and UTIME_OMIT constants defined in libc crate
instead of redefining them. This improves consistency, as utimesat
and its timespec parameter are also defined via the libc crate.

Signed-off-by: Christian Ebner <c.ebner@proxmox.com>
This commit is contained in:
Christian Ebner 2025-03-04 19:35:40 +01:00 committed by Fabian Grünbichler
parent 62ff4f2472
commit f098814876

View File

@ -220,19 +220,16 @@ impl ChunkStore {
// unwrap: only `None` in unit tests
assert!(self.locker.is_some());
const UTIME_NOW: i64 = (1 << 30) - 1;
const UTIME_OMIT: i64 = (1 << 30) - 2;
let times: [libc::timespec; 2] = [
// access time -> update to now
libc::timespec {
tv_sec: 0,
tv_nsec: UTIME_NOW,
tv_nsec: libc::UTIME_NOW,
},
// modification time -> keep as is
libc::timespec {
tv_sec: 0,
tv_nsec: UTIME_OMIT,
tv_nsec: libc::UTIME_OMIT,
},
];