mirror of
https://github.com/containers/podman.git
synced 2025-12-11 09:18:34 +08:00
Bump github.com/containers/storage from 1.24.5 to 1.25.0
Bumps [github.com/containers/storage](https://github.com/containers/storage) from 1.24.5 to 1.25.0. - [Release notes](https://github.com/containers/storage/releases) - [Changelog](https://github.com/containers/storage/blob/master/docs/containers-storage-changes.md) - [Commits](https://github.com/containers/storage/compare/v1.24.5...v1.25.0) Signed-off-by: dependabot-preview[bot] <support@dependabot.com> Signed-off-by: Daniel J Walsh <dwalsh@redhat.com>
This commit is contained in:
committed by
Daniel J Walsh
parent
d1e0afdd47
commit
ebc42f5086
125
vendor/github.com/containers/storage/pkg/archive/archive_freebsd.go
generated
vendored
Normal file
125
vendor/github.com/containers/storage/pkg/archive/archive_freebsd.go
generated
vendored
Normal file
@@ -0,0 +1,125 @@
|
||||
// +build freebsd
|
||||
|
||||
package archive
|
||||
|
||||
import (
|
||||
"archive/tar"
|
||||
"errors"
|
||||
"os"
|
||||
"path/filepath"
|
||||
"syscall"
|
||||
|
||||
"github.com/containers/storage/pkg/idtools"
|
||||
"github.com/containers/storage/pkg/system"
|
||||
rsystem "github.com/opencontainers/runc/libcontainer/system"
|
||||
"golang.org/x/sys/unix"
|
||||
)
|
||||
|
||||
// fixVolumePathPrefix does platform specific processing to ensure that if
|
||||
// the path being passed in is not in a volume path format, convert it to one.
|
||||
func fixVolumePathPrefix(srcPath string) string {
|
||||
return srcPath
|
||||
}
|
||||
|
||||
// getWalkRoot calculates the root path when performing a TarWithOptions.
|
||||
// We use a separate function as this is platform specific. On Linux, we
|
||||
// can't use filepath.Join(srcPath,include) because this will clean away
|
||||
// a trailing "." or "/" which may be important.
|
||||
func getWalkRoot(srcPath string, include string) string {
|
||||
return srcPath + string(filepath.Separator) + include
|
||||
}
|
||||
|
||||
// CanonicalTarNameForPath returns platform-specific filepath
|
||||
// to canonical posix-style path for tar archival. p is relative
|
||||
// path.
|
||||
func CanonicalTarNameForPath(p string) (string, error) {
|
||||
return p, nil // already unix-style
|
||||
}
|
||||
|
||||
// chmodTarEntry is used to adjust the file permissions used in tar header based
|
||||
// on the platform the archival is done.
|
||||
func chmodTarEntry(perm os.FileMode) os.FileMode {
|
||||
return perm // noop for unix as golang APIs provide perm bits correctly
|
||||
}
|
||||
|
||||
func setHeaderForSpecialDevice(hdr *tar.Header, name string, stat interface{}) (err error) {
|
||||
s, ok := stat.(*syscall.Stat_t)
|
||||
|
||||
if ok {
|
||||
// Currently go does not fill in the major/minors
|
||||
if s.Mode&unix.S_IFBLK != 0 ||
|
||||
s.Mode&unix.S_IFCHR != 0 {
|
||||
hdr.Devmajor = int64(major(uint64(s.Rdev))) // nolint: unconvert
|
||||
hdr.Devminor = int64(minor(uint64(s.Rdev))) // nolint: unconvert
|
||||
}
|
||||
}
|
||||
|
||||
return
|
||||
}
|
||||
|
||||
func getInodeFromStat(stat interface{}) (inode uint64, err error) {
|
||||
s, ok := stat.(*syscall.Stat_t)
|
||||
|
||||
if ok {
|
||||
inode = s.Ino
|
||||
}
|
||||
|
||||
return
|
||||
}
|
||||
|
||||
func getFileUIDGID(stat interface{}) (idtools.IDPair, error) {
|
||||
s, ok := stat.(*syscall.Stat_t)
|
||||
|
||||
if !ok {
|
||||
return idtools.IDPair{}, errors.New("cannot convert stat value to syscall.Stat_t")
|
||||
}
|
||||
return idtools.IDPair{UID: int(s.Uid), GID: int(s.Gid)}, nil
|
||||
}
|
||||
|
||||
func major(device uint64) uint64 {
|
||||
return (device >> 8) & 0xfff
|
||||
}
|
||||
|
||||
func minor(device uint64) uint64 {
|
||||
return (device & 0xff) | ((device >> 12) & 0xfff00)
|
||||
}
|
||||
|
||||
// handleTarTypeBlockCharFifo is an OS-specific helper function used by
|
||||
// createTarFile to handle the following types of header: Block; Char; Fifo
|
||||
func handleTarTypeBlockCharFifo(hdr *tar.Header, path string) error {
|
||||
if rsystem.RunningInUserNS() {
|
||||
// cannot create a device if running in user namespace
|
||||
return nil
|
||||
}
|
||||
|
||||
mode := uint32(hdr.Mode & 07777)
|
||||
switch hdr.Typeflag {
|
||||
case tar.TypeBlock:
|
||||
mode |= unix.S_IFBLK
|
||||
case tar.TypeChar:
|
||||
mode |= unix.S_IFCHR
|
||||
case tar.TypeFifo:
|
||||
mode |= unix.S_IFIFO
|
||||
}
|
||||
|
||||
return system.Mknod(path, mode, uint64(system.Mkdev(hdr.Devmajor, hdr.Devminor)))
|
||||
}
|
||||
|
||||
func handleLChmod(hdr *tar.Header, path string, hdrInfo os.FileInfo, forceMask *os.FileMode) error {
|
||||
permissionsMask := hdrInfo.Mode()
|
||||
if forceMask != nil {
|
||||
permissionsMask = *forceMask
|
||||
}
|
||||
if hdr.Typeflag == tar.TypeLink {
|
||||
if fi, err := os.Lstat(hdr.Linkname); err == nil && (fi.Mode()&os.ModeSymlink == 0) {
|
||||
if err := os.Chmod(path, permissionsMask); err != nil {
|
||||
return err
|
||||
}
|
||||
}
|
||||
} else if hdr.Typeflag != tar.TypeSymlink {
|
||||
if err := os.Chmod(path, permissionsMask); err != nil {
|
||||
return err
|
||||
}
|
||||
}
|
||||
return nil
|
||||
}
|
||||
2
vendor/github.com/containers/storage/pkg/archive/archive_unix.go
generated
vendored
2
vendor/github.com/containers/storage/pkg/archive/archive_unix.go
generated
vendored
@@ -1,4 +1,4 @@
|
||||
// +build !windows
|
||||
// +build !windows,!freebsd
|
||||
|
||||
package archive
|
||||
|
||||
|
||||
8
vendor/github.com/containers/storage/pkg/directory/directory.go
generated
vendored
8
vendor/github.com/containers/storage/pkg/directory/directory.go
generated
vendored
@@ -6,9 +6,15 @@ import (
|
||||
"path/filepath"
|
||||
)
|
||||
|
||||
// DiskUsage is a structure that describes the disk usage (size and inode count)
|
||||
// of a particular directory.
|
||||
type DiskUsage struct {
|
||||
Size int64
|
||||
InodeCount int64
|
||||
}
|
||||
|
||||
// MoveToSubdir moves all contents of a directory to a subdirectory underneath the original path
|
||||
func MoveToSubdir(oldpath, subdir string) error {
|
||||
|
||||
infos, err := ioutil.ReadDir(oldpath)
|
||||
if err != nil {
|
||||
return err
|
||||
|
||||
31
vendor/github.com/containers/storage/pkg/directory/directory_unix.go
generated
vendored
31
vendor/github.com/containers/storage/pkg/directory/directory_unix.go
generated
vendored
@@ -10,37 +10,50 @@ import (
|
||||
|
||||
// Size walks a directory tree and returns its total size in bytes.
|
||||
func Size(dir string) (size int64, err error) {
|
||||
usage, err := Usage(dir)
|
||||
if err != nil {
|
||||
return 0, err
|
||||
}
|
||||
return usage.Size, nil
|
||||
}
|
||||
|
||||
// Usage walks a directory tree and returns its total size in bytes and the number of inodes.
|
||||
func Usage(dir string) (usage *DiskUsage, err error) {
|
||||
usage = &DiskUsage{}
|
||||
data := make(map[uint64]struct{})
|
||||
err = filepath.Walk(dir, func(d string, fileInfo os.FileInfo, err error) error {
|
||||
if err != nil {
|
||||
// if dir does not exist, Size() returns the error.
|
||||
// if dir/x disappeared while walking, Size() ignores dir/x.
|
||||
// if dir does not exist, Usage() returns the error.
|
||||
// if dir/x disappeared while walking, Usage() ignores dir/x.
|
||||
if os.IsNotExist(err) && d != dir {
|
||||
return nil
|
||||
}
|
||||
return err
|
||||
}
|
||||
|
||||
// Ignore directory sizes
|
||||
if fileInfo == nil {
|
||||
return nil
|
||||
}
|
||||
|
||||
s := fileInfo.Size()
|
||||
if fileInfo.IsDir() || s == 0 {
|
||||
return nil
|
||||
}
|
||||
|
||||
// Check inode to handle hard links correctly
|
||||
inode := fileInfo.Sys().(*syscall.Stat_t).Ino
|
||||
// inode is not a uint64 on all platforms. Cast it to avoid issues.
|
||||
if _, exists := data[uint64(inode)]; exists {
|
||||
return nil
|
||||
}
|
||||
|
||||
// inode is not a uint64 on all platforms. Cast it to avoid issues.
|
||||
data[uint64(inode)] = struct{}{}
|
||||
|
||||
size += s
|
||||
// Count the unique inode
|
||||
usage.InodeCount++
|
||||
|
||||
// Ignore directory sizes
|
||||
if fileInfo.IsDir() {
|
||||
return nil
|
||||
}
|
||||
|
||||
usage.Size += fileInfo.Size()
|
||||
|
||||
return nil
|
||||
})
|
||||
|
||||
15
vendor/github.com/containers/storage/pkg/directory/directory_windows.go
generated
vendored
15
vendor/github.com/containers/storage/pkg/directory/directory_windows.go
generated
vendored
@@ -7,8 +7,18 @@ import (
|
||||
"path/filepath"
|
||||
)
|
||||
|
||||
// Size walks a directory tree and returns its total size in bytes.
|
||||
// Size walks a directory tree and returns its total size in bytes
|
||||
func Size(dir string) (size int64, err error) {
|
||||
usage, err := Usage(dir)
|
||||
if err != nil {
|
||||
return 0, nil
|
||||
}
|
||||
return usage.Size, nil
|
||||
}
|
||||
|
||||
// Usage walks a directory tree and returns its total size in bytes and the number of inodes.
|
||||
func Usage(dir string) (usage *DiskUsage, err error) {
|
||||
usage = &DiskUsage{}
|
||||
err = filepath.Walk(dir, func(d string, fileInfo os.FileInfo, err error) error {
|
||||
if err != nil {
|
||||
// if dir does not exist, Size() returns the error.
|
||||
@@ -29,7 +39,8 @@ func Size(dir string) (size int64, err error) {
|
||||
return nil
|
||||
}
|
||||
|
||||
size += s
|
||||
usage.Size += s
|
||||
usage.InodeCount++
|
||||
|
||||
return nil
|
||||
})
|
||||
|
||||
2
vendor/github.com/containers/storage/pkg/homedir/homedir_others.go
generated
vendored
2
vendor/github.com/containers/storage/pkg/homedir/homedir_others.go
generated
vendored
@@ -1,4 +1,4 @@
|
||||
// +build !linux,!darwin
|
||||
// +build !linux,!darwin,!freebsd
|
||||
|
||||
package homedir
|
||||
|
||||
|
||||
2
vendor/github.com/containers/storage/pkg/mount/mounter_unsupported.go
generated
vendored
2
vendor/github.com/containers/storage/pkg/mount/mounter_unsupported.go
generated
vendored
@@ -1,4 +1,4 @@
|
||||
// +build !linux
|
||||
// +build !linux,!freebsd
|
||||
|
||||
package mount
|
||||
|
||||
|
||||
2
vendor/github.com/containers/storage/pkg/system/mknod.go
generated
vendored
2
vendor/github.com/containers/storage/pkg/system/mknod.go
generated
vendored
@@ -1,4 +1,4 @@
|
||||
// +build !windows
|
||||
// +build !windows,!freebsd
|
||||
|
||||
package system
|
||||
|
||||
|
||||
22
vendor/github.com/containers/storage/pkg/system/mknod_freebsd.go
generated
vendored
Normal file
22
vendor/github.com/containers/storage/pkg/system/mknod_freebsd.go
generated
vendored
Normal file
@@ -0,0 +1,22 @@
|
||||
// +build freebsd
|
||||
|
||||
package system
|
||||
|
||||
import (
|
||||
"golang.org/x/sys/unix"
|
||||
)
|
||||
|
||||
// Mknod creates a filesystem node (file, device special file or named pipe) named path
|
||||
// with attributes specified by mode and dev.
|
||||
func Mknod(path string, mode uint32, dev uint64) error {
|
||||
return unix.Mknod(path, mode, dev)
|
||||
}
|
||||
|
||||
// Mkdev is used to build the value of linux devices (in /dev/) which specifies major
|
||||
// and minor number of the newly created device special file.
|
||||
// Linux device nodes are a bit weird due to backwards compat with 16 bit device nodes.
|
||||
// They are, from low to high: the lower 8 bits of the minor, then 12 bits of the major,
|
||||
// then the top 12 bits of the minor.
|
||||
func Mkdev(major int64, minor int64) uint32 {
|
||||
return uint32(((minor & 0xfff00) << 12) | ((major & 0xfff) << 8) | (minor & 0xff))
|
||||
}
|
||||
Reference in New Issue
Block a user