Skip to content

Commit

Permalink
build: add linkinfo_freebsd.go
Browse files Browse the repository at this point in the history
  • Loading branch information
zze0s committed Dec 10, 2024
1 parent 9d559f3 commit c19f4ee
Showing 1 changed file with 19 additions and 0 deletions.
19 changes: 19 additions & 0 deletions hardlinkfilemap/linkinfo_freebsd.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
package hardlinkfilemap

import (
"errors"
"os"
"strconv"
"syscall"
)

func LinkInfo(fi os.FileInfo, _ string) (string, uint64, error) {
sys, ok := fi.Sys().(*syscall.Stat_t)
if !ok {
return "", 0, errors.New("failed to get file identifier")
}

return strconv.FormatUint(sys.Dev, 10) + "|" + strconv.FormatUint(sys.Ino, 10),
uint64(sys.Nlink),
nil
}

0 comments on commit c19f4ee

Please sign in to comment.