2015-05-07 18:14:11 -04:00
|
|
|
// +build !windows
|
|
|
|
|
|
|
|
package archive
|
|
|
|
|
|
|
|
import (
|
2015-10-12 15:11:22 -04:00
|
|
|
"os"
|
2015-05-07 18:14:11 -04:00
|
|
|
"syscall"
|
|
|
|
|
|
|
|
"github.com/docker/docker/pkg/system"
|
2017-05-23 10:22:32 -04:00
|
|
|
"golang.org/x/sys/unix"
|
2015-05-07 18:14:11 -04:00
|
|
|
)
|
|
|
|
|
2015-07-28 12:13:12 -04:00
|
|
|
func statDifferent(oldStat *system.StatT, newStat *system.StatT) bool {
|
2015-05-07 18:14:11 -04:00
|
|
|
// Don't look at size for dirs, its not a good measure of change
|
|
|
|
if oldStat.Mode() != newStat.Mode() ||
|
2015-07-28 12:13:12 -04:00
|
|
|
oldStat.UID() != newStat.UID() ||
|
2015-10-12 10:58:33 -04:00
|
|
|
oldStat.GID() != newStat.GID() ||
|
2015-05-07 18:14:11 -04:00
|
|
|
oldStat.Rdev() != newStat.Rdev() ||
|
|
|
|
// Don't look at size for dirs, its not a good measure of change
|
2017-05-23 10:22:32 -04:00
|
|
|
(oldStat.Mode()&unix.S_IFDIR != unix.S_IFDIR &&
|
2015-05-07 18:14:11 -04:00
|
|
|
(!sameFsTimeSpec(oldStat.Mtim(), newStat.Mtim()) || (oldStat.Size() != newStat.Size()))) {
|
|
|
|
return true
|
|
|
|
}
|
|
|
|
return false
|
|
|
|
}
|
|
|
|
|
|
|
|
func (info *FileInfo) isDir() bool {
|
2017-05-23 10:22:32 -04:00
|
|
|
return info.parent == nil || info.stat.Mode()&unix.S_IFDIR != 0
|
2015-05-07 18:14:11 -04:00
|
|
|
}
|
2015-10-12 15:11:22 -04:00
|
|
|
|
|
|
|
func getIno(fi os.FileInfo) uint64 {
|
2017-08-24 13:11:44 -04:00
|
|
|
return fi.Sys().(*syscall.Stat_t).Ino
|
2015-10-12 15:11:22 -04:00
|
|
|
}
|
|
|
|
|
|
|
|
func hasHardlinks(fi os.FileInfo) bool {
|
|
|
|
return fi.Sys().(*syscall.Stat_t).Nlink > 1
|
|
|
|
}
|