github.com/buildpacks/pack@v0.33.3-0.20240516162812-884dd1837311/pkg/archive/archive_unix.go (about)

     1  //go:build linux || darwin
     2  
     3  package archive
     4  
     5  import (
     6  	"os"
     7  	"syscall"
     8  )
     9  
    10  // hasHardlinks check if the given files has a hard-link associated with it
    11  func hasHardlinks(fi os.FileInfo, path string) (bool, error) {
    12  	return fi.Sys().(*syscall.Stat_t).Nlink > 1, nil
    13  }
    14  
    15  // getInodeFromStat returns the inode (index node) value associated with the given file
    16  func getInodeFromStat(stat interface{}, path string) (inode uint64, err error) {
    17  	s, ok := stat.(*syscall.Stat_t)
    18  	if ok {
    19  		inode = s.Ino
    20  	}
    21  	return
    22  }