github.com/Heebron/moby@v0.0.0-20221111184709-6eab4f55faf7/pkg/archive/archive_windows.go (about) 1 package archive // import "github.com/docker/docker/pkg/archive" 2 3 import ( 4 "archive/tar" 5 "os" 6 "path/filepath" 7 8 "github.com/docker/docker/pkg/idtools" 9 "github.com/docker/docker/pkg/longpath" 10 ) 11 12 // fixVolumePathPrefix does platform specific processing to ensure that if 13 // the path being passed in is not in a volume path format, convert it to one. 14 func fixVolumePathPrefix(srcPath string) string { 15 return longpath.AddPrefix(srcPath) 16 } 17 18 // getWalkRoot calculates the root path when performing a TarWithOptions. 19 // We use a separate function as this is platform specific. 20 func getWalkRoot(srcPath string, include string) string { 21 return filepath.Join(srcPath, include) 22 } 23 24 // chmodTarEntry is used to adjust the file permissions used in tar header based 25 // on the platform the archival is done. 26 func chmodTarEntry(perm os.FileMode) os.FileMode { 27 // Remove group- and world-writable bits. 28 perm &= 0o755 29 30 // Add the x bit: make everything +x on Windows 31 return perm | 0o111 32 } 33 34 func setHeaderForSpecialDevice(hdr *tar.Header, name string, stat interface{}) (err error) { 35 // do nothing. no notion of Rdev, Nlink in stat on Windows 36 return 37 } 38 39 func getInodeFromStat(stat interface{}) (inode uint64, err error) { 40 // do nothing. no notion of Inode in stat on Windows 41 return 42 } 43 44 // handleTarTypeBlockCharFifo is an OS-specific helper function used by 45 // createTarFile to handle the following types of header: Block; Char; Fifo 46 func handleTarTypeBlockCharFifo(hdr *tar.Header, path string) error { 47 return nil 48 } 49 50 func handleLChmod(hdr *tar.Header, path string, hdrInfo os.FileInfo) error { 51 return nil 52 } 53 54 func getFileUIDGID(stat interface{}) (idtools.Identity, error) { 55 // no notion of file ownership mapping yet on Windows 56 return idtools.Identity{UID: 0, GID: 0}, nil 57 }