mirror of
https://github.com/moby/moby.git
synced 2022-11-09 12:21:53 -05:00
Merge pull request #40246 from thaJeztah/system_windows_cleanup
pkg/system: minor cleanups and remove use of deprecated system.GetOSVersion()
This commit is contained in:
commit
8d2456d1e6
3 changed files with 6 additions and 9 deletions
|
@ -222,8 +222,7 @@ func verifyDaemonSettings(config *config.Config) error {
|
||||||
func checkSystem() error {
|
func checkSystem() error {
|
||||||
// Validate the OS version. Note that dockerd.exe must be manifested for this
|
// Validate the OS version. Note that dockerd.exe must be manifested for this
|
||||||
// call to return the correct version.
|
// call to return the correct version.
|
||||||
osv := system.GetOSVersion()
|
if osversion.Get().MajorVersion < 10 {
|
||||||
if osv.MajorVersion < 10 {
|
|
||||||
return fmt.Errorf("This version of Windows does not support the docker daemon")
|
return fmt.Errorf("This version of Windows does not support the docker daemon")
|
||||||
}
|
}
|
||||||
if osversion.Build() < osversion.RS1 {
|
if osversion.Build() < osversion.RS1 {
|
||||||
|
|
|
@ -3,7 +3,7 @@ package operatingsystem // import "github.com/docker/docker/pkg/parsers/operatin
|
||||||
import (
|
import (
|
||||||
"fmt"
|
"fmt"
|
||||||
|
|
||||||
"github.com/docker/docker/pkg/system"
|
"github.com/Microsoft/hcsshim/osversion"
|
||||||
"golang.org/x/sys/windows/registry"
|
"golang.org/x/sys/windows/registry"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
@ -52,7 +52,7 @@ func withCurrentVersionRegistryKey(f func(registry.Key) (string, error)) (string
|
||||||
|
|
||||||
// GetOperatingSystemVersion gets the version of the current operating system, as a string.
|
// GetOperatingSystemVersion gets the version of the current operating system, as a string.
|
||||||
func GetOperatingSystemVersion() (string, error) {
|
func GetOperatingSystemVersion() (string, error) {
|
||||||
version := system.GetOSVersion()
|
version := osversion.Get()
|
||||||
return fmt.Sprintf("%d.%d.%d", version.MajorVersion, version.MinorVersion, version.Build), nil
|
return fmt.Sprintf("%d.%d.%d", version.MajorVersion, version.MinorVersion, version.Build), nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -87,8 +87,6 @@ func GetOSVersion() OSVersion {
|
||||||
}
|
}
|
||||||
|
|
||||||
// IsWindowsClient returns true if the SKU is client
|
// IsWindowsClient returns true if the SKU is client
|
||||||
// @engine maintainers - this function should not be removed or modified as it
|
|
||||||
// is used to enforce licensing restrictions on Windows.
|
|
||||||
func IsWindowsClient() bool {
|
func IsWindowsClient() bool {
|
||||||
osviex := &osVersionInfoEx{OSVersionInfoSize: 284}
|
osviex := &osVersionInfoEx{OSVersionInfoSize: 284}
|
||||||
r1, _, err := procGetVersionExW.Call(uintptr(unsafe.Pointer(osviex)))
|
r1, _, err := procGetVersionExW.Call(uintptr(unsafe.Pointer(osviex)))
|
||||||
|
@ -102,7 +100,7 @@ func IsWindowsClient() bool {
|
||||||
|
|
||||||
// Unmount is a platform-specific helper function to call
|
// Unmount is a platform-specific helper function to call
|
||||||
// the unmount syscall. Not supported on Windows
|
// the unmount syscall. Not supported on Windows
|
||||||
func Unmount(dest string) error {
|
func Unmount(_ string) error {
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -123,7 +121,7 @@ func CommandLineToArgv(commandLine string) ([]string, error) {
|
||||||
|
|
||||||
newArgs := make([]string, argc)
|
newArgs := make([]string, argc)
|
||||||
for i, v := range (*argv)[:argc] {
|
for i, v := range (*argv)[:argc] {
|
||||||
newArgs[i] = string(windows.UTF16ToString((*v)[:]))
|
newArgs[i] = windows.UTF16ToString((*v)[:])
|
||||||
}
|
}
|
||||||
|
|
||||||
return newArgs, nil
|
return newArgs, nil
|
||||||
|
@ -150,7 +148,7 @@ func GetSecurityDescriptorDacl(securityDescriptor *byte, daclPresent *uint32, da
|
||||||
r1, _, e1 := syscall.Syscall6(procGetSecurityDescriptorDacl.Addr(), 4, uintptr(unsafe.Pointer(securityDescriptor)), uintptr(unsafe.Pointer(daclPresent)), uintptr(unsafe.Pointer(dacl)), uintptr(unsafe.Pointer(daclDefaulted)), 0, 0)
|
r1, _, e1 := syscall.Syscall6(procGetSecurityDescriptorDacl.Addr(), 4, uintptr(unsafe.Pointer(securityDescriptor)), uintptr(unsafe.Pointer(daclPresent)), uintptr(unsafe.Pointer(dacl)), uintptr(unsafe.Pointer(daclDefaulted)), 0, 0)
|
||||||
if r1 == 0 {
|
if r1 == 0 {
|
||||||
if e1 != 0 {
|
if e1 != 0 {
|
||||||
result = syscall.Errno(e1)
|
result = e1
|
||||||
} else {
|
} else {
|
||||||
result = syscall.EINVAL
|
result = syscall.EINVAL
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Reference in a new issue