diff --git a/go.mod b/go.mod index 4057e225..e13a7fea 100644 --- a/go.mod +++ b/go.mod @@ -7,7 +7,7 @@ toolchain go1.22.3 require ( github.com/BurntSushi/toml v1.3.2 github.com/bradleyfalzon/ghinstallation/v2 v2.10.0 - github.com/cloudbase/garm-provider-common v0.1.3 + github.com/cloudbase/garm-provider-common v0.1.4-0.20240821093055-dfdf8e2e4853 github.com/felixge/httpsnoop v1.0.4 github.com/go-openapi/errors v0.22.0 github.com/go-openapi/runtime v0.28.0 @@ -28,7 +28,7 @@ require ( github.com/prometheus/client_golang v1.19.0 github.com/spf13/cobra v1.8.0 github.com/stretchr/testify v1.9.0 - golang.org/x/crypto v0.25.0 + golang.org/x/crypto v0.26.0 golang.org/x/oauth2 v0.19.0 golang.org/x/sync v0.7.0 gopkg.in/DATA-DOG/go-sqlmock.v1 v1.3.0 @@ -85,8 +85,8 @@ require ( go.opentelemetry.io/otel v1.25.0 // indirect go.opentelemetry.io/otel/metric v1.25.0 // indirect go.opentelemetry.io/otel/trace v1.25.0 // indirect - golang.org/x/net v0.27.0 // indirect - golang.org/x/sys v0.22.0 // indirect + golang.org/x/net v0.28.0 // indirect + golang.org/x/sys v0.24.0 // indirect google.golang.org/protobuf v1.33.0 // indirect gopkg.in/yaml.v3 v3.0.1 // indirect ) diff --git a/go.sum b/go.sum index f4939954..338c248a 100644 --- a/go.sum +++ b/go.sum @@ -19,8 +19,8 @@ github.com/chzyer/readline v1.5.1/go.mod h1:Eh+b79XXUwfKfcPLepksvw2tcLE/Ct21YObk github.com/chzyer/test v0.0.0-20180213035817-a1ea475d72b1/go.mod h1:Q3SI9o4m/ZMnBNeIyt5eFwwo7qiLfzFZmjNmxjkiQlU= github.com/chzyer/test v1.0.0 h1:p3BQDXSxOhOG0P9z6/hGnII4LGiEPOYBhs8asl/fC04= github.com/chzyer/test v1.0.0/go.mod h1:2JlltgoNkt4TW/z9V/IzDdFaMTM2JPIi26O1pF38GC8= -github.com/cloudbase/garm-provider-common v0.1.3 h1:8pHSRs2ljwLHgtDrge68dZ7ILUW97VF5h2ZA2fQubGQ= -github.com/cloudbase/garm-provider-common v0.1.3/go.mod h1:VIJzbcg5iwyD4ac99tnnwcActfwibn/VOt2MYOFjf2c= +github.com/cloudbase/garm-provider-common v0.1.4-0.20240821093055-dfdf8e2e4853 h1:eaWT9rcqYheM1IMQtHQJNKLwSQfVKhj6veX221rDkIU= +github.com/cloudbase/garm-provider-common v0.1.4-0.20240821093055-dfdf8e2e4853/go.mod h1:/N8rXH2iXCsqCcOODsI2DTR9afnijMhNp/vjR9wbzSg= github.com/cpuguy83/go-md2man/v2 v2.0.3/go.mod h1:tgQtvFlXSQOSOSIRvRPT7W67SCa46tRHOmNcaadrF8o= github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c= @@ -180,10 +180,10 @@ go.opentelemetry.io/otel/sdk v1.24.0 h1:YMPPDNymmQN3ZgczicBY3B6sf9n62Dlj9pWD3ucg go.opentelemetry.io/otel/sdk v1.24.0/go.mod h1:KVrIYw6tEubO9E96HQpcmpTKDVn9gdv35HoYiQWGDFg= go.opentelemetry.io/otel/trace v1.25.0 h1:tqukZGLwQYRIFtSQM2u2+yfMVTgGVeqRLPUYx1Dq6RM= go.opentelemetry.io/otel/trace v1.25.0/go.mod h1:hCCs70XM/ljO+BeQkyFnbK28SBIJ/Emuha+ccrCRT7I= -golang.org/x/crypto v0.25.0 h1:ypSNr+bnYL2YhwoMt2zPxHFmbAN1KZs/njMG3hxUp30= -golang.org/x/crypto v0.25.0/go.mod h1:T+wALwcMOSE0kXgUAnPAHqTLW+XHgcELELW8VaDgm/M= -golang.org/x/net v0.27.0 h1:5K3Njcw06/l2y9vpGCSdcxWOYHOUk3dVNGDXN+FvAys= -golang.org/x/net v0.27.0/go.mod h1:dDi0PyhWNoiUOrAS8uXv/vnScO4wnHQO4mj9fn/RytE= +golang.org/x/crypto v0.26.0 h1:RrRspgV4mU+YwB4FYnuBoKsUapNIL5cohGAmSH3azsw= +golang.org/x/crypto v0.26.0/go.mod h1:GY7jblb9wI+FOo5y8/S2oY4zWP07AkOJ4+jxCqdqn54= +golang.org/x/net v0.28.0 h1:a9JDOJc5GMUJ0+UDqmLT86WiEy7iWyIhz8gz8E4e5hE= +golang.org/x/net v0.28.0/go.mod h1:yqtgsTWOOnlGLG9GFRrK3++bGOUEkNBoHZc8MEDWPNg= golang.org/x/oauth2 v0.19.0 h1:9+E/EZBCbTLNrbN35fHv/a/d/mOBatymz1zbtQrXpIg= golang.org/x/oauth2 v0.19.0/go.mod h1:vYi7skDa1x015PmRRYZ7+s1cWyPgrPiSYRe4rnsexc8= golang.org/x/sync v0.7.0 h1:YsImfSBoP9QPYL0xyKJPq0gcaJdG3rInoqxTWbfQu9M= @@ -191,10 +191,10 @@ golang.org/x/sync v0.7.0/go.mod h1:Czt+wKu1gCyEFDUtn0jG5QVvpJ6rzVqr5aXyt9drQfk= golang.org/x/sys v0.0.0-20181122145206-62eef0e2fa9b/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= golang.org/x/sys v0.0.0-20220310020820-b874c991c1a5/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.6.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= -golang.org/x/sys v0.22.0 h1:RI27ohtqKCnwULzJLqkv897zojh5/DwS/ENaMzUOaWI= -golang.org/x/sys v0.22.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= -golang.org/x/text v0.16.0 h1:a94ExnEXNtEwYLGJSIUxnWoxoRz/ZcCsV63ROupILh4= -golang.org/x/text v0.16.0/go.mod h1:GhwF1Be+LQoKShO3cGOHzqOgRrGaYc9AvblQOmPVHnI= +golang.org/x/sys v0.24.0 h1:Twjiwq9dn6R1fQcyiK+wQyHWfaz/BJB+YIpzU/Cv3Xg= +golang.org/x/sys v0.24.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= +golang.org/x/text v0.17.0 h1:XtiM5bkSOt+ewxlOE/aE/AKEHibwj/6gvWMl9Rsh0Qc= +golang.org/x/text v0.17.0/go.mod h1:BuEKDfySbSR4drPmRPG/7iBdf8hvFMuRexcpahXilzY= golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= google.golang.org/protobuf v1.33.0 h1:uNO2rsAINq/JlFpSdYEKIZ0uKD/R9cpdv0T+yoGwGmI= google.golang.org/protobuf v1.33.0/go.mod h1:c6P6GXX6sHbq/GpV6MGZEdwhWPcYBgnhAHhKbcUYpos= diff --git a/runner/providers/v0.1.0/external.go b/runner/providers/v0.1.0/external.go index 5f47002e..704c414d 100644 --- a/runner/providers/v0.1.0/external.go +++ b/runner/providers/v0.1.0/external.go @@ -10,7 +10,7 @@ import ( "github.com/pkg/errors" garmErrors "github.com/cloudbase/garm-provider-common/errors" - execution "github.com/cloudbase/garm-provider-common/execution/v0.1.0" + commonExecution "github.com/cloudbase/garm-provider-common/execution/common" commonParams "github.com/cloudbase/garm-provider-common/params" garmExec "github.com/cloudbase/garm-provider-common/util/exec" "github.com/cloudbase/garm/config" @@ -76,7 +76,7 @@ func (e *external) validateResult(inst commonParams.ProviderInstance) error { // CreateInstance creates a new compute instance in the provider. func (e *external) CreateInstance(ctx context.Context, bootstrapParams commonParams.BootstrapInstance, _ common.CreateInstanceParams) (commonParams.ProviderInstance, error) { asEnv := []string{ - fmt.Sprintf("GARM_COMMAND=%s", execution.CreateInstanceCommand), + fmt.Sprintf("GARM_COMMAND=%s", commonExecution.CreateInstanceCommand), fmt.Sprintf("GARM_CONTROLLER_ID=%s", e.controllerID), fmt.Sprintf("GARM_POOL_ID=%s", bootstrapParams.PoolID), fmt.Sprintf("GARM_PROVIDER_CONFIG_FILE=%s", e.cfg.External.ConfigFile), @@ -129,7 +129,7 @@ func (e *external) CreateInstance(ctx context.Context, bootstrapParams commonPar // Delete instance will delete the instance in a provider. func (e *external) DeleteInstance(ctx context.Context, instance string, _ common.DeleteInstanceParams) error { asEnv := []string{ - fmt.Sprintf("GARM_COMMAND=%s", execution.DeleteInstanceCommand), + fmt.Sprintf("GARM_COMMAND=%s", commonExecution.DeleteInstanceCommand), fmt.Sprintf("GARM_CONTROLLER_ID=%s", e.controllerID), fmt.Sprintf("GARM_INSTANCE_ID=%s", instance), fmt.Sprintf("GARM_PROVIDER_CONFIG_FILE=%s", e.cfg.External.ConfigFile), @@ -143,7 +143,7 @@ func (e *external) DeleteInstance(ctx context.Context, instance string, _ common _, err := garmExec.Exec(ctx, e.execPath, nil, asEnv) if err != nil { var exitErr *exec.ExitError - if !errors.As(err, &exitErr) || exitErr.ExitCode() != execution.ExitCodeNotFound { + if !errors.As(err, &exitErr) || exitErr.ExitCode() != commonExecution.ExitCodeNotFound { metrics.InstanceOperationFailedCount.WithLabelValues( "DeleteInstance", // label: operation e.cfg.Name, // label: provider @@ -157,7 +157,7 @@ func (e *external) DeleteInstance(ctx context.Context, instance string, _ common // GetInstance will return details about one instance. func (e *external) GetInstance(ctx context.Context, instance string, _ common.GetInstanceParams) (commonParams.ProviderInstance, error) { asEnv := []string{ - fmt.Sprintf("GARM_COMMAND=%s", execution.GetInstanceCommand), + fmt.Sprintf("GARM_COMMAND=%s", commonExecution.GetInstanceCommand), fmt.Sprintf("GARM_CONTROLLER_ID=%s", e.controllerID), fmt.Sprintf("GARM_INSTANCE_ID=%s", instance), fmt.Sprintf("GARM_PROVIDER_CONFIG_FILE=%s", e.cfg.External.ConfigFile), @@ -203,7 +203,7 @@ func (e *external) GetInstance(ctx context.Context, instance string, _ common.Ge // ListInstances will list all instances for a provider. func (e *external) ListInstances(ctx context.Context, poolID string, _ common.ListInstancesParams) ([]commonParams.ProviderInstance, error) { asEnv := []string{ - fmt.Sprintf("GARM_COMMAND=%s", execution.ListInstancesCommand), + fmt.Sprintf("GARM_COMMAND=%s", commonExecution.ListInstancesCommand), fmt.Sprintf("GARM_CONTROLLER_ID=%s", e.controllerID), fmt.Sprintf("GARM_POOL_ID=%s", poolID), fmt.Sprintf("GARM_PROVIDER_CONFIG_FILE=%s", e.cfg.External.ConfigFile), @@ -250,7 +250,7 @@ func (e *external) ListInstances(ctx context.Context, poolID string, _ common.Li // RemoveAllInstances will remove all instances created by this provider. func (e *external) RemoveAllInstances(ctx context.Context, _ common.RemoveAllInstancesParams) error { asEnv := []string{ - fmt.Sprintf("GARM_COMMAND=%s", execution.RemoveAllInstancesCommand), + fmt.Sprintf("GARM_COMMAND=%s", commonExecution.RemoveAllInstancesCommand), fmt.Sprintf("GARM_CONTROLLER_ID=%s", e.controllerID), fmt.Sprintf("GARM_PROVIDER_CONFIG_FILE=%s", e.cfg.External.ConfigFile), } @@ -275,7 +275,7 @@ func (e *external) RemoveAllInstances(ctx context.Context, _ common.RemoveAllIns // Stop shuts down the instance. func (e *external) Stop(ctx context.Context, instance string, _ common.StopParams) error { asEnv := []string{ - fmt.Sprintf("GARM_COMMAND=%s", execution.StopInstanceCommand), + fmt.Sprintf("GARM_COMMAND=%s", commonExecution.StopInstanceCommand), fmt.Sprintf("GARM_CONTROLLER_ID=%s", e.controllerID), fmt.Sprintf("GARM_INSTANCE_ID=%s", instance), fmt.Sprintf("GARM_PROVIDER_CONFIG_FILE=%s", e.cfg.External.ConfigFile), @@ -300,7 +300,7 @@ func (e *external) Stop(ctx context.Context, instance string, _ common.StopParam // Start boots up an instance. func (e *external) Start(ctx context.Context, instance string, _ common.StartParams) error { asEnv := []string{ - fmt.Sprintf("GARM_COMMAND=%s", execution.StartInstanceCommand), + fmt.Sprintf("GARM_COMMAND=%s", commonExecution.StartInstanceCommand), fmt.Sprintf("GARM_CONTROLLER_ID=%s", e.controllerID), fmt.Sprintf("GARM_INSTANCE_ID=%s", instance), fmt.Sprintf("GARM_PROVIDER_CONFIG_FILE=%s", e.cfg.External.ConfigFile), diff --git a/runner/providers/v0.1.1/external.go b/runner/providers/v0.1.1/external.go index babc0a65..ad582c42 100644 --- a/runner/providers/v0.1.1/external.go +++ b/runner/providers/v0.1.1/external.go @@ -11,7 +11,7 @@ import ( "github.com/pkg/errors" garmErrors "github.com/cloudbase/garm-provider-common/errors" - execution "github.com/cloudbase/garm-provider-common/execution/v0.1.1" + commonExecution "github.com/cloudbase/garm-provider-common/execution/common" commonParams "github.com/cloudbase/garm-provider-common/params" garmExec "github.com/cloudbase/garm-provider-common/util/exec" "github.com/cloudbase/garm/config" @@ -75,7 +75,7 @@ func (e *external) validateResult(inst commonParams.ProviderInstance) error { // CreateInstance creates a new compute instance in the provider. func (e *external) CreateInstance(ctx context.Context, bootstrapParams commonParams.BootstrapInstance, _ common.CreateInstanceParams) (commonParams.ProviderInstance, error) { asEnv := []string{ - fmt.Sprintf("GARM_COMMAND=%s", execution.CreateInstanceCommand), + fmt.Sprintf("GARM_COMMAND=%s", commonExecution.CreateInstanceCommand), fmt.Sprintf("GARM_CONTROLLER_ID=%s", e.controllerID), fmt.Sprintf("GARM_POOL_ID=%s", bootstrapParams.PoolID), fmt.Sprintf("GARM_PROVIDER_CONFIG_FILE=%s", e.cfg.External.ConfigFile), @@ -135,7 +135,7 @@ func (e *external) DeleteInstance(ctx context.Context, instance string, deleteIn // Encode the extraspecs as base64 to avoid issues with special characters. base64EncodedExtraSpecs := base64.StdEncoding.EncodeToString(extraspecsValue) asEnv := []string{ - fmt.Sprintf("GARM_COMMAND=%s", execution.DeleteInstanceCommand), + fmt.Sprintf("GARM_COMMAND=%s", commonExecution.DeleteInstanceCommand), fmt.Sprintf("GARM_CONTROLLER_ID=%s", e.controllerID), fmt.Sprintf("GARM_INSTANCE_ID=%s", instance), fmt.Sprintf("GARM_PROVIDER_CONFIG_FILE=%s", e.cfg.External.ConfigFile), @@ -151,7 +151,7 @@ func (e *external) DeleteInstance(ctx context.Context, instance string, deleteIn _, err = garmExec.Exec(ctx, e.execPath, nil, asEnv) if err != nil { var exitErr *exec.ExitError - if !errors.As(err, &exitErr) || exitErr.ExitCode() != execution.ExitCodeNotFound { + if !errors.As(err, &exitErr) || exitErr.ExitCode() != commonExecution.ExitCodeNotFound { metrics.InstanceOperationFailedCount.WithLabelValues( "DeleteInstance", // label: operation e.cfg.Name, // label: provider @@ -172,7 +172,7 @@ func (e *external) GetInstance(ctx context.Context, instance string, getInstance // Encode the extraspecs as base64 to avoid issues with special characters. base64EncodedExtraSpecs := base64.StdEncoding.EncodeToString(extraspecsValue) asEnv := []string{ - fmt.Sprintf("GARM_COMMAND=%s", execution.GetInstanceCommand), + fmt.Sprintf("GARM_COMMAND=%s", commonExecution.GetInstanceCommand), fmt.Sprintf("GARM_CONTROLLER_ID=%s", e.controllerID), fmt.Sprintf("GARM_INSTANCE_ID=%s", instance), fmt.Sprintf("GARM_PROVIDER_CONFIG_FILE=%s", e.cfg.External.ConfigFile), @@ -227,7 +227,7 @@ func (e *external) ListInstances(ctx context.Context, poolID string, listInstanc // Encode the extraspecs as base64 to avoid issues with special characters. base64EncodedExtraSpecs := base64.StdEncoding.EncodeToString(extraspecsValue) asEnv := []string{ - fmt.Sprintf("GARM_COMMAND=%s", execution.ListInstancesCommand), + fmt.Sprintf("GARM_COMMAND=%s", commonExecution.ListInstancesCommand), fmt.Sprintf("GARM_CONTROLLER_ID=%s", e.controllerID), fmt.Sprintf("GARM_POOL_ID=%s", poolID), fmt.Sprintf("GARM_PROVIDER_CONFIG_FILE=%s", e.cfg.External.ConfigFile), @@ -282,7 +282,7 @@ func (e *external) RemoveAllInstances(ctx context.Context, removeAllInstances co // Encode the extraspecs as base64 to avoid issues with special characters. base64EncodedExtraSpecs := base64.StdEncoding.EncodeToString(extraspecsValue) asEnv := []string{ - fmt.Sprintf("GARM_COMMAND=%s", execution.RemoveAllInstancesCommand), + fmt.Sprintf("GARM_COMMAND=%s", commonExecution.RemoveAllInstancesCommand), fmt.Sprintf("GARM_CONTROLLER_ID=%s", e.controllerID), fmt.Sprintf("GARM_PROVIDER_CONFIG_FILE=%s", e.cfg.External.ConfigFile), fmt.Sprintf("GARM_POOL_ID=%s", removeAllInstances.RemoveAllInstancesV011.PoolInfo.ID), @@ -316,7 +316,7 @@ func (e *external) Stop(ctx context.Context, instance string, stopParams common. // Encode the extraspecs as base64 to avoid issues with special characters. base64EncodedExtraSpecs := base64.StdEncoding.EncodeToString(extraspecsValue) asEnv := []string{ - fmt.Sprintf("GARM_COMMAND=%s", execution.StopInstanceCommand), + fmt.Sprintf("GARM_COMMAND=%s", commonExecution.StopInstanceCommand), fmt.Sprintf("GARM_CONTROLLER_ID=%s", e.controllerID), fmt.Sprintf("GARM_INSTANCE_ID=%s", instance), fmt.Sprintf("GARM_PROVIDER_CONFIG_FILE=%s", e.cfg.External.ConfigFile), @@ -350,7 +350,7 @@ func (e *external) Start(ctx context.Context, instance string, startParams commo // Encode the extraspecs as base64 to avoid issues with special characters. base64EncodedExtraSpecs := base64.StdEncoding.EncodeToString(extraspecsValue) asEnv := []string{ - fmt.Sprintf("GARM_COMMAND=%s", execution.StartInstanceCommand), + fmt.Sprintf("GARM_COMMAND=%s", commonExecution.StartInstanceCommand), fmt.Sprintf("GARM_CONTROLLER_ID=%s", e.controllerID), fmt.Sprintf("GARM_INSTANCE_ID=%s", instance), fmt.Sprintf("GARM_PROVIDER_CONFIG_FILE=%s", e.cfg.External.ConfigFile), diff --git a/vendor/github.com/cloudbase/garm-provider-common/execution/common/commands.go b/vendor/github.com/cloudbase/garm-provider-common/execution/common/commands.go new file mode 100644 index 00000000..c4e3a607 --- /dev/null +++ b/vendor/github.com/cloudbase/garm-provider-common/execution/common/commands.go @@ -0,0 +1,98 @@ +// Copyright 2023 Cloudbase Solutions SRL +// +// 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 common + +import ( + "bytes" + "encoding/json" + "errors" + "fmt" + "io" + "os" + + gErrors "github.com/cloudbase/garm-provider-common/errors" + "github.com/cloudbase/garm-provider-common/params" + "github.com/mattn/go-isatty" +) + +type ExecutionCommand string + +const ( + CreateInstanceCommand ExecutionCommand = "CreateInstance" + DeleteInstanceCommand ExecutionCommand = "DeleteInstance" + GetInstanceCommand ExecutionCommand = "GetInstance" + ListInstancesCommand ExecutionCommand = "ListInstances" + StartInstanceCommand ExecutionCommand = "StartInstance" + StopInstanceCommand ExecutionCommand = "StopInstance" + RemoveAllInstancesCommand ExecutionCommand = "RemoveAllInstances" + GetVersionCommand ExecutionCommand = "GetVersion" +) + +// V0.1.1 commands +const ( + ValidatePoolInfoCommand ExecutionCommand = "ValidatePoolInfo" + GetConfigJSONSchemaCommand ExecutionCommand = "GetConfigJSONSchema" + GetExtraSpecsJSONSchemaCommand ExecutionCommand = "GetExtraSpecsJSONSchema" +) + +const ( + // ExitCodeNotFound is an exit code that indicates a Not Found error + ExitCodeNotFound int = 30 + // ExitCodeDuplicate is an exit code that indicates a duplicate error + ExitCodeDuplicate int = 31 +) + +func GetBoostrapParamsFromStdin(c ExecutionCommand) (params.BootstrapInstance, error) { + var bootstrapParams params.BootstrapInstance + if c == CreateInstanceCommand { + if isatty.IsTerminal(os.Stdin.Fd()) || isatty.IsCygwinTerminal(os.Stdin.Fd()) { + return params.BootstrapInstance{}, fmt.Errorf("%s requires data passed into stdin", CreateInstanceCommand) + } + + var data bytes.Buffer + if _, err := io.Copy(&data, os.Stdin); err != nil { + return params.BootstrapInstance{}, fmt.Errorf("failed to copy bootstrap params") + } + + if data.Len() == 0 { + return params.BootstrapInstance{}, fmt.Errorf("%s requires data passed into stdin", CreateInstanceCommand) + } + + if err := json.Unmarshal(data.Bytes(), &bootstrapParams); err != nil { + return params.BootstrapInstance{}, fmt.Errorf("failed to decode instance params: %w", err) + } + if bootstrapParams.ExtraSpecs == nil { + // Initialize ExtraSpecs as an empty JSON object + bootstrapParams.ExtraSpecs = json.RawMessage([]byte("{}")) + } + + return bootstrapParams, nil + } + + // If the command is not CreateInstance, we don't need to read from stdin + return params.BootstrapInstance{}, nil +} + +func ResolveErrorToExitCode(err error) int { + if err != nil { + if errors.Is(err, gErrors.ErrNotFound) { + return ExitCodeNotFound + } else if errors.Is(err, gErrors.ErrDuplicateEntity) { + return ExitCodeDuplicate + } + return 1 + } + return 0 +} diff --git a/vendor/github.com/cloudbase/garm-provider-common/execution/v0.1.1/interface.go b/vendor/github.com/cloudbase/garm-provider-common/execution/common/interface.go similarity index 89% rename from vendor/github.com/cloudbase/garm-provider-common/execution/v0.1.1/interface.go rename to vendor/github.com/cloudbase/garm-provider-common/execution/common/interface.go index 24e39e09..d00afe92 100644 --- a/vendor/github.com/cloudbase/garm-provider-common/execution/v0.1.1/interface.go +++ b/vendor/github.com/cloudbase/garm-provider-common/execution/common/interface.go @@ -12,7 +12,7 @@ // License for the specific language governing permissions and limitations // under the License. -package execution +package common import ( "context" @@ -20,7 +20,7 @@ import ( "github.com/cloudbase/garm-provider-common/params" ) -// ExternalProvider defines an interface that external providers need to implement. +// ExternalProvider defines a common interface that external providers need to implement. // This is very similar to the common.Provider interface, and was redefined here to // decouple it, in case it may diverge from native providers. type ExternalProvider interface { @@ -38,4 +38,6 @@ type ExternalProvider interface { Stop(ctx context.Context, instance string, force bool) error // Start boots up an instance. Start(ctx context.Context, instance string) error + // GetVersion returns the version of the provider. + GetVersion(ctx context.Context) string } diff --git a/vendor/github.com/cloudbase/garm-provider-common/execution/v0.1.0/commands.go b/vendor/github.com/cloudbase/garm-provider-common/execution/common/versions.go similarity index 56% rename from vendor/github.com/cloudbase/garm-provider-common/execution/v0.1.0/commands.go rename to vendor/github.com/cloudbase/garm-provider-common/execution/common/versions.go index b7976bfb..ebdbbb8c 100644 --- a/vendor/github.com/cloudbase/garm-provider-common/execution/v0.1.0/commands.go +++ b/vendor/github.com/cloudbase/garm-provider-common/execution/common/versions.go @@ -12,16 +12,11 @@ // License for the specific language governing permissions and limitations // under the License. -package execution - -type ExecutionCommand string +package common const ( - CreateInstanceCommand ExecutionCommand = "CreateInstance" - DeleteInstanceCommand ExecutionCommand = "DeleteInstance" - GetInstanceCommand ExecutionCommand = "GetInstance" - ListInstancesCommand ExecutionCommand = "ListInstances" - StartInstanceCommand ExecutionCommand = "StartInstance" - StopInstanceCommand ExecutionCommand = "StopInstance" - RemoveAllInstancesCommand ExecutionCommand = "RemoveAllInstances" + // Version v0.1.0 + Version010 = "v0.1.0" + // Version v0.1.1 + Version011 = "v0.1.1" ) diff --git a/vendor/github.com/cloudbase/garm-provider-common/execution/v0.1.0/execution.go b/vendor/github.com/cloudbase/garm-provider-common/execution/v0.1.0/execution.go deleted file mode 100644 index 948fe3a7..00000000 --- a/vendor/github.com/cloudbase/garm-provider-common/execution/v0.1.0/execution.go +++ /dev/null @@ -1,204 +0,0 @@ -// Copyright 2023 Cloudbase Solutions SRL -// -// 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 execution - -import ( - "bytes" - "context" - "encoding/json" - "errors" - "fmt" - "io" - "os" - - gErrors "github.com/cloudbase/garm-provider-common/errors" - "github.com/cloudbase/garm-provider-common/params" - - "github.com/mattn/go-isatty" -) - -const ( - // ExitCodeNotFound is an exit code that indicates a Not Found error - ExitCodeNotFound int = 30 - // ExitCodeDuplicate is an exit code that indicates a duplicate error - ExitCodeDuplicate int = 31 -) - -func ResolveErrorToExitCode(err error) int { - if err != nil { - if errors.Is(err, gErrors.ErrNotFound) { - return ExitCodeNotFound - } else if errors.Is(err, gErrors.ErrDuplicateEntity) { - return ExitCodeDuplicate - } - return 1 - } - return 0 -} - -func GetEnvironment() (Environment, error) { - env := Environment{ - Command: ExecutionCommand(os.Getenv("GARM_COMMAND")), - ControllerID: os.Getenv("GARM_CONTROLLER_ID"), - PoolID: os.Getenv("GARM_POOL_ID"), - ProviderConfigFile: os.Getenv("GARM_PROVIDER_CONFIG_FILE"), - InstanceID: os.Getenv("GARM_INSTANCE_ID"), - } - - // If this is a CreateInstance command, we need to get the bootstrap params - // from stdin - if env.Command == CreateInstanceCommand { - if isatty.IsTerminal(os.Stdin.Fd()) || isatty.IsCygwinTerminal(os.Stdin.Fd()) { - return Environment{}, fmt.Errorf("%s requires data passed into stdin", CreateInstanceCommand) - } - - var data bytes.Buffer - if _, err := io.Copy(&data, os.Stdin); err != nil { - return Environment{}, fmt.Errorf("failed to copy bootstrap params") - } - - if data.Len() == 0 { - return Environment{}, fmt.Errorf("%s requires data passed into stdin", CreateInstanceCommand) - } - - var bootstrapParams params.BootstrapInstance - if err := json.Unmarshal(data.Bytes(), &bootstrapParams); err != nil { - return Environment{}, fmt.Errorf("failed to decode instance params: %w", err) - } - if bootstrapParams.ExtraSpecs == nil { - // Initialize ExtraSpecs as an empty JSON object - bootstrapParams.ExtraSpecs = json.RawMessage([]byte("{}")) - } - env.BootstrapParams = bootstrapParams - } - - if err := env.Validate(); err != nil { - return Environment{}, fmt.Errorf("failed to validate execution environment: %w", err) - } - - return env, nil -} - -type Environment struct { - Command ExecutionCommand - ControllerID string - PoolID string - ProviderConfigFile string - InstanceID string - BootstrapParams params.BootstrapInstance -} - -func (e Environment) Validate() error { - if e.Command == "" { - return fmt.Errorf("missing GARM_COMMAND") - } - - if e.ProviderConfigFile == "" { - return fmt.Errorf("missing GARM_PROVIDER_CONFIG_FILE") - } - - if _, err := os.Lstat(e.ProviderConfigFile); err != nil { - return fmt.Errorf("error accessing config file: %w", err) - } - - if e.ControllerID == "" { - return fmt.Errorf("missing GARM_CONTROLLER_ID") - } - - switch e.Command { - case CreateInstanceCommand: - if e.BootstrapParams.Name == "" { - return fmt.Errorf("missing bootstrap params") - } - if e.ControllerID == "" { - return fmt.Errorf("missing controller ID") - } - if e.PoolID == "" { - return fmt.Errorf("missing pool ID") - } - case DeleteInstanceCommand, GetInstanceCommand, - StartInstanceCommand, StopInstanceCommand: - if e.InstanceID == "" { - return fmt.Errorf("missing instance ID") - } - case ListInstancesCommand: - if e.PoolID == "" { - return fmt.Errorf("missing pool ID") - } - case RemoveAllInstancesCommand: - if e.ControllerID == "" { - return fmt.Errorf("missing controller ID") - } - default: - return fmt.Errorf("unknown GARM_COMMAND: %s", e.Command) - } - return nil -} - -func Run(ctx context.Context, provider ExternalProvider, env Environment) (string, error) { - var ret string - switch env.Command { - case CreateInstanceCommand: - instance, err := provider.CreateInstance(ctx, env.BootstrapParams) - if err != nil { - return "", fmt.Errorf("failed to create instance in provider: %w", err) - } - - asJs, err := json.Marshal(instance) - if err != nil { - return "", fmt.Errorf("failed to marshal response: %w", err) - } - ret = string(asJs) - case GetInstanceCommand: - instance, err := provider.GetInstance(ctx, env.InstanceID) - if err != nil { - return "", fmt.Errorf("failed to get instance from provider: %w", err) - } - asJs, err := json.Marshal(instance) - if err != nil { - return "", fmt.Errorf("failed to marshal response: %w", err) - } - ret = string(asJs) - case ListInstancesCommand: - instances, err := provider.ListInstances(ctx, env.PoolID) - if err != nil { - return "", fmt.Errorf("failed to list instances from provider: %w", err) - } - asJs, err := json.Marshal(instances) - if err != nil { - return "", fmt.Errorf("failed to marshal response: %w", err) - } - ret = string(asJs) - case DeleteInstanceCommand: - if err := provider.DeleteInstance(ctx, env.InstanceID); err != nil { - return "", fmt.Errorf("failed to delete instance from provider: %w", err) - } - case RemoveAllInstancesCommand: - if err := provider.RemoveAllInstances(ctx); err != nil { - return "", fmt.Errorf("failed to destroy environment: %w", err) - } - case StartInstanceCommand: - if err := provider.Start(ctx, env.InstanceID); err != nil { - return "", fmt.Errorf("failed to start instance: %w", err) - } - case StopInstanceCommand: - if err := provider.Stop(ctx, env.InstanceID, true); err != nil { - return "", fmt.Errorf("failed to stop instance: %w", err) - } - default: - return "", fmt.Errorf("invalid command: %s", env.Command) - } - return ret, nil -} diff --git a/vendor/github.com/cloudbase/garm-provider-common/execution/v0.1.0/execution_test.go b/vendor/github.com/cloudbase/garm-provider-common/execution/v0.1.0/execution_test.go deleted file mode 100644 index 459f9d8b..00000000 --- a/vendor/github.com/cloudbase/garm-provider-common/execution/v0.1.0/execution_test.go +++ /dev/null @@ -1,494 +0,0 @@ -// Copyright 2023 Cloudbase Solutions SRL -// -// 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 execution - -import ( - "context" - "encoding/json" - "errors" - "fmt" - "log" - "os" - "testing" - - gErrors "github.com/cloudbase/garm-provider-common/errors" - "github.com/cloudbase/garm-provider-common/params" - "github.com/stretchr/testify/require" -) - -type testExternalProvider struct { - mockErr error - mockInstance params.ProviderInstance -} - -func (e *testExternalProvider) CreateInstance(ctx context.Context, bootstrapParams params.BootstrapInstance) (params.ProviderInstance, error) { - if e.mockErr != nil { - return params.ProviderInstance{}, e.mockErr - } - return e.mockInstance, nil -} - -func (p *testExternalProvider) DeleteInstance(context.Context, string) error { - if p.mockErr != nil { - return p.mockErr - } - return nil -} - -func (p *testExternalProvider) GetInstance(context.Context, string) (params.ProviderInstance, error) { - if p.mockErr != nil { - return params.ProviderInstance{}, p.mockErr - } - return p.mockInstance, nil -} - -func (p *testExternalProvider) ListInstances(context.Context, string) ([]params.ProviderInstance, error) { - if p.mockErr != nil { - return nil, p.mockErr - } - return []params.ProviderInstance{p.mockInstance}, nil -} - -func (p *testExternalProvider) RemoveAllInstances(context.Context) error { - if p.mockErr != nil { - return p.mockErr - } - return nil -} - -func (p *testExternalProvider) Stop(context.Context, string, bool) error { - if p.mockErr != nil { - return p.mockErr - } - return nil -} - -func (p *testExternalProvider) Start(context.Context, string) error { - if p.mockErr != nil { - return p.mockErr - } - return nil -} - -func TestResolveErrorToExitCode(t *testing.T) { - tests := []struct { - name string - err error - code int - }{ - { - name: "nil error", - err: nil, - code: 0, - }, - { - name: "not found error", - err: gErrors.ErrNotFound, - code: ExitCodeNotFound, - }, - { - name: "duplicate entity error", - err: gErrors.ErrDuplicateEntity, - code: ExitCodeDuplicate, - }, - { - name: "other error", - err: errors.New("other error"), - code: 1, - }, - } - - for _, tc := range tests { - t.Run(tc.name, func(t *testing.T) { - code := ResolveErrorToExitCode(tc.err) - require.Equal(t, tc.code, code) - }) - } -} - -func TestValidateEnvironment(t *testing.T) { - // Create a temporary file - tmpfile, err := os.CreateTemp("", "provider-config") - if err != nil { - log.Fatal(err) - } - // clean up the temporary file - t.Cleanup(func() { os.RemoveAll(tmpfile.Name()) }) - - tests := []struct { - name string - env Environment - errString string - }{ - { - name: "valid environment", - env: Environment{ - Command: CreateInstanceCommand, - ControllerID: "controller-id", - PoolID: "pool-id", - ProviderConfigFile: tmpfile.Name(), - InstanceID: "instance-id", - BootstrapParams: params.BootstrapInstance{ - Name: "instance-name", - }, - }, - errString: "", - }, - { - name: "invalid command", - env: Environment{ - Command: "", - }, - errString: "missing GARM_COMMAND", - }, - { - name: "invalid provider config file", - env: Environment{ - Command: CreateInstanceCommand, - ProviderConfigFile: "", - }, - errString: "missing GARM_PROVIDER_CONFIG_FILE", - }, - { - name: "error accessing config file", - env: Environment{ - Command: CreateInstanceCommand, - ProviderConfigFile: "invalid-file", - }, - errString: "error accessing config file", - }, - { - name: "invalid controller ID", - env: Environment{ - Command: CreateInstanceCommand, - ProviderConfigFile: tmpfile.Name(), - }, - errString: "missing GARM_CONTROLLER_ID", - }, - - { - name: "invalid instance ID", - env: Environment{ - Command: DeleteInstanceCommand, - ProviderConfigFile: tmpfile.Name(), - ControllerID: "controller-id", - InstanceID: "", - }, - errString: "missing instance ID", - }, - { - name: "invalid pool ID", - env: Environment{ - Command: ListInstancesCommand, - ProviderConfigFile: tmpfile.Name(), - ControllerID: "controller-id", - PoolID: "", - }, - errString: "missing pool ID", - }, - { - name: "invalid bootstrap params", - env: Environment{ - Command: CreateInstanceCommand, - ProviderConfigFile: tmpfile.Name(), - ControllerID: "controller-id", - PoolID: "pool-id", - BootstrapParams: params.BootstrapInstance{}, - }, - errString: "missing bootstrap params", - }, - { - name: "missing pool ID", - env: Environment{ - Command: CreateInstanceCommand, - ProviderConfigFile: tmpfile.Name(), - ControllerID: "controller-id", - PoolID: "", - BootstrapParams: params.BootstrapInstance{ - Name: "instance-name", - }, - }, - errString: "missing pool ID", - }, - { - name: "unknown command", - env: Environment{ - Command: "unknown-command", - ProviderConfigFile: tmpfile.Name(), - ControllerID: "controller-id", - PoolID: "pool-id", - BootstrapParams: params.BootstrapInstance{ - Name: "instance-name", - }, - }, - errString: "unknown GARM_COMMAND", - }, - } - - for _, tc := range tests { - t.Run(tc.name, func(t *testing.T) { - err := tc.env.Validate() - if tc.errString == "" { - require.NoError(t, err) - } else { - require.Error(t, err) - require.Regexp(t, tc.errString, err.Error()) - } - }) - } -} - -func TestRun(t *testing.T) { - tests := []struct { - name string - providerEnv Environment - providerInstance params.ProviderInstance - providerErr error - expectedErrMsg string - }{ - { - name: "Valid environment", - providerEnv: Environment{ - Command: CreateInstanceCommand, - }, - providerInstance: params.ProviderInstance{ - Name: "test-instance", - OSType: params.Linux, - }, - providerErr: nil, - expectedErrMsg: "", - }, - { - name: "Failed to create instance", - providerEnv: Environment{ - Command: CreateInstanceCommand, - }, - providerInstance: params.ProviderInstance{ - Name: "test-instance", - OSType: params.Linux, - }, - providerErr: fmt.Errorf("error creating test-instance"), - expectedErrMsg: "failed to create instance in provider: error creating test-instance", - }, - { - name: "Failed to get instance", - providerEnv: Environment{ - Command: GetInstanceCommand, - }, - providerInstance: params.ProviderInstance{ - Name: "test-instance", - OSType: params.Linux, - }, - providerErr: fmt.Errorf("error getting test-instance"), - expectedErrMsg: "failed to get instance from provider: error getting test-instance", - }, - { - name: "Failed to list instances", - providerEnv: Environment{ - Command: ListInstancesCommand, - }, - providerInstance: params.ProviderInstance{ - Name: "test-instance", - OSType: params.Linux, - }, - providerErr: fmt.Errorf("error listing instances"), - expectedErrMsg: "failed to list instances from provider: error listing instances", - }, - { - name: "Failed to delete instance", - providerEnv: Environment{ - Command: DeleteInstanceCommand, - }, - providerInstance: params.ProviderInstance{ - Name: "test-instance", - OSType: params.Linux, - }, - providerErr: fmt.Errorf("error deleting test-instance"), - expectedErrMsg: "failed to delete instance from provider: error deleting test-instance", - }, - { - name: "Failed to remove all instances", - providerEnv: Environment{ - Command: RemoveAllInstancesCommand, - }, - providerInstance: params.ProviderInstance{ - Name: "test-instance", - OSType: params.Linux, - }, - providerErr: fmt.Errorf("error removing all instances"), - expectedErrMsg: "failed to destroy environment: error removing all instances", - }, - { - name: "Failed to start instance", - providerEnv: Environment{ - Command: StartInstanceCommand, - }, - providerInstance: params.ProviderInstance{ - Name: "test-instance", - OSType: params.Linux, - }, - providerErr: fmt.Errorf("error starting test-instance"), - expectedErrMsg: "failed to start instance: error starting test-instance", - }, - { - name: "Failed to stop instance", - providerEnv: Environment{ - Command: StopInstanceCommand, - }, - providerInstance: params.ProviderInstance{ - Name: "test-instance", - OSType: params.Linux, - }, - providerErr: fmt.Errorf("error stopping test-instance"), - expectedErrMsg: "failed to stop instance: error stopping test-instance", - }, - { - name: "Invalid command", - providerEnv: Environment{ - Command: "invalid-command", - }, - providerInstance: params.ProviderInstance{ - Name: "test-instance", - OSType: params.Linux, - }, - providerErr: nil, - expectedErrMsg: "invalid command: invalid-command", - }, - } - - for _, tc := range tests { - testExternalProvider := testExternalProvider{ - mockErr: tc.providerErr, - mockInstance: tc.providerInstance, - } - - out, err := Run(context.Background(), &testExternalProvider, tc.providerEnv) - - if tc.expectedErrMsg == "" { - require.NoError(t, err) - expectedJs, marshalErr := json.Marshal(tc.providerInstance) - require.NoError(t, marshalErr) - require.Equal(t, string(expectedJs), out) - } else { - require.Equal(t, err.Error(), tc.expectedErrMsg) - require.Equal(t, "", out) - } - } -} - -func TestGetEnvironment(t *testing.T) { - tests := []struct { - name string - stdinData string - envData map[string]string - errString string - }{ - { - name: "The environment is valid", - stdinData: `{"name": "test"}`, - errString: "", - }, - { - name: "Data is missing from stdin", - stdinData: ``, - errString: "CreateInstance requires data passed into stdin", - }, - { - name: "Invalid JSON", - stdinData: `bogus`, - errString: "failed to decode instance params: invalid character 'b' looking for beginning of value", - }, - } - - for _, tc := range tests { - // Create a temporary file - tmpfile, err := os.CreateTemp("", "test-get-env") - if err != nil { - log.Fatal(err) - } - - // clean up the temporary file - t.Cleanup(func() { os.RemoveAll(tmpfile.Name()) }) - - // Write some test data to the temporary file - if _, err := tmpfile.Write([]byte(tc.stdinData)); err != nil { - log.Fatal(err) - } - // Rewind the temporary file to the beginning - if _, err := tmpfile.Seek(0, 0); err != nil { - log.Fatal(err) - } - - // Clean up the temporary file - t.Cleanup(func() { os.RemoveAll(tmpfile.Name()) }) - - oldStdin := os.Stdin - defer func() { os.Stdin = oldStdin }() // Restore original Stdin - - os.Stdin = tmpfile // mock os.Stdin - - for key, value := range tc.envData { - os.Setenv(key, value) - } - - // Define the environment variables - os.Setenv("GARM_COMMAND", "CreateInstance") - os.Setenv("GARM_CONTROLLER_ID", "test-controller-id") - os.Setenv("GARM_POOL_ID", "test-pool-id") - os.Setenv("GARM_PROVIDER_CONFIG_FILE", tmpfile.Name()) - - // Clean up the environment variables - t.Cleanup(func() { - for key := range tc.envData { - os.Unsetenv(key) - } - }) - - env, err := GetEnvironment() - if tc.errString == "" { - require.NoError(t, err) - require.Equal(t, CreateInstanceCommand, env.Command) - } else { - require.Equal(t, tc.errString, err.Error()) - } - } -} - -func TestGetEnvValidateFailed(t *testing.T) { - // Create a temporary file - tmpfile, err := os.CreateTemp("", "test-get-env") - if err != nil { - log.Fatal(err) - } - // clean up the temporary file - t.Cleanup(func() { os.RemoveAll(tmpfile.Name()) }) - - os.Setenv("GARM_COMMAND", "unknown-command") - os.Setenv("GARM_CONTROLLER_ID", "test-controller-id") - os.Setenv("GARM_POOL_ID", "test-pool-id") - os.Setenv("GARM_PROVIDER_CONFIG_FILE", tmpfile.Name()) - - // Clean up the environment variables - t.Cleanup(func() { - os.Unsetenv("GARM_COMMAND") - os.Unsetenv("GARM_CONTROLLER_ID") - os.Unsetenv("GARM_POOL_ID") - os.Unsetenv("GARM_PROVIDER_CONFIG_FILE") - }) - - _, err = GetEnvironment() - require.Error(t, err) - require.Equal(t, "failed to validate execution environment: unknown GARM_COMMAND: unknown-command", err.Error()) -} diff --git a/vendor/github.com/cloudbase/garm-provider-common/execution/v0.1.0/interface.go b/vendor/github.com/cloudbase/garm-provider-common/execution/v0.1.0/interface.go deleted file mode 100644 index 24e39e09..00000000 --- a/vendor/github.com/cloudbase/garm-provider-common/execution/v0.1.0/interface.go +++ /dev/null @@ -1,41 +0,0 @@ -// Copyright 2023 Cloudbase Solutions SRL -// -// 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 execution - -import ( - "context" - - "github.com/cloudbase/garm-provider-common/params" -) - -// ExternalProvider defines an interface that external providers need to implement. -// This is very similar to the common.Provider interface, and was redefined here to -// decouple it, in case it may diverge from native providers. -type ExternalProvider interface { - // CreateInstance creates a new compute instance in the provider. - CreateInstance(ctx context.Context, bootstrapParams params.BootstrapInstance) (params.ProviderInstance, error) - // Delete instance will delete the instance in a provider. - DeleteInstance(ctx context.Context, instance string) error - // GetInstance will return details about one instance. - GetInstance(ctx context.Context, instance string) (params.ProviderInstance, error) - // ListInstances will list all instances for a provider. - ListInstances(ctx context.Context, poolID string) ([]params.ProviderInstance, error) - // RemoveAllInstances will remove all instances created by this provider. - RemoveAllInstances(ctx context.Context) error - // Stop shuts down the instance. - Stop(ctx context.Context, instance string, force bool) error - // Start boots up an instance. - Start(ctx context.Context, instance string) error -} diff --git a/vendor/github.com/cloudbase/garm-provider-common/execution/v0.1.1/commands.go b/vendor/github.com/cloudbase/garm-provider-common/execution/v0.1.1/commands.go deleted file mode 100644 index 2b42efc8..00000000 --- a/vendor/github.com/cloudbase/garm-provider-common/execution/v0.1.1/commands.go +++ /dev/null @@ -1,28 +0,0 @@ -// Copyright 2023 Cloudbase Solutions SRL -// -// 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 execution - -type ExecutionCommand string - -const ( - CreateInstanceCommand ExecutionCommand = "CreateInstance" - DeleteInstanceCommand ExecutionCommand = "DeleteInstance" - GetInstanceCommand ExecutionCommand = "GetInstance" - ListInstancesCommand ExecutionCommand = "ListInstances" - StartInstanceCommand ExecutionCommand = "StartInstance" - StopInstanceCommand ExecutionCommand = "StopInstance" - RemoveAllInstancesCommand ExecutionCommand = "RemoveAllInstances" - GetVersionInfoCommand ExecutionCommand = "GetVersionInfo" -) diff --git a/vendor/github.com/cloudbase/garm-provider-common/execution/v0.1.1/execution.go b/vendor/github.com/cloudbase/garm-provider-common/execution/v0.1.1/execution.go deleted file mode 100644 index 42947575..00000000 --- a/vendor/github.com/cloudbase/garm-provider-common/execution/v0.1.1/execution.go +++ /dev/null @@ -1,212 +0,0 @@ -// Copyright 2023 Cloudbase Solutions SRL -// -// 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 execution - -import ( - "bytes" - "context" - "encoding/json" - "errors" - "fmt" - "io" - "os" - - gErrors "github.com/cloudbase/garm-provider-common/errors" - "github.com/cloudbase/garm-provider-common/params" - - "github.com/mattn/go-isatty" -) - -const ( - // ExitCodeNotFound is an exit code that indicates a Not Found error - ExitCodeNotFound int = 30 - // ExitCodeDuplicate is an exit code that indicates a duplicate error - ExitCodeDuplicate int = 31 -) - -func ResolveErrorToExitCode(err error) int { - if err != nil { - if errors.Is(err, gErrors.ErrNotFound) { - return ExitCodeNotFound - } else if errors.Is(err, gErrors.ErrDuplicateEntity) { - return ExitCodeDuplicate - } - return 1 - } - return 0 -} - -func GetEnvironment() (Environment, error) { - env := Environment{ - Command: ExecutionCommand(os.Getenv("GARM_COMMAND")), - ControllerID: os.Getenv("GARM_CONTROLLER_ID"), - PoolID: os.Getenv("GARM_POOL_ID"), - ProviderConfigFile: os.Getenv("GARM_PROVIDER_CONFIG_FILE"), - InstanceID: os.Getenv("GARM_INSTANCE_ID"), - InterfaceVersion: os.Getenv("GARM_INTERFACE_VERSION"), - ExtraSpecs: os.Getenv("GARM_POOL_EXTRASPECS"), - } - - // If this is a CreateInstance command, we need to get the bootstrap params - // from stdin - if env.Command == CreateInstanceCommand { - if isatty.IsTerminal(os.Stdin.Fd()) || isatty.IsCygwinTerminal(os.Stdin.Fd()) { - return Environment{}, fmt.Errorf("%s requires data passed into stdin", CreateInstanceCommand) - } - - var data bytes.Buffer - if _, err := io.Copy(&data, os.Stdin); err != nil { - return Environment{}, fmt.Errorf("failed to copy bootstrap params") - } - - if data.Len() == 0 { - return Environment{}, fmt.Errorf("%s requires data passed into stdin", CreateInstanceCommand) - } - - var bootstrapParams params.BootstrapInstance - if err := json.Unmarshal(data.Bytes(), &bootstrapParams); err != nil { - return Environment{}, fmt.Errorf("failed to decode instance params: %w", err) - } - if bootstrapParams.ExtraSpecs == nil { - // Initialize ExtraSpecs as an empty JSON object - bootstrapParams.ExtraSpecs = json.RawMessage([]byte("{}")) - } - env.BootstrapParams = bootstrapParams - } - - if err := env.Validate(); err != nil { - return Environment{}, fmt.Errorf("failed to validate execution environment: %w", err) - } - - return env, nil -} - -type Environment struct { - Command ExecutionCommand - ControllerID string - PoolID string - ProviderConfigFile string - InstanceID string - InterfaceVersion string - ExtraSpecs string - BootstrapParams params.BootstrapInstance -} - -func (e Environment) Validate() error { - if e.Command == "" { - return fmt.Errorf("missing GARM_COMMAND") - } - - if e.ProviderConfigFile == "" { - return fmt.Errorf("missing GARM_PROVIDER_CONFIG_FILE") - } - - if _, err := os.Lstat(e.ProviderConfigFile); err != nil { - return fmt.Errorf("error accessing config file: %w", err) - } - - if e.ControllerID == "" { - return fmt.Errorf("missing GARM_CONTROLLER_ID") - } - - switch e.Command { - case CreateInstanceCommand: - if e.BootstrapParams.Name == "" { - return fmt.Errorf("missing bootstrap params") - } - if e.ControllerID == "" { - return fmt.Errorf("missing controller ID") - } - if e.PoolID == "" { - return fmt.Errorf("missing pool ID") - } - case DeleteInstanceCommand, GetInstanceCommand, - StartInstanceCommand, StopInstanceCommand: - if e.InstanceID == "" { - return fmt.Errorf("missing instance ID") - } - if e.PoolID == "" { - return fmt.Errorf("missing pool ID") - } - case ListInstancesCommand: - if e.PoolID == "" { - return fmt.Errorf("missing pool ID") - } - - case RemoveAllInstancesCommand: - if e.ControllerID == "" { - return fmt.Errorf("missing controller ID") - } - default: - return fmt.Errorf("unknown GARM_COMMAND: %s", e.Command) - } - return nil -} - -func Run(ctx context.Context, provider ExternalProvider, env Environment) (string, error) { - var ret string - switch env.Command { - case CreateInstanceCommand: - instance, err := provider.CreateInstance(ctx, env.BootstrapParams) - if err != nil { - return "", fmt.Errorf("failed to create instance in provider: %w", err) - } - - asJs, err := json.Marshal(instance) - if err != nil { - return "", fmt.Errorf("failed to marshal response: %w", err) - } - ret = string(asJs) - case GetInstanceCommand: - instance, err := provider.GetInstance(ctx, env.InstanceID) - if err != nil { - return "", fmt.Errorf("failed to get instance from provider: %w", err) - } - asJs, err := json.Marshal(instance) - if err != nil { - return "", fmt.Errorf("failed to marshal response: %w", err) - } - ret = string(asJs) - case ListInstancesCommand: - instances, err := provider.ListInstances(ctx, env.PoolID) - if err != nil { - return "", fmt.Errorf("failed to list instances from provider: %w", err) - } - asJs, err := json.Marshal(instances) - if err != nil { - return "", fmt.Errorf("failed to marshal response: %w", err) - } - ret = string(asJs) - case DeleteInstanceCommand: - if err := provider.DeleteInstance(ctx, env.InstanceID); err != nil { - return "", fmt.Errorf("failed to delete instance from provider: %w", err) - } - case RemoveAllInstancesCommand: - if err := provider.RemoveAllInstances(ctx); err != nil { - return "", fmt.Errorf("failed to destroy environment: %w", err) - } - case StartInstanceCommand: - if err := provider.Start(ctx, env.InstanceID); err != nil { - return "", fmt.Errorf("failed to start instance: %w", err) - } - case StopInstanceCommand: - if err := provider.Stop(ctx, env.InstanceID, true); err != nil { - return "", fmt.Errorf("failed to stop instance: %w", err) - } - default: - return "", fmt.Errorf("invalid command: %s", env.Command) - } - return ret, nil -} diff --git a/vendor/github.com/cloudbase/garm-provider-common/execution/v0.1.1/execution_test.go b/vendor/github.com/cloudbase/garm-provider-common/execution/v0.1.1/execution_test.go deleted file mode 100644 index 459f9d8b..00000000 --- a/vendor/github.com/cloudbase/garm-provider-common/execution/v0.1.1/execution_test.go +++ /dev/null @@ -1,494 +0,0 @@ -// Copyright 2023 Cloudbase Solutions SRL -// -// 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 execution - -import ( - "context" - "encoding/json" - "errors" - "fmt" - "log" - "os" - "testing" - - gErrors "github.com/cloudbase/garm-provider-common/errors" - "github.com/cloudbase/garm-provider-common/params" - "github.com/stretchr/testify/require" -) - -type testExternalProvider struct { - mockErr error - mockInstance params.ProviderInstance -} - -func (e *testExternalProvider) CreateInstance(ctx context.Context, bootstrapParams params.BootstrapInstance) (params.ProviderInstance, error) { - if e.mockErr != nil { - return params.ProviderInstance{}, e.mockErr - } - return e.mockInstance, nil -} - -func (p *testExternalProvider) DeleteInstance(context.Context, string) error { - if p.mockErr != nil { - return p.mockErr - } - return nil -} - -func (p *testExternalProvider) GetInstance(context.Context, string) (params.ProviderInstance, error) { - if p.mockErr != nil { - return params.ProviderInstance{}, p.mockErr - } - return p.mockInstance, nil -} - -func (p *testExternalProvider) ListInstances(context.Context, string) ([]params.ProviderInstance, error) { - if p.mockErr != nil { - return nil, p.mockErr - } - return []params.ProviderInstance{p.mockInstance}, nil -} - -func (p *testExternalProvider) RemoveAllInstances(context.Context) error { - if p.mockErr != nil { - return p.mockErr - } - return nil -} - -func (p *testExternalProvider) Stop(context.Context, string, bool) error { - if p.mockErr != nil { - return p.mockErr - } - return nil -} - -func (p *testExternalProvider) Start(context.Context, string) error { - if p.mockErr != nil { - return p.mockErr - } - return nil -} - -func TestResolveErrorToExitCode(t *testing.T) { - tests := []struct { - name string - err error - code int - }{ - { - name: "nil error", - err: nil, - code: 0, - }, - { - name: "not found error", - err: gErrors.ErrNotFound, - code: ExitCodeNotFound, - }, - { - name: "duplicate entity error", - err: gErrors.ErrDuplicateEntity, - code: ExitCodeDuplicate, - }, - { - name: "other error", - err: errors.New("other error"), - code: 1, - }, - } - - for _, tc := range tests { - t.Run(tc.name, func(t *testing.T) { - code := ResolveErrorToExitCode(tc.err) - require.Equal(t, tc.code, code) - }) - } -} - -func TestValidateEnvironment(t *testing.T) { - // Create a temporary file - tmpfile, err := os.CreateTemp("", "provider-config") - if err != nil { - log.Fatal(err) - } - // clean up the temporary file - t.Cleanup(func() { os.RemoveAll(tmpfile.Name()) }) - - tests := []struct { - name string - env Environment - errString string - }{ - { - name: "valid environment", - env: Environment{ - Command: CreateInstanceCommand, - ControllerID: "controller-id", - PoolID: "pool-id", - ProviderConfigFile: tmpfile.Name(), - InstanceID: "instance-id", - BootstrapParams: params.BootstrapInstance{ - Name: "instance-name", - }, - }, - errString: "", - }, - { - name: "invalid command", - env: Environment{ - Command: "", - }, - errString: "missing GARM_COMMAND", - }, - { - name: "invalid provider config file", - env: Environment{ - Command: CreateInstanceCommand, - ProviderConfigFile: "", - }, - errString: "missing GARM_PROVIDER_CONFIG_FILE", - }, - { - name: "error accessing config file", - env: Environment{ - Command: CreateInstanceCommand, - ProviderConfigFile: "invalid-file", - }, - errString: "error accessing config file", - }, - { - name: "invalid controller ID", - env: Environment{ - Command: CreateInstanceCommand, - ProviderConfigFile: tmpfile.Name(), - }, - errString: "missing GARM_CONTROLLER_ID", - }, - - { - name: "invalid instance ID", - env: Environment{ - Command: DeleteInstanceCommand, - ProviderConfigFile: tmpfile.Name(), - ControllerID: "controller-id", - InstanceID: "", - }, - errString: "missing instance ID", - }, - { - name: "invalid pool ID", - env: Environment{ - Command: ListInstancesCommand, - ProviderConfigFile: tmpfile.Name(), - ControllerID: "controller-id", - PoolID: "", - }, - errString: "missing pool ID", - }, - { - name: "invalid bootstrap params", - env: Environment{ - Command: CreateInstanceCommand, - ProviderConfigFile: tmpfile.Name(), - ControllerID: "controller-id", - PoolID: "pool-id", - BootstrapParams: params.BootstrapInstance{}, - }, - errString: "missing bootstrap params", - }, - { - name: "missing pool ID", - env: Environment{ - Command: CreateInstanceCommand, - ProviderConfigFile: tmpfile.Name(), - ControllerID: "controller-id", - PoolID: "", - BootstrapParams: params.BootstrapInstance{ - Name: "instance-name", - }, - }, - errString: "missing pool ID", - }, - { - name: "unknown command", - env: Environment{ - Command: "unknown-command", - ProviderConfigFile: tmpfile.Name(), - ControllerID: "controller-id", - PoolID: "pool-id", - BootstrapParams: params.BootstrapInstance{ - Name: "instance-name", - }, - }, - errString: "unknown GARM_COMMAND", - }, - } - - for _, tc := range tests { - t.Run(tc.name, func(t *testing.T) { - err := tc.env.Validate() - if tc.errString == "" { - require.NoError(t, err) - } else { - require.Error(t, err) - require.Regexp(t, tc.errString, err.Error()) - } - }) - } -} - -func TestRun(t *testing.T) { - tests := []struct { - name string - providerEnv Environment - providerInstance params.ProviderInstance - providerErr error - expectedErrMsg string - }{ - { - name: "Valid environment", - providerEnv: Environment{ - Command: CreateInstanceCommand, - }, - providerInstance: params.ProviderInstance{ - Name: "test-instance", - OSType: params.Linux, - }, - providerErr: nil, - expectedErrMsg: "", - }, - { - name: "Failed to create instance", - providerEnv: Environment{ - Command: CreateInstanceCommand, - }, - providerInstance: params.ProviderInstance{ - Name: "test-instance", - OSType: params.Linux, - }, - providerErr: fmt.Errorf("error creating test-instance"), - expectedErrMsg: "failed to create instance in provider: error creating test-instance", - }, - { - name: "Failed to get instance", - providerEnv: Environment{ - Command: GetInstanceCommand, - }, - providerInstance: params.ProviderInstance{ - Name: "test-instance", - OSType: params.Linux, - }, - providerErr: fmt.Errorf("error getting test-instance"), - expectedErrMsg: "failed to get instance from provider: error getting test-instance", - }, - { - name: "Failed to list instances", - providerEnv: Environment{ - Command: ListInstancesCommand, - }, - providerInstance: params.ProviderInstance{ - Name: "test-instance", - OSType: params.Linux, - }, - providerErr: fmt.Errorf("error listing instances"), - expectedErrMsg: "failed to list instances from provider: error listing instances", - }, - { - name: "Failed to delete instance", - providerEnv: Environment{ - Command: DeleteInstanceCommand, - }, - providerInstance: params.ProviderInstance{ - Name: "test-instance", - OSType: params.Linux, - }, - providerErr: fmt.Errorf("error deleting test-instance"), - expectedErrMsg: "failed to delete instance from provider: error deleting test-instance", - }, - { - name: "Failed to remove all instances", - providerEnv: Environment{ - Command: RemoveAllInstancesCommand, - }, - providerInstance: params.ProviderInstance{ - Name: "test-instance", - OSType: params.Linux, - }, - providerErr: fmt.Errorf("error removing all instances"), - expectedErrMsg: "failed to destroy environment: error removing all instances", - }, - { - name: "Failed to start instance", - providerEnv: Environment{ - Command: StartInstanceCommand, - }, - providerInstance: params.ProviderInstance{ - Name: "test-instance", - OSType: params.Linux, - }, - providerErr: fmt.Errorf("error starting test-instance"), - expectedErrMsg: "failed to start instance: error starting test-instance", - }, - { - name: "Failed to stop instance", - providerEnv: Environment{ - Command: StopInstanceCommand, - }, - providerInstance: params.ProviderInstance{ - Name: "test-instance", - OSType: params.Linux, - }, - providerErr: fmt.Errorf("error stopping test-instance"), - expectedErrMsg: "failed to stop instance: error stopping test-instance", - }, - { - name: "Invalid command", - providerEnv: Environment{ - Command: "invalid-command", - }, - providerInstance: params.ProviderInstance{ - Name: "test-instance", - OSType: params.Linux, - }, - providerErr: nil, - expectedErrMsg: "invalid command: invalid-command", - }, - } - - for _, tc := range tests { - testExternalProvider := testExternalProvider{ - mockErr: tc.providerErr, - mockInstance: tc.providerInstance, - } - - out, err := Run(context.Background(), &testExternalProvider, tc.providerEnv) - - if tc.expectedErrMsg == "" { - require.NoError(t, err) - expectedJs, marshalErr := json.Marshal(tc.providerInstance) - require.NoError(t, marshalErr) - require.Equal(t, string(expectedJs), out) - } else { - require.Equal(t, err.Error(), tc.expectedErrMsg) - require.Equal(t, "", out) - } - } -} - -func TestGetEnvironment(t *testing.T) { - tests := []struct { - name string - stdinData string - envData map[string]string - errString string - }{ - { - name: "The environment is valid", - stdinData: `{"name": "test"}`, - errString: "", - }, - { - name: "Data is missing from stdin", - stdinData: ``, - errString: "CreateInstance requires data passed into stdin", - }, - { - name: "Invalid JSON", - stdinData: `bogus`, - errString: "failed to decode instance params: invalid character 'b' looking for beginning of value", - }, - } - - for _, tc := range tests { - // Create a temporary file - tmpfile, err := os.CreateTemp("", "test-get-env") - if err != nil { - log.Fatal(err) - } - - // clean up the temporary file - t.Cleanup(func() { os.RemoveAll(tmpfile.Name()) }) - - // Write some test data to the temporary file - if _, err := tmpfile.Write([]byte(tc.stdinData)); err != nil { - log.Fatal(err) - } - // Rewind the temporary file to the beginning - if _, err := tmpfile.Seek(0, 0); err != nil { - log.Fatal(err) - } - - // Clean up the temporary file - t.Cleanup(func() { os.RemoveAll(tmpfile.Name()) }) - - oldStdin := os.Stdin - defer func() { os.Stdin = oldStdin }() // Restore original Stdin - - os.Stdin = tmpfile // mock os.Stdin - - for key, value := range tc.envData { - os.Setenv(key, value) - } - - // Define the environment variables - os.Setenv("GARM_COMMAND", "CreateInstance") - os.Setenv("GARM_CONTROLLER_ID", "test-controller-id") - os.Setenv("GARM_POOL_ID", "test-pool-id") - os.Setenv("GARM_PROVIDER_CONFIG_FILE", tmpfile.Name()) - - // Clean up the environment variables - t.Cleanup(func() { - for key := range tc.envData { - os.Unsetenv(key) - } - }) - - env, err := GetEnvironment() - if tc.errString == "" { - require.NoError(t, err) - require.Equal(t, CreateInstanceCommand, env.Command) - } else { - require.Equal(t, tc.errString, err.Error()) - } - } -} - -func TestGetEnvValidateFailed(t *testing.T) { - // Create a temporary file - tmpfile, err := os.CreateTemp("", "test-get-env") - if err != nil { - log.Fatal(err) - } - // clean up the temporary file - t.Cleanup(func() { os.RemoveAll(tmpfile.Name()) }) - - os.Setenv("GARM_COMMAND", "unknown-command") - os.Setenv("GARM_CONTROLLER_ID", "test-controller-id") - os.Setenv("GARM_POOL_ID", "test-pool-id") - os.Setenv("GARM_PROVIDER_CONFIG_FILE", tmpfile.Name()) - - // Clean up the environment variables - t.Cleanup(func() { - os.Unsetenv("GARM_COMMAND") - os.Unsetenv("GARM_CONTROLLER_ID") - os.Unsetenv("GARM_POOL_ID") - os.Unsetenv("GARM_PROVIDER_CONFIG_FILE") - }) - - _, err = GetEnvironment() - require.Error(t, err) - require.Equal(t, "failed to validate execution environment: unknown GARM_COMMAND: unknown-command", err.Error()) -} diff --git a/vendor/golang.org/x/crypto/LICENSE b/vendor/golang.org/x/crypto/LICENSE index 6a66aea5..2a7cf70d 100644 --- a/vendor/golang.org/x/crypto/LICENSE +++ b/vendor/golang.org/x/crypto/LICENSE @@ -1,4 +1,4 @@ -Copyright (c) 2009 The Go Authors. All rights reserved. +Copyright 2009 The Go Authors. Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are @@ -10,7 +10,7 @@ notice, this list of conditions and the following disclaimer. copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. - * Neither the name of Google Inc. nor the names of its + * Neither the name of Google LLC nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission. diff --git a/vendor/golang.org/x/net/LICENSE b/vendor/golang.org/x/net/LICENSE index 6a66aea5..2a7cf70d 100644 --- a/vendor/golang.org/x/net/LICENSE +++ b/vendor/golang.org/x/net/LICENSE @@ -1,4 +1,4 @@ -Copyright (c) 2009 The Go Authors. All rights reserved. +Copyright 2009 The Go Authors. Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are @@ -10,7 +10,7 @@ notice, this list of conditions and the following disclaimer. copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. - * Neither the name of Google Inc. nor the names of its + * Neither the name of Google LLC nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission. diff --git a/vendor/golang.org/x/sys/LICENSE b/vendor/golang.org/x/sys/LICENSE index 6a66aea5..2a7cf70d 100644 --- a/vendor/golang.org/x/sys/LICENSE +++ b/vendor/golang.org/x/sys/LICENSE @@ -1,4 +1,4 @@ -Copyright (c) 2009 The Go Authors. All rights reserved. +Copyright 2009 The Go Authors. Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are @@ -10,7 +10,7 @@ notice, this list of conditions and the following disclaimer. copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. - * Neither the name of Google Inc. nor the names of its + * Neither the name of Google LLC nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission. diff --git a/vendor/golang.org/x/sys/cpu/cpu.go b/vendor/golang.org/x/sys/cpu/cpu.go index 8fa707aa..ec07aab0 100644 --- a/vendor/golang.org/x/sys/cpu/cpu.go +++ b/vendor/golang.org/x/sys/cpu/cpu.go @@ -105,6 +105,8 @@ var ARM64 struct { HasSVE bool // Scalable Vector Extensions HasSVE2 bool // Scalable Vector Extensions 2 HasASIMDFHM bool // Advanced SIMD multiplication FP16 to FP32 + HasDIT bool // Data Independent Timing support + HasI8MM bool // Advanced SIMD Int8 matrix multiplication instructions _ CacheLinePad } diff --git a/vendor/golang.org/x/sys/cpu/cpu_arm64.go b/vendor/golang.org/x/sys/cpu/cpu_arm64.go index 0e27a21e..af2aa99f 100644 --- a/vendor/golang.org/x/sys/cpu/cpu_arm64.go +++ b/vendor/golang.org/x/sys/cpu/cpu_arm64.go @@ -38,6 +38,8 @@ func initOptions() { {Name: "dcpop", Feature: &ARM64.HasDCPOP}, {Name: "asimddp", Feature: &ARM64.HasASIMDDP}, {Name: "asimdfhm", Feature: &ARM64.HasASIMDFHM}, + {Name: "dit", Feature: &ARM64.HasDIT}, + {Name: "i8mm", Feature: &ARM64.HasI8MM}, } } @@ -145,6 +147,11 @@ func parseARM64SystemRegisters(isar0, isar1, pfr0 uint64) { ARM64.HasLRCPC = true } + switch extractBits(isar1, 52, 55) { + case 1: + ARM64.HasI8MM = true + } + // ID_AA64PFR0_EL1 switch extractBits(pfr0, 16, 19) { case 0: @@ -168,6 +175,11 @@ func parseARM64SystemRegisters(isar0, isar1, pfr0 uint64) { parseARM64SVERegister(getzfr0()) } + + switch extractBits(pfr0, 48, 51) { + case 1: + ARM64.HasDIT = true + } } func parseARM64SVERegister(zfr0 uint64) { diff --git a/vendor/golang.org/x/sys/cpu/cpu_linux_arm64.go b/vendor/golang.org/x/sys/cpu/cpu_linux_arm64.go index 3d386d0f..08f35ea1 100644 --- a/vendor/golang.org/x/sys/cpu/cpu_linux_arm64.go +++ b/vendor/golang.org/x/sys/cpu/cpu_linux_arm64.go @@ -35,8 +35,10 @@ const ( hwcap_SHA512 = 1 << 21 hwcap_SVE = 1 << 22 hwcap_ASIMDFHM = 1 << 23 + hwcap_DIT = 1 << 24 hwcap2_SVE2 = 1 << 1 + hwcap2_I8MM = 1 << 13 ) // linuxKernelCanEmulateCPUID reports whether we're running @@ -106,9 +108,12 @@ func doinit() { ARM64.HasSHA512 = isSet(hwCap, hwcap_SHA512) ARM64.HasSVE = isSet(hwCap, hwcap_SVE) ARM64.HasASIMDFHM = isSet(hwCap, hwcap_ASIMDFHM) + ARM64.HasDIT = isSet(hwCap, hwcap_DIT) + // HWCAP2 feature bits ARM64.HasSVE2 = isSet(hwCap2, hwcap2_SVE2) + ARM64.HasI8MM = isSet(hwCap2, hwcap2_I8MM) } func isSet(hwc uint, value uint) bool { diff --git a/vendor/golang.org/x/sys/unix/mkerrors.sh b/vendor/golang.org/x/sys/unix/mkerrors.sh index 4ed2e488..d07dd09e 100644 --- a/vendor/golang.org/x/sys/unix/mkerrors.sh +++ b/vendor/golang.org/x/sys/unix/mkerrors.sh @@ -58,6 +58,7 @@ includes_Darwin=' #define _DARWIN_USE_64_BIT_INODE #define __APPLE_USE_RFC_3542 #include +#include #include #include #include diff --git a/vendor/golang.org/x/sys/unix/syscall_darwin.go b/vendor/golang.org/x/sys/unix/syscall_darwin.go index 4cc7b005..2d15200a 100644 --- a/vendor/golang.org/x/sys/unix/syscall_darwin.go +++ b/vendor/golang.org/x/sys/unix/syscall_darwin.go @@ -402,6 +402,18 @@ func IoctlSetIfreqMTU(fd int, ifreq *IfreqMTU) error { return ioctlPtr(fd, SIOCSIFMTU, unsafe.Pointer(ifreq)) } +//sys renamexNp(from string, to string, flag uint32) (err error) + +func RenamexNp(from string, to string, flag uint32) (err error) { + return renamexNp(from, to, flag) +} + +//sys renameatxNp(fromfd int, from string, tofd int, to string, flag uint32) (err error) + +func RenameatxNp(fromfd int, from string, tofd int, to string, flag uint32) (err error) { + return renameatxNp(fromfd, from, tofd, to, flag) +} + //sys sysctl(mib []_C_int, old *byte, oldlen *uintptr, new *byte, newlen uintptr) (err error) = SYS_SYSCTL func Uname(uname *Utsname) error { diff --git a/vendor/golang.org/x/sys/unix/syscall_linux.go b/vendor/golang.org/x/sys/unix/syscall_linux.go index 5682e262..3f1d3d4c 100644 --- a/vendor/golang.org/x/sys/unix/syscall_linux.go +++ b/vendor/golang.org/x/sys/unix/syscall_linux.go @@ -2592,3 +2592,4 @@ func SchedGetAttr(pid int, flags uint) (*SchedAttr, error) { } //sys Cachestat(fd uint, crange *CachestatRange, cstat *Cachestat_t, flags uint) (err error) +//sys Mseal(b []byte, flags uint) (err error) diff --git a/vendor/golang.org/x/sys/unix/syscall_openbsd.go b/vendor/golang.org/x/sys/unix/syscall_openbsd.go index b25343c7..b86ded54 100644 --- a/vendor/golang.org/x/sys/unix/syscall_openbsd.go +++ b/vendor/golang.org/x/sys/unix/syscall_openbsd.go @@ -293,6 +293,7 @@ func Uname(uname *Utsname) error { //sys Mkfifoat(dirfd int, path string, mode uint32) (err error) //sys Mknod(path string, mode uint32, dev int) (err error) //sys Mknodat(dirfd int, path string, mode uint32, dev int) (err error) +//sys Mount(fsType string, dir string, flags int, data unsafe.Pointer) (err error) //sys Nanosleep(time *Timespec, leftover *Timespec) (err error) //sys Open(path string, mode int, perm uint32) (fd int, err error) //sys Openat(dirfd int, path string, mode int, perm uint32) (fd int, err error) diff --git a/vendor/golang.org/x/sys/unix/zerrors_darwin_amd64.go b/vendor/golang.org/x/sys/unix/zerrors_darwin_amd64.go index e40fa852..4308ac17 100644 --- a/vendor/golang.org/x/sys/unix/zerrors_darwin_amd64.go +++ b/vendor/golang.org/x/sys/unix/zerrors_darwin_amd64.go @@ -1169,6 +1169,11 @@ const ( PT_WRITE_D = 0x5 PT_WRITE_I = 0x4 PT_WRITE_U = 0x6 + RENAME_EXCL = 0x4 + RENAME_NOFOLLOW_ANY = 0x10 + RENAME_RESERVED1 = 0x8 + RENAME_SECLUDE = 0x1 + RENAME_SWAP = 0x2 RLIMIT_AS = 0x5 RLIMIT_CORE = 0x4 RLIMIT_CPU = 0x0 diff --git a/vendor/golang.org/x/sys/unix/zerrors_darwin_arm64.go b/vendor/golang.org/x/sys/unix/zerrors_darwin_arm64.go index bb02aa6c..c8068a7a 100644 --- a/vendor/golang.org/x/sys/unix/zerrors_darwin_arm64.go +++ b/vendor/golang.org/x/sys/unix/zerrors_darwin_arm64.go @@ -1169,6 +1169,11 @@ const ( PT_WRITE_D = 0x5 PT_WRITE_I = 0x4 PT_WRITE_U = 0x6 + RENAME_EXCL = 0x4 + RENAME_NOFOLLOW_ANY = 0x10 + RENAME_RESERVED1 = 0x8 + RENAME_SECLUDE = 0x1 + RENAME_SWAP = 0x2 RLIMIT_AS = 0x5 RLIMIT_CORE = 0x4 RLIMIT_CPU = 0x0 diff --git a/vendor/golang.org/x/sys/unix/zerrors_linux.go b/vendor/golang.org/x/sys/unix/zerrors_linux.go index 877a62b4..01a70b24 100644 --- a/vendor/golang.org/x/sys/unix/zerrors_linux.go +++ b/vendor/golang.org/x/sys/unix/zerrors_linux.go @@ -457,6 +457,7 @@ const ( B600 = 0x8 B75 = 0x2 B9600 = 0xd + BCACHEFS_SUPER_MAGIC = 0xca451a4e BDEVFS_MAGIC = 0x62646576 BINDERFS_SUPER_MAGIC = 0x6c6f6f70 BINFMTFS_MAGIC = 0x42494e4d @@ -928,6 +929,7 @@ const ( EPOLL_CTL_ADD = 0x1 EPOLL_CTL_DEL = 0x2 EPOLL_CTL_MOD = 0x3 + EPOLL_IOC_TYPE = 0x8a EROFS_SUPER_MAGIC_V1 = 0xe0f5e1e2 ESP_V4_FLOW = 0xa ESP_V6_FLOW = 0xc @@ -941,9 +943,6 @@ const ( ETHTOOL_FEC_OFF = 0x4 ETHTOOL_FEC_RS = 0x8 ETHTOOL_FLAG_ALL = 0x7 - ETHTOOL_FLAG_COMPACT_BITSETS = 0x1 - ETHTOOL_FLAG_OMIT_REPLY = 0x2 - ETHTOOL_FLAG_STATS = 0x4 ETHTOOL_FLASHDEV = 0x33 ETHTOOL_FLASH_MAX_FILENAME = 0x80 ETHTOOL_FWVERS_LEN = 0x20 @@ -1705,6 +1704,7 @@ const ( KEXEC_ARCH_S390 = 0x160000 KEXEC_ARCH_SH = 0x2a0000 KEXEC_ARCH_X86_64 = 0x3e0000 + KEXEC_CRASH_HOTPLUG_SUPPORT = 0x8 KEXEC_FILE_DEBUG = 0x8 KEXEC_FILE_NO_INITRAMFS = 0x4 KEXEC_FILE_ON_CRASH = 0x2 @@ -1780,6 +1780,7 @@ const ( KEY_SPEC_USER_KEYRING = -0x4 KEY_SPEC_USER_SESSION_KEYRING = -0x5 LANDLOCK_ACCESS_FS_EXECUTE = 0x1 + LANDLOCK_ACCESS_FS_IOCTL_DEV = 0x8000 LANDLOCK_ACCESS_FS_MAKE_BLOCK = 0x800 LANDLOCK_ACCESS_FS_MAKE_CHAR = 0x40 LANDLOCK_ACCESS_FS_MAKE_DIR = 0x80 @@ -1861,6 +1862,19 @@ const ( MAP_FILE = 0x0 MAP_FIXED = 0x10 MAP_FIXED_NOREPLACE = 0x100000 + MAP_HUGE_16GB = 0x88000000 + MAP_HUGE_16KB = 0x38000000 + MAP_HUGE_16MB = 0x60000000 + MAP_HUGE_1GB = 0x78000000 + MAP_HUGE_1MB = 0x50000000 + MAP_HUGE_256MB = 0x70000000 + MAP_HUGE_2GB = 0x7c000000 + MAP_HUGE_2MB = 0x54000000 + MAP_HUGE_32MB = 0x64000000 + MAP_HUGE_512KB = 0x4c000000 + MAP_HUGE_512MB = 0x74000000 + MAP_HUGE_64KB = 0x40000000 + MAP_HUGE_8MB = 0x5c000000 MAP_HUGE_MASK = 0x3f MAP_HUGE_SHIFT = 0x1a MAP_PRIVATE = 0x2 @@ -2498,6 +2512,23 @@ const ( PR_PAC_GET_ENABLED_KEYS = 0x3d PR_PAC_RESET_KEYS = 0x36 PR_PAC_SET_ENABLED_KEYS = 0x3c + PR_PPC_DEXCR_CTRL_CLEAR = 0x4 + PR_PPC_DEXCR_CTRL_CLEAR_ONEXEC = 0x10 + PR_PPC_DEXCR_CTRL_EDITABLE = 0x1 + PR_PPC_DEXCR_CTRL_MASK = 0x1f + PR_PPC_DEXCR_CTRL_SET = 0x2 + PR_PPC_DEXCR_CTRL_SET_ONEXEC = 0x8 + PR_PPC_DEXCR_IBRTPD = 0x1 + PR_PPC_DEXCR_NPHIE = 0x3 + PR_PPC_DEXCR_SBHE = 0x0 + PR_PPC_DEXCR_SRAPD = 0x2 + PR_PPC_GET_DEXCR = 0x48 + PR_PPC_SET_DEXCR = 0x49 + PR_RISCV_CTX_SW_FENCEI_OFF = 0x1 + PR_RISCV_CTX_SW_FENCEI_ON = 0x0 + PR_RISCV_SCOPE_PER_PROCESS = 0x0 + PR_RISCV_SCOPE_PER_THREAD = 0x1 + PR_RISCV_SET_ICACHE_FLUSH_CTX = 0x47 PR_RISCV_V_GET_CONTROL = 0x46 PR_RISCV_V_SET_CONTROL = 0x45 PR_RISCV_V_VSTATE_CTRL_CUR_MASK = 0x3 @@ -3192,6 +3223,7 @@ const ( STATX_MTIME = 0x40 STATX_NLINK = 0x4 STATX_SIZE = 0x200 + STATX_SUBVOL = 0x8000 STATX_TYPE = 0x1 STATX_UID = 0x8 STATX__RESERVED = 0x80000000 diff --git a/vendor/golang.org/x/sys/unix/zerrors_linux_386.go b/vendor/golang.org/x/sys/unix/zerrors_linux_386.go index e4bc0bd5..684a5168 100644 --- a/vendor/golang.org/x/sys/unix/zerrors_linux_386.go +++ b/vendor/golang.org/x/sys/unix/zerrors_linux_386.go @@ -78,6 +78,8 @@ const ( ECHOPRT = 0x400 EFD_CLOEXEC = 0x80000 EFD_NONBLOCK = 0x800 + EPIOCGPARAMS = 0x80088a02 + EPIOCSPARAMS = 0x40088a01 EPOLL_CLOEXEC = 0x80000 EXTPROC = 0x10000 FF1 = 0x8000 diff --git a/vendor/golang.org/x/sys/unix/zerrors_linux_amd64.go b/vendor/golang.org/x/sys/unix/zerrors_linux_amd64.go index 689317af..61d74b59 100644 --- a/vendor/golang.org/x/sys/unix/zerrors_linux_amd64.go +++ b/vendor/golang.org/x/sys/unix/zerrors_linux_amd64.go @@ -78,6 +78,8 @@ const ( ECHOPRT = 0x400 EFD_CLOEXEC = 0x80000 EFD_NONBLOCK = 0x800 + EPIOCGPARAMS = 0x80088a02 + EPIOCSPARAMS = 0x40088a01 EPOLL_CLOEXEC = 0x80000 EXTPROC = 0x10000 FF1 = 0x8000 diff --git a/vendor/golang.org/x/sys/unix/zerrors_linux_arm.go b/vendor/golang.org/x/sys/unix/zerrors_linux_arm.go index 5cca668a..a28c9e3e 100644 --- a/vendor/golang.org/x/sys/unix/zerrors_linux_arm.go +++ b/vendor/golang.org/x/sys/unix/zerrors_linux_arm.go @@ -78,6 +78,8 @@ const ( ECHOPRT = 0x400 EFD_CLOEXEC = 0x80000 EFD_NONBLOCK = 0x800 + EPIOCGPARAMS = 0x80088a02 + EPIOCSPARAMS = 0x40088a01 EPOLL_CLOEXEC = 0x80000 EXTPROC = 0x10000 FF1 = 0x8000 diff --git a/vendor/golang.org/x/sys/unix/zerrors_linux_arm64.go b/vendor/golang.org/x/sys/unix/zerrors_linux_arm64.go index 14270508..ab5d1fe8 100644 --- a/vendor/golang.org/x/sys/unix/zerrors_linux_arm64.go +++ b/vendor/golang.org/x/sys/unix/zerrors_linux_arm64.go @@ -78,6 +78,8 @@ const ( ECHOPRT = 0x400 EFD_CLOEXEC = 0x80000 EFD_NONBLOCK = 0x800 + EPIOCGPARAMS = 0x80088a02 + EPIOCSPARAMS = 0x40088a01 EPOLL_CLOEXEC = 0x80000 ESR_MAGIC = 0x45535201 EXTPROC = 0x10000 diff --git a/vendor/golang.org/x/sys/unix/zerrors_linux_loong64.go b/vendor/golang.org/x/sys/unix/zerrors_linux_loong64.go index 28e39afd..c523090e 100644 --- a/vendor/golang.org/x/sys/unix/zerrors_linux_loong64.go +++ b/vendor/golang.org/x/sys/unix/zerrors_linux_loong64.go @@ -78,6 +78,8 @@ const ( ECHOPRT = 0x400 EFD_CLOEXEC = 0x80000 EFD_NONBLOCK = 0x800 + EPIOCGPARAMS = 0x80088a02 + EPIOCSPARAMS = 0x40088a01 EPOLL_CLOEXEC = 0x80000 EXTPROC = 0x10000 FF1 = 0x8000 diff --git a/vendor/golang.org/x/sys/unix/zerrors_linux_mips.go b/vendor/golang.org/x/sys/unix/zerrors_linux_mips.go index cd66e92c..01e6ea78 100644 --- a/vendor/golang.org/x/sys/unix/zerrors_linux_mips.go +++ b/vendor/golang.org/x/sys/unix/zerrors_linux_mips.go @@ -78,6 +78,8 @@ const ( ECHOPRT = 0x400 EFD_CLOEXEC = 0x80000 EFD_NONBLOCK = 0x80 + EPIOCGPARAMS = 0x40088a02 + EPIOCSPARAMS = 0x80088a01 EPOLL_CLOEXEC = 0x80000 EXTPROC = 0x10000 FF1 = 0x8000 diff --git a/vendor/golang.org/x/sys/unix/zerrors_linux_mips64.go b/vendor/golang.org/x/sys/unix/zerrors_linux_mips64.go index c1595eba..7aa610b1 100644 --- a/vendor/golang.org/x/sys/unix/zerrors_linux_mips64.go +++ b/vendor/golang.org/x/sys/unix/zerrors_linux_mips64.go @@ -78,6 +78,8 @@ const ( ECHOPRT = 0x400 EFD_CLOEXEC = 0x80000 EFD_NONBLOCK = 0x80 + EPIOCGPARAMS = 0x40088a02 + EPIOCSPARAMS = 0x80088a01 EPOLL_CLOEXEC = 0x80000 EXTPROC = 0x10000 FF1 = 0x8000 diff --git a/vendor/golang.org/x/sys/unix/zerrors_linux_mips64le.go b/vendor/golang.org/x/sys/unix/zerrors_linux_mips64le.go index ee9456b0..92af771b 100644 --- a/vendor/golang.org/x/sys/unix/zerrors_linux_mips64le.go +++ b/vendor/golang.org/x/sys/unix/zerrors_linux_mips64le.go @@ -78,6 +78,8 @@ const ( ECHOPRT = 0x400 EFD_CLOEXEC = 0x80000 EFD_NONBLOCK = 0x80 + EPIOCGPARAMS = 0x40088a02 + EPIOCSPARAMS = 0x80088a01 EPOLL_CLOEXEC = 0x80000 EXTPROC = 0x10000 FF1 = 0x8000 diff --git a/vendor/golang.org/x/sys/unix/zerrors_linux_mipsle.go b/vendor/golang.org/x/sys/unix/zerrors_linux_mipsle.go index 8cfca81e..b27ef5e6 100644 --- a/vendor/golang.org/x/sys/unix/zerrors_linux_mipsle.go +++ b/vendor/golang.org/x/sys/unix/zerrors_linux_mipsle.go @@ -78,6 +78,8 @@ const ( ECHOPRT = 0x400 EFD_CLOEXEC = 0x80000 EFD_NONBLOCK = 0x80 + EPIOCGPARAMS = 0x40088a02 + EPIOCSPARAMS = 0x80088a01 EPOLL_CLOEXEC = 0x80000 EXTPROC = 0x10000 FF1 = 0x8000 diff --git a/vendor/golang.org/x/sys/unix/zerrors_linux_ppc.go b/vendor/golang.org/x/sys/unix/zerrors_linux_ppc.go index 60b0deb3..237a2cef 100644 --- a/vendor/golang.org/x/sys/unix/zerrors_linux_ppc.go +++ b/vendor/golang.org/x/sys/unix/zerrors_linux_ppc.go @@ -78,6 +78,8 @@ const ( ECHOPRT = 0x20 EFD_CLOEXEC = 0x80000 EFD_NONBLOCK = 0x800 + EPIOCGPARAMS = 0x40088a02 + EPIOCSPARAMS = 0x80088a01 EPOLL_CLOEXEC = 0x80000 EXTPROC = 0x10000000 FF1 = 0x4000 diff --git a/vendor/golang.org/x/sys/unix/zerrors_linux_ppc64.go b/vendor/golang.org/x/sys/unix/zerrors_linux_ppc64.go index f90aa728..4a5c555a 100644 --- a/vendor/golang.org/x/sys/unix/zerrors_linux_ppc64.go +++ b/vendor/golang.org/x/sys/unix/zerrors_linux_ppc64.go @@ -78,6 +78,8 @@ const ( ECHOPRT = 0x20 EFD_CLOEXEC = 0x80000 EFD_NONBLOCK = 0x800 + EPIOCGPARAMS = 0x40088a02 + EPIOCSPARAMS = 0x80088a01 EPOLL_CLOEXEC = 0x80000 EXTPROC = 0x10000000 FF1 = 0x4000 diff --git a/vendor/golang.org/x/sys/unix/zerrors_linux_ppc64le.go b/vendor/golang.org/x/sys/unix/zerrors_linux_ppc64le.go index ba9e0150..a02fb49a 100644 --- a/vendor/golang.org/x/sys/unix/zerrors_linux_ppc64le.go +++ b/vendor/golang.org/x/sys/unix/zerrors_linux_ppc64le.go @@ -78,6 +78,8 @@ const ( ECHOPRT = 0x20 EFD_CLOEXEC = 0x80000 EFD_NONBLOCK = 0x800 + EPIOCGPARAMS = 0x40088a02 + EPIOCSPARAMS = 0x80088a01 EPOLL_CLOEXEC = 0x80000 EXTPROC = 0x10000000 FF1 = 0x4000 diff --git a/vendor/golang.org/x/sys/unix/zerrors_linux_riscv64.go b/vendor/golang.org/x/sys/unix/zerrors_linux_riscv64.go index 07cdfd6e..e26a7c61 100644 --- a/vendor/golang.org/x/sys/unix/zerrors_linux_riscv64.go +++ b/vendor/golang.org/x/sys/unix/zerrors_linux_riscv64.go @@ -78,6 +78,8 @@ const ( ECHOPRT = 0x400 EFD_CLOEXEC = 0x80000 EFD_NONBLOCK = 0x800 + EPIOCGPARAMS = 0x80088a02 + EPIOCSPARAMS = 0x40088a01 EPOLL_CLOEXEC = 0x80000 EXTPROC = 0x10000 FF1 = 0x8000 diff --git a/vendor/golang.org/x/sys/unix/zerrors_linux_s390x.go b/vendor/golang.org/x/sys/unix/zerrors_linux_s390x.go index 2f1dd214..c48f7c21 100644 --- a/vendor/golang.org/x/sys/unix/zerrors_linux_s390x.go +++ b/vendor/golang.org/x/sys/unix/zerrors_linux_s390x.go @@ -78,6 +78,8 @@ const ( ECHOPRT = 0x400 EFD_CLOEXEC = 0x80000 EFD_NONBLOCK = 0x800 + EPIOCGPARAMS = 0x80088a02 + EPIOCSPARAMS = 0x40088a01 EPOLL_CLOEXEC = 0x80000 EXTPROC = 0x10000 FF1 = 0x8000 diff --git a/vendor/golang.org/x/sys/unix/zerrors_linux_sparc64.go b/vendor/golang.org/x/sys/unix/zerrors_linux_sparc64.go index f40519d9..ad4b9aac 100644 --- a/vendor/golang.org/x/sys/unix/zerrors_linux_sparc64.go +++ b/vendor/golang.org/x/sys/unix/zerrors_linux_sparc64.go @@ -82,6 +82,8 @@ const ( EFD_CLOEXEC = 0x400000 EFD_NONBLOCK = 0x4000 EMT_TAGOVF = 0x1 + EPIOCGPARAMS = 0x40088a02 + EPIOCSPARAMS = 0x80088a01 EPOLL_CLOEXEC = 0x400000 EXTPROC = 0x10000 FF1 = 0x8000 diff --git a/vendor/golang.org/x/sys/unix/zsyscall_darwin_amd64.go b/vendor/golang.org/x/sys/unix/zsyscall_darwin_amd64.go index 07642c30..b622533e 100644 --- a/vendor/golang.org/x/sys/unix/zsyscall_darwin_amd64.go +++ b/vendor/golang.org/x/sys/unix/zsyscall_darwin_amd64.go @@ -740,6 +740,54 @@ func ioctlPtr(fd int, req uint, arg unsafe.Pointer) (err error) { // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT +func renamexNp(from string, to string, flag uint32) (err error) { + var _p0 *byte + _p0, err = BytePtrFromString(from) + if err != nil { + return + } + var _p1 *byte + _p1, err = BytePtrFromString(to) + if err != nil { + return + } + _, _, e1 := syscall_syscall(libc_renamex_np_trampoline_addr, uintptr(unsafe.Pointer(_p0)), uintptr(unsafe.Pointer(_p1)), uintptr(flag)) + if e1 != 0 { + err = errnoErr(e1) + } + return +} + +var libc_renamex_np_trampoline_addr uintptr + +//go:cgo_import_dynamic libc_renamex_np renamex_np "/usr/lib/libSystem.B.dylib" + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + +func renameatxNp(fromfd int, from string, tofd int, to string, flag uint32) (err error) { + var _p0 *byte + _p0, err = BytePtrFromString(from) + if err != nil { + return + } + var _p1 *byte + _p1, err = BytePtrFromString(to) + if err != nil { + return + } + _, _, e1 := syscall_syscall6(libc_renameatx_np_trampoline_addr, uintptr(fromfd), uintptr(unsafe.Pointer(_p0)), uintptr(tofd), uintptr(unsafe.Pointer(_p1)), uintptr(flag), 0) + if e1 != 0 { + err = errnoErr(e1) + } + return +} + +var libc_renameatx_np_trampoline_addr uintptr + +//go:cgo_import_dynamic libc_renameatx_np renameatx_np "/usr/lib/libSystem.B.dylib" + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + func sysctl(mib []_C_int, old *byte, oldlen *uintptr, new *byte, newlen uintptr) (err error) { var _p0 unsafe.Pointer if len(mib) > 0 { diff --git a/vendor/golang.org/x/sys/unix/zsyscall_darwin_amd64.s b/vendor/golang.org/x/sys/unix/zsyscall_darwin_amd64.s index 923e08cb..cfe6646b 100644 --- a/vendor/golang.org/x/sys/unix/zsyscall_darwin_amd64.s +++ b/vendor/golang.org/x/sys/unix/zsyscall_darwin_amd64.s @@ -223,6 +223,16 @@ TEXT libc_ioctl_trampoline<>(SB),NOSPLIT,$0-0 GLOBL ·libc_ioctl_trampoline_addr(SB), RODATA, $8 DATA ·libc_ioctl_trampoline_addr(SB)/8, $libc_ioctl_trampoline<>(SB) +TEXT libc_renamex_np_trampoline<>(SB),NOSPLIT,$0-0 + JMP libc_renamex_np(SB) +GLOBL ·libc_renamex_np_trampoline_addr(SB), RODATA, $8 +DATA ·libc_renamex_np_trampoline_addr(SB)/8, $libc_renamex_np_trampoline<>(SB) + +TEXT libc_renameatx_np_trampoline<>(SB),NOSPLIT,$0-0 + JMP libc_renameatx_np(SB) +GLOBL ·libc_renameatx_np_trampoline_addr(SB), RODATA, $8 +DATA ·libc_renameatx_np_trampoline_addr(SB)/8, $libc_renameatx_np_trampoline<>(SB) + TEXT libc_sysctl_trampoline<>(SB),NOSPLIT,$0-0 JMP libc_sysctl(SB) GLOBL ·libc_sysctl_trampoline_addr(SB), RODATA, $8 diff --git a/vendor/golang.org/x/sys/unix/zsyscall_darwin_arm64.go b/vendor/golang.org/x/sys/unix/zsyscall_darwin_arm64.go index 7d73dda6..13f624f6 100644 --- a/vendor/golang.org/x/sys/unix/zsyscall_darwin_arm64.go +++ b/vendor/golang.org/x/sys/unix/zsyscall_darwin_arm64.go @@ -740,6 +740,54 @@ func ioctlPtr(fd int, req uint, arg unsafe.Pointer) (err error) { // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT +func renamexNp(from string, to string, flag uint32) (err error) { + var _p0 *byte + _p0, err = BytePtrFromString(from) + if err != nil { + return + } + var _p1 *byte + _p1, err = BytePtrFromString(to) + if err != nil { + return + } + _, _, e1 := syscall_syscall(libc_renamex_np_trampoline_addr, uintptr(unsafe.Pointer(_p0)), uintptr(unsafe.Pointer(_p1)), uintptr(flag)) + if e1 != 0 { + err = errnoErr(e1) + } + return +} + +var libc_renamex_np_trampoline_addr uintptr + +//go:cgo_import_dynamic libc_renamex_np renamex_np "/usr/lib/libSystem.B.dylib" + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + +func renameatxNp(fromfd int, from string, tofd int, to string, flag uint32) (err error) { + var _p0 *byte + _p0, err = BytePtrFromString(from) + if err != nil { + return + } + var _p1 *byte + _p1, err = BytePtrFromString(to) + if err != nil { + return + } + _, _, e1 := syscall_syscall6(libc_renameatx_np_trampoline_addr, uintptr(fromfd), uintptr(unsafe.Pointer(_p0)), uintptr(tofd), uintptr(unsafe.Pointer(_p1)), uintptr(flag), 0) + if e1 != 0 { + err = errnoErr(e1) + } + return +} + +var libc_renameatx_np_trampoline_addr uintptr + +//go:cgo_import_dynamic libc_renameatx_np renameatx_np "/usr/lib/libSystem.B.dylib" + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + func sysctl(mib []_C_int, old *byte, oldlen *uintptr, new *byte, newlen uintptr) (err error) { var _p0 unsafe.Pointer if len(mib) > 0 { diff --git a/vendor/golang.org/x/sys/unix/zsyscall_darwin_arm64.s b/vendor/golang.org/x/sys/unix/zsyscall_darwin_arm64.s index 05770011..fe222b75 100644 --- a/vendor/golang.org/x/sys/unix/zsyscall_darwin_arm64.s +++ b/vendor/golang.org/x/sys/unix/zsyscall_darwin_arm64.s @@ -223,6 +223,16 @@ TEXT libc_ioctl_trampoline<>(SB),NOSPLIT,$0-0 GLOBL ·libc_ioctl_trampoline_addr(SB), RODATA, $8 DATA ·libc_ioctl_trampoline_addr(SB)/8, $libc_ioctl_trampoline<>(SB) +TEXT libc_renamex_np_trampoline<>(SB),NOSPLIT,$0-0 + JMP libc_renamex_np(SB) +GLOBL ·libc_renamex_np_trampoline_addr(SB), RODATA, $8 +DATA ·libc_renamex_np_trampoline_addr(SB)/8, $libc_renamex_np_trampoline<>(SB) + +TEXT libc_renameatx_np_trampoline<>(SB),NOSPLIT,$0-0 + JMP libc_renameatx_np(SB) +GLOBL ·libc_renameatx_np_trampoline_addr(SB), RODATA, $8 +DATA ·libc_renameatx_np_trampoline_addr(SB)/8, $libc_renameatx_np_trampoline<>(SB) + TEXT libc_sysctl_trampoline<>(SB),NOSPLIT,$0-0 JMP libc_sysctl(SB) GLOBL ·libc_sysctl_trampoline_addr(SB), RODATA, $8 diff --git a/vendor/golang.org/x/sys/unix/zsyscall_linux.go b/vendor/golang.org/x/sys/unix/zsyscall_linux.go index 87d8612a..1bc1a5ad 100644 --- a/vendor/golang.org/x/sys/unix/zsyscall_linux.go +++ b/vendor/golang.org/x/sys/unix/zsyscall_linux.go @@ -2229,3 +2229,19 @@ func Cachestat(fd uint, crange *CachestatRange, cstat *Cachestat_t, flags uint) } return } + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + +func Mseal(b []byte, flags uint) (err error) { + var _p0 unsafe.Pointer + if len(b) > 0 { + _p0 = unsafe.Pointer(&b[0]) + } else { + _p0 = unsafe.Pointer(&_zero) + } + _, _, e1 := Syscall(SYS_MSEAL, uintptr(_p0), uintptr(len(b)), uintptr(flags)) + if e1 != 0 { + err = errnoErr(e1) + } + return +} diff --git a/vendor/golang.org/x/sys/unix/zsyscall_openbsd_386.go b/vendor/golang.org/x/sys/unix/zsyscall_openbsd_386.go index 9dc42410..1851df14 100644 --- a/vendor/golang.org/x/sys/unix/zsyscall_openbsd_386.go +++ b/vendor/golang.org/x/sys/unix/zsyscall_openbsd_386.go @@ -1493,6 +1493,30 @@ var libc_mknodat_trampoline_addr uintptr // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT +func Mount(fsType string, dir string, flags int, data unsafe.Pointer) (err error) { + var _p0 *byte + _p0, err = BytePtrFromString(fsType) + if err != nil { + return + } + var _p1 *byte + _p1, err = BytePtrFromString(dir) + if err != nil { + return + } + _, _, e1 := syscall_syscall6(libc_mount_trampoline_addr, uintptr(unsafe.Pointer(_p0)), uintptr(unsafe.Pointer(_p1)), uintptr(flags), uintptr(data), 0, 0) + if e1 != 0 { + err = errnoErr(e1) + } + return +} + +var libc_mount_trampoline_addr uintptr + +//go:cgo_import_dynamic libc_mount mount "libc.so" + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + func Nanosleep(time *Timespec, leftover *Timespec) (err error) { _, _, e1 := syscall_syscall(libc_nanosleep_trampoline_addr, uintptr(unsafe.Pointer(time)), uintptr(unsafe.Pointer(leftover)), 0) if e1 != 0 { diff --git a/vendor/golang.org/x/sys/unix/zsyscall_openbsd_386.s b/vendor/golang.org/x/sys/unix/zsyscall_openbsd_386.s index 41b56173..0b43c693 100644 --- a/vendor/golang.org/x/sys/unix/zsyscall_openbsd_386.s +++ b/vendor/golang.org/x/sys/unix/zsyscall_openbsd_386.s @@ -463,6 +463,11 @@ TEXT libc_mknodat_trampoline<>(SB),NOSPLIT,$0-0 GLOBL ·libc_mknodat_trampoline_addr(SB), RODATA, $4 DATA ·libc_mknodat_trampoline_addr(SB)/4, $libc_mknodat_trampoline<>(SB) +TEXT libc_mount_trampoline<>(SB),NOSPLIT,$0-0 + JMP libc_mount(SB) +GLOBL ·libc_mount_trampoline_addr(SB), RODATA, $4 +DATA ·libc_mount_trampoline_addr(SB)/4, $libc_mount_trampoline<>(SB) + TEXT libc_nanosleep_trampoline<>(SB),NOSPLIT,$0-0 JMP libc_nanosleep(SB) GLOBL ·libc_nanosleep_trampoline_addr(SB), RODATA, $4 diff --git a/vendor/golang.org/x/sys/unix/zsyscall_openbsd_amd64.go b/vendor/golang.org/x/sys/unix/zsyscall_openbsd_amd64.go index 0d3a0751..e1ec0dbe 100644 --- a/vendor/golang.org/x/sys/unix/zsyscall_openbsd_amd64.go +++ b/vendor/golang.org/x/sys/unix/zsyscall_openbsd_amd64.go @@ -1493,6 +1493,30 @@ var libc_mknodat_trampoline_addr uintptr // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT +func Mount(fsType string, dir string, flags int, data unsafe.Pointer) (err error) { + var _p0 *byte + _p0, err = BytePtrFromString(fsType) + if err != nil { + return + } + var _p1 *byte + _p1, err = BytePtrFromString(dir) + if err != nil { + return + } + _, _, e1 := syscall_syscall6(libc_mount_trampoline_addr, uintptr(unsafe.Pointer(_p0)), uintptr(unsafe.Pointer(_p1)), uintptr(flags), uintptr(data), 0, 0) + if e1 != 0 { + err = errnoErr(e1) + } + return +} + +var libc_mount_trampoline_addr uintptr + +//go:cgo_import_dynamic libc_mount mount "libc.so" + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + func Nanosleep(time *Timespec, leftover *Timespec) (err error) { _, _, e1 := syscall_syscall(libc_nanosleep_trampoline_addr, uintptr(unsafe.Pointer(time)), uintptr(unsafe.Pointer(leftover)), 0) if e1 != 0 { diff --git a/vendor/golang.org/x/sys/unix/zsyscall_openbsd_amd64.s b/vendor/golang.org/x/sys/unix/zsyscall_openbsd_amd64.s index 4019a656..880c6d6e 100644 --- a/vendor/golang.org/x/sys/unix/zsyscall_openbsd_amd64.s +++ b/vendor/golang.org/x/sys/unix/zsyscall_openbsd_amd64.s @@ -463,6 +463,11 @@ TEXT libc_mknodat_trampoline<>(SB),NOSPLIT,$0-0 GLOBL ·libc_mknodat_trampoline_addr(SB), RODATA, $8 DATA ·libc_mknodat_trampoline_addr(SB)/8, $libc_mknodat_trampoline<>(SB) +TEXT libc_mount_trampoline<>(SB),NOSPLIT,$0-0 + JMP libc_mount(SB) +GLOBL ·libc_mount_trampoline_addr(SB), RODATA, $8 +DATA ·libc_mount_trampoline_addr(SB)/8, $libc_mount_trampoline<>(SB) + TEXT libc_nanosleep_trampoline<>(SB),NOSPLIT,$0-0 JMP libc_nanosleep(SB) GLOBL ·libc_nanosleep_trampoline_addr(SB), RODATA, $8 diff --git a/vendor/golang.org/x/sys/unix/zsyscall_openbsd_arm.go b/vendor/golang.org/x/sys/unix/zsyscall_openbsd_arm.go index c39f7776..7c8452a6 100644 --- a/vendor/golang.org/x/sys/unix/zsyscall_openbsd_arm.go +++ b/vendor/golang.org/x/sys/unix/zsyscall_openbsd_arm.go @@ -1493,6 +1493,30 @@ var libc_mknodat_trampoline_addr uintptr // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT +func Mount(fsType string, dir string, flags int, data unsafe.Pointer) (err error) { + var _p0 *byte + _p0, err = BytePtrFromString(fsType) + if err != nil { + return + } + var _p1 *byte + _p1, err = BytePtrFromString(dir) + if err != nil { + return + } + _, _, e1 := syscall_syscall6(libc_mount_trampoline_addr, uintptr(unsafe.Pointer(_p0)), uintptr(unsafe.Pointer(_p1)), uintptr(flags), uintptr(data), 0, 0) + if e1 != 0 { + err = errnoErr(e1) + } + return +} + +var libc_mount_trampoline_addr uintptr + +//go:cgo_import_dynamic libc_mount mount "libc.so" + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + func Nanosleep(time *Timespec, leftover *Timespec) (err error) { _, _, e1 := syscall_syscall(libc_nanosleep_trampoline_addr, uintptr(unsafe.Pointer(time)), uintptr(unsafe.Pointer(leftover)), 0) if e1 != 0 { diff --git a/vendor/golang.org/x/sys/unix/zsyscall_openbsd_arm.s b/vendor/golang.org/x/sys/unix/zsyscall_openbsd_arm.s index ac4af24f..b8ef95b0 100644 --- a/vendor/golang.org/x/sys/unix/zsyscall_openbsd_arm.s +++ b/vendor/golang.org/x/sys/unix/zsyscall_openbsd_arm.s @@ -463,6 +463,11 @@ TEXT libc_mknodat_trampoline<>(SB),NOSPLIT,$0-0 GLOBL ·libc_mknodat_trampoline_addr(SB), RODATA, $4 DATA ·libc_mknodat_trampoline_addr(SB)/4, $libc_mknodat_trampoline<>(SB) +TEXT libc_mount_trampoline<>(SB),NOSPLIT,$0-0 + JMP libc_mount(SB) +GLOBL ·libc_mount_trampoline_addr(SB), RODATA, $4 +DATA ·libc_mount_trampoline_addr(SB)/4, $libc_mount_trampoline<>(SB) + TEXT libc_nanosleep_trampoline<>(SB),NOSPLIT,$0-0 JMP libc_nanosleep(SB) GLOBL ·libc_nanosleep_trampoline_addr(SB), RODATA, $4 diff --git a/vendor/golang.org/x/sys/unix/zsyscall_openbsd_arm64.go b/vendor/golang.org/x/sys/unix/zsyscall_openbsd_arm64.go index 57571d07..2ffdf861 100644 --- a/vendor/golang.org/x/sys/unix/zsyscall_openbsd_arm64.go +++ b/vendor/golang.org/x/sys/unix/zsyscall_openbsd_arm64.go @@ -1493,6 +1493,30 @@ var libc_mknodat_trampoline_addr uintptr // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT +func Mount(fsType string, dir string, flags int, data unsafe.Pointer) (err error) { + var _p0 *byte + _p0, err = BytePtrFromString(fsType) + if err != nil { + return + } + var _p1 *byte + _p1, err = BytePtrFromString(dir) + if err != nil { + return + } + _, _, e1 := syscall_syscall6(libc_mount_trampoline_addr, uintptr(unsafe.Pointer(_p0)), uintptr(unsafe.Pointer(_p1)), uintptr(flags), uintptr(data), 0, 0) + if e1 != 0 { + err = errnoErr(e1) + } + return +} + +var libc_mount_trampoline_addr uintptr + +//go:cgo_import_dynamic libc_mount mount "libc.so" + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + func Nanosleep(time *Timespec, leftover *Timespec) (err error) { _, _, e1 := syscall_syscall(libc_nanosleep_trampoline_addr, uintptr(unsafe.Pointer(time)), uintptr(unsafe.Pointer(leftover)), 0) if e1 != 0 { diff --git a/vendor/golang.org/x/sys/unix/zsyscall_openbsd_arm64.s b/vendor/golang.org/x/sys/unix/zsyscall_openbsd_arm64.s index f77d5321..2af3b5c7 100644 --- a/vendor/golang.org/x/sys/unix/zsyscall_openbsd_arm64.s +++ b/vendor/golang.org/x/sys/unix/zsyscall_openbsd_arm64.s @@ -463,6 +463,11 @@ TEXT libc_mknodat_trampoline<>(SB),NOSPLIT,$0-0 GLOBL ·libc_mknodat_trampoline_addr(SB), RODATA, $8 DATA ·libc_mknodat_trampoline_addr(SB)/8, $libc_mknodat_trampoline<>(SB) +TEXT libc_mount_trampoline<>(SB),NOSPLIT,$0-0 + JMP libc_mount(SB) +GLOBL ·libc_mount_trampoline_addr(SB), RODATA, $8 +DATA ·libc_mount_trampoline_addr(SB)/8, $libc_mount_trampoline<>(SB) + TEXT libc_nanosleep_trampoline<>(SB),NOSPLIT,$0-0 JMP libc_nanosleep(SB) GLOBL ·libc_nanosleep_trampoline_addr(SB), RODATA, $8 diff --git a/vendor/golang.org/x/sys/unix/zsyscall_openbsd_mips64.go b/vendor/golang.org/x/sys/unix/zsyscall_openbsd_mips64.go index e62963e6..1da08d52 100644 --- a/vendor/golang.org/x/sys/unix/zsyscall_openbsd_mips64.go +++ b/vendor/golang.org/x/sys/unix/zsyscall_openbsd_mips64.go @@ -1493,6 +1493,30 @@ var libc_mknodat_trampoline_addr uintptr // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT +func Mount(fsType string, dir string, flags int, data unsafe.Pointer) (err error) { + var _p0 *byte + _p0, err = BytePtrFromString(fsType) + if err != nil { + return + } + var _p1 *byte + _p1, err = BytePtrFromString(dir) + if err != nil { + return + } + _, _, e1 := syscall_syscall6(libc_mount_trampoline_addr, uintptr(unsafe.Pointer(_p0)), uintptr(unsafe.Pointer(_p1)), uintptr(flags), uintptr(data), 0, 0) + if e1 != 0 { + err = errnoErr(e1) + } + return +} + +var libc_mount_trampoline_addr uintptr + +//go:cgo_import_dynamic libc_mount mount "libc.so" + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + func Nanosleep(time *Timespec, leftover *Timespec) (err error) { _, _, e1 := syscall_syscall(libc_nanosleep_trampoline_addr, uintptr(unsafe.Pointer(time)), uintptr(unsafe.Pointer(leftover)), 0) if e1 != 0 { diff --git a/vendor/golang.org/x/sys/unix/zsyscall_openbsd_mips64.s b/vendor/golang.org/x/sys/unix/zsyscall_openbsd_mips64.s index fae140b6..b7a25135 100644 --- a/vendor/golang.org/x/sys/unix/zsyscall_openbsd_mips64.s +++ b/vendor/golang.org/x/sys/unix/zsyscall_openbsd_mips64.s @@ -463,6 +463,11 @@ TEXT libc_mknodat_trampoline<>(SB),NOSPLIT,$0-0 GLOBL ·libc_mknodat_trampoline_addr(SB), RODATA, $8 DATA ·libc_mknodat_trampoline_addr(SB)/8, $libc_mknodat_trampoline<>(SB) +TEXT libc_mount_trampoline<>(SB),NOSPLIT,$0-0 + JMP libc_mount(SB) +GLOBL ·libc_mount_trampoline_addr(SB), RODATA, $8 +DATA ·libc_mount_trampoline_addr(SB)/8, $libc_mount_trampoline<>(SB) + TEXT libc_nanosleep_trampoline<>(SB),NOSPLIT,$0-0 JMP libc_nanosleep(SB) GLOBL ·libc_nanosleep_trampoline_addr(SB), RODATA, $8 diff --git a/vendor/golang.org/x/sys/unix/zsyscall_openbsd_ppc64.go b/vendor/golang.org/x/sys/unix/zsyscall_openbsd_ppc64.go index 00831354..6e85b0aa 100644 --- a/vendor/golang.org/x/sys/unix/zsyscall_openbsd_ppc64.go +++ b/vendor/golang.org/x/sys/unix/zsyscall_openbsd_ppc64.go @@ -1493,6 +1493,30 @@ var libc_mknodat_trampoline_addr uintptr // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT +func Mount(fsType string, dir string, flags int, data unsafe.Pointer) (err error) { + var _p0 *byte + _p0, err = BytePtrFromString(fsType) + if err != nil { + return + } + var _p1 *byte + _p1, err = BytePtrFromString(dir) + if err != nil { + return + } + _, _, e1 := syscall_syscall6(libc_mount_trampoline_addr, uintptr(unsafe.Pointer(_p0)), uintptr(unsafe.Pointer(_p1)), uintptr(flags), uintptr(data), 0, 0) + if e1 != 0 { + err = errnoErr(e1) + } + return +} + +var libc_mount_trampoline_addr uintptr + +//go:cgo_import_dynamic libc_mount mount "libc.so" + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + func Nanosleep(time *Timespec, leftover *Timespec) (err error) { _, _, e1 := syscall_syscall(libc_nanosleep_trampoline_addr, uintptr(unsafe.Pointer(time)), uintptr(unsafe.Pointer(leftover)), 0) if e1 != 0 { diff --git a/vendor/golang.org/x/sys/unix/zsyscall_openbsd_ppc64.s b/vendor/golang.org/x/sys/unix/zsyscall_openbsd_ppc64.s index 9d1e0ff0..f15dadf0 100644 --- a/vendor/golang.org/x/sys/unix/zsyscall_openbsd_ppc64.s +++ b/vendor/golang.org/x/sys/unix/zsyscall_openbsd_ppc64.s @@ -555,6 +555,12 @@ TEXT libc_mknodat_trampoline<>(SB),NOSPLIT,$0-0 GLOBL ·libc_mknodat_trampoline_addr(SB), RODATA, $8 DATA ·libc_mknodat_trampoline_addr(SB)/8, $libc_mknodat_trampoline<>(SB) +TEXT libc_mount_trampoline<>(SB),NOSPLIT,$0-0 + CALL libc_mount(SB) + RET +GLOBL ·libc_mount_trampoline_addr(SB), RODATA, $8 +DATA ·libc_mount_trampoline_addr(SB)/8, $libc_mount_trampoline<>(SB) + TEXT libc_nanosleep_trampoline<>(SB),NOSPLIT,$0-0 CALL libc_nanosleep(SB) RET diff --git a/vendor/golang.org/x/sys/unix/zsyscall_openbsd_riscv64.go b/vendor/golang.org/x/sys/unix/zsyscall_openbsd_riscv64.go index 79029ed5..28b487df 100644 --- a/vendor/golang.org/x/sys/unix/zsyscall_openbsd_riscv64.go +++ b/vendor/golang.org/x/sys/unix/zsyscall_openbsd_riscv64.go @@ -1493,6 +1493,30 @@ var libc_mknodat_trampoline_addr uintptr // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT +func Mount(fsType string, dir string, flags int, data unsafe.Pointer) (err error) { + var _p0 *byte + _p0, err = BytePtrFromString(fsType) + if err != nil { + return + } + var _p1 *byte + _p1, err = BytePtrFromString(dir) + if err != nil { + return + } + _, _, e1 := syscall_syscall6(libc_mount_trampoline_addr, uintptr(unsafe.Pointer(_p0)), uintptr(unsafe.Pointer(_p1)), uintptr(flags), uintptr(data), 0, 0) + if e1 != 0 { + err = errnoErr(e1) + } + return +} + +var libc_mount_trampoline_addr uintptr + +//go:cgo_import_dynamic libc_mount mount "libc.so" + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + func Nanosleep(time *Timespec, leftover *Timespec) (err error) { _, _, e1 := syscall_syscall(libc_nanosleep_trampoline_addr, uintptr(unsafe.Pointer(time)), uintptr(unsafe.Pointer(leftover)), 0) if e1 != 0 { diff --git a/vendor/golang.org/x/sys/unix/zsyscall_openbsd_riscv64.s b/vendor/golang.org/x/sys/unix/zsyscall_openbsd_riscv64.s index da115f9a..1e7f321e 100644 --- a/vendor/golang.org/x/sys/unix/zsyscall_openbsd_riscv64.s +++ b/vendor/golang.org/x/sys/unix/zsyscall_openbsd_riscv64.s @@ -463,6 +463,11 @@ TEXT libc_mknodat_trampoline<>(SB),NOSPLIT,$0-0 GLOBL ·libc_mknodat_trampoline_addr(SB), RODATA, $8 DATA ·libc_mknodat_trampoline_addr(SB)/8, $libc_mknodat_trampoline<>(SB) +TEXT libc_mount_trampoline<>(SB),NOSPLIT,$0-0 + JMP libc_mount(SB) +GLOBL ·libc_mount_trampoline_addr(SB), RODATA, $8 +DATA ·libc_mount_trampoline_addr(SB)/8, $libc_mount_trampoline<>(SB) + TEXT libc_nanosleep_trampoline<>(SB),NOSPLIT,$0-0 JMP libc_nanosleep(SB) GLOBL ·libc_nanosleep_trampoline_addr(SB), RODATA, $8 diff --git a/vendor/golang.org/x/sys/unix/zsysnum_linux_386.go b/vendor/golang.org/x/sys/unix/zsysnum_linux_386.go index 53aef5dc..524b0820 100644 --- a/vendor/golang.org/x/sys/unix/zsysnum_linux_386.go +++ b/vendor/golang.org/x/sys/unix/zsysnum_linux_386.go @@ -457,4 +457,5 @@ const ( SYS_LSM_GET_SELF_ATTR = 459 SYS_LSM_SET_SELF_ATTR = 460 SYS_LSM_LIST_MODULES = 461 + SYS_MSEAL = 462 ) diff --git a/vendor/golang.org/x/sys/unix/zsysnum_linux_amd64.go b/vendor/golang.org/x/sys/unix/zsysnum_linux_amd64.go index 71d52476..d3e38f68 100644 --- a/vendor/golang.org/x/sys/unix/zsysnum_linux_amd64.go +++ b/vendor/golang.org/x/sys/unix/zsysnum_linux_amd64.go @@ -379,4 +379,5 @@ const ( SYS_LSM_GET_SELF_ATTR = 459 SYS_LSM_SET_SELF_ATTR = 460 SYS_LSM_LIST_MODULES = 461 + SYS_MSEAL = 462 ) diff --git a/vendor/golang.org/x/sys/unix/zsysnum_linux_arm.go b/vendor/golang.org/x/sys/unix/zsysnum_linux_arm.go index c7477061..70b35bf3 100644 --- a/vendor/golang.org/x/sys/unix/zsysnum_linux_arm.go +++ b/vendor/golang.org/x/sys/unix/zsysnum_linux_arm.go @@ -421,4 +421,5 @@ const ( SYS_LSM_GET_SELF_ATTR = 459 SYS_LSM_SET_SELF_ATTR = 460 SYS_LSM_LIST_MODULES = 461 + SYS_MSEAL = 462 ) diff --git a/vendor/golang.org/x/sys/unix/zsysnum_linux_arm64.go b/vendor/golang.org/x/sys/unix/zsysnum_linux_arm64.go index f96e214f..6c778c23 100644 --- a/vendor/golang.org/x/sys/unix/zsysnum_linux_arm64.go +++ b/vendor/golang.org/x/sys/unix/zsysnum_linux_arm64.go @@ -324,4 +324,5 @@ const ( SYS_LSM_GET_SELF_ATTR = 459 SYS_LSM_SET_SELF_ATTR = 460 SYS_LSM_LIST_MODULES = 461 + SYS_MSEAL = 462 ) diff --git a/vendor/golang.org/x/sys/unix/zsysnum_linux_loong64.go b/vendor/golang.org/x/sys/unix/zsysnum_linux_loong64.go index 28425346..37281cf5 100644 --- a/vendor/golang.org/x/sys/unix/zsysnum_linux_loong64.go +++ b/vendor/golang.org/x/sys/unix/zsysnum_linux_loong64.go @@ -318,4 +318,5 @@ const ( SYS_LSM_GET_SELF_ATTR = 459 SYS_LSM_SET_SELF_ATTR = 460 SYS_LSM_LIST_MODULES = 461 + SYS_MSEAL = 462 ) diff --git a/vendor/golang.org/x/sys/unix/zsysnum_linux_mips.go b/vendor/golang.org/x/sys/unix/zsysnum_linux_mips.go index d0953018..7e567f1e 100644 --- a/vendor/golang.org/x/sys/unix/zsysnum_linux_mips.go +++ b/vendor/golang.org/x/sys/unix/zsysnum_linux_mips.go @@ -441,4 +441,5 @@ const ( SYS_LSM_GET_SELF_ATTR = 4459 SYS_LSM_SET_SELF_ATTR = 4460 SYS_LSM_LIST_MODULES = 4461 + SYS_MSEAL = 4462 ) diff --git a/vendor/golang.org/x/sys/unix/zsysnum_linux_mips64.go b/vendor/golang.org/x/sys/unix/zsysnum_linux_mips64.go index 295c7f4b..38ae55e5 100644 --- a/vendor/golang.org/x/sys/unix/zsysnum_linux_mips64.go +++ b/vendor/golang.org/x/sys/unix/zsysnum_linux_mips64.go @@ -371,4 +371,5 @@ const ( SYS_LSM_GET_SELF_ATTR = 5459 SYS_LSM_SET_SELF_ATTR = 5460 SYS_LSM_LIST_MODULES = 5461 + SYS_MSEAL = 5462 ) diff --git a/vendor/golang.org/x/sys/unix/zsysnum_linux_mips64le.go b/vendor/golang.org/x/sys/unix/zsysnum_linux_mips64le.go index d1a9eaca..55e92e60 100644 --- a/vendor/golang.org/x/sys/unix/zsysnum_linux_mips64le.go +++ b/vendor/golang.org/x/sys/unix/zsysnum_linux_mips64le.go @@ -371,4 +371,5 @@ const ( SYS_LSM_GET_SELF_ATTR = 5459 SYS_LSM_SET_SELF_ATTR = 5460 SYS_LSM_LIST_MODULES = 5461 + SYS_MSEAL = 5462 ) diff --git a/vendor/golang.org/x/sys/unix/zsysnum_linux_mipsle.go b/vendor/golang.org/x/sys/unix/zsysnum_linux_mipsle.go index bec157c3..60658d6a 100644 --- a/vendor/golang.org/x/sys/unix/zsysnum_linux_mipsle.go +++ b/vendor/golang.org/x/sys/unix/zsysnum_linux_mipsle.go @@ -441,4 +441,5 @@ const ( SYS_LSM_GET_SELF_ATTR = 4459 SYS_LSM_SET_SELF_ATTR = 4460 SYS_LSM_LIST_MODULES = 4461 + SYS_MSEAL = 4462 ) diff --git a/vendor/golang.org/x/sys/unix/zsysnum_linux_ppc.go b/vendor/golang.org/x/sys/unix/zsysnum_linux_ppc.go index 7ee7bdc4..e203e8a7 100644 --- a/vendor/golang.org/x/sys/unix/zsysnum_linux_ppc.go +++ b/vendor/golang.org/x/sys/unix/zsysnum_linux_ppc.go @@ -448,4 +448,5 @@ const ( SYS_LSM_GET_SELF_ATTR = 459 SYS_LSM_SET_SELF_ATTR = 460 SYS_LSM_LIST_MODULES = 461 + SYS_MSEAL = 462 ) diff --git a/vendor/golang.org/x/sys/unix/zsysnum_linux_ppc64.go b/vendor/golang.org/x/sys/unix/zsysnum_linux_ppc64.go index fad1f25b..5944b97d 100644 --- a/vendor/golang.org/x/sys/unix/zsysnum_linux_ppc64.go +++ b/vendor/golang.org/x/sys/unix/zsysnum_linux_ppc64.go @@ -420,4 +420,5 @@ const ( SYS_LSM_GET_SELF_ATTR = 459 SYS_LSM_SET_SELF_ATTR = 460 SYS_LSM_LIST_MODULES = 461 + SYS_MSEAL = 462 ) diff --git a/vendor/golang.org/x/sys/unix/zsysnum_linux_ppc64le.go b/vendor/golang.org/x/sys/unix/zsysnum_linux_ppc64le.go index 7d3e1635..c66d416d 100644 --- a/vendor/golang.org/x/sys/unix/zsysnum_linux_ppc64le.go +++ b/vendor/golang.org/x/sys/unix/zsysnum_linux_ppc64le.go @@ -420,4 +420,5 @@ const ( SYS_LSM_GET_SELF_ATTR = 459 SYS_LSM_SET_SELF_ATTR = 460 SYS_LSM_LIST_MODULES = 461 + SYS_MSEAL = 462 ) diff --git a/vendor/golang.org/x/sys/unix/zsysnum_linux_riscv64.go b/vendor/golang.org/x/sys/unix/zsysnum_linux_riscv64.go index 0ed53ad9..9889f6a5 100644 --- a/vendor/golang.org/x/sys/unix/zsysnum_linux_riscv64.go +++ b/vendor/golang.org/x/sys/unix/zsysnum_linux_riscv64.go @@ -325,4 +325,5 @@ const ( SYS_LSM_GET_SELF_ATTR = 459 SYS_LSM_SET_SELF_ATTR = 460 SYS_LSM_LIST_MODULES = 461 + SYS_MSEAL = 462 ) diff --git a/vendor/golang.org/x/sys/unix/zsysnum_linux_s390x.go b/vendor/golang.org/x/sys/unix/zsysnum_linux_s390x.go index 2fba04ad..01d86825 100644 --- a/vendor/golang.org/x/sys/unix/zsysnum_linux_s390x.go +++ b/vendor/golang.org/x/sys/unix/zsysnum_linux_s390x.go @@ -386,4 +386,5 @@ const ( SYS_LSM_GET_SELF_ATTR = 459 SYS_LSM_SET_SELF_ATTR = 460 SYS_LSM_LIST_MODULES = 461 + SYS_MSEAL = 462 ) diff --git a/vendor/golang.org/x/sys/unix/zsysnum_linux_sparc64.go b/vendor/golang.org/x/sys/unix/zsysnum_linux_sparc64.go index 621d00d7..7b703e77 100644 --- a/vendor/golang.org/x/sys/unix/zsysnum_linux_sparc64.go +++ b/vendor/golang.org/x/sys/unix/zsysnum_linux_sparc64.go @@ -399,4 +399,5 @@ const ( SYS_LSM_GET_SELF_ATTR = 459 SYS_LSM_SET_SELF_ATTR = 460 SYS_LSM_LIST_MODULES = 461 + SYS_MSEAL = 462 ) diff --git a/vendor/golang.org/x/sys/unix/ztypes_linux.go b/vendor/golang.org/x/sys/unix/ztypes_linux.go index 4740b834..7f1961b9 100644 --- a/vendor/golang.org/x/sys/unix/ztypes_linux.go +++ b/vendor/golang.org/x/sys/unix/ztypes_linux.go @@ -110,7 +110,8 @@ type Statx_t struct { Mnt_id uint64 Dio_mem_align uint32 Dio_offset_align uint32 - _ [12]uint64 + Subvol uint64 + _ [11]uint64 } type Fsid struct { @@ -3473,7 +3474,7 @@ const ( DEVLINK_PORT_FN_ATTR_STATE = 0x2 DEVLINK_PORT_FN_ATTR_OPSTATE = 0x3 DEVLINK_PORT_FN_ATTR_CAPS = 0x4 - DEVLINK_PORT_FUNCTION_ATTR_MAX = 0x5 + DEVLINK_PORT_FUNCTION_ATTR_MAX = 0x6 ) type FsverityDigest struct { @@ -3806,6 +3807,9 @@ const ( ETHTOOL_MSG_PSE_GET_REPLY = 0x25 ETHTOOL_MSG_RSS_GET_REPLY = 0x26 ETHTOOL_MSG_KERNEL_MAX = 0x2b + ETHTOOL_FLAG_COMPACT_BITSETS = 0x1 + ETHTOOL_FLAG_OMIT_REPLY = 0x2 + ETHTOOL_FLAG_STATS = 0x4 ETHTOOL_A_HEADER_UNSPEC = 0x0 ETHTOOL_A_HEADER_DEV_INDEX = 0x1 ETHTOOL_A_HEADER_DEV_NAME = 0x2 @@ -3975,7 +3979,7 @@ const ( ETHTOOL_A_TSINFO_TX_TYPES = 0x3 ETHTOOL_A_TSINFO_RX_FILTERS = 0x4 ETHTOOL_A_TSINFO_PHC_INDEX = 0x5 - ETHTOOL_A_TSINFO_MAX = 0x5 + ETHTOOL_A_TSINFO_MAX = 0x6 ETHTOOL_A_CABLE_TEST_UNSPEC = 0x0 ETHTOOL_A_CABLE_TEST_HEADER = 0x1 ETHTOOL_A_CABLE_TEST_MAX = 0x1 diff --git a/vendor/golang.org/x/sys/windows/security_windows.go b/vendor/golang.org/x/sys/windows/security_windows.go index 97651b5b..b6e1ab76 100644 --- a/vendor/golang.org/x/sys/windows/security_windows.go +++ b/vendor/golang.org/x/sys/windows/security_windows.go @@ -1179,7 +1179,7 @@ type OBJECTS_AND_NAME struct { //sys makeSelfRelativeSD(absoluteSD *SECURITY_DESCRIPTOR, selfRelativeSD *SECURITY_DESCRIPTOR, selfRelativeSDSize *uint32) (err error) = advapi32.MakeSelfRelativeSD //sys setEntriesInAcl(countExplicitEntries uint32, explicitEntries *EXPLICIT_ACCESS, oldACL *ACL, newACL **ACL) (ret error) = advapi32.SetEntriesInAclW -//sys GetAce(acl *ACL, aceIndex uint32, pAce **ACCESS_ALLOWED_ACE) (ret error) = advapi32.GetAce +//sys GetAce(acl *ACL, aceIndex uint32, pAce **ACCESS_ALLOWED_ACE) (err error) = advapi32.GetAce // Control returns the security descriptor control bits. func (sd *SECURITY_DESCRIPTOR) Control() (control SECURITY_DESCRIPTOR_CONTROL, revision uint32, err error) { diff --git a/vendor/golang.org/x/sys/windows/syscall_windows.go b/vendor/golang.org/x/sys/windows/syscall_windows.go index 6525c62f..1fa34fd1 100644 --- a/vendor/golang.org/x/sys/windows/syscall_windows.go +++ b/vendor/golang.org/x/sys/windows/syscall_windows.go @@ -17,8 +17,10 @@ import ( "unsafe" ) -type Handle uintptr -type HWND uintptr +type ( + Handle uintptr + HWND uintptr +) const ( InvalidHandle = ^Handle(0) @@ -211,6 +213,10 @@ func NewCallbackCDecl(fn interface{}) uintptr { //sys OpenProcess(desiredAccess uint32, inheritHandle bool, processId uint32) (handle Handle, err error) //sys ShellExecute(hwnd Handle, verb *uint16, file *uint16, args *uint16, cwd *uint16, showCmd int32) (err error) [failretval<=32] = shell32.ShellExecuteW //sys GetWindowThreadProcessId(hwnd HWND, pid *uint32) (tid uint32, err error) = user32.GetWindowThreadProcessId +//sys LoadKeyboardLayout(name *uint16, flags uint32) (hkl Handle, err error) [failretval==0] = user32.LoadKeyboardLayoutW +//sys UnloadKeyboardLayout(hkl Handle) (err error) = user32.UnloadKeyboardLayout +//sys GetKeyboardLayout(tid uint32) (hkl Handle) = user32.GetKeyboardLayout +//sys ToUnicodeEx(vkey uint32, scancode uint32, keystate *byte, pwszBuff *uint16, cchBuff int32, flags uint32, hkl Handle) (ret int32) = user32.ToUnicodeEx //sys GetShellWindow() (shellWindow HWND) = user32.GetShellWindow //sys MessageBox(hwnd HWND, text *uint16, caption *uint16, boxtype uint32) (ret int32, err error) [failretval==0] = user32.MessageBoxW //sys ExitWindowsEx(flags uint32, reason uint32) (err error) = user32.ExitWindowsEx @@ -1368,9 +1374,11 @@ func SetsockoptLinger(fd Handle, level, opt int, l *Linger) (err error) { func SetsockoptInet4Addr(fd Handle, level, opt int, value [4]byte) (err error) { return Setsockopt(fd, int32(level), int32(opt), (*byte)(unsafe.Pointer(&value[0])), 4) } + func SetsockoptIPMreq(fd Handle, level, opt int, mreq *IPMreq) (err error) { return Setsockopt(fd, int32(level), int32(opt), (*byte)(unsafe.Pointer(mreq)), int32(unsafe.Sizeof(*mreq))) } + func SetsockoptIPv6Mreq(fd Handle, level, opt int, mreq *IPv6Mreq) (err error) { return syscall.EWINDOWS } diff --git a/vendor/golang.org/x/sys/windows/types_windows.go b/vendor/golang.org/x/sys/windows/types_windows.go index d8cb71db..3f03b3d5 100644 --- a/vendor/golang.org/x/sys/windows/types_windows.go +++ b/vendor/golang.org/x/sys/windows/types_windows.go @@ -2003,7 +2003,21 @@ const ( MOVEFILE_FAIL_IF_NOT_TRACKABLE = 0x20 ) -const GAA_FLAG_INCLUDE_PREFIX = 0x00000010 +// Flags for GetAdaptersAddresses, see +// https://learn.microsoft.com/en-us/windows/win32/api/iphlpapi/nf-iphlpapi-getadaptersaddresses. +const ( + GAA_FLAG_SKIP_UNICAST = 0x1 + GAA_FLAG_SKIP_ANYCAST = 0x2 + GAA_FLAG_SKIP_MULTICAST = 0x4 + GAA_FLAG_SKIP_DNS_SERVER = 0x8 + GAA_FLAG_INCLUDE_PREFIX = 0x10 + GAA_FLAG_SKIP_FRIENDLY_NAME = 0x20 + GAA_FLAG_INCLUDE_WINS_INFO = 0x40 + GAA_FLAG_INCLUDE_GATEWAYS = 0x80 + GAA_FLAG_INCLUDE_ALL_INTERFACES = 0x100 + GAA_FLAG_INCLUDE_ALL_COMPARTMENTS = 0x200 + GAA_FLAG_INCLUDE_TUNNEL_BINDINGORDER = 0x400 +) const ( IF_TYPE_OTHER = 1 @@ -2017,6 +2031,50 @@ const ( IF_TYPE_IEEE1394 = 144 ) +// Enum NL_PREFIX_ORIGIN for [IpAdapterUnicastAddress], see +// https://learn.microsoft.com/en-us/windows/win32/api/nldef/ne-nldef-nl_prefix_origin +const ( + IpPrefixOriginOther = 0 + IpPrefixOriginManual = 1 + IpPrefixOriginWellKnown = 2 + IpPrefixOriginDhcp = 3 + IpPrefixOriginRouterAdvertisement = 4 + IpPrefixOriginUnchanged = 1 << 4 +) + +// Enum NL_SUFFIX_ORIGIN for [IpAdapterUnicastAddress], see +// https://learn.microsoft.com/en-us/windows/win32/api/nldef/ne-nldef-nl_suffix_origin +const ( + NlsoOther = 0 + NlsoManual = 1 + NlsoWellKnown = 2 + NlsoDhcp = 3 + NlsoLinkLayerAddress = 4 + NlsoRandom = 5 + IpSuffixOriginOther = 0 + IpSuffixOriginManual = 1 + IpSuffixOriginWellKnown = 2 + IpSuffixOriginDhcp = 3 + IpSuffixOriginLinkLayerAddress = 4 + IpSuffixOriginRandom = 5 + IpSuffixOriginUnchanged = 1 << 4 +) + +// Enum NL_DAD_STATE for [IpAdapterUnicastAddress], see +// https://learn.microsoft.com/en-us/windows/win32/api/nldef/ne-nldef-nl_dad_state +const ( + NldsInvalid = 0 + NldsTentative = 1 + NldsDuplicate = 2 + NldsDeprecated = 3 + NldsPreferred = 4 + IpDadStateInvalid = 0 + IpDadStateTentative = 1 + IpDadStateDuplicate = 2 + IpDadStateDeprecated = 3 + IpDadStatePreferred = 4 +) + type SocketAddress struct { Sockaddr *syscall.RawSockaddrAny SockaddrLength int32 @@ -3404,3 +3462,14 @@ type DCB struct { EvtChar byte wReserved1 uint16 } + +// Keyboard Layout Flags. +// See https://learn.microsoft.com/en-us/windows/win32/api/winuser/nf-winuser-loadkeyboardlayoutw +const ( + KLF_ACTIVATE = 0x00000001 + KLF_SUBSTITUTE_OK = 0x00000002 + KLF_REORDER = 0x00000008 + KLF_REPLACELANG = 0x00000010 + KLF_NOTELLSHELL = 0x00000080 + KLF_SETFORPROCESS = 0x00000100 +) diff --git a/vendor/golang.org/x/sys/windows/zsyscall_windows.go b/vendor/golang.org/x/sys/windows/zsyscall_windows.go index eba76101..9bb979a3 100644 --- a/vendor/golang.org/x/sys/windows/zsyscall_windows.go +++ b/vendor/golang.org/x/sys/windows/zsyscall_windows.go @@ -478,12 +478,16 @@ var ( procGetDesktopWindow = moduser32.NewProc("GetDesktopWindow") procGetForegroundWindow = moduser32.NewProc("GetForegroundWindow") procGetGUIThreadInfo = moduser32.NewProc("GetGUIThreadInfo") + procGetKeyboardLayout = moduser32.NewProc("GetKeyboardLayout") procGetShellWindow = moduser32.NewProc("GetShellWindow") procGetWindowThreadProcessId = moduser32.NewProc("GetWindowThreadProcessId") procIsWindow = moduser32.NewProc("IsWindow") procIsWindowUnicode = moduser32.NewProc("IsWindowUnicode") procIsWindowVisible = moduser32.NewProc("IsWindowVisible") + procLoadKeyboardLayoutW = moduser32.NewProc("LoadKeyboardLayoutW") procMessageBoxW = moduser32.NewProc("MessageBoxW") + procToUnicodeEx = moduser32.NewProc("ToUnicodeEx") + procUnloadKeyboardLayout = moduser32.NewProc("UnloadKeyboardLayout") procCreateEnvironmentBlock = moduserenv.NewProc("CreateEnvironmentBlock") procDestroyEnvironmentBlock = moduserenv.NewProc("DestroyEnvironmentBlock") procGetUserProfileDirectoryW = moduserenv.NewProc("GetUserProfileDirectoryW") @@ -789,6 +793,14 @@ func FreeSid(sid *SID) (err error) { return } +func GetAce(acl *ACL, aceIndex uint32, pAce **ACCESS_ALLOWED_ACE) (err error) { + r1, _, e1 := syscall.Syscall(procGetAce.Addr(), 3, uintptr(unsafe.Pointer(acl)), uintptr(aceIndex), uintptr(unsafe.Pointer(pAce))) + if r1 == 0 { + err = errnoErr(e1) + } + return +} + func GetLengthSid(sid *SID) (len uint32) { r0, _, _ := syscall.Syscall(procGetLengthSid.Addr(), 1, uintptr(unsafe.Pointer(sid)), 0, 0) len = uint32(r0) @@ -1225,14 +1237,6 @@ func setEntriesInAcl(countExplicitEntries uint32, explicitEntries *EXPLICIT_ACCE return } -func GetAce(acl *ACL, aceIndex uint32, pAce **ACCESS_ALLOWED_ACE) (ret error) { - r0, _, _ := syscall.Syscall(procGetAce.Addr(), 3, uintptr(unsafe.Pointer(acl)), uintptr(aceIndex), uintptr(unsafe.Pointer(pAce))) - if r0 == 0 { - ret = GetLastError() - } - return -} - func SetKernelObjectSecurity(handle Handle, securityInformation SECURITY_INFORMATION, securityDescriptor *SECURITY_DESCRIPTOR) (err error) { r1, _, e1 := syscall.Syscall(procSetKernelObjectSecurity.Addr(), 3, uintptr(handle), uintptr(securityInformation), uintptr(unsafe.Pointer(securityDescriptor))) if r1 == 0 { @@ -4082,6 +4086,12 @@ func GetGUIThreadInfo(thread uint32, info *GUIThreadInfo) (err error) { return } +func GetKeyboardLayout(tid uint32) (hkl Handle) { + r0, _, _ := syscall.Syscall(procGetKeyboardLayout.Addr(), 1, uintptr(tid), 0, 0) + hkl = Handle(r0) + return +} + func GetShellWindow() (shellWindow HWND) { r0, _, _ := syscall.Syscall(procGetShellWindow.Addr(), 0, 0, 0, 0) shellWindow = HWND(r0) @@ -4115,6 +4125,15 @@ func IsWindowVisible(hwnd HWND) (isVisible bool) { return } +func LoadKeyboardLayout(name *uint16, flags uint32) (hkl Handle, err error) { + r0, _, e1 := syscall.Syscall(procLoadKeyboardLayoutW.Addr(), 2, uintptr(unsafe.Pointer(name)), uintptr(flags), 0) + hkl = Handle(r0) + if hkl == 0 { + err = errnoErr(e1) + } + return +} + func MessageBox(hwnd HWND, text *uint16, caption *uint16, boxtype uint32) (ret int32, err error) { r0, _, e1 := syscall.Syscall6(procMessageBoxW.Addr(), 4, uintptr(hwnd), uintptr(unsafe.Pointer(text)), uintptr(unsafe.Pointer(caption)), uintptr(boxtype), 0, 0) ret = int32(r0) @@ -4124,6 +4143,20 @@ func MessageBox(hwnd HWND, text *uint16, caption *uint16, boxtype uint32) (ret i return } +func ToUnicodeEx(vkey uint32, scancode uint32, keystate *byte, pwszBuff *uint16, cchBuff int32, flags uint32, hkl Handle) (ret int32) { + r0, _, _ := syscall.Syscall9(procToUnicodeEx.Addr(), 7, uintptr(vkey), uintptr(scancode), uintptr(unsafe.Pointer(keystate)), uintptr(unsafe.Pointer(pwszBuff)), uintptr(cchBuff), uintptr(flags), uintptr(hkl), 0, 0) + ret = int32(r0) + return +} + +func UnloadKeyboardLayout(hkl Handle) (err error) { + r1, _, e1 := syscall.Syscall(procUnloadKeyboardLayout.Addr(), 1, uintptr(hkl), 0, 0) + if r1 == 0 { + err = errnoErr(e1) + } + return +} + func CreateEnvironmentBlock(block **uint16, token Token, inheritExisting bool) (err error) { var _p0 uint32 if inheritExisting { diff --git a/vendor/modules.txt b/vendor/modules.txt index 8380b1d6..6385761b 100644 --- a/vendor/modules.txt +++ b/vendor/modules.txt @@ -21,11 +21,11 @@ github.com/cespare/xxhash/v2 # github.com/chzyer/readline v1.5.1 ## explicit; go 1.15 github.com/chzyer/readline -# github.com/cloudbase/garm-provider-common v0.1.3 +# github.com/cloudbase/garm-provider-common v0.1.4-0.20240821093055-dfdf8e2e4853 ## explicit; go 1.22 github.com/cloudbase/garm-provider-common/defaults github.com/cloudbase/garm-provider-common/errors -github.com/cloudbase/garm-provider-common/execution +github.com/cloudbase/garm-provider-common/execution/common github.com/cloudbase/garm-provider-common/params github.com/cloudbase/garm-provider-common/util github.com/cloudbase/garm-provider-common/util/exec @@ -267,7 +267,7 @@ go.opentelemetry.io/otel/metric/embedded ## explicit; go 1.21 go.opentelemetry.io/otel/trace go.opentelemetry.io/otel/trace/embedded -# golang.org/x/crypto v0.25.0 +# golang.org/x/crypto v0.26.0 ## explicit; go 1.20 golang.org/x/crypto/bcrypt golang.org/x/crypto/blowfish @@ -276,7 +276,7 @@ golang.org/x/crypto/chacha20poly1305 golang.org/x/crypto/hkdf golang.org/x/crypto/internal/alias golang.org/x/crypto/internal/poly1305 -# golang.org/x/net v0.27.0 +# golang.org/x/net v0.28.0 ## explicit; go 1.18 golang.org/x/net/internal/socks golang.org/x/net/proxy @@ -287,7 +287,7 @@ golang.org/x/oauth2/internal # golang.org/x/sync v0.7.0 ## explicit; go 1.18 golang.org/x/sync/errgroup -# golang.org/x/sys v0.22.0 +# golang.org/x/sys v0.24.0 ## explicit; go 1.18 golang.org/x/sys/cpu golang.org/x/sys/unix