diff options
Diffstat (limited to 'internal/scan/fileid_unix.go')
| -rw-r--r-- | internal/scan/fileid_unix.go | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/internal/scan/fileid_unix.go b/internal/scan/fileid_unix.go new file mode 100644 index 0000000..e29066a --- /dev/null +++ b/internal/scan/fileid_unix.go @@ -0,0 +1,19 @@ +// SPDX-License-Identifier: GPL-3.0-or-later + +//go:build unix + +package scan + +import ( + "io/fs" + "syscall" +) + +// fileID returns the device and inode info was read from. +func fileID(info fs.FileInfo) (dev, ino uint64) { + st, ok := info.Sys().(*syscall.Stat_t) + if !ok { + return 0, 0 + } + return uint64(st.Dev), uint64(st.Ino) +} |
