refactor: resolved cross-platform build warnings and add windows-sys features

- Add conditional attributes to silence dead-code warnings on platform-specific code and fields.
- Update target dependencies in pi-walker/Cargo.toml with explicit windows-sys feature sets.
- Simplify time cast expressions in linux_reflink and rcopy modules.
This commit is contained in:
can1357
2026-07-27 17:00:31 +02:00
parent d16a251777
commit 3d9f28dd46
13 changed files with 32 additions and 19 deletions
+2 -8
View File
@@ -248,14 +248,8 @@ mod imp {
fn set_times_nofollow(path: &Path, meta: &fs::Metadata) -> std::io::Result<()> {
let times = [
libc::timespec {
tv_sec: meta.atime() as libc::time_t,
tv_nsec: meta.atime_nsec() as libc::c_long,
},
libc::timespec {
tv_sec: meta.mtime() as libc::time_t,
tv_nsec: meta.mtime_nsec() as libc::c_long,
},
libc::timespec { tv_sec: meta.atime() as _, tv_nsec: meta.atime_nsec() as libc::c_long },
libc::timespec { tv_sec: meta.mtime() as _, tv_nsec: meta.mtime_nsec() as libc::c_long },
];
let c_path = CString::new(path.as_os_str().as_bytes())?;
// SAFETY: `c_path` and `times` live until the syscall returns; the
+4 -5
View File
@@ -413,11 +413,10 @@ fn filetime_set(path: &Path, mtime: std::time::SystemTime) -> std::io::Result<()
let dur = mtime
.duration_since(std::time::UNIX_EPOCH)
.map_err(std::io::Error::other)?;
let times =
[libc::timespec { tv_sec: dur.as_secs() as libc::time_t, tv_nsec: 0 }, libc::timespec {
tv_sec: dur.as_secs() as libc::time_t,
tv_nsec: dur.subsec_nanos() as libc::c_long,
}];
let times = [libc::timespec { tv_sec: dur.as_secs() as _, tv_nsec: 0 }, libc::timespec {
tv_sec: dur.as_secs() as _,
tv_nsec: dur.subsec_nanos() as libc::c_long,
}];
let c_path = std::ffi::CString::new(path.as_os_str().as_bytes())?;
// SAFETY: `c_path` and `times` outlive the syscall; the kernel does
// not retain the pointers.