github.com/hustcat/docker@v1.3.3-0.20160314103604-901c67a8eeab/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 ) 11 12 func statDifferent(oldStat *system.StatT, newStat *system.StatT) bool { 13 // Don't look at size for dirs, its not a good measure of change 14 if oldStat.Mode() != newStat.Mode() || 15 oldStat.UID() != newStat.UID() || 16 oldStat.GID() != newStat.GID() || 17 oldStat.Rdev() != newStat.Rdev() || 18 // Don't look at size for dirs, its not a good measure of change 19 (oldStat.Mode()&syscall.S_IFDIR != syscall.S_IFDIR && 20 (!sameFsTimeSpec(oldStat.Mtim(), newStat.Mtim()) || (oldStat.Size() != newStat.Size()))) { 21 return true 22 } 23 return false 24 } 25 26 func (info *FileInfo) isDir() bool { 27 return info.parent == nil || info.stat.Mode()&syscall.S_IFDIR != 0 28 } 29 30 func getIno(fi os.FileInfo) uint64 { 31 return uint64(fi.Sys().(*syscall.Stat_t).Ino) 32 } 33 34 func hasHardlinks(fi os.FileInfo) bool { 35 return fi.Sys().(*syscall.Stat_t).Nlink > 1 36 }