summaryrefslogtreecommitdiff
path: root/vendor/github.com/containerd/containerd
diff options
context:
space:
mode:
authorGiuseppe Scrivano <gscrivan@redhat.com>2021-03-17 14:43:10 +0100
committerGiuseppe Scrivano <gscrivan@redhat.com>2021-03-18 20:27:25 +0100
commitec1651fbf11c4d3d1c792e7f46139ebd96f7ffb2 (patch)
tree61606abbce5e8efbf0c1f0c0ff6fe1c785c8a203 /vendor/github.com/containerd/containerd
parent77b3a2df645f2548f7bd2da85bbdb17e4de98310 (diff)
downloadpodman-ec1651fbf11c4d3d1c792e7f46139ebd96f7ffb2.tar.gz
podman-ec1651fbf11c4d3d1c792e7f46139ebd96f7ffb2.tar.bz2
podman-ec1651fbf11c4d3d1c792e7f46139ebd96f7ffb2.zip
Bump github.com/containers/storage from 1.25.0 to 1.28.0
Bumps [github.com/containers/storage](https://github.com/containers/storage) from 1.25.0 to 1.28.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.25.0...v1.28.0) Signed-off-by: dependabot-preview[bot] <support@dependabot.com> Signed-off-by: Giuseppe Scrivano <gscrivan@redhat.com>
Diffstat (limited to 'vendor/github.com/containerd/containerd')
-rw-r--r--vendor/github.com/containerd/containerd/log/context.go14
-rw-r--r--vendor/github.com/containerd/containerd/platforms/compare.go166
-rw-r--r--vendor/github.com/containerd/containerd/platforms/cpuinfo.go35
-rw-r--r--vendor/github.com/containerd/containerd/platforms/defaults.go7
-rw-r--r--vendor/github.com/containerd/containerd/platforms/defaults_windows.go4
-rw-r--r--vendor/github.com/containerd/containerd/platforms/platforms.go4
-rw-r--r--vendor/github.com/containerd/containerd/sys/oom_unix.go8
-rw-r--r--vendor/github.com/containerd/containerd/sys/oom_windows.go5
-rw-r--r--vendor/github.com/containerd/containerd/sys/stat_bsd.go2
-rw-r--r--vendor/github.com/containerd/containerd/sys/stat_openbsd.go45
10 files changed, 166 insertions, 124 deletions
diff --git a/vendor/github.com/containerd/containerd/log/context.go b/vendor/github.com/containerd/containerd/log/context.go
index 21599c4fd..37b6a7d1c 100644
--- a/vendor/github.com/containerd/containerd/log/context.go
+++ b/vendor/github.com/containerd/containerd/log/context.go
@@ -37,9 +37,17 @@ type (
loggerKey struct{}
)
-// RFC3339NanoFixed is time.RFC3339Nano with nanoseconds padded using zeros to
-// ensure the formatted time is always the same number of characters.
-const RFC3339NanoFixed = "2006-01-02T15:04:05.000000000Z07:00"
+const (
+ // RFC3339NanoFixed is time.RFC3339Nano with nanoseconds padded using zeros to
+ // ensure the formatted time is always the same number of characters.
+ RFC3339NanoFixed = "2006-01-02T15:04:05.000000000Z07:00"
+
+ // TextFormat represents the text logging format
+ TextFormat = "text"
+
+ // JSONFormat represents the JSON logging format
+ JSONFormat = "json"
+)
// WithLogger returns a new context with the provided logger. Use in
// combination with logger.WithField(s) for great effect.
diff --git a/vendor/github.com/containerd/containerd/platforms/compare.go b/vendor/github.com/containerd/containerd/platforms/compare.go
index 3ad22a10d..c7657e186 100644
--- a/vendor/github.com/containerd/containerd/platforms/compare.go
+++ b/vendor/github.com/containerd/containerd/platforms/compare.go
@@ -16,7 +16,12 @@
package platforms
-import specs "github.com/opencontainers/image-spec/specs-go/v1"
+import (
+ "strconv"
+ "strings"
+
+ specs "github.com/opencontainers/image-spec/specs-go/v1"
+)
// MatchComparer is able to match and compare platforms to
// filter and sort platforms.
@@ -26,103 +31,70 @@ type MatchComparer interface {
Less(specs.Platform, specs.Platform) bool
}
-// Only returns a match comparer for a single platform
-// using default resolution logic for the platform.
-//
-// For ARMv8, will also match ARMv7, ARMv6 and ARMv5 (for 32bit runtimes)
-// For ARMv7, will also match ARMv6 and ARMv5
-// For ARMv6, will also match ARMv5
-func Only(platform specs.Platform) MatchComparer {
- platform = Normalize(platform)
- if platform.Architecture == "arm" {
- if platform.Variant == "v8" {
- return orderedPlatformComparer{
- matchers: []Matcher{
- &matcher{
- Platform: platform,
- },
- &matcher{
- Platform: specs.Platform{
- Architecture: platform.Architecture,
- OS: platform.OS,
- OSVersion: platform.OSVersion,
- OSFeatures: platform.OSFeatures,
- Variant: "v7",
- },
- },
- &matcher{
- Platform: specs.Platform{
- Architecture: platform.Architecture,
- OS: platform.OS,
- OSVersion: platform.OSVersion,
- OSFeatures: platform.OSFeatures,
- Variant: "v6",
- },
- },
- &matcher{
- Platform: specs.Platform{
- Architecture: platform.Architecture,
- OS: platform.OS,
- OSVersion: platform.OSVersion,
- OSFeatures: platform.OSFeatures,
- Variant: "v5",
- },
- },
- },
- }
- }
- if platform.Variant == "v7" {
- return orderedPlatformComparer{
- matchers: []Matcher{
- &matcher{
- Platform: platform,
- },
- &matcher{
- Platform: specs.Platform{
- Architecture: platform.Architecture,
- OS: platform.OS,
- OSVersion: platform.OSVersion,
- OSFeatures: platform.OSFeatures,
- Variant: "v6",
- },
- },
- &matcher{
- Platform: specs.Platform{
- Architecture: platform.Architecture,
- OS: platform.OS,
- OSVersion: platform.OSVersion,
- OSFeatures: platform.OSFeatures,
- Variant: "v5",
- },
- },
- },
+// platformVector returns an (ordered) vector of appropriate specs.Platform
+// objects to try matching for the given platform object (see platforms.Only).
+func platformVector(platform specs.Platform) []specs.Platform {
+ vector := []specs.Platform{platform}
+
+ switch platform.Architecture {
+ case "amd64":
+ vector = append(vector, specs.Platform{
+ Architecture: "386",
+ OS: platform.OS,
+ OSVersion: platform.OSVersion,
+ OSFeatures: platform.OSFeatures,
+ Variant: platform.Variant,
+ })
+ case "arm":
+ if armVersion, err := strconv.Atoi(strings.TrimPrefix(platform.Variant, "v")); err == nil && armVersion > 5 {
+ for armVersion--; armVersion >= 5; armVersion-- {
+ vector = append(vector, specs.Platform{
+ Architecture: platform.Architecture,
+ OS: platform.OS,
+ OSVersion: platform.OSVersion,
+ OSFeatures: platform.OSFeatures,
+ Variant: "v" + strconv.Itoa(armVersion),
+ })
}
}
- if platform.Variant == "v6" {
- return orderedPlatformComparer{
- matchers: []Matcher{
- &matcher{
- Platform: platform,
- },
- &matcher{
- Platform: specs.Platform{
- Architecture: platform.Architecture,
- OS: platform.OS,
- OSVersion: platform.OSVersion,
- OSFeatures: platform.OSFeatures,
- Variant: "v5",
- },
- },
- },
- }
+ case "arm64":
+ variant := platform.Variant
+ if variant == "" {
+ variant = "v8"
}
+ vector = append(vector, platformVector(specs.Platform{
+ Architecture: "arm",
+ OS: platform.OS,
+ OSVersion: platform.OSVersion,
+ OSFeatures: platform.OSFeatures,
+ Variant: variant,
+ })...)
}
- return singlePlatformComparer{
- Matcher: &matcher{
- Platform: platform,
- },
- }
+ return vector
+}
+
+// Only returns a match comparer for a single platform
+// using default resolution logic for the platform.
+//
+// For arm/v8, will also match arm/v7, arm/v6 and arm/v5
+// For arm/v7, will also match arm/v6 and arm/v5
+// For arm/v6, will also match arm/v5
+// For amd64, will also match 386
+func Only(platform specs.Platform) MatchComparer {
+ return Ordered(platformVector(Normalize(platform))...)
+}
+
+// OnlyStrict returns a match comparer for a single platform.
+//
+// Unlike Only, OnlyStrict does not match sub platforms.
+// So, "arm/vN" will not match "arm/vM" where M < N,
+// and "amd64" will not also match "386".
+//
+// OnlyStrict matches non-canonical forms.
+// So, "arm64" matches "arm/64/v8".
+func OnlyStrict(platform specs.Platform) MatchComparer {
+ return Ordered(Normalize(platform))
}
// Ordered returns a platform MatchComparer which matches any of the platforms
@@ -153,14 +125,6 @@ func Any(platforms ...specs.Platform) MatchComparer {
// with preference for ordering.
var All MatchComparer = allPlatformComparer{}
-type singlePlatformComparer struct {
- Matcher
-}
-
-func (c singlePlatformComparer) Less(p1, p2 specs.Platform) bool {
- return c.Match(p1) && !c.Match(p2)
-}
-
type orderedPlatformComparer struct {
matchers []Matcher
}
diff --git a/vendor/github.com/containerd/containerd/platforms/cpuinfo.go b/vendor/github.com/containerd/containerd/platforms/cpuinfo.go
index db65a726b..4a7177e31 100644
--- a/vendor/github.com/containerd/containerd/platforms/cpuinfo.go
+++ b/vendor/github.com/containerd/containerd/platforms/cpuinfo.go
@@ -21,6 +21,7 @@ import (
"os"
"runtime"
"strings"
+ "sync"
"github.com/containerd/containerd/errdefs"
"github.com/containerd/containerd/log"
@@ -28,14 +29,18 @@ import (
)
// Present the ARM instruction set architecture, eg: v7, v8
-var cpuVariant string
+// Don't use this value directly; call cpuVariant() instead.
+var cpuVariantValue string
-func init() {
- if isArmArch(runtime.GOARCH) {
- cpuVariant = getCPUVariant()
- } else {
- cpuVariant = ""
- }
+var cpuVariantOnce sync.Once
+
+func cpuVariant() string {
+ cpuVariantOnce.Do(func() {
+ if isArmArch(runtime.GOARCH) {
+ cpuVariantValue = getCPUVariant()
+ }
+ })
+ return cpuVariantValue
}
// For Linux, the kernel has already detected the ABI, ISA and Features.
@@ -96,14 +101,18 @@ func getCPUVariant() string {
return ""
}
+ // handle edge case for Raspberry Pi ARMv6 devices (which due to a kernel quirk, report "CPU architecture: 7")
+ // https://www.raspberrypi.org/forums/viewtopic.php?t=12614
+ if runtime.GOARCH == "arm" && variant == "7" {
+ model, err := getCPUInfo("model name")
+ if err == nil && strings.HasPrefix(strings.ToLower(model), "armv6-compatible") {
+ variant = "6"
+ }
+ }
+
switch strings.ToLower(variant) {
case "8", "aarch64":
- // special case: if running a 32-bit userspace on aarch64, the variant should be "v7"
- if runtime.GOARCH == "arm" {
- variant = "v7"
- } else {
- variant = "v8"
- }
+ variant = "v8"
case "7", "7m", "?(12)", "?(13)", "?(14)", "?(15)", "?(16)", "?(17)":
variant = "v7"
case "6", "6tej":
diff --git a/vendor/github.com/containerd/containerd/platforms/defaults.go b/vendor/github.com/containerd/containerd/platforms/defaults.go
index a14d80e58..cb77fbc9f 100644
--- a/vendor/github.com/containerd/containerd/platforms/defaults.go
+++ b/vendor/github.com/containerd/containerd/platforms/defaults.go
@@ -33,6 +33,11 @@ func DefaultSpec() specs.Platform {
OS: runtime.GOOS,
Architecture: runtime.GOARCH,
// The Variant field will be empty if arch != ARM.
- Variant: cpuVariant,
+ Variant: cpuVariant(),
}
}
+
+// DefaultStrict returns strict form of Default.
+func DefaultStrict() MatchComparer {
+ return OnlyStrict(DefaultSpec())
+}
diff --git a/vendor/github.com/containerd/containerd/platforms/defaults_windows.go b/vendor/github.com/containerd/containerd/platforms/defaults_windows.go
index 0defbd36c..58713aa5f 100644
--- a/vendor/github.com/containerd/containerd/platforms/defaults_windows.go
+++ b/vendor/github.com/containerd/containerd/platforms/defaults_windows.go
@@ -19,6 +19,8 @@
package platforms
import (
+ "runtime"
+
specs "github.com/opencontainers/image-spec/specs-go/v1"
)
@@ -26,6 +28,6 @@ import (
func Default() MatchComparer {
return Ordered(DefaultSpec(), specs.Platform{
OS: "linux",
- Architecture: "amd64",
+ Architecture: runtime.GOARCH,
})
}
diff --git a/vendor/github.com/containerd/containerd/platforms/platforms.go b/vendor/github.com/containerd/containerd/platforms/platforms.go
index 77d3f184e..088bdea05 100644
--- a/vendor/github.com/containerd/containerd/platforms/platforms.go
+++ b/vendor/github.com/containerd/containerd/platforms/platforms.go
@@ -189,8 +189,8 @@ func Parse(specifier string) (specs.Platform, error) {
if isKnownOS(p.OS) {
// picks a default architecture
p.Architecture = runtime.GOARCH
- if p.Architecture == "arm" && cpuVariant != "v7" {
- p.Variant = cpuVariant
+ if p.Architecture == "arm" && cpuVariant() != "v7" {
+ p.Variant = cpuVariant()
}
return p, nil
diff --git a/vendor/github.com/containerd/containerd/sys/oom_unix.go b/vendor/github.com/containerd/containerd/sys/oom_unix.go
index d49d5bc8d..c381e1a7e 100644
--- a/vendor/github.com/containerd/containerd/sys/oom_unix.go
+++ b/vendor/github.com/containerd/containerd/sys/oom_unix.go
@@ -26,8 +26,12 @@ import (
"strings"
)
-// OOMScoreMaxKillable is the maximum score keeping the process killable by the oom killer
-const OOMScoreMaxKillable = -999
+const (
+ // OOMScoreMaxKillable is the maximum score keeping the process killable by the oom killer
+ OOMScoreMaxKillable = -999
+ // OOMScoreAdjMax is from OOM_SCORE_ADJ_MAX https://github.com/torvalds/linux/blob/master/include/uapi/linux/oom.h
+ OOMScoreAdjMax = 1000
+)
// SetOOMScore sets the oom score for the provided pid
func SetOOMScore(pid, score int) error {
diff --git a/vendor/github.com/containerd/containerd/sys/oom_windows.go b/vendor/github.com/containerd/containerd/sys/oom_windows.go
index a917ba635..215c171f6 100644
--- a/vendor/github.com/containerd/containerd/sys/oom_windows.go
+++ b/vendor/github.com/containerd/containerd/sys/oom_windows.go
@@ -16,6 +16,11 @@
package sys
+const (
+ // OOMScoreAdjMax is not implemented on Windows
+ OOMScoreAdjMax = 0
+)
+
// SetOOMScore sets the oom score for the process
//
// Not implemented on Windows
diff --git a/vendor/github.com/containerd/containerd/sys/stat_bsd.go b/vendor/github.com/containerd/containerd/sys/stat_bsd.go
index b9c95d90d..4f03cd6cb 100644
--- a/vendor/github.com/containerd/containerd/sys/stat_bsd.go
+++ b/vendor/github.com/containerd/containerd/sys/stat_bsd.go
@@ -1,4 +1,4 @@
-// +build darwin freebsd
+// +build darwin freebsd netbsd
/*
Copyright The containerd Authors.
diff --git a/vendor/github.com/containerd/containerd/sys/stat_openbsd.go b/vendor/github.com/containerd/containerd/sys/stat_openbsd.go
new file mode 100644
index 000000000..ec3b9df69
--- /dev/null
+++ b/vendor/github.com/containerd/containerd/sys/stat_openbsd.go
@@ -0,0 +1,45 @@
+// +build openbsd
+
+/*
+ Copyright The containerd Authors.
+
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+*/
+
+package sys
+
+import (
+ "syscall"
+ "time"
+)
+
+// StatAtime returns the Atim
+func StatAtime(st *syscall.Stat_t) syscall.Timespec {
+ return st.Atim
+}
+
+// StatCtime returns the Ctim
+func StatCtime(st *syscall.Stat_t) syscall.Timespec {
+ return st.Ctim
+}
+
+// StatMtime returns the Mtim
+func StatMtime(st *syscall.Stat_t) syscall.Timespec {
+ return st.Mtim
+}
+
+// StatATimeAsTime returns st.Atim as a time.Time
+func StatATimeAsTime(st *syscall.Stat_t) time.Time {
+ // The int64 conversions ensure the line compiles for 32-bit systems as well.
+ return time.Unix(int64(st.Atim.Sec), int64(st.Atim.Nsec)) // nolint: unconvert
+}