Files
sfdupes/scan_dev_darwin.go
sneak 4b1c3cbf70
All checks were successful
check / check (push) Successful in 4s
Make scan paths required operands; add -x/--one-file-system
scan now takes one or more PATH operands (directories or regular
files) via cobra flags instead of the -root flag with its /srv
default; invoking scan with no operand is a usage error and a
nonexistent operand is fatal. Filesystem boundaries are crossed by
default; the new -x/--one-file-system flag (GNU du/rsync convention)
stops the walk at each operand's filesystem, implemented by comparing
lstat device IDs with build-tagged helpers for darwin's int32 Dev.
Verified against a real mounted disk image: default crosses, -x does
not, --one-file-system is identical to -x.
2026-07-23 08:55:17 +07:00

15 lines
391 B
Go

//go:build darwin
package main
import "syscall"
// statDev returns the filesystem device ID of st as uint64. Device IDs
// are opaque; the conversion only needs to be consistent so equality
// comparisons work, not numerically meaningful.
//
//nolint:gosec // int32 device IDs convert consistently; only equality matters
func statDev(st *syscall.Stat_t) uint64 {
return uint64(st.Dev)
}