github.com/ttys3/engine@v17.12.1-ce-rc2+incompatible/pkg/archive/changes_unix.go (about)

     1  // +build !windows
     2  
     3  package archive
     4  
     5  import (
     6  	"os"
     7  	"syscall"
     8  
     9  	"github.com/docker/docker/pkg/system"
    10  	"golang.org/x/sys/unix"
    11  )
    12  
    13  func statDifferent(oldStat *system.StatT, newStat *system.StatT) bool {
    14  	// Don't look at size for dirs, its not a good measure of change
    15  	if oldStat.Mode() != newStat.Mode() ||
    16  		oldStat.UID() != newStat.UID() ||
    17  		oldStat.GID() != newStat.GID() ||
    18  		oldStat.Rdev() != newStat.Rdev() ||
    19  		// Don't look at size for dirs, its not a good measure of change
    20  		(oldStat.Mode()&unix.S_IFDIR != unix.S_IFDIR &&
    21  			(!sameFsTimeSpec(oldStat.Mtim(), newStat.Mtim()) || (oldStat.Size() != newStat.Size()))) {
    22  		return true
    23  	}
    24  	return false
    25  }
    26  
    27  func (info *FileInfo) isDir() bool {
    28  	return info.parent == nil || info.stat.Mode()&unix.S_IFDIR != 0
    29  }
    30  
    31  func getIno(fi os.FileInfo) uint64 {
    32  	return fi.Sys().(*syscall.Stat_t).Ino
    33  }
    34  
    35  func hasHardlinks(fi os.FileInfo) bool {
    36  	return fi.Sys().(*syscall.Stat_t).Nlink > 1
    37  }