mirror of
https://github.com/containers/podman.git
synced 2025-12-10 15:47:46 +08:00
vendor in containers/storage v1.29.0
Signed-off-by: Daniel J Walsh <dwalsh@redhat.com>
This commit is contained in:
12
vendor/github.com/containers/storage/pkg/archive/archive.go
generated
vendored
12
vendor/github.com/containers/storage/pkg/archive/archive.go
generated
vendored
@@ -20,6 +20,7 @@ import (
|
||||
"github.com/containers/storage/pkg/pools"
|
||||
"github.com/containers/storage/pkg/promise"
|
||||
"github.com/containers/storage/pkg/system"
|
||||
"github.com/containers/storage/pkg/unshare"
|
||||
gzip "github.com/klauspost/pgzip"
|
||||
rsystem "github.com/opencontainers/runc/libcontainer/system"
|
||||
"github.com/pkg/errors"
|
||||
@@ -1489,3 +1490,14 @@ func TarPath(uidmap []idtools.IDMap, gidmap []idtools.IDMap) func(path string) (
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
// GetOverlayXattrName returns the xattr used by the overlay driver with the
|
||||
// given name.
|
||||
// It uses the trusted.overlay prefix when running as root, and user.overlay
|
||||
// in rootless mode.
|
||||
func GetOverlayXattrName(name string) string {
|
||||
if unshare.IsRootless() {
|
||||
return fmt.Sprintf("user.overlay.%s", name)
|
||||
}
|
||||
return fmt.Sprintf("trusted.overlay.%s", name)
|
||||
}
|
||||
|
||||
10
vendor/github.com/containers/storage/pkg/archive/archive_linux.go
generated
vendored
10
vendor/github.com/containers/storage/pkg/archive/archive_linux.go
generated
vendored
@@ -12,6 +12,10 @@ import (
|
||||
"golang.org/x/sys/unix"
|
||||
)
|
||||
|
||||
func getOverlayOpaqueXattrName() string {
|
||||
return GetOverlayXattrName("opaque")
|
||||
}
|
||||
|
||||
func GetWhiteoutConverter(format WhiteoutFormat, data interface{}) TarWhiteoutConverter {
|
||||
if format == OverlayWhiteoutFormat {
|
||||
if rolayers, ok := data.([]string); ok && len(rolayers) > 0 {
|
||||
@@ -39,13 +43,13 @@ func (o overlayWhiteoutConverter) ConvertWrite(hdr *tar.Header, path string, fi
|
||||
|
||||
if fi.Mode()&os.ModeDir != 0 {
|
||||
// convert opaque dirs to AUFS format by writing an empty file with the whiteout prefix
|
||||
opaque, err := system.Lgetxattr(path, "trusted.overlay.opaque")
|
||||
opaque, err := system.Lgetxattr(path, getOverlayOpaqueXattrName())
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
if len(opaque) == 1 && opaque[0] == 'y' {
|
||||
if hdr.Xattrs != nil {
|
||||
delete(hdr.Xattrs, "trusted.overlay.opaque")
|
||||
delete(hdr.Xattrs, getOverlayOpaqueXattrName())
|
||||
}
|
||||
// If there are no lower layers, then it can't have been deleted in this layer.
|
||||
if len(o.rolayers) == 0 {
|
||||
@@ -114,7 +118,7 @@ func (overlayWhiteoutConverter) ConvertReadWithHandler(hdr *tar.Header, path str
|
||||
|
||||
// if a directory is marked as opaque by the AUFS special file, we need to translate that to overlay
|
||||
if base == WhiteoutOpaqueDir {
|
||||
err := handler.Setxattr(dir, "trusted.overlay.opaque", []byte{'y'})
|
||||
err := handler.Setxattr(dir, getOverlayOpaqueXattrName(), []byte{'y'})
|
||||
// don't write the file itself
|
||||
return false, err
|
||||
}
|
||||
|
||||
2
vendor/github.com/containers/storage/pkg/archive/changes_linux.go
generated
vendored
2
vendor/github.com/containers/storage/pkg/archive/changes_linux.go
generated
vendored
@@ -349,7 +349,7 @@ func overlayDeletedFile(layers []string, root, path string, fi os.FileInfo) (str
|
||||
return "", nil
|
||||
}
|
||||
// If the directory isn't marked as opaque, then it's just a normal directory.
|
||||
opaque, err := system.Lgetxattr(filepath.Join(root, path), "trusted.overlay.opaque")
|
||||
opaque, err := system.Lgetxattr(filepath.Join(root, path), getOverlayOpaqueXattrName())
|
||||
if err != nil {
|
||||
return "", err
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user