mirror of
https://github.com/containers/podman.git
synced 2025-11-13 17:47:13 +08:00
Vendor in containers/(storage,image, common, buildah)
Signed-off-by: Daniel J Walsh <dwalsh@redhat.com>
This commit is contained in:
12
vendor/github.com/containers/storage/pkg/system/meminfo_freebsd.go
generated
vendored
12
vendor/github.com/containers/storage/pkg/system/meminfo_freebsd.go
generated
vendored
@@ -19,7 +19,7 @@ import "C"
|
||||
func getMemInfo() (int64, int64, error) {
|
||||
data, err := unix.SysctlRaw("vm.vmtotal")
|
||||
if err != nil {
|
||||
return -1, -1, fmt.Errorf("Can't get kernel info: %v", err)
|
||||
return -1, -1, fmt.Errorf("can't get kernel info: %w", err)
|
||||
}
|
||||
if len(data) != C.sizeof_struct_vmtotal {
|
||||
return -1, -1, fmt.Errorf("unexpected vmtotal size %d", len(data))
|
||||
@@ -39,12 +39,12 @@ func getSwapInfo() (int64, int64, error) {
|
||||
)
|
||||
swapCount, err := unix.SysctlUint32("vm.nswapdev")
|
||||
if err != nil {
|
||||
return -1, -1, fmt.Errorf("error reading vm.nswapdev: %v", err)
|
||||
return -1, -1, fmt.Errorf("reading vm.nswapdev: %w", err)
|
||||
}
|
||||
for i := 0; i < int(swapCount); i++ {
|
||||
data, err := unix.SysctlRaw("vm.swap_info", i)
|
||||
if err != nil {
|
||||
return -1, -1, fmt.Errorf("error reading vm.swap_info.%d: %v", i, err)
|
||||
return -1, -1, fmt.Errorf("reading vm.swap_info.%d: %w", i, err)
|
||||
}
|
||||
if len(data) != C.sizeof_struct_xswdev {
|
||||
return -1, -1, fmt.Errorf("unexpected swap_info size %d", len(data))
|
||||
@@ -62,15 +62,15 @@ func getSwapInfo() (int64, int64, error) {
|
||||
func ReadMemInfo() (*MemInfo, error) {
|
||||
MemTotal, MemFree, err := getMemInfo()
|
||||
if err != nil {
|
||||
return nil, fmt.Errorf("error getting memory totals %v\n", err)
|
||||
return nil, fmt.Errorf("getting memory totals %w", err)
|
||||
}
|
||||
SwapTotal, SwapFree, err := getSwapInfo()
|
||||
if err != nil {
|
||||
return nil, fmt.Errorf("error getting swap totals %v\n", err)
|
||||
return nil, fmt.Errorf("getting swap totals %w", err)
|
||||
}
|
||||
|
||||
if MemTotal < 0 || MemFree < 0 || SwapTotal < 0 || SwapFree < 0 {
|
||||
return nil, fmt.Errorf("error getting system memory info %v\n", err)
|
||||
return nil, fmt.Errorf("getting system memory info %w", err)
|
||||
}
|
||||
|
||||
meminfo := &MemInfo{}
|
||||
|
||||
3
vendor/github.com/containers/storage/pkg/system/meminfo_solaris.go
generated
vendored
3
vendor/github.com/containers/storage/pkg/system/meminfo_solaris.go
generated
vendored
@@ -1,3 +1,4 @@
|
||||
//go:build solaris && cgo
|
||||
// +build solaris,cgo
|
||||
|
||||
package system
|
||||
@@ -90,7 +91,7 @@ func ReadMemInfo() (*MemInfo, error) {
|
||||
|
||||
if ppKernel < 0 || MemTotal < 0 || MemFree < 0 || SwapTotal < 0 ||
|
||||
SwapFree < 0 {
|
||||
return nil, fmt.Errorf("error getting system memory info %v\n", err)
|
||||
return nil, fmt.Errorf("getting system memory info %w", err)
|
||||
}
|
||||
|
||||
meminfo := &MemInfo{}
|
||||
|
||||
5
vendor/github.com/containers/storage/pkg/system/path_windows.go
generated
vendored
5
vendor/github.com/containers/storage/pkg/system/path_windows.go
generated
vendored
@@ -1,3 +1,4 @@
|
||||
//go:build windows
|
||||
// +build windows
|
||||
|
||||
package system
|
||||
@@ -21,13 +22,13 @@ import (
|
||||
// d:\ --> Fail
|
||||
func CheckSystemDriveAndRemoveDriveLetter(path string) (string, error) {
|
||||
if len(path) == 2 && string(path[1]) == ":" {
|
||||
return "", fmt.Errorf("No relative path specified in %q", path)
|
||||
return "", fmt.Errorf("relative path not specified in %q", path)
|
||||
}
|
||||
if !filepath.IsAbs(path) || len(path) < 2 {
|
||||
return filepath.FromSlash(path), nil
|
||||
}
|
||||
if string(path[1]) == ":" && !strings.EqualFold(string(path[0]), "c") {
|
||||
return "", fmt.Errorf("The specified path is not on the system drive (C:)")
|
||||
return "", fmt.Errorf("specified path is not on the system drive (C:)")
|
||||
}
|
||||
return filepath.FromSlash(path[2:]), nil
|
||||
}
|
||||
|
||||
4
vendor/github.com/containers/storage/pkg/system/rm.go
generated
vendored
4
vendor/github.com/containers/storage/pkg/system/rm.go
generated
vendored
@@ -1,12 +1,12 @@
|
||||
package system
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"os"
|
||||
"syscall"
|
||||
"time"
|
||||
|
||||
"github.com/containers/storage/pkg/mount"
|
||||
"github.com/pkg/errors"
|
||||
"github.com/sirupsen/logrus"
|
||||
)
|
||||
|
||||
@@ -67,7 +67,7 @@ func EnsureRemoveAll(dir string) error {
|
||||
}
|
||||
|
||||
if e := mount.Unmount(pe.Path); e != nil {
|
||||
return errors.Wrapf(e, "error while removing %s", dir)
|
||||
return fmt.Errorf("while removing %s: %w", dir, e)
|
||||
}
|
||||
|
||||
if exitOnErr[pe.Path] == maxRetry {
|
||||
|
||||
4
vendor/github.com/containers/storage/pkg/system/syscall_unix.go
generated
vendored
4
vendor/github.com/containers/storage/pkg/system/syscall_unix.go
generated
vendored
@@ -1,9 +1,11 @@
|
||||
//go:build linux || freebsd || darwin
|
||||
// +build linux freebsd darwin
|
||||
|
||||
package system
|
||||
|
||||
import (
|
||||
"github.com/pkg/errors"
|
||||
"errors"
|
||||
|
||||
"golang.org/x/sys/unix"
|
||||
)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user