diff --git a/.prow.sh b/.prow.sh index c9947b93c..66cad996e 100755 --- a/.prow.sh +++ b/.prow.sh @@ -1,3 +1,17 @@ +# Copyright 2020 The Kubernetes Authors. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + #! /bin/bash # A Prow job can override these defaults, but this shouldn't be necessary. diff --git a/Dockerfile b/Dockerfile index 489fbc26b..e7b6e6ead 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,3 +1,17 @@ +# Copyright 2020 The Kubernetes Authors. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + FROM centos:latest # Copy nfsplugin from build _output directory diff --git a/charts/README.md b/charts/README.md index 4df83ae35..0828570b8 100644 --- a/charts/README.md +++ b/charts/README.md @@ -25,7 +25,7 @@ $ helm install --name csi-driver-nfs csi-driver-nfs/csi-driver-nfs --namespace k $ helm search repo -l csi-driver-nfs ``` -### Install a specific verison +### Install a specific version ``` https://raw.githubusercontent.com/kubernetes-csi/csi-driver-nfs/master/charts --version v2.0.0 diff --git a/charts/latest/csi-driver-nfs/templates/csi-nfs-controller.yaml b/charts/latest/csi-driver-nfs/templates/csi-nfs-controller.yaml index e7ac27629..8fa5df748 100644 --- a/charts/latest/csi-driver-nfs/templates/csi-nfs-controller.yaml +++ b/charts/latest/csi-driver-nfs/templates/csi-nfs-controller.yaml @@ -83,8 +83,6 @@ spec: - name: CSI_ENDPOINT value: unix:///csi/csi.sock volumeMounts: - - name: plugin-dir - mountPath: /plugin - name: pods-mount-dir mountPath: /var/lib/kubelet/pods mountPropagation: "Bidirectional" @@ -98,10 +96,6 @@ spec: cpu: 10m memory: 20Mi volumes: - - name: plugin-dir - hostPath: - path: /var/lib/kubelet/plugins/csi-nfsplugin - type: DirectoryOrCreate - name: pods-mount-dir hostPath: path: /var/lib/kubelet/pods diff --git a/charts/latest/csi-driver-nfs/templates/csi-nfs-driverinfo.yaml b/charts/latest/csi-driver-nfs/templates/csi-nfs-driverinfo.yaml index 7b7c0e5b3..bf2484948 100644 --- a/charts/latest/csi-driver-nfs/templates/csi-nfs-driverinfo.yaml +++ b/charts/latest/csi-driver-nfs/templates/csi-nfs-driverinfo.yaml @@ -5,5 +5,5 @@ metadata: spec: attachRequired: false volumeLifecycleModes: - - Persistent + - Persistent podInfoOnMount: true diff --git a/charts/latest/csi-driver-nfs/templates/csi-nfs-node.yaml b/charts/latest/csi-driver-nfs/templates/csi-nfs-node.yaml index ca347141b..318f2610c 100644 --- a/charts/latest/csi-driver-nfs/templates/csi-nfs-node.yaml +++ b/charts/latest/csi-driver-nfs/templates/csi-nfs-node.yaml @@ -18,6 +18,24 @@ spec: hostNetwork: true # original nfs connection would be broken without hostNetwork setting dnsPolicy: ClusterFirstWithHostNet containers: + - name: liveness-probe + image: "{{ .Values.image.livenessProbe.repository }}:{{ .Values.image.livenessProbe.tag }}" + args: + - --csi-address=/csi/csi.sock + - --probe-timeout=3s + - --health-port=29642 + - --v=5 + imagePullPolicy: {{ .Values.image.livenessProbe.pullPolicy }} + volumeMounts: + - name: socket-dir + mountPath: /csi + resources: + limits: + cpu: 100m + memory: 100Mi + requests: + cpu: 10m + memory: 20Mi - name: node-driver-registrar image: "{{ .Values.image.nodeDriverRegistrar.repository }}:{{ .Values.image.nodeDriverRegistrar.tag }}" lifecycle: @@ -26,7 +44,7 @@ spec: command: ["/bin/sh", "-c", "rm -rf /registration/csi-nfsplugin /registration/csi-nfsplugin-reg.sock"] args: - --v=5 - - --csi-address=/plugin/csi.sock + - --csi-address=/csi/csi.sock - --kubelet-registration-path=/var/lib/kubelet/plugins/csi-nfsplugin/csi.sock env: - name: KUBE_NODE_NAME @@ -35,8 +53,8 @@ spec: fieldPath: spec.nodeName imagePullPolicy: {{ .Values.image.nodeDriverRegistrar.pullPolicy }} volumeMounts: - - name: plugin-dir - mountPath: /plugin + - name: socket-dir + mountPath: /csi - name: registration-dir mountPath: /registration - name: nfs @@ -56,16 +74,16 @@ spec: fieldRef: fieldPath: spec.nodeName - name: CSI_ENDPOINT - value: unix://plugin/csi.sock + value: unix:///csi/csi.sock imagePullPolicy: {{ .Values.image.nfs.pullPolicy }} volumeMounts: - - name: plugin-dir - mountPath: /plugin + - name: socket-dir + mountPath: /csi - name: pods-mount-dir mountPath: /var/lib/kubelet/pods mountPropagation: "Bidirectional" volumes: - - name: plugin-dir + - name: socket-dir hostPath: path: /var/lib/kubelet/plugins/csi-nfsplugin type: DirectoryOrCreate diff --git a/charts/latest/csi-driver-nfs/templates/rbac-csi-nfs-controller.yaml b/charts/latest/csi-driver-nfs/templates/rbac-csi-nfs-controller.yaml index 814981819..ce3bb21b4 100644 --- a/charts/latest/csi-driver-nfs/templates/rbac-csi-nfs-controller.yaml +++ b/charts/latest/csi-driver-nfs/templates/rbac-csi-nfs-controller.yaml @@ -51,4 +51,4 @@ roleRef: kind: ClusterRole name: nfs-external-provisioner-role apiGroup: rbac.authorization.k8s.io -{{- end -}} \ No newline at end of file +{{- end -}} diff --git a/cmd/nfsplugin/main.go b/cmd/nfsplugin/main.go index d1e86fe41..fb7177df3 100644 --- a/cmd/nfsplugin/main.go +++ b/cmd/nfsplugin/main.go @@ -34,12 +34,12 @@ var ( ) func init() { - flag.Set("logtostderr", "true") + _ = flag.Set("logtostderr", "true") } func main() { - flag.CommandLine.Parse([]string{}) + _ = flag.CommandLine.Parse([]string{}) cmd := &cobra.Command{ Use: "NFS", @@ -52,14 +52,14 @@ func main() { cmd.Flags().AddGoFlagSet(flag.CommandLine) cmd.PersistentFlags().StringVar(&nodeID, "nodeid", "", "node id") - cmd.MarkPersistentFlagRequired("nodeid") + _ = cmd.MarkPersistentFlagRequired("nodeid") cmd.PersistentFlags().StringVar(&endpoint, "endpoint", "", "CSI endpoint") - cmd.MarkPersistentFlagRequired("endpoint") + _ = cmd.MarkPersistentFlagRequired("endpoint") cmd.PersistentFlags().StringVar(&perm, "mount-permissions", "", "mounted folder permissions") - cmd.ParseFlags(os.Args[1:]) + _ = cmd.ParseFlags(os.Args[1:]) if err := cmd.Execute(); err != nil { fmt.Fprintf(os.Stderr, "%s", err.Error()) os.Exit(1) diff --git a/deploy/csi-nfs-controller.yaml b/deploy/csi-nfs-controller.yaml index 2eb5b8f73..4cb1c9d70 100644 --- a/deploy/csi-nfs-controller.yaml +++ b/deploy/csi-nfs-controller.yaml @@ -80,8 +80,6 @@ spec: - name: CSI_ENDPOINT value: unix:///csi/csi.sock volumeMounts: - - name: plugin-dir - mountPath: /plugin - name: pods-mount-dir mountPath: /var/lib/kubelet/pods mountPropagation: "Bidirectional" @@ -95,10 +93,6 @@ spec: cpu: 10m memory: 20Mi volumes: - - name: plugin-dir - hostPath: - path: /var/lib/kubelet/plugins/csi-nfsplugin - type: DirectoryOrCreate - name: pods-mount-dir hostPath: path: /var/lib/kubelet/pods diff --git a/deploy/csi-nfs-driverinfo.yaml b/deploy/csi-nfs-driverinfo.yaml index 7b7c0e5b3..fd5923117 100644 --- a/deploy/csi-nfs-driverinfo.yaml +++ b/deploy/csi-nfs-driverinfo.yaml @@ -1,3 +1,4 @@ +--- apiVersion: storage.k8s.io/v1beta1 kind: CSIDriver metadata: @@ -5,5 +6,5 @@ metadata: spec: attachRequired: false volumeLifecycleModes: - - Persistent + - Persistent podInfoOnMount: true diff --git a/deploy/csi-nfs-node.yaml b/deploy/csi-nfs-node.yaml index b6307b330..18e0bc3e3 100644 --- a/deploy/csi-nfs-node.yaml +++ b/deploy/csi-nfs-node.yaml @@ -1,3 +1,4 @@ +--- # This YAML file contains driver-registrar & csi driver nodeplugin API objects # that are necessary to run CSI nodeplugin for nfs kind: DaemonSet @@ -14,18 +15,35 @@ spec: labels: app: csi-nfs-node spec: - hostNetwork: true # original nfs connection would be broken without hostNetwork setting + hostNetwork: true # original nfs connection would be broken without hostNetwork setting dnsPolicy: ClusterFirstWithHostNet containers: + - name: liveness-probe + image: k8s.gcr.io/sig-storage/livenessprobe:v2.1.0 + args: + - --csi-address=/csi/csi.sock + - --probe-timeout=3s + - --health-port=29642 + - --v=5 + volumeMounts: + - name: socket-dir + mountPath: /csi + resources: + limits: + cpu: 100m + memory: 100Mi + requests: + cpu: 10m + memory: 20Mi - name: node-driver-registrar - image: quay.io/k8scsi/csi-node-driver-registrar:v2.0.1 + image: k8s.gcr.io/sig-storage/csi-node-driver-registrar:v2.0.1 lifecycle: preStop: exec: command: ["/bin/sh", "-c", "rm -rf /registration/csi-nfsplugin /registration/csi-nfsplugin-reg.sock"] args: - --v=5 - - --csi-address=/plugin/csi.sock + - --csi-address=/csi/csi.sock - --kubelet-registration-path=/var/lib/kubelet/plugins/csi-nfsplugin/csi.sock env: - name: KUBE_NODE_NAME @@ -33,8 +51,8 @@ spec: fieldRef: fieldPath: spec.nodeName volumeMounts: - - name: plugin-dir - mountPath: /plugin + - name: socket-dir + mountPath: /csi - name: registration-dir mountPath: /registration - name: nfs @@ -44,7 +62,7 @@ spec: add: ["SYS_ADMIN"] allowPrivilegeEscalation: true image: gcr.io/k8s-staging-sig-storage/nfsplugin:amd64-linux-canary - args : + args: - "-v=5" - "--nodeid=$(NODE_ID)" - "--endpoint=$(CSI_ENDPOINT)" @@ -54,16 +72,16 @@ spec: fieldRef: fieldPath: spec.nodeName - name: CSI_ENDPOINT - value: unix://plugin/csi.sock + value: unix:///csi/csi.sock imagePullPolicy: "IfNotPresent" volumeMounts: - - name: plugin-dir - mountPath: /plugin + - name: socket-dir + mountPath: /csi - name: pods-mount-dir mountPath: /var/lib/kubelet/pods mountPropagation: "Bidirectional" volumes: - - name: plugin-dir + - name: socket-dir hostPath: path: /var/lib/kubelet/plugins/csi-nfsplugin type: DirectoryOrCreate diff --git a/deploy/rbac-csi-nfs-controller.yaml b/deploy/rbac-csi-nfs-controller.yaml index 39f7953a5..20860e594 100644 --- a/deploy/rbac-csi-nfs-controller.yaml +++ b/deploy/rbac-csi-nfs-controller.yaml @@ -46,4 +46,4 @@ subjects: roleRef: kind: ClusterRole name: nfs-external-provisioner-role - apiGroup: rbac.authorization.k8s.io \ No newline at end of file + apiGroup: rbac.authorization.k8s.io diff --git a/go.mod b/go.mod index 862978174..24288978a 100644 --- a/go.mod +++ b/go.mod @@ -5,20 +5,24 @@ go 1.13 require ( github.com/container-storage-interface/spec v1.3.0 github.com/golang/glog v0.0.0-20160126235308-23def4e6c14b - github.com/kubernetes-csi/csi-driver-smb v0.4.0 github.com/kubernetes-csi/csi-lib-utils v0.7.0 github.com/kubernetes-csi/external-snapshotter/v2 v2.0.0-20200617021606-4800ca72d403 github.com/onsi/ginkgo v1.11.0 github.com/onsi/gomega v1.7.1 github.com/pborman/uuid v1.2.0 + github.com/prometheus/client_golang v1.5.1 // indirect github.com/spf13/cobra v0.0.5 + github.com/stretchr/testify v1.5.1 // indirect + golang.org/x/crypto v0.0.0-20200622213623-75b288015ac9 // indirect golang.org/x/net v0.0.0-20200324143707-d3edc9973b7e golang.org/x/text v0.3.3 // indirect google.golang.org/grpc v1.28.0 + google.golang.org/protobuf v1.25.0 // indirect k8s.io/api v0.18.1 k8s.io/apimachinery v0.18.2-beta.0 k8s.io/client-go v0.18.1 k8s.io/klog v1.0.0 + k8s.io/klog/v2 v2.2.0 // indirect k8s.io/kubernetes v1.18.0 k8s.io/utils v0.0.0-20200411171748-3d5a2fe318e4 ) diff --git a/go.sum b/go.sum index d06cf820d..4b21d7420 100644 --- a/go.sum +++ b/go.sum @@ -2,25 +2,16 @@ bitbucket.org/bertimus9/systemstat v0.0.0-20180207000608-0eeff89b0690/go.mod h1: cloud.google.com/go v0.34.0/go.mod h1:aQUYkXzVsufM+DwF1aE+0xfcU+56JwCaLick0ClmMTw= cloud.google.com/go v0.38.0/go.mod h1:990N+gfupTy94rShfmMCWGDn0LpTmnzTp2qbd1dvSRU= github.com/Azure/azure-sdk-for-go v35.0.0+incompatible/go.mod h1:9XXNKU+eRnpl9moKnB4QOLf1HestfXbmab5FXxiDBjc= -github.com/Azure/azure-sdk-for-go v40.2.0+incompatible/go.mod h1:9XXNKU+eRnpl9moKnB4QOLf1HestfXbmab5FXxiDBjc= github.com/Azure/go-ansiterm v0.0.0-20170929234023-d6e3b3328b78/go.mod h1:LmzpDX56iTiv29bbRTIsUNlaFfuhWRQBWjQdVyAevI8= -github.com/Azure/go-autorest v14.2.0+incompatible/go.mod h1:r+4oMnoxhatjLLJ6zxSWATqVooLgysK6ZNox3g/xq24= github.com/Azure/go-autorest/autorest v0.9.0/go.mod h1:xyHB1BMZT0cuDHU7I0+g046+BFDTQ8rEZB0s4Yfa6bI= -github.com/Azure/go-autorest/autorest v0.11.1/go.mod h1:JFgpikqFJ/MleTTxwepExTKnFUKKszPS8UavbQYUMuw= github.com/Azure/go-autorest/autorest/adal v0.5.0/go.mod h1:8Z9fGy2MpX0PvDjB1pEgQTmVqjGhiHBW7RJJEciWzS0= -github.com/Azure/go-autorest/autorest/adal v0.9.0/go.mod h1:/c022QCutn2P7uY+/oQWWNcK9YU+MH96NgK+jErpbcg= github.com/Azure/go-autorest/autorest/date v0.1.0/go.mod h1:plvfp3oPSKwf2DNjlBjWF/7vwR+cUD/ELuzDCXwHUVA= -github.com/Azure/go-autorest/autorest/date v0.3.0/go.mod h1:BI0uouVdmngYNUzGWeSYnokU+TrmwEsOqdt8Y6sso74= github.com/Azure/go-autorest/autorest/mocks v0.1.0/go.mod h1:OTyCOPRA2IgIlWxVYxBee2F5Gr4kF2zd2J5cFRaIDN0= github.com/Azure/go-autorest/autorest/mocks v0.2.0/go.mod h1:OTyCOPRA2IgIlWxVYxBee2F5Gr4kF2zd2J5cFRaIDN0= -github.com/Azure/go-autorest/autorest/mocks v0.4.0/go.mod h1:LTp+uSrOhSkaKrUy935gNZuuIPPVsHlr9DSOxSayd+k= github.com/Azure/go-autorest/autorest/to v0.2.0/go.mod h1:GunWKJp1AEqgMaGLV+iocmRAJWqST1wQYhyyjXJ3SJc= -github.com/Azure/go-autorest/autorest/to v0.3.0/go.mod h1:MgwOyqaIuKdG4TL/2ywSsIWKAfJfgHDo8ObuUk3t5sA= github.com/Azure/go-autorest/autorest/validation v0.1.0/go.mod h1:Ha3z/SqBeaalWQvokg3NZAlQTalVMtOIAs1aGK7G6u8= github.com/Azure/go-autorest/logger v0.1.0/go.mod h1:oExouG+K6PryycPJfVSxi/koC6LSNgds39diKLz7Vrc= -github.com/Azure/go-autorest/logger v0.2.0/go.mod h1:T9E3cAhj2VqvPOtCYAvby9aBXkZmbF5NWuPV8+WeEW8= github.com/Azure/go-autorest/tracing v0.5.0/go.mod h1:r/s2XiOKccPW3HrqB+W0TQzfbtp2fGCgRFtBroKn4Dk= -github.com/Azure/go-autorest/tracing v0.6.0/go.mod h1:+vhtPC754Xsa23ID7GlGsrdKBpUA79WCAKPPZVC2DeU= github.com/BurntSushi/toml v0.3.1/go.mod h1:xHWCNGjB5oqiDr8zfno3MHue2Ht5sIBksp03qcyfWMU= github.com/BurntSushi/xgb v0.0.0-20160522181843-27f122750802/go.mod h1:IVnqGOEym/WlBOVXweHU+Q+/VP0lqqI8lqeDx9IjBqo= github.com/GoogleCloudPlatform/k8s-cloud-provider v0.0.0-20190822182118-27a4ced34534/go.mod h1:iroGtC8B3tQiqtds1l+mgk/BBOrxbqjH+eUfFQYRc14= @@ -387,12 +378,8 @@ github.com/kr/pty v1.1.3/go.mod h1:pFQYn66WHrOpPYNljwOMqo10TkYh1fy3cYio2l3bCsQ= github.com/kr/pty v1.1.5/go.mod h1:9r2w37qlBe7rQ6e1fg1S/9xpWHSnaqNdHD3WcMdbPDA= github.com/kr/text v0.1.0 h1:45sCR5RtlFHMR4UwH9sdQ5TC8v0qDQCHnXt+kaKSTVE= github.com/kr/text v0.1.0/go.mod h1:4Jbv+DJW3UT/LiOwJeYQe1efqtUx/iVham/4vfdArNI= -github.com/kubernetes-csi/csi-driver-smb v0.4.0 h1:EmeIm42SVMENy063N7qI68gRFFaG3ILnTYB1s+G9phk= -github.com/kubernetes-csi/csi-driver-smb v0.4.0/go.mod h1:S+TO4JVNvOYSEPNO7qNUBM7aUJKzNWMCzYcJiioNgsg= github.com/kubernetes-csi/csi-lib-utils v0.7.0 h1:t1cS7HTD7z5D7h9iAdjWuHtMxJPb9s1fIv34rxytzqs= github.com/kubernetes-csi/csi-lib-utils v0.7.0/go.mod h1:bze+2G9+cmoHxN6+WyG1qT4MDxgZJMLGwc7V4acPNm0= -github.com/kubernetes-csi/csi-proxy/client v0.0.0-20200907051941-1c32ab57cb4f h1:GLqHBmavdyCUPDxjbAxDcfTsw1V73GBEpDl093CUQyk= -github.com/kubernetes-csi/csi-proxy/client v0.0.0-20200907051941-1c32ab57cb4f/go.mod h1:6ptQQmti5QHwBxSsh8Cy00oGdogj0JXewFnu8FFjgOs= github.com/kubernetes-csi/csi-test v2.0.0+incompatible/go.mod h1:YxJ4UiuPWIhMBkxUKY5c267DyA0uDZ/MtAimhx/2TA0= github.com/kubernetes-csi/external-snapshotter/v2 v2.0.0-20200617021606-4800ca72d403 h1:FMqYb5aUkq8JLzdm5m/abJPoclqdo9k446E4mNU7qsE= github.com/kubernetes-csi/external-snapshotter/v2 v2.0.0-20200617021606-4800ca72d403/go.mod h1:ArR2bKKq4dEfoRwRH69kt/xYOliLUlaqCZ+LM1teU8Q= @@ -484,7 +471,6 @@ github.com/pborman/uuid v1.2.0 h1:J7Q5mO4ysT1dv8hyrUGHb9+ooztCXu1D8MY8DZYsu3g= github.com/pborman/uuid v1.2.0/go.mod h1:X/NO0urCmaxf9VXbdlT7C2Yzkj2IKimNn4k+gtPdI/k= github.com/pelletier/go-toml v1.1.0/go.mod h1:5z9KED0ma1S8pY6P1sdut58dfprrGBbd/94hg7ilaic= github.com/pelletier/go-toml v1.2.0/go.mod h1:5z9KED0ma1S8pY6P1sdut58dfprrGBbd/94hg7ilaic= -github.com/pelletier/go-toml v1.7.0/go.mod h1:vwGMzjaWMwyfHwgIBhI2YUM4fB6nL6lVAvS1LBMMhTE= github.com/peterbourgon/diskv v2.0.1+incompatible h1:UBdAOUP5p4RWqPBg048CAvpKN+vxiaj6gdUUzhl4XmI= github.com/peterbourgon/diskv v2.0.1+incompatible/go.mod h1:uqqh8zWWbv1HBMNONnaR/tNboyR3/BZd58JJSHlUSCU= github.com/pkg/errors v0.8.0 h1:WdK/asTD0HN+q6hsWO3/vpuAkAr+tw6aNJNDFFf0+qw= diff --git a/pkg/nfs/controllerserver.go b/pkg/nfs/controllerserver.go index 83fc95812..bde023dc0 100644 --- a/pkg/nfs/controllerserver.go +++ b/pkg/nfs/controllerserver.go @@ -1,3 +1,19 @@ +/* +Copyright 2020 The Kubernetes Authors. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + package nfs import ( @@ -14,7 +30,7 @@ import ( ) type ControllerServer struct { - Driver *nfsDriver + Driver *Driver // Working directory for the provisioner to temporarily mount nfs shares at workingMountDir string } @@ -87,32 +103,15 @@ func (cs *ControllerServer) CreateVolume(ctx context.Context, req *csi.CreateVol return &csi.CreateVolumeResponse{Volume: cs.nfsVolToCSI(nfsVol, reqCapacity)}, nil } -func validCapacity(requested int64, volumePath string) error { - metrics, err := getVolumeMetrics(volumePath) - if err != nil { - return err - } - - capacity, ok := metrics.Capacity.AsInt64() - if !ok { - return status.Errorf(codes.Internal, "failed to get capacity") - } - - if capacity != requested { - return status.Errorf(codes.AlreadyExists, "volume at this path exists with a different capacity") - } - return nil -} - func (cs *ControllerServer) DeleteVolume(ctx context.Context, req *csi.DeleteVolumeRequest) (*csi.DeleteVolumeResponse, error) { - volumeId := req.GetVolumeId() - if volumeId == "" { + volumeID := req.GetVolumeId() + if volumeID == "" { return nil, status.Error(codes.InvalidArgument, "volume id is empty") } - nfsVol, err := cs.getNfsVolFromId(volumeId) + nfsVol, err := cs.getNfsVolFromID(volumeID) if err != nil { // An invalid ID should be treated as doesn't exist - glog.V(5).Infof("failed to get nfs volume for volume id %v deletion: %v", volumeId, err) + glog.V(5).Infof("failed to get nfs volume for volume id %v deletion: %v", volumeID, err) return &csi.DeleteVolumeResponse{}, nil } @@ -300,7 +299,7 @@ func (cs *ControllerServer) newNFSVolume(name string, size int64, params map[str subDir: name, size: size, } - vol.id = cs.getVolumeIdFromNfsVol(vol) + vol.id = cs.getVolumeIDFromNfsVol(vol) return vol, nil } @@ -343,7 +342,7 @@ func (cs *ControllerServer) nfsVolToCSI(vol *nfsVolume, reqCapacity int64) *csi. } // Given a nfsVolume, return a CSI volume id -func (cs *ControllerServer) getVolumeIdFromNfsVol(vol *nfsVolume) string { +func (cs *ControllerServer) getVolumeIDFromNfsVol(vol *nfsVolume) string { idElements := make([]string, totalIDElements) idElements[idServer] = strings.Trim(vol.server, "/") idElements[idBaseDir] = strings.Trim(vol.baseDir, "/") @@ -352,7 +351,7 @@ func (cs *ControllerServer) getVolumeIdFromNfsVol(vol *nfsVolume) string { } // Given a CSI volume id, return a nfsVolume -func (cs *ControllerServer) getNfsVolFromId(id string) (*nfsVolume, error) { +func (cs *ControllerServer) getNfsVolFromID(id string) (*nfsVolume, error) { tokens := strings.Split(id, "/") if len(tokens) != totalIDElements { return nil, fmt.Errorf("volume id %q unexpected format: got %v token(s) instead of %v", id, len(tokens), totalIDElements) diff --git a/pkg/nfs/controllerserver_test.go b/pkg/nfs/controllerserver_test.go index de946e7a6..526090b9d 100644 --- a/pkg/nfs/controllerserver_test.go +++ b/pkg/nfs/controllerserver_test.go @@ -1,3 +1,19 @@ +/* +Copyright 2020 The Kubernetes Authors. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + package nfs import ( @@ -7,6 +23,7 @@ import ( "testing" "fmt" + "github.com/container-storage-interface/spec/lib/go/csi" "golang.org/x/net/context" "k8s.io/utils/mount" @@ -16,7 +33,7 @@ const ( testServer = "test-server" testBaseDir = "test-base-dir" testCSIVolume = "test-csi" - testVolumeId = "test-server/test-base-dir/test-csi" + testVolumeID = "test-server/test-base-dir/test-csi" ) // for Windows support in the future @@ -36,7 +53,7 @@ func teardown() { err := os.RemoveAll("/tmp/" + testCSIVolume) if err != nil { - fmt.Printf(err.Error()) + fmt.Print(err.Error()) fmt.Printf("\n") fmt.Printf("\033[1;91m%s\033[0m\n", "> Teardown failed") } else { @@ -78,7 +95,7 @@ func TestCreateVolume(t *testing.T) { }, resp: &csi.CreateVolumeResponse{ Volume: &csi.Volume{ - VolumeId: testVolumeId, + VolumeId: testVolumeID, VolumeContext: map[string]string{ paramServer: testServer, paramShare: testShare, diff --git a/pkg/nfs/indentityserver.go b/pkg/nfs/indentityserver.go index af631b1c5..8f276bd17 100644 --- a/pkg/nfs/indentityserver.go +++ b/pkg/nfs/indentityserver.go @@ -1,3 +1,19 @@ +/* +Copyright 2020 The Kubernetes Authors. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + package nfs import ( @@ -9,7 +25,7 @@ import ( ) type IdentityServer struct { - Driver *nfsDriver + Driver *Driver } func (ids *IdentityServer) GetPluginInfo(ctx context.Context, req *csi.GetPluginInfoRequest) (*csi.GetPluginInfoResponse, error) { diff --git a/pkg/nfs/nfs.go b/pkg/nfs/nfs.go index 313e51ed8..9d71b8889 100644 --- a/pkg/nfs/nfs.go +++ b/pkg/nfs/nfs.go @@ -22,7 +22,7 @@ import ( "k8s.io/utils/mount" ) -type nfsDriver struct { +type Driver struct { name string nodeID string version string @@ -32,7 +32,7 @@ type nfsDriver struct { perm *uint32 //ids *identityServer - ns *nodeServer + ns *NodeServer cap map[csi.VolumeCapability_AccessMode_Mode]bool cscap []*csi.ControllerServiceCapability } @@ -43,7 +43,7 @@ const ( paramServer = "server" // Base directory of the NFS server to create volumes under. // The base directory must be a direct child of the root directory. - // The root directory is ommitted from the string, for example: + // The root directory is omitted from the string, for example: // "base" instead of "/base" paramShare = "share" ) @@ -52,10 +52,10 @@ var ( version = "2.0.0" ) -func NewNFSdriver(nodeID, endpoint string, perm *uint32) *nfsDriver { +func NewNFSdriver(nodeID, endpoint string, perm *uint32) *Driver { glog.Infof("Driver: %v version: %v", DriverName, version) - n := &nfsDriver{ + n := &Driver{ name: DriverName, version: version, nodeID: nodeID, @@ -82,14 +82,14 @@ func NewNFSdriver(nodeID, endpoint string, perm *uint32) *nfsDriver { return n } -func NewNodeServer(n *nfsDriver, mounter mount.Interface) *nodeServer { - return &nodeServer{ +func NewNodeServer(n *Driver, mounter mount.Interface) *NodeServer { + return &NodeServer{ Driver: n, mounter: mounter, } } -func (n *nfsDriver) Run() { +func (n *Driver) Run() { n.ns = NewNodeServer(n, mount.New("")) s := NewNonBlockingGRPCServer() s.Start(n.endpoint, @@ -101,7 +101,7 @@ func (n *nfsDriver) Run() { s.Wait() } -func (n *nfsDriver) AddVolumeCapabilityAccessModes(vc []csi.VolumeCapability_AccessMode_Mode) []*csi.VolumeCapability_AccessMode { +func (n *Driver) AddVolumeCapabilityAccessModes(vc []csi.VolumeCapability_AccessMode_Mode) []*csi.VolumeCapability_AccessMode { var vca []*csi.VolumeCapability_AccessMode for _, c := range vc { glog.Infof("Enabling volume access mode: %v", c.String()) @@ -111,7 +111,7 @@ func (n *nfsDriver) AddVolumeCapabilityAccessModes(vc []csi.VolumeCapability_Acc return vca } -func (n *nfsDriver) AddControllerServiceCapabilities(cl []csi.ControllerServiceCapability_RPC_Type) { +func (n *Driver) AddControllerServiceCapabilities(cl []csi.ControllerServiceCapability_RPC_Type) { var csc []*csi.ControllerServiceCapability for _, c := range cl { @@ -120,6 +120,4 @@ func (n *nfsDriver) AddControllerServiceCapabilities(cl []csi.ControllerServiceC } n.cscap = csc - - return } diff --git a/pkg/nfs/nodeserver.go b/pkg/nfs/nodeserver.go index 33c6ab22e..91f18c342 100644 --- a/pkg/nfs/nodeserver.go +++ b/pkg/nfs/nodeserver.go @@ -27,16 +27,15 @@ import ( "golang.org/x/net/context" "google.golang.org/grpc/codes" "google.golang.org/grpc/status" - "k8s.io/kubernetes/pkg/volume" "k8s.io/utils/mount" ) -type nodeServer struct { - Driver *nfsDriver +type NodeServer struct { + Driver *Driver mounter mount.Interface } -func (ns *nodeServer) NodePublishVolume(ctx context.Context, req *csi.NodePublishVolumeRequest) (*csi.NodePublishVolumeResponse, error) { +func (ns *NodeServer) NodePublishVolume(ctx context.Context, req *csi.NodePublishVolumeRequest) (*csi.NodePublishVolumeResponse, error) { if req.GetVolumeCapability() == nil { return nil, status.Error(codes.InvalidArgument, "Volume capability missing in request") } @@ -94,7 +93,7 @@ func (ns *nodeServer) NodePublishVolume(ctx context.Context, req *csi.NodePublis return &csi.NodePublishVolumeResponse{}, nil } -func (ns *nodeServer) NodeUnpublishVolume(ctx context.Context, req *csi.NodeUnpublishVolumeRequest) (*csi.NodeUnpublishVolumeResponse, error) { +func (ns *NodeServer) NodeUnpublishVolume(ctx context.Context, req *csi.NodeUnpublishVolumeRequest) (*csi.NodeUnpublishVolumeResponse, error) { if len(req.GetVolumeId()) == 0 { return nil, status.Error(codes.InvalidArgument, "Volume ID missing in request") } @@ -107,9 +106,8 @@ func (ns *nodeServer) NodeUnpublishVolume(ctx context.Context, req *csi.NodeUnpu if err != nil { if os.IsNotExist(err) { return nil, status.Error(codes.NotFound, "Targetpath not found") - } else { - return nil, status.Error(codes.Internal, err.Error()) } + return nil, status.Error(codes.Internal, err.Error()) } if notMnt { return nil, status.Error(codes.NotFound, "Volume not mounted") @@ -123,7 +121,7 @@ func (ns *nodeServer) NodeUnpublishVolume(ctx context.Context, req *csi.NodeUnpu return &csi.NodeUnpublishVolumeResponse{}, nil } -func (ns *nodeServer) NodeGetInfo(ctx context.Context, req *csi.NodeGetInfoRequest) (*csi.NodeGetInfoResponse, error) { +func (ns *NodeServer) NodeGetInfo(ctx context.Context, req *csi.NodeGetInfoRequest) (*csi.NodeGetInfoResponse, error) { glog.V(5).Infof("Using default NodeGetInfo") return &csi.NodeGetInfoResponse{ @@ -131,7 +129,7 @@ func (ns *nodeServer) NodeGetInfo(ctx context.Context, req *csi.NodeGetInfoReque }, nil } -func (ns *nodeServer) NodeGetCapabilities(ctx context.Context, req *csi.NodeGetCapabilitiesRequest) (*csi.NodeGetCapabilitiesResponse, error) { +func (ns *NodeServer) NodeGetCapabilities(ctx context.Context, req *csi.NodeGetCapabilitiesRequest) (*csi.NodeGetCapabilitiesResponse, error) { glog.V(5).Infof("Using default NodeGetCapabilities") return &csi.NodeGetCapabilitiesResponse{ @@ -147,22 +145,18 @@ func (ns *nodeServer) NodeGetCapabilities(ctx context.Context, req *csi.NodeGetC }, nil } -func (ns *nodeServer) NodeGetVolumeStats(ctx context.Context, in *csi.NodeGetVolumeStatsRequest) (*csi.NodeGetVolumeStatsResponse, error) { +func (ns *NodeServer) NodeGetVolumeStats(ctx context.Context, in *csi.NodeGetVolumeStatsRequest) (*csi.NodeGetVolumeStatsResponse, error) { return nil, status.Error(codes.Unimplemented, "") } -func (ns *nodeServer) NodeUnstageVolume(ctx context.Context, req *csi.NodeUnstageVolumeRequest) (*csi.NodeUnstageVolumeResponse, error) { +func (ns *NodeServer) NodeUnstageVolume(ctx context.Context, req *csi.NodeUnstageVolumeRequest) (*csi.NodeUnstageVolumeResponse, error) { return &csi.NodeUnstageVolumeResponse{}, nil } -func (ns *nodeServer) NodeStageVolume(ctx context.Context, req *csi.NodeStageVolumeRequest) (*csi.NodeStageVolumeResponse, error) { +func (ns *NodeServer) NodeStageVolume(ctx context.Context, req *csi.NodeStageVolumeRequest) (*csi.NodeStageVolumeResponse, error) { return &csi.NodeStageVolumeResponse{}, nil } -func (ns *nodeServer) NodeExpandVolume(ctx context.Context, req *csi.NodeExpandVolumeRequest) (*csi.NodeExpandVolumeResponse, error) { +func (ns *NodeServer) NodeExpandVolume(ctx context.Context, req *csi.NodeExpandVolumeRequest) (*csi.NodeExpandVolumeResponse, error) { return nil, status.Error(codes.Unimplemented, "") } - -func getVolumeMetrics(volumePath string) (*volume.Metrics, error) { - return volume.NewMetricsStatFS(volumePath).GetMetrics() -} diff --git a/pkg/nfs/server.go b/pkg/nfs/server.go index 7b2ea275d..eccd93286 100644 --- a/pkg/nfs/server.go +++ b/pkg/nfs/server.go @@ -1,3 +1,19 @@ +/* +Copyright 2020 The Kubernetes Authors. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + package nfs import ( @@ -38,8 +54,6 @@ func (s *nonBlockingGRPCServer) Start(endpoint string, ids csi.IdentityServer, c s.wg.Add(1) go s.serve(endpoint, ids, cs, ns) - - return } func (s *nonBlockingGRPCServer) Wait() { @@ -91,6 +105,8 @@ func (s *nonBlockingGRPCServer) serve(endpoint string, ids csi.IdentityServer, c glog.Infof("Listening for connections on address: %#v", listener.Addr()) - server.Serve(listener) - + err = server.Serve(listener) + if err != nil { + glog.Fatalf("Failed to serve grpc server: %v", err) + } } diff --git a/pkg/nfs/utils.go b/pkg/nfs/utils.go index e5b7af944..6a35fb2ff 100644 --- a/pkg/nfs/utils.go +++ b/pkg/nfs/utils.go @@ -1,3 +1,19 @@ +/* +Copyright 2020 The Kubernetes Authors. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + package nfs import ( @@ -11,13 +27,13 @@ import ( "google.golang.org/grpc" ) -func NewDefaultIdentityServer(d *nfsDriver) *IdentityServer { +func NewDefaultIdentityServer(d *Driver) *IdentityServer { return &IdentityServer{ Driver: d, } } -func NewControllerServer(d *nfsDriver) *ControllerServer { +func NewControllerServer(d *Driver) *ControllerServer { return &ControllerServer{ Driver: d, } diff --git a/test/e2e/e2e_suite_test.go b/test/e2e/e2e_suite_test.go index 90d399865..49522fc30 100644 --- a/test/e2e/e2e_suite_test.go +++ b/test/e2e/e2e_suite_test.go @@ -1,3 +1,19 @@ +/* +Copyright 2020 The Kubernetes Authors. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + package e2e import ( @@ -22,19 +38,17 @@ import ( const ( kubeconfigEnvVar = "KUBECONFIG" - reportDirEnv = "ARTIFACTS" - defaultReportDir = "test/e2e" ) var ( nodeID = os.Getenv("NODE_ID") perm *uint32 - nfsDriver = nfs.NewNFSdriver(nodeID, fmt.Sprintf("unix:///tmp/csi-%s.sock", uuid.NewUUID().String()), perm) + nfsDriver *nfs.Driver defaultStorageClassParameters = map[string]string{ "server": "nfs-server.default.svc.cluster.local", "share": "/", } - controllerServer = nfs.NewControllerServer(nfsDriver) + controllerServer *nfs.ControllerServer ) type testCmd struct { @@ -54,6 +68,9 @@ var _ = ginkgo.BeforeSuite(func() { handleFlags() framework.AfterReadingAllFlags(&framework.TestContext) + nfsDriver = nfs.NewNFSdriver(nodeID, fmt.Sprintf("unix:///tmp/csi-%s.sock", uuid.NewUUID().String()), perm) + controllerServer = nfs.NewControllerServer(nfsDriver) + // install nfs server installNFSServer := testCmd{ command: "make", diff --git a/test/e2e/testsuites/testsuites.go b/test/e2e/testsuites/testsuites.go index 2b2448ea7..46881e727 100644 --- a/test/e2e/testsuites/testsuites.go +++ b/test/e2e/testsuites/testsuites.go @@ -51,7 +51,6 @@ const ( slowPodStartTimeout = 15 * time.Minute // Description that will printed during tests failedConditionDescription = "Error status code" - pollLongTimeout = 5 * time.Minute ) type TestStorageClass struct { diff --git a/test/integration/run-test.sh b/test/integration/run-test.sh index 42acaea77..db411dac6 100755 --- a/test/integration/run-test.sh +++ b/test/integration/run-test.sh @@ -46,7 +46,7 @@ install_csc_bin readonly volname="citest-$(date +%s)" readonly volsize="2147483648" -readonly endpoint="tcp://127.0.0.1:10000" +readonly endpoint="unix:///tmp/csi.sock" readonly target_path="/tmp/targetpath" readonly params="server=127.0.0.1,share=/" diff --git a/test/utils/check_driver_pods_restart.sh b/test/utils/check_driver_pods_restart.sh index fa048564c..f9df9fcd8 100644 --- a/test/utils/check_driver_pods_restart.sh +++ b/test/utils/check_driver_pods_restart.sh @@ -1,4 +1,3 @@ - # Copyright 2020 The Kubernetes Authors. # # Licensed under the Apache License, Version 2.0 (the "License"); diff --git a/vendor/github.com/Microsoft/go-winio/.gitignore b/vendor/github.com/Microsoft/go-winio/.gitignore deleted file mode 100644 index b883f1fdc..000000000 --- a/vendor/github.com/Microsoft/go-winio/.gitignore +++ /dev/null @@ -1 +0,0 @@ -*.exe diff --git a/vendor/github.com/Microsoft/go-winio/LICENSE b/vendor/github.com/Microsoft/go-winio/LICENSE deleted file mode 100644 index b8b569d77..000000000 --- a/vendor/github.com/Microsoft/go-winio/LICENSE +++ /dev/null @@ -1,22 +0,0 @@ -The MIT License (MIT) - -Copyright (c) 2015 Microsoft - -Permission is hereby granted, free of charge, to any person obtaining a copy -of this software and associated documentation files (the "Software"), to deal -in the Software without restriction, including without limitation the rights -to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -copies of the Software, and to permit persons to whom the Software is -furnished to do so, subject to the following conditions: - -The above copyright notice and this permission notice shall be included in all -copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE -SOFTWARE. - diff --git a/vendor/github.com/Microsoft/go-winio/README.md b/vendor/github.com/Microsoft/go-winio/README.md deleted file mode 100644 index 568001057..000000000 --- a/vendor/github.com/Microsoft/go-winio/README.md +++ /dev/null @@ -1,22 +0,0 @@ -# go-winio - -This repository contains utilities for efficiently performing Win32 IO operations in -Go. Currently, this is focused on accessing named pipes and other file handles, and -for using named pipes as a net transport. - -This code relies on IO completion ports to avoid blocking IO on system threads, allowing Go -to reuse the thread to schedule another goroutine. This limits support to Windows Vista and -newer operating systems. This is similar to the implementation of network sockets in Go's net -package. - -Please see the LICENSE file for licensing information. - -This project has adopted the [Microsoft Open Source Code of -Conduct](https://opensource.microsoft.com/codeofconduct/). For more information -see the [Code of Conduct -FAQ](https://opensource.microsoft.com/codeofconduct/faq/) or contact -[opencode@microsoft.com](mailto:opencode@microsoft.com) with any additional -questions or comments. - -Thanks to natefinch for the inspiration for this library. See https://github.com/natefinch/npipe -for another named pipe implementation. diff --git a/vendor/github.com/Microsoft/go-winio/backup.go b/vendor/github.com/Microsoft/go-winio/backup.go deleted file mode 100644 index 2be34af43..000000000 --- a/vendor/github.com/Microsoft/go-winio/backup.go +++ /dev/null @@ -1,280 +0,0 @@ -// +build windows - -package winio - -import ( - "encoding/binary" - "errors" - "fmt" - "io" - "io/ioutil" - "os" - "runtime" - "syscall" - "unicode/utf16" -) - -//sys backupRead(h syscall.Handle, b []byte, bytesRead *uint32, abort bool, processSecurity bool, context *uintptr) (err error) = BackupRead -//sys backupWrite(h syscall.Handle, b []byte, bytesWritten *uint32, abort bool, processSecurity bool, context *uintptr) (err error) = BackupWrite - -const ( - BackupData = uint32(iota + 1) - BackupEaData - BackupSecurity - BackupAlternateData - BackupLink - BackupPropertyData - BackupObjectId - BackupReparseData - BackupSparseBlock - BackupTxfsData -) - -const ( - StreamSparseAttributes = uint32(8) -) - -const ( - WRITE_DAC = 0x40000 - WRITE_OWNER = 0x80000 - ACCESS_SYSTEM_SECURITY = 0x1000000 -) - -// BackupHeader represents a backup stream of a file. -type BackupHeader struct { - Id uint32 // The backup stream ID - Attributes uint32 // Stream attributes - Size int64 // The size of the stream in bytes - Name string // The name of the stream (for BackupAlternateData only). - Offset int64 // The offset of the stream in the file (for BackupSparseBlock only). -} - -type win32StreamId struct { - StreamId uint32 - Attributes uint32 - Size uint64 - NameSize uint32 -} - -// BackupStreamReader reads from a stream produced by the BackupRead Win32 API and produces a series -// of BackupHeader values. -type BackupStreamReader struct { - r io.Reader - bytesLeft int64 -} - -// NewBackupStreamReader produces a BackupStreamReader from any io.Reader. -func NewBackupStreamReader(r io.Reader) *BackupStreamReader { - return &BackupStreamReader{r, 0} -} - -// Next returns the next backup stream and prepares for calls to Read(). It skips the remainder of the current stream if -// it was not completely read. -func (r *BackupStreamReader) Next() (*BackupHeader, error) { - if r.bytesLeft > 0 { - if s, ok := r.r.(io.Seeker); ok { - // Make sure Seek on io.SeekCurrent sometimes succeeds - // before trying the actual seek. - if _, err := s.Seek(0, io.SeekCurrent); err == nil { - if _, err = s.Seek(r.bytesLeft, io.SeekCurrent); err != nil { - return nil, err - } - r.bytesLeft = 0 - } - } - if _, err := io.Copy(ioutil.Discard, r); err != nil { - return nil, err - } - } - var wsi win32StreamId - if err := binary.Read(r.r, binary.LittleEndian, &wsi); err != nil { - return nil, err - } - hdr := &BackupHeader{ - Id: wsi.StreamId, - Attributes: wsi.Attributes, - Size: int64(wsi.Size), - } - if wsi.NameSize != 0 { - name := make([]uint16, int(wsi.NameSize/2)) - if err := binary.Read(r.r, binary.LittleEndian, name); err != nil { - return nil, err - } - hdr.Name = syscall.UTF16ToString(name) - } - if wsi.StreamId == BackupSparseBlock { - if err := binary.Read(r.r, binary.LittleEndian, &hdr.Offset); err != nil { - return nil, err - } - hdr.Size -= 8 - } - r.bytesLeft = hdr.Size - return hdr, nil -} - -// Read reads from the current backup stream. -func (r *BackupStreamReader) Read(b []byte) (int, error) { - if r.bytesLeft == 0 { - return 0, io.EOF - } - if int64(len(b)) > r.bytesLeft { - b = b[:r.bytesLeft] - } - n, err := r.r.Read(b) - r.bytesLeft -= int64(n) - if err == io.EOF { - err = io.ErrUnexpectedEOF - } else if r.bytesLeft == 0 && err == nil { - err = io.EOF - } - return n, err -} - -// BackupStreamWriter writes a stream compatible with the BackupWrite Win32 API. -type BackupStreamWriter struct { - w io.Writer - bytesLeft int64 -} - -// NewBackupStreamWriter produces a BackupStreamWriter on top of an io.Writer. -func NewBackupStreamWriter(w io.Writer) *BackupStreamWriter { - return &BackupStreamWriter{w, 0} -} - -// WriteHeader writes the next backup stream header and prepares for calls to Write(). -func (w *BackupStreamWriter) WriteHeader(hdr *BackupHeader) error { - if w.bytesLeft != 0 { - return fmt.Errorf("missing %d bytes", w.bytesLeft) - } - name := utf16.Encode([]rune(hdr.Name)) - wsi := win32StreamId{ - StreamId: hdr.Id, - Attributes: hdr.Attributes, - Size: uint64(hdr.Size), - NameSize: uint32(len(name) * 2), - } - if hdr.Id == BackupSparseBlock { - // Include space for the int64 block offset - wsi.Size += 8 - } - if err := binary.Write(w.w, binary.LittleEndian, &wsi); err != nil { - return err - } - if len(name) != 0 { - if err := binary.Write(w.w, binary.LittleEndian, name); err != nil { - return err - } - } - if hdr.Id == BackupSparseBlock { - if err := binary.Write(w.w, binary.LittleEndian, hdr.Offset); err != nil { - return err - } - } - w.bytesLeft = hdr.Size - return nil -} - -// Write writes to the current backup stream. -func (w *BackupStreamWriter) Write(b []byte) (int, error) { - if w.bytesLeft < int64(len(b)) { - return 0, fmt.Errorf("too many bytes by %d", int64(len(b))-w.bytesLeft) - } - n, err := w.w.Write(b) - w.bytesLeft -= int64(n) - return n, err -} - -// BackupFileReader provides an io.ReadCloser interface on top of the BackupRead Win32 API. -type BackupFileReader struct { - f *os.File - includeSecurity bool - ctx uintptr -} - -// NewBackupFileReader returns a new BackupFileReader from a file handle. If includeSecurity is true, -// Read will attempt to read the security descriptor of the file. -func NewBackupFileReader(f *os.File, includeSecurity bool) *BackupFileReader { - r := &BackupFileReader{f, includeSecurity, 0} - return r -} - -// Read reads a backup stream from the file by calling the Win32 API BackupRead(). -func (r *BackupFileReader) Read(b []byte) (int, error) { - var bytesRead uint32 - err := backupRead(syscall.Handle(r.f.Fd()), b, &bytesRead, false, r.includeSecurity, &r.ctx) - if err != nil { - return 0, &os.PathError{"BackupRead", r.f.Name(), err} - } - runtime.KeepAlive(r.f) - if bytesRead == 0 { - return 0, io.EOF - } - return int(bytesRead), nil -} - -// Close frees Win32 resources associated with the BackupFileReader. It does not close -// the underlying file. -func (r *BackupFileReader) Close() error { - if r.ctx != 0 { - backupRead(syscall.Handle(r.f.Fd()), nil, nil, true, false, &r.ctx) - runtime.KeepAlive(r.f) - r.ctx = 0 - } - return nil -} - -// BackupFileWriter provides an io.WriteCloser interface on top of the BackupWrite Win32 API. -type BackupFileWriter struct { - f *os.File - includeSecurity bool - ctx uintptr -} - -// NewBackupFileWriter returns a new BackupFileWriter from a file handle. If includeSecurity is true, -// Write() will attempt to restore the security descriptor from the stream. -func NewBackupFileWriter(f *os.File, includeSecurity bool) *BackupFileWriter { - w := &BackupFileWriter{f, includeSecurity, 0} - return w -} - -// Write restores a portion of the file using the provided backup stream. -func (w *BackupFileWriter) Write(b []byte) (int, error) { - var bytesWritten uint32 - err := backupWrite(syscall.Handle(w.f.Fd()), b, &bytesWritten, false, w.includeSecurity, &w.ctx) - if err != nil { - return 0, &os.PathError{"BackupWrite", w.f.Name(), err} - } - runtime.KeepAlive(w.f) - if int(bytesWritten) != len(b) { - return int(bytesWritten), errors.New("not all bytes could be written") - } - return len(b), nil -} - -// Close frees Win32 resources associated with the BackupFileWriter. It does not -// close the underlying file. -func (w *BackupFileWriter) Close() error { - if w.ctx != 0 { - backupWrite(syscall.Handle(w.f.Fd()), nil, nil, true, false, &w.ctx) - runtime.KeepAlive(w.f) - w.ctx = 0 - } - return nil -} - -// OpenForBackup opens a file or directory, potentially skipping access checks if the backup -// or restore privileges have been acquired. -// -// If the file opened was a directory, it cannot be used with Readdir(). -func OpenForBackup(path string, access uint32, share uint32, createmode uint32) (*os.File, error) { - winPath, err := syscall.UTF16FromString(path) - if err != nil { - return nil, err - } - h, err := syscall.CreateFile(&winPath[0], access, share, nil, createmode, syscall.FILE_FLAG_BACKUP_SEMANTICS|syscall.FILE_FLAG_OPEN_REPARSE_POINT, 0) - if err != nil { - err = &os.PathError{Op: "open", Path: path, Err: err} - return nil, err - } - return os.NewFile(uintptr(h), path), nil -} diff --git a/vendor/github.com/Microsoft/go-winio/ea.go b/vendor/github.com/Microsoft/go-winio/ea.go deleted file mode 100644 index 4051c1b33..000000000 --- a/vendor/github.com/Microsoft/go-winio/ea.go +++ /dev/null @@ -1,137 +0,0 @@ -package winio - -import ( - "bytes" - "encoding/binary" - "errors" -) - -type fileFullEaInformation struct { - NextEntryOffset uint32 - Flags uint8 - NameLength uint8 - ValueLength uint16 -} - -var ( - fileFullEaInformationSize = binary.Size(&fileFullEaInformation{}) - - errInvalidEaBuffer = errors.New("invalid extended attribute buffer") - errEaNameTooLarge = errors.New("extended attribute name too large") - errEaValueTooLarge = errors.New("extended attribute value too large") -) - -// ExtendedAttribute represents a single Windows EA. -type ExtendedAttribute struct { - Name string - Value []byte - Flags uint8 -} - -func parseEa(b []byte) (ea ExtendedAttribute, nb []byte, err error) { - var info fileFullEaInformation - err = binary.Read(bytes.NewReader(b), binary.LittleEndian, &info) - if err != nil { - err = errInvalidEaBuffer - return - } - - nameOffset := fileFullEaInformationSize - nameLen := int(info.NameLength) - valueOffset := nameOffset + int(info.NameLength) + 1 - valueLen := int(info.ValueLength) - nextOffset := int(info.NextEntryOffset) - if valueLen+valueOffset > len(b) || nextOffset < 0 || nextOffset > len(b) { - err = errInvalidEaBuffer - return - } - - ea.Name = string(b[nameOffset : nameOffset+nameLen]) - ea.Value = b[valueOffset : valueOffset+valueLen] - ea.Flags = info.Flags - if info.NextEntryOffset != 0 { - nb = b[info.NextEntryOffset:] - } - return -} - -// DecodeExtendedAttributes decodes a list of EAs from a FILE_FULL_EA_INFORMATION -// buffer retrieved from BackupRead, ZwQueryEaFile, etc. -func DecodeExtendedAttributes(b []byte) (eas []ExtendedAttribute, err error) { - for len(b) != 0 { - ea, nb, err := parseEa(b) - if err != nil { - return nil, err - } - - eas = append(eas, ea) - b = nb - } - return -} - -func writeEa(buf *bytes.Buffer, ea *ExtendedAttribute, last bool) error { - if int(uint8(len(ea.Name))) != len(ea.Name) { - return errEaNameTooLarge - } - if int(uint16(len(ea.Value))) != len(ea.Value) { - return errEaValueTooLarge - } - entrySize := uint32(fileFullEaInformationSize + len(ea.Name) + 1 + len(ea.Value)) - withPadding := (entrySize + 3) &^ 3 - nextOffset := uint32(0) - if !last { - nextOffset = withPadding - } - info := fileFullEaInformation{ - NextEntryOffset: nextOffset, - Flags: ea.Flags, - NameLength: uint8(len(ea.Name)), - ValueLength: uint16(len(ea.Value)), - } - - err := binary.Write(buf, binary.LittleEndian, &info) - if err != nil { - return err - } - - _, err = buf.Write([]byte(ea.Name)) - if err != nil { - return err - } - - err = buf.WriteByte(0) - if err != nil { - return err - } - - _, err = buf.Write(ea.Value) - if err != nil { - return err - } - - _, err = buf.Write([]byte{0, 0, 0}[0 : withPadding-entrySize]) - if err != nil { - return err - } - - return nil -} - -// EncodeExtendedAttributes encodes a list of EAs into a FILE_FULL_EA_INFORMATION -// buffer for use with BackupWrite, ZwSetEaFile, etc. -func EncodeExtendedAttributes(eas []ExtendedAttribute) ([]byte, error) { - var buf bytes.Buffer - for i := range eas { - last := false - if i == len(eas)-1 { - last = true - } - - err := writeEa(&buf, &eas[i], last) - if err != nil { - return nil, err - } - } - return buf.Bytes(), nil -} diff --git a/vendor/github.com/Microsoft/go-winio/file.go b/vendor/github.com/Microsoft/go-winio/file.go deleted file mode 100644 index 0385e4108..000000000 --- a/vendor/github.com/Microsoft/go-winio/file.go +++ /dev/null @@ -1,323 +0,0 @@ -// +build windows - -package winio - -import ( - "errors" - "io" - "runtime" - "sync" - "sync/atomic" - "syscall" - "time" -) - -//sys cancelIoEx(file syscall.Handle, o *syscall.Overlapped) (err error) = CancelIoEx -//sys createIoCompletionPort(file syscall.Handle, port syscall.Handle, key uintptr, threadCount uint32) (newport syscall.Handle, err error) = CreateIoCompletionPort -//sys getQueuedCompletionStatus(port syscall.Handle, bytes *uint32, key *uintptr, o **ioOperation, timeout uint32) (err error) = GetQueuedCompletionStatus -//sys setFileCompletionNotificationModes(h syscall.Handle, flags uint8) (err error) = SetFileCompletionNotificationModes -//sys wsaGetOverlappedResult(h syscall.Handle, o *syscall.Overlapped, bytes *uint32, wait bool, flags *uint32) (err error) = ws2_32.WSAGetOverlappedResult - -type atomicBool int32 - -func (b *atomicBool) isSet() bool { return atomic.LoadInt32((*int32)(b)) != 0 } -func (b *atomicBool) setFalse() { atomic.StoreInt32((*int32)(b), 0) } -func (b *atomicBool) setTrue() { atomic.StoreInt32((*int32)(b), 1) } -func (b *atomicBool) swap(new bool) bool { - var newInt int32 - if new { - newInt = 1 - } - return atomic.SwapInt32((*int32)(b), newInt) == 1 -} - -const ( - cFILE_SKIP_COMPLETION_PORT_ON_SUCCESS = 1 - cFILE_SKIP_SET_EVENT_ON_HANDLE = 2 -) - -var ( - ErrFileClosed = errors.New("file has already been closed") - ErrTimeout = &timeoutError{} -) - -type timeoutError struct{} - -func (e *timeoutError) Error() string { return "i/o timeout" } -func (e *timeoutError) Timeout() bool { return true } -func (e *timeoutError) Temporary() bool { return true } - -type timeoutChan chan struct{} - -var ioInitOnce sync.Once -var ioCompletionPort syscall.Handle - -// ioResult contains the result of an asynchronous IO operation -type ioResult struct { - bytes uint32 - err error -} - -// ioOperation represents an outstanding asynchronous Win32 IO -type ioOperation struct { - o syscall.Overlapped - ch chan ioResult -} - -func initIo() { - h, err := createIoCompletionPort(syscall.InvalidHandle, 0, 0, 0xffffffff) - if err != nil { - panic(err) - } - ioCompletionPort = h - go ioCompletionProcessor(h) -} - -// win32File implements Reader, Writer, and Closer on a Win32 handle without blocking in a syscall. -// It takes ownership of this handle and will close it if it is garbage collected. -type win32File struct { - handle syscall.Handle - wg sync.WaitGroup - wgLock sync.RWMutex - closing atomicBool - socket bool - readDeadline deadlineHandler - writeDeadline deadlineHandler -} - -type deadlineHandler struct { - setLock sync.Mutex - channel timeoutChan - channelLock sync.RWMutex - timer *time.Timer - timedout atomicBool -} - -// makeWin32File makes a new win32File from an existing file handle -func makeWin32File(h syscall.Handle) (*win32File, error) { - f := &win32File{handle: h} - ioInitOnce.Do(initIo) - _, err := createIoCompletionPort(h, ioCompletionPort, 0, 0xffffffff) - if err != nil { - return nil, err - } - err = setFileCompletionNotificationModes(h, cFILE_SKIP_COMPLETION_PORT_ON_SUCCESS|cFILE_SKIP_SET_EVENT_ON_HANDLE) - if err != nil { - return nil, err - } - f.readDeadline.channel = make(timeoutChan) - f.writeDeadline.channel = make(timeoutChan) - return f, nil -} - -func MakeOpenFile(h syscall.Handle) (io.ReadWriteCloser, error) { - // If we return the result of makeWin32File directly, it can result in an - // interface-wrapped nil, rather than a nil interface value. - f, err := makeWin32File(h) - if err != nil { - return nil, err - } - return f, nil -} - -// closeHandle closes the resources associated with a Win32 handle -func (f *win32File) closeHandle() { - f.wgLock.Lock() - // Atomically set that we are closing, releasing the resources only once. - if !f.closing.swap(true) { - f.wgLock.Unlock() - // cancel all IO and wait for it to complete - cancelIoEx(f.handle, nil) - f.wg.Wait() - // at this point, no new IO can start - syscall.Close(f.handle) - f.handle = 0 - } else { - f.wgLock.Unlock() - } -} - -// Close closes a win32File. -func (f *win32File) Close() error { - f.closeHandle() - return nil -} - -// prepareIo prepares for a new IO operation. -// The caller must call f.wg.Done() when the IO is finished, prior to Close() returning. -func (f *win32File) prepareIo() (*ioOperation, error) { - f.wgLock.RLock() - if f.closing.isSet() { - f.wgLock.RUnlock() - return nil, ErrFileClosed - } - f.wg.Add(1) - f.wgLock.RUnlock() - c := &ioOperation{} - c.ch = make(chan ioResult) - return c, nil -} - -// ioCompletionProcessor processes completed async IOs forever -func ioCompletionProcessor(h syscall.Handle) { - for { - var bytes uint32 - var key uintptr - var op *ioOperation - err := getQueuedCompletionStatus(h, &bytes, &key, &op, syscall.INFINITE) - if op == nil { - panic(err) - } - op.ch <- ioResult{bytes, err} - } -} - -// asyncIo processes the return value from ReadFile or WriteFile, blocking until -// the operation has actually completed. -func (f *win32File) asyncIo(c *ioOperation, d *deadlineHandler, bytes uint32, err error) (int, error) { - if err != syscall.ERROR_IO_PENDING { - return int(bytes), err - } - - if f.closing.isSet() { - cancelIoEx(f.handle, &c.o) - } - - var timeout timeoutChan - if d != nil { - d.channelLock.Lock() - timeout = d.channel - d.channelLock.Unlock() - } - - var r ioResult - select { - case r = <-c.ch: - err = r.err - if err == syscall.ERROR_OPERATION_ABORTED { - if f.closing.isSet() { - err = ErrFileClosed - } - } else if err != nil && f.socket { - // err is from Win32. Query the overlapped structure to get the winsock error. - var bytes, flags uint32 - err = wsaGetOverlappedResult(f.handle, &c.o, &bytes, false, &flags) - } - case <-timeout: - cancelIoEx(f.handle, &c.o) - r = <-c.ch - err = r.err - if err == syscall.ERROR_OPERATION_ABORTED { - err = ErrTimeout - } - } - - // runtime.KeepAlive is needed, as c is passed via native - // code to ioCompletionProcessor, c must remain alive - // until the channel read is complete. - runtime.KeepAlive(c) - return int(r.bytes), err -} - -// Read reads from a file handle. -func (f *win32File) Read(b []byte) (int, error) { - c, err := f.prepareIo() - if err != nil { - return 0, err - } - defer f.wg.Done() - - if f.readDeadline.timedout.isSet() { - return 0, ErrTimeout - } - - var bytes uint32 - err = syscall.ReadFile(f.handle, b, &bytes, &c.o) - n, err := f.asyncIo(c, &f.readDeadline, bytes, err) - runtime.KeepAlive(b) - - // Handle EOF conditions. - if err == nil && n == 0 && len(b) != 0 { - return 0, io.EOF - } else if err == syscall.ERROR_BROKEN_PIPE { - return 0, io.EOF - } else { - return n, err - } -} - -// Write writes to a file handle. -func (f *win32File) Write(b []byte) (int, error) { - c, err := f.prepareIo() - if err != nil { - return 0, err - } - defer f.wg.Done() - - if f.writeDeadline.timedout.isSet() { - return 0, ErrTimeout - } - - var bytes uint32 - err = syscall.WriteFile(f.handle, b, &bytes, &c.o) - n, err := f.asyncIo(c, &f.writeDeadline, bytes, err) - runtime.KeepAlive(b) - return n, err -} - -func (f *win32File) SetReadDeadline(deadline time.Time) error { - return f.readDeadline.set(deadline) -} - -func (f *win32File) SetWriteDeadline(deadline time.Time) error { - return f.writeDeadline.set(deadline) -} - -func (f *win32File) Flush() error { - return syscall.FlushFileBuffers(f.handle) -} - -func (f *win32File) Fd() uintptr { - return uintptr(f.handle) -} - -func (d *deadlineHandler) set(deadline time.Time) error { - d.setLock.Lock() - defer d.setLock.Unlock() - - if d.timer != nil { - if !d.timer.Stop() { - <-d.channel - } - d.timer = nil - } - d.timedout.setFalse() - - select { - case <-d.channel: - d.channelLock.Lock() - d.channel = make(chan struct{}) - d.channelLock.Unlock() - default: - } - - if deadline.IsZero() { - return nil - } - - timeoutIO := func() { - d.timedout.setTrue() - close(d.channel) - } - - now := time.Now() - duration := deadline.Sub(now) - if deadline.After(now) { - // Deadline is in the future, set a timer to wait - d.timer = time.AfterFunc(duration, timeoutIO) - } else { - // Deadline is in the past. Cancel all pending IO now. - timeoutIO() - } - return nil -} diff --git a/vendor/github.com/Microsoft/go-winio/fileinfo.go b/vendor/github.com/Microsoft/go-winio/fileinfo.go deleted file mode 100644 index ada2fbab6..000000000 --- a/vendor/github.com/Microsoft/go-winio/fileinfo.go +++ /dev/null @@ -1,61 +0,0 @@ -// +build windows - -package winio - -import ( - "os" - "runtime" - "syscall" - "unsafe" -) - -//sys getFileInformationByHandleEx(h syscall.Handle, class uint32, buffer *byte, size uint32) (err error) = GetFileInformationByHandleEx -//sys setFileInformationByHandle(h syscall.Handle, class uint32, buffer *byte, size uint32) (err error) = SetFileInformationByHandle - -const ( - fileBasicInfo = 0 - fileIDInfo = 0x12 -) - -// FileBasicInfo contains file access time and file attributes information. -type FileBasicInfo struct { - CreationTime, LastAccessTime, LastWriteTime, ChangeTime syscall.Filetime - FileAttributes uint32 - pad uint32 // padding -} - -// GetFileBasicInfo retrieves times and attributes for a file. -func GetFileBasicInfo(f *os.File) (*FileBasicInfo, error) { - bi := &FileBasicInfo{} - if err := getFileInformationByHandleEx(syscall.Handle(f.Fd()), fileBasicInfo, (*byte)(unsafe.Pointer(bi)), uint32(unsafe.Sizeof(*bi))); err != nil { - return nil, &os.PathError{Op: "GetFileInformationByHandleEx", Path: f.Name(), Err: err} - } - runtime.KeepAlive(f) - return bi, nil -} - -// SetFileBasicInfo sets times and attributes for a file. -func SetFileBasicInfo(f *os.File, bi *FileBasicInfo) error { - if err := setFileInformationByHandle(syscall.Handle(f.Fd()), fileBasicInfo, (*byte)(unsafe.Pointer(bi)), uint32(unsafe.Sizeof(*bi))); err != nil { - return &os.PathError{Op: "SetFileInformationByHandle", Path: f.Name(), Err: err} - } - runtime.KeepAlive(f) - return nil -} - -// FileIDInfo contains the volume serial number and file ID for a file. This pair should be -// unique on a system. -type FileIDInfo struct { - VolumeSerialNumber uint64 - FileID [16]byte -} - -// GetFileID retrieves the unique (volume, file ID) pair for a file. -func GetFileID(f *os.File) (*FileIDInfo, error) { - fileID := &FileIDInfo{} - if err := getFileInformationByHandleEx(syscall.Handle(f.Fd()), fileIDInfo, (*byte)(unsafe.Pointer(fileID)), uint32(unsafe.Sizeof(*fileID))); err != nil { - return nil, &os.PathError{Op: "GetFileInformationByHandleEx", Path: f.Name(), Err: err} - } - runtime.KeepAlive(f) - return fileID, nil -} diff --git a/vendor/github.com/Microsoft/go-winio/go.mod b/vendor/github.com/Microsoft/go-winio/go.mod deleted file mode 100644 index b3846826b..000000000 --- a/vendor/github.com/Microsoft/go-winio/go.mod +++ /dev/null @@ -1,9 +0,0 @@ -module github.com/Microsoft/go-winio - -go 1.12 - -require ( - github.com/pkg/errors v0.8.1 - github.com/sirupsen/logrus v1.4.1 - golang.org/x/sys v0.0.0-20190507160741-ecd444e8653b -) diff --git a/vendor/github.com/Microsoft/go-winio/go.sum b/vendor/github.com/Microsoft/go-winio/go.sum deleted file mode 100644 index babb4a70d..000000000 --- a/vendor/github.com/Microsoft/go-winio/go.sum +++ /dev/null @@ -1,16 +0,0 @@ -github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c= -github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= -github.com/konsorten/go-windows-terminal-sequences v1.0.1 h1:mweAR1A6xJ3oS2pRaGiHgQ4OO8tzTaLawm8vnODuwDk= -github.com/konsorten/go-windows-terminal-sequences v1.0.1/go.mod h1:T0+1ngSBFLxvqU3pZ+m/2kptfBszLMUkC4ZK/EgS/cQ= -github.com/pkg/errors v0.8.1 h1:iURUrRGxPUNPdy5/HRSm+Yj6okJ6UtLINN0Q9M4+h3I= -github.com/pkg/errors v0.8.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0= -github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM= -github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= -github.com/sirupsen/logrus v1.4.1 h1:GL2rEmy6nsikmW0r8opw9JIRScdMF5hA8cOYLH7In1k= -github.com/sirupsen/logrus v1.4.1/go.mod h1:ni0Sbl8bgC9z8RoU9G6nDWqqs/fq4eDPysMBDgk/93Q= -github.com/stretchr/objx v0.1.1/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= -github.com/stretchr/testify v1.2.2 h1:bSDNvY7ZPG5RlJ8otE/7V6gMiyenm9RtJ7IUVIAoJ1w= -github.com/stretchr/testify v1.2.2/go.mod h1:a8OnRcib4nhh0OaRAV+Yts87kKdq0PP7pXfy6kDkUVs= -golang.org/x/sys v0.0.0-20180905080454-ebe1bf3edb33/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= -golang.org/x/sys v0.0.0-20190507160741-ecd444e8653b h1:ag/x1USPSsqHud38I9BAC88qdNLDHHtQ4mlgQIZPPNA= -golang.org/x/sys v0.0.0-20190507160741-ecd444e8653b/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= diff --git a/vendor/github.com/Microsoft/go-winio/hvsock.go b/vendor/github.com/Microsoft/go-winio/hvsock.go deleted file mode 100644 index dbfe790ee..000000000 --- a/vendor/github.com/Microsoft/go-winio/hvsock.go +++ /dev/null @@ -1,305 +0,0 @@ -package winio - -import ( - "fmt" - "io" - "net" - "os" - "syscall" - "time" - "unsafe" - - "github.com/Microsoft/go-winio/pkg/guid" -) - -//sys bind(s syscall.Handle, name unsafe.Pointer, namelen int32) (err error) [failretval==socketError] = ws2_32.bind - -const ( - afHvSock = 34 // AF_HYPERV - - socketError = ^uintptr(0) -) - -// An HvsockAddr is an address for a AF_HYPERV socket. -type HvsockAddr struct { - VMID guid.GUID - ServiceID guid.GUID -} - -type rawHvsockAddr struct { - Family uint16 - _ uint16 - VMID guid.GUID - ServiceID guid.GUID -} - -// Network returns the address's network name, "hvsock". -func (addr *HvsockAddr) Network() string { - return "hvsock" -} - -func (addr *HvsockAddr) String() string { - return fmt.Sprintf("%s:%s", &addr.VMID, &addr.ServiceID) -} - -// VsockServiceID returns an hvsock service ID corresponding to the specified AF_VSOCK port. -func VsockServiceID(port uint32) guid.GUID { - g, _ := guid.FromString("00000000-facb-11e6-bd58-64006a7986d3") - g.Data1 = port - return g -} - -func (addr *HvsockAddr) raw() rawHvsockAddr { - return rawHvsockAddr{ - Family: afHvSock, - VMID: addr.VMID, - ServiceID: addr.ServiceID, - } -} - -func (addr *HvsockAddr) fromRaw(raw *rawHvsockAddr) { - addr.VMID = raw.VMID - addr.ServiceID = raw.ServiceID -} - -// HvsockListener is a socket listener for the AF_HYPERV address family. -type HvsockListener struct { - sock *win32File - addr HvsockAddr -} - -// HvsockConn is a connected socket of the AF_HYPERV address family. -type HvsockConn struct { - sock *win32File - local, remote HvsockAddr -} - -func newHvSocket() (*win32File, error) { - fd, err := syscall.Socket(afHvSock, syscall.SOCK_STREAM, 1) - if err != nil { - return nil, os.NewSyscallError("socket", err) - } - f, err := makeWin32File(fd) - if err != nil { - syscall.Close(fd) - return nil, err - } - f.socket = true - return f, nil -} - -// ListenHvsock listens for connections on the specified hvsock address. -func ListenHvsock(addr *HvsockAddr) (_ *HvsockListener, err error) { - l := &HvsockListener{addr: *addr} - sock, err := newHvSocket() - if err != nil { - return nil, l.opErr("listen", err) - } - sa := addr.raw() - err = bind(sock.handle, unsafe.Pointer(&sa), int32(unsafe.Sizeof(sa))) - if err != nil { - return nil, l.opErr("listen", os.NewSyscallError("socket", err)) - } - err = syscall.Listen(sock.handle, 16) - if err != nil { - return nil, l.opErr("listen", os.NewSyscallError("listen", err)) - } - return &HvsockListener{sock: sock, addr: *addr}, nil -} - -func (l *HvsockListener) opErr(op string, err error) error { - return &net.OpError{Op: op, Net: "hvsock", Addr: &l.addr, Err: err} -} - -// Addr returns the listener's network address. -func (l *HvsockListener) Addr() net.Addr { - return &l.addr -} - -// Accept waits for the next connection and returns it. -func (l *HvsockListener) Accept() (_ net.Conn, err error) { - sock, err := newHvSocket() - if err != nil { - return nil, l.opErr("accept", err) - } - defer func() { - if sock != nil { - sock.Close() - } - }() - c, err := l.sock.prepareIo() - if err != nil { - return nil, l.opErr("accept", err) - } - defer l.sock.wg.Done() - - // AcceptEx, per documentation, requires an extra 16 bytes per address. - const addrlen = uint32(16 + unsafe.Sizeof(rawHvsockAddr{})) - var addrbuf [addrlen * 2]byte - - var bytes uint32 - err = syscall.AcceptEx(l.sock.handle, sock.handle, &addrbuf[0], 0, addrlen, addrlen, &bytes, &c.o) - _, err = l.sock.asyncIo(c, nil, bytes, err) - if err != nil { - return nil, l.opErr("accept", os.NewSyscallError("acceptex", err)) - } - conn := &HvsockConn{ - sock: sock, - } - conn.local.fromRaw((*rawHvsockAddr)(unsafe.Pointer(&addrbuf[0]))) - conn.remote.fromRaw((*rawHvsockAddr)(unsafe.Pointer(&addrbuf[addrlen]))) - sock = nil - return conn, nil -} - -// Close closes the listener, causing any pending Accept calls to fail. -func (l *HvsockListener) Close() error { - return l.sock.Close() -} - -/* Need to finish ConnectEx handling -func DialHvsock(ctx context.Context, addr *HvsockAddr) (*HvsockConn, error) { - sock, err := newHvSocket() - if err != nil { - return nil, err - } - defer func() { - if sock != nil { - sock.Close() - } - }() - c, err := sock.prepareIo() - if err != nil { - return nil, err - } - defer sock.wg.Done() - var bytes uint32 - err = windows.ConnectEx(windows.Handle(sock.handle), sa, nil, 0, &bytes, &c.o) - _, err = sock.asyncIo(ctx, c, nil, bytes, err) - if err != nil { - return nil, err - } - conn := &HvsockConn{ - sock: sock, - remote: *addr, - } - sock = nil - return conn, nil -} -*/ - -func (conn *HvsockConn) opErr(op string, err error) error { - return &net.OpError{Op: op, Net: "hvsock", Source: &conn.local, Addr: &conn.remote, Err: err} -} - -func (conn *HvsockConn) Read(b []byte) (int, error) { - c, err := conn.sock.prepareIo() - if err != nil { - return 0, conn.opErr("read", err) - } - defer conn.sock.wg.Done() - buf := syscall.WSABuf{Buf: &b[0], Len: uint32(len(b))} - var flags, bytes uint32 - err = syscall.WSARecv(conn.sock.handle, &buf, 1, &bytes, &flags, &c.o, nil) - n, err := conn.sock.asyncIo(c, &conn.sock.readDeadline, bytes, err) - if err != nil { - if _, ok := err.(syscall.Errno); ok { - err = os.NewSyscallError("wsarecv", err) - } - return 0, conn.opErr("read", err) - } else if n == 0 { - err = io.EOF - } - return n, err -} - -func (conn *HvsockConn) Write(b []byte) (int, error) { - t := 0 - for len(b) != 0 { - n, err := conn.write(b) - if err != nil { - return t + n, err - } - t += n - b = b[n:] - } - return t, nil -} - -func (conn *HvsockConn) write(b []byte) (int, error) { - c, err := conn.sock.prepareIo() - if err != nil { - return 0, conn.opErr("write", err) - } - defer conn.sock.wg.Done() - buf := syscall.WSABuf{Buf: &b[0], Len: uint32(len(b))} - var bytes uint32 - err = syscall.WSASend(conn.sock.handle, &buf, 1, &bytes, 0, &c.o, nil) - n, err := conn.sock.asyncIo(c, &conn.sock.writeDeadline, bytes, err) - if err != nil { - if _, ok := err.(syscall.Errno); ok { - err = os.NewSyscallError("wsasend", err) - } - return 0, conn.opErr("write", err) - } - return n, err -} - -// Close closes the socket connection, failing any pending read or write calls. -func (conn *HvsockConn) Close() error { - return conn.sock.Close() -} - -func (conn *HvsockConn) shutdown(how int) error { - err := syscall.Shutdown(conn.sock.handle, syscall.SHUT_RD) - if err != nil { - return os.NewSyscallError("shutdown", err) - } - return nil -} - -// CloseRead shuts down the read end of the socket. -func (conn *HvsockConn) CloseRead() error { - err := conn.shutdown(syscall.SHUT_RD) - if err != nil { - return conn.opErr("close", err) - } - return nil -} - -// CloseWrite shuts down the write end of the socket, notifying the other endpoint that -// no more data will be written. -func (conn *HvsockConn) CloseWrite() error { - err := conn.shutdown(syscall.SHUT_WR) - if err != nil { - return conn.opErr("close", err) - } - return nil -} - -// LocalAddr returns the local address of the connection. -func (conn *HvsockConn) LocalAddr() net.Addr { - return &conn.local -} - -// RemoteAddr returns the remote address of the connection. -func (conn *HvsockConn) RemoteAddr() net.Addr { - return &conn.remote -} - -// SetDeadline implements the net.Conn SetDeadline method. -func (conn *HvsockConn) SetDeadline(t time.Time) error { - conn.SetReadDeadline(t) - conn.SetWriteDeadline(t) - return nil -} - -// SetReadDeadline implements the net.Conn SetReadDeadline method. -func (conn *HvsockConn) SetReadDeadline(t time.Time) error { - return conn.sock.SetReadDeadline(t) -} - -// SetWriteDeadline implements the net.Conn SetWriteDeadline method. -func (conn *HvsockConn) SetWriteDeadline(t time.Time) error { - return conn.sock.SetWriteDeadline(t) -} diff --git a/vendor/github.com/Microsoft/go-winio/pipe.go b/vendor/github.com/Microsoft/go-winio/pipe.go deleted file mode 100644 index d6a46f6a2..000000000 --- a/vendor/github.com/Microsoft/go-winio/pipe.go +++ /dev/null @@ -1,510 +0,0 @@ -// +build windows - -package winio - -import ( - "context" - "errors" - "fmt" - "io" - "net" - "os" - "runtime" - "syscall" - "time" - "unsafe" -) - -//sys connectNamedPipe(pipe syscall.Handle, o *syscall.Overlapped) (err error) = ConnectNamedPipe -//sys createNamedPipe(name string, flags uint32, pipeMode uint32, maxInstances uint32, outSize uint32, inSize uint32, defaultTimeout uint32, sa *syscall.SecurityAttributes) (handle syscall.Handle, err error) [failretval==syscall.InvalidHandle] = CreateNamedPipeW -//sys createFile(name string, access uint32, mode uint32, sa *syscall.SecurityAttributes, createmode uint32, attrs uint32, templatefile syscall.Handle) (handle syscall.Handle, err error) [failretval==syscall.InvalidHandle] = CreateFileW -//sys getNamedPipeInfo(pipe syscall.Handle, flags *uint32, outSize *uint32, inSize *uint32, maxInstances *uint32) (err error) = GetNamedPipeInfo -//sys getNamedPipeHandleState(pipe syscall.Handle, state *uint32, curInstances *uint32, maxCollectionCount *uint32, collectDataTimeout *uint32, userName *uint16, maxUserNameSize uint32) (err error) = GetNamedPipeHandleStateW -//sys localAlloc(uFlags uint32, length uint32) (ptr uintptr) = LocalAlloc -//sys ntCreateNamedPipeFile(pipe *syscall.Handle, access uint32, oa *objectAttributes, iosb *ioStatusBlock, share uint32, disposition uint32, options uint32, typ uint32, readMode uint32, completionMode uint32, maxInstances uint32, inboundQuota uint32, outputQuota uint32, timeout *int64) (status ntstatus) = ntdll.NtCreateNamedPipeFile -//sys rtlNtStatusToDosError(status ntstatus) (winerr error) = ntdll.RtlNtStatusToDosErrorNoTeb -//sys rtlDosPathNameToNtPathName(name *uint16, ntName *unicodeString, filePart uintptr, reserved uintptr) (status ntstatus) = ntdll.RtlDosPathNameToNtPathName_U -//sys rtlDefaultNpAcl(dacl *uintptr) (status ntstatus) = ntdll.RtlDefaultNpAcl - -type ioStatusBlock struct { - Status, Information uintptr -} - -type objectAttributes struct { - Length uintptr - RootDirectory uintptr - ObjectName *unicodeString - Attributes uintptr - SecurityDescriptor *securityDescriptor - SecurityQoS uintptr -} - -type unicodeString struct { - Length uint16 - MaximumLength uint16 - Buffer uintptr -} - -type securityDescriptor struct { - Revision byte - Sbz1 byte - Control uint16 - Owner uintptr - Group uintptr - Sacl uintptr - Dacl uintptr -} - -type ntstatus int32 - -func (status ntstatus) Err() error { - if status >= 0 { - return nil - } - return rtlNtStatusToDosError(status) -} - -const ( - cERROR_PIPE_BUSY = syscall.Errno(231) - cERROR_NO_DATA = syscall.Errno(232) - cERROR_PIPE_CONNECTED = syscall.Errno(535) - cERROR_SEM_TIMEOUT = syscall.Errno(121) - - cSECURITY_SQOS_PRESENT = 0x100000 - cSECURITY_ANONYMOUS = 0 - - cPIPE_TYPE_MESSAGE = 4 - - cPIPE_READMODE_MESSAGE = 2 - - cFILE_OPEN = 1 - cFILE_CREATE = 2 - - cFILE_PIPE_MESSAGE_TYPE = 1 - cFILE_PIPE_REJECT_REMOTE_CLIENTS = 2 - - cSE_DACL_PRESENT = 4 -) - -var ( - // ErrPipeListenerClosed is returned for pipe operations on listeners that have been closed. - // This error should match net.errClosing since docker takes a dependency on its text. - ErrPipeListenerClosed = errors.New("use of closed network connection") - - errPipeWriteClosed = errors.New("pipe has been closed for write") -) - -type win32Pipe struct { - *win32File - path string -} - -type win32MessageBytePipe struct { - win32Pipe - writeClosed bool - readEOF bool -} - -type pipeAddress string - -func (f *win32Pipe) LocalAddr() net.Addr { - return pipeAddress(f.path) -} - -func (f *win32Pipe) RemoteAddr() net.Addr { - return pipeAddress(f.path) -} - -func (f *win32Pipe) SetDeadline(t time.Time) error { - f.SetReadDeadline(t) - f.SetWriteDeadline(t) - return nil -} - -// CloseWrite closes the write side of a message pipe in byte mode. -func (f *win32MessageBytePipe) CloseWrite() error { - if f.writeClosed { - return errPipeWriteClosed - } - err := f.win32File.Flush() - if err != nil { - return err - } - _, err = f.win32File.Write(nil) - if err != nil { - return err - } - f.writeClosed = true - return nil -} - -// Write writes bytes to a message pipe in byte mode. Zero-byte writes are ignored, since -// they are used to implement CloseWrite(). -func (f *win32MessageBytePipe) Write(b []byte) (int, error) { - if f.writeClosed { - return 0, errPipeWriteClosed - } - if len(b) == 0 { - return 0, nil - } - return f.win32File.Write(b) -} - -// Read reads bytes from a message pipe in byte mode. A read of a zero-byte message on a message -// mode pipe will return io.EOF, as will all subsequent reads. -func (f *win32MessageBytePipe) Read(b []byte) (int, error) { - if f.readEOF { - return 0, io.EOF - } - n, err := f.win32File.Read(b) - if err == io.EOF { - // If this was the result of a zero-byte read, then - // it is possible that the read was due to a zero-size - // message. Since we are simulating CloseWrite with a - // zero-byte message, ensure that all future Read() calls - // also return EOF. - f.readEOF = true - } else if err == syscall.ERROR_MORE_DATA { - // ERROR_MORE_DATA indicates that the pipe's read mode is message mode - // and the message still has more bytes. Treat this as a success, since - // this package presents all named pipes as byte streams. - err = nil - } - return n, err -} - -func (s pipeAddress) Network() string { - return "pipe" -} - -func (s pipeAddress) String() string { - return string(s) -} - -// tryDialPipe attempts to dial the pipe at `path` until `ctx` cancellation or timeout. -func tryDialPipe(ctx context.Context, path *string) (syscall.Handle, error) { - for { - select { - case <-ctx.Done(): - return syscall.Handle(0), ctx.Err() - default: - h, err := createFile(*path, syscall.GENERIC_READ|syscall.GENERIC_WRITE, 0, nil, syscall.OPEN_EXISTING, syscall.FILE_FLAG_OVERLAPPED|cSECURITY_SQOS_PRESENT|cSECURITY_ANONYMOUS, 0) - if err == nil { - return h, nil - } - if err != cERROR_PIPE_BUSY { - return h, &os.PathError{Err: err, Op: "open", Path: *path} - } - // Wait 10 msec and try again. This is a rather simplistic - // view, as we always try each 10 milliseconds. - time.Sleep(time.Millisecond * 10) - } - } -} - -// DialPipe connects to a named pipe by path, timing out if the connection -// takes longer than the specified duration. If timeout is nil, then we use -// a default timeout of 2 seconds. (We do not use WaitNamedPipe.) -func DialPipe(path string, timeout *time.Duration) (net.Conn, error) { - var absTimeout time.Time - if timeout != nil { - absTimeout = time.Now().Add(*timeout) - } else { - absTimeout = time.Now().Add(time.Second * 2) - } - ctx, _ := context.WithDeadline(context.Background(), absTimeout) - conn, err := DialPipeContext(ctx, path) - if err == context.DeadlineExceeded { - return nil, ErrTimeout - } - return conn, err -} - -// DialPipeContext attempts to connect to a named pipe by `path` until `ctx` -// cancellation or timeout. -func DialPipeContext(ctx context.Context, path string) (net.Conn, error) { - var err error - var h syscall.Handle - h, err = tryDialPipe(ctx, &path) - if err != nil { - return nil, err - } - - var flags uint32 - err = getNamedPipeInfo(h, &flags, nil, nil, nil) - if err != nil { - return nil, err - } - - f, err := makeWin32File(h) - if err != nil { - syscall.Close(h) - return nil, err - } - - // If the pipe is in message mode, return a message byte pipe, which - // supports CloseWrite(). - if flags&cPIPE_TYPE_MESSAGE != 0 { - return &win32MessageBytePipe{ - win32Pipe: win32Pipe{win32File: f, path: path}, - }, nil - } - return &win32Pipe{win32File: f, path: path}, nil -} - -type acceptResponse struct { - f *win32File - err error -} - -type win32PipeListener struct { - firstHandle syscall.Handle - path string - config PipeConfig - acceptCh chan (chan acceptResponse) - closeCh chan int - doneCh chan int -} - -func makeServerPipeHandle(path string, sd []byte, c *PipeConfig, first bool) (syscall.Handle, error) { - path16, err := syscall.UTF16FromString(path) - if err != nil { - return 0, &os.PathError{Op: "open", Path: path, Err: err} - } - - var oa objectAttributes - oa.Length = unsafe.Sizeof(oa) - - var ntPath unicodeString - if err := rtlDosPathNameToNtPathName(&path16[0], &ntPath, 0, 0).Err(); err != nil { - return 0, &os.PathError{Op: "open", Path: path, Err: err} - } - defer localFree(ntPath.Buffer) - oa.ObjectName = &ntPath - - // The security descriptor is only needed for the first pipe. - if first { - if sd != nil { - len := uint32(len(sd)) - sdb := localAlloc(0, len) - defer localFree(sdb) - copy((*[0xffff]byte)(unsafe.Pointer(sdb))[:], sd) - oa.SecurityDescriptor = (*securityDescriptor)(unsafe.Pointer(sdb)) - } else { - // Construct the default named pipe security descriptor. - var dacl uintptr - if err := rtlDefaultNpAcl(&dacl).Err(); err != nil { - return 0, fmt.Errorf("getting default named pipe ACL: %s", err) - } - defer localFree(dacl) - - sdb := &securityDescriptor{ - Revision: 1, - Control: cSE_DACL_PRESENT, - Dacl: dacl, - } - oa.SecurityDescriptor = sdb - } - } - - typ := uint32(cFILE_PIPE_REJECT_REMOTE_CLIENTS) - if c.MessageMode { - typ |= cFILE_PIPE_MESSAGE_TYPE - } - - disposition := uint32(cFILE_OPEN) - access := uint32(syscall.GENERIC_READ | syscall.GENERIC_WRITE | syscall.SYNCHRONIZE) - if first { - disposition = cFILE_CREATE - // By not asking for read or write access, the named pipe file system - // will put this pipe into an initially disconnected state, blocking - // client connections until the next call with first == false. - access = syscall.SYNCHRONIZE - } - - timeout := int64(-50 * 10000) // 50ms - - var ( - h syscall.Handle - iosb ioStatusBlock - ) - err = ntCreateNamedPipeFile(&h, access, &oa, &iosb, syscall.FILE_SHARE_READ|syscall.FILE_SHARE_WRITE, disposition, 0, typ, 0, 0, 0xffffffff, uint32(c.InputBufferSize), uint32(c.OutputBufferSize), &timeout).Err() - if err != nil { - return 0, &os.PathError{Op: "open", Path: path, Err: err} - } - - runtime.KeepAlive(ntPath) - return h, nil -} - -func (l *win32PipeListener) makeServerPipe() (*win32File, error) { - h, err := makeServerPipeHandle(l.path, nil, &l.config, false) - if err != nil { - return nil, err - } - f, err := makeWin32File(h) - if err != nil { - syscall.Close(h) - return nil, err - } - return f, nil -} - -func (l *win32PipeListener) makeConnectedServerPipe() (*win32File, error) { - p, err := l.makeServerPipe() - if err != nil { - return nil, err - } - - // Wait for the client to connect. - ch := make(chan error) - go func(p *win32File) { - ch <- connectPipe(p) - }(p) - - select { - case err = <-ch: - if err != nil { - p.Close() - p = nil - } - case <-l.closeCh: - // Abort the connect request by closing the handle. - p.Close() - p = nil - err = <-ch - if err == nil || err == ErrFileClosed { - err = ErrPipeListenerClosed - } - } - return p, err -} - -func (l *win32PipeListener) listenerRoutine() { - closed := false - for !closed { - select { - case <-l.closeCh: - closed = true - case responseCh := <-l.acceptCh: - var ( - p *win32File - err error - ) - for { - p, err = l.makeConnectedServerPipe() - // If the connection was immediately closed by the client, try - // again. - if err != cERROR_NO_DATA { - break - } - } - responseCh <- acceptResponse{p, err} - closed = err == ErrPipeListenerClosed - } - } - syscall.Close(l.firstHandle) - l.firstHandle = 0 - // Notify Close() and Accept() callers that the handle has been closed. - close(l.doneCh) -} - -// PipeConfig contain configuration for the pipe listener. -type PipeConfig struct { - // SecurityDescriptor contains a Windows security descriptor in SDDL format. - SecurityDescriptor string - - // MessageMode determines whether the pipe is in byte or message mode. In either - // case the pipe is read in byte mode by default. The only practical difference in - // this implementation is that CloseWrite() is only supported for message mode pipes; - // CloseWrite() is implemented as a zero-byte write, but zero-byte writes are only - // transferred to the reader (and returned as io.EOF in this implementation) - // when the pipe is in message mode. - MessageMode bool - - // InputBufferSize specifies the size the input buffer, in bytes. - InputBufferSize int32 - - // OutputBufferSize specifies the size the input buffer, in bytes. - OutputBufferSize int32 -} - -// ListenPipe creates a listener on a Windows named pipe path, e.g. \\.\pipe\mypipe. -// The pipe must not already exist. -func ListenPipe(path string, c *PipeConfig) (net.Listener, error) { - var ( - sd []byte - err error - ) - if c == nil { - c = &PipeConfig{} - } - if c.SecurityDescriptor != "" { - sd, err = SddlToSecurityDescriptor(c.SecurityDescriptor) - if err != nil { - return nil, err - } - } - h, err := makeServerPipeHandle(path, sd, c, true) - if err != nil { - return nil, err - } - l := &win32PipeListener{ - firstHandle: h, - path: path, - config: *c, - acceptCh: make(chan (chan acceptResponse)), - closeCh: make(chan int), - doneCh: make(chan int), - } - go l.listenerRoutine() - return l, nil -} - -func connectPipe(p *win32File) error { - c, err := p.prepareIo() - if err != nil { - return err - } - defer p.wg.Done() - - err = connectNamedPipe(p.handle, &c.o) - _, err = p.asyncIo(c, nil, 0, err) - if err != nil && err != cERROR_PIPE_CONNECTED { - return err - } - return nil -} - -func (l *win32PipeListener) Accept() (net.Conn, error) { - ch := make(chan acceptResponse) - select { - case l.acceptCh <- ch: - response := <-ch - err := response.err - if err != nil { - return nil, err - } - if l.config.MessageMode { - return &win32MessageBytePipe{ - win32Pipe: win32Pipe{win32File: response.f, path: l.path}, - }, nil - } - return &win32Pipe{win32File: response.f, path: l.path}, nil - case <-l.doneCh: - return nil, ErrPipeListenerClosed - } -} - -func (l *win32PipeListener) Close() error { - select { - case l.closeCh <- 1: - <-l.doneCh - case <-l.doneCh: - } - return nil -} - -func (l *win32PipeListener) Addr() net.Addr { - return pipeAddress(l.path) -} diff --git a/vendor/github.com/Microsoft/go-winio/pkg/guid/guid.go b/vendor/github.com/Microsoft/go-winio/pkg/guid/guid.go deleted file mode 100644 index 586406577..000000000 --- a/vendor/github.com/Microsoft/go-winio/pkg/guid/guid.go +++ /dev/null @@ -1,235 +0,0 @@ -// Package guid provides a GUID type. The backing structure for a GUID is -// identical to that used by the golang.org/x/sys/windows GUID type. -// There are two main binary encodings used for a GUID, the big-endian encoding, -// and the Windows (mixed-endian) encoding. See here for details: -// https://en.wikipedia.org/wiki/Universally_unique_identifier#Encoding -package guid - -import ( - "crypto/rand" - "crypto/sha1" - "encoding" - "encoding/binary" - "fmt" - "strconv" - - "golang.org/x/sys/windows" -) - -// Variant specifies which GUID variant (or "type") of the GUID. It determines -// how the entirety of the rest of the GUID is interpreted. -type Variant uint8 - -// The variants specified by RFC 4122. -const ( - // VariantUnknown specifies a GUID variant which does not conform to one of - // the variant encodings specified in RFC 4122. - VariantUnknown Variant = iota - VariantNCS - VariantRFC4122 - VariantMicrosoft - VariantFuture -) - -// Version specifies how the bits in the GUID were generated. For instance, a -// version 4 GUID is randomly generated, and a version 5 is generated from the -// hash of an input string. -type Version uint8 - -var _ = (encoding.TextMarshaler)(GUID{}) -var _ = (encoding.TextUnmarshaler)(&GUID{}) - -// GUID represents a GUID/UUID. It has the same structure as -// golang.org/x/sys/windows.GUID so that it can be used with functions expecting -// that type. It is defined as its own type so that stringification and -// marshaling can be supported. The representation matches that used by native -// Windows code. -type GUID windows.GUID - -// NewV4 returns a new version 4 (pseudorandom) GUID, as defined by RFC 4122. -func NewV4() (GUID, error) { - var b [16]byte - if _, err := rand.Read(b[:]); err != nil { - return GUID{}, err - } - - g := FromArray(b) - g.setVersion(4) // Version 4 means randomly generated. - g.setVariant(VariantRFC4122) - - return g, nil -} - -// NewV5 returns a new version 5 (generated from a string via SHA-1 hashing) -// GUID, as defined by RFC 4122. The RFC is unclear on the encoding of the name, -// and the sample code treats it as a series of bytes, so we do the same here. -// -// Some implementations, such as those found on Windows, treat the name as a -// big-endian UTF16 stream of bytes. If that is desired, the string can be -// encoded as such before being passed to this function. -func NewV5(namespace GUID, name []byte) (GUID, error) { - b := sha1.New() - namespaceBytes := namespace.ToArray() - b.Write(namespaceBytes[:]) - b.Write(name) - - a := [16]byte{} - copy(a[:], b.Sum(nil)) - - g := FromArray(a) - g.setVersion(5) // Version 5 means generated from a string. - g.setVariant(VariantRFC4122) - - return g, nil -} - -func fromArray(b [16]byte, order binary.ByteOrder) GUID { - var g GUID - g.Data1 = order.Uint32(b[0:4]) - g.Data2 = order.Uint16(b[4:6]) - g.Data3 = order.Uint16(b[6:8]) - copy(g.Data4[:], b[8:16]) - return g -} - -func (g GUID) toArray(order binary.ByteOrder) [16]byte { - b := [16]byte{} - order.PutUint32(b[0:4], g.Data1) - order.PutUint16(b[4:6], g.Data2) - order.PutUint16(b[6:8], g.Data3) - copy(b[8:16], g.Data4[:]) - return b -} - -// FromArray constructs a GUID from a big-endian encoding array of 16 bytes. -func FromArray(b [16]byte) GUID { - return fromArray(b, binary.BigEndian) -} - -// ToArray returns an array of 16 bytes representing the GUID in big-endian -// encoding. -func (g GUID) ToArray() [16]byte { - return g.toArray(binary.BigEndian) -} - -// FromWindowsArray constructs a GUID from a Windows encoding array of bytes. -func FromWindowsArray(b [16]byte) GUID { - return fromArray(b, binary.LittleEndian) -} - -// ToWindowsArray returns an array of 16 bytes representing the GUID in Windows -// encoding. -func (g GUID) ToWindowsArray() [16]byte { - return g.toArray(binary.LittleEndian) -} - -func (g GUID) String() string { - return fmt.Sprintf( - "%08x-%04x-%04x-%04x-%012x", - g.Data1, - g.Data2, - g.Data3, - g.Data4[:2], - g.Data4[2:]) -} - -// FromString parses a string containing a GUID and returns the GUID. The only -// format currently supported is the `xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx` -// format. -func FromString(s string) (GUID, error) { - if len(s) != 36 { - return GUID{}, fmt.Errorf("invalid GUID %q", s) - } - if s[8] != '-' || s[13] != '-' || s[18] != '-' || s[23] != '-' { - return GUID{}, fmt.Errorf("invalid GUID %q", s) - } - - var g GUID - - data1, err := strconv.ParseUint(s[0:8], 16, 32) - if err != nil { - return GUID{}, fmt.Errorf("invalid GUID %q", s) - } - g.Data1 = uint32(data1) - - data2, err := strconv.ParseUint(s[9:13], 16, 16) - if err != nil { - return GUID{}, fmt.Errorf("invalid GUID %q", s) - } - g.Data2 = uint16(data2) - - data3, err := strconv.ParseUint(s[14:18], 16, 16) - if err != nil { - return GUID{}, fmt.Errorf("invalid GUID %q", s) - } - g.Data3 = uint16(data3) - - for i, x := range []int{19, 21, 24, 26, 28, 30, 32, 34} { - v, err := strconv.ParseUint(s[x:x+2], 16, 8) - if err != nil { - return GUID{}, fmt.Errorf("invalid GUID %q", s) - } - g.Data4[i] = uint8(v) - } - - return g, nil -} - -func (g *GUID) setVariant(v Variant) { - d := g.Data4[0] - switch v { - case VariantNCS: - d = (d & 0x7f) - case VariantRFC4122: - d = (d & 0x3f) | 0x80 - case VariantMicrosoft: - d = (d & 0x1f) | 0xc0 - case VariantFuture: - d = (d & 0x0f) | 0xe0 - case VariantUnknown: - fallthrough - default: - panic(fmt.Sprintf("invalid variant: %d", v)) - } - g.Data4[0] = d -} - -// Variant returns the GUID variant, as defined in RFC 4122. -func (g GUID) Variant() Variant { - b := g.Data4[0] - if b&0x80 == 0 { - return VariantNCS - } else if b&0xc0 == 0x80 { - return VariantRFC4122 - } else if b&0xe0 == 0xc0 { - return VariantMicrosoft - } else if b&0xe0 == 0xe0 { - return VariantFuture - } - return VariantUnknown -} - -func (g *GUID) setVersion(v Version) { - g.Data3 = (g.Data3 & 0x0fff) | (uint16(v) << 12) -} - -// Version returns the GUID version, as defined in RFC 4122. -func (g GUID) Version() Version { - return Version((g.Data3 & 0xF000) >> 12) -} - -// MarshalText returns the textual representation of the GUID. -func (g GUID) MarshalText() ([]byte, error) { - return []byte(g.String()), nil -} - -// UnmarshalText takes the textual representation of a GUID, and unmarhals it -// into this GUID. -func (g *GUID) UnmarshalText(text []byte) error { - g2, err := FromString(string(text)) - if err != nil { - return err - } - *g = g2 - return nil -} diff --git a/vendor/github.com/Microsoft/go-winio/privilege.go b/vendor/github.com/Microsoft/go-winio/privilege.go deleted file mode 100644 index 9c83d36fe..000000000 --- a/vendor/github.com/Microsoft/go-winio/privilege.go +++ /dev/null @@ -1,202 +0,0 @@ -// +build windows - -package winio - -import ( - "bytes" - "encoding/binary" - "fmt" - "runtime" - "sync" - "syscall" - "unicode/utf16" - - "golang.org/x/sys/windows" -) - -//sys adjustTokenPrivileges(token windows.Token, releaseAll bool, input *byte, outputSize uint32, output *byte, requiredSize *uint32) (success bool, err error) [true] = advapi32.AdjustTokenPrivileges -//sys impersonateSelf(level uint32) (err error) = advapi32.ImpersonateSelf -//sys revertToSelf() (err error) = advapi32.RevertToSelf -//sys openThreadToken(thread syscall.Handle, accessMask uint32, openAsSelf bool, token *windows.Token) (err error) = advapi32.OpenThreadToken -//sys getCurrentThread() (h syscall.Handle) = GetCurrentThread -//sys lookupPrivilegeValue(systemName string, name string, luid *uint64) (err error) = advapi32.LookupPrivilegeValueW -//sys lookupPrivilegeName(systemName string, luid *uint64, buffer *uint16, size *uint32) (err error) = advapi32.LookupPrivilegeNameW -//sys lookupPrivilegeDisplayName(systemName string, name *uint16, buffer *uint16, size *uint32, languageId *uint32) (err error) = advapi32.LookupPrivilegeDisplayNameW - -const ( - SE_PRIVILEGE_ENABLED = 2 - - ERROR_NOT_ALL_ASSIGNED syscall.Errno = 1300 - - SeBackupPrivilege = "SeBackupPrivilege" - SeRestorePrivilege = "SeRestorePrivilege" -) - -const ( - securityAnonymous = iota - securityIdentification - securityImpersonation - securityDelegation -) - -var ( - privNames = make(map[string]uint64) - privNameMutex sync.Mutex -) - -// PrivilegeError represents an error enabling privileges. -type PrivilegeError struct { - privileges []uint64 -} - -func (e *PrivilegeError) Error() string { - s := "" - if len(e.privileges) > 1 { - s = "Could not enable privileges " - } else { - s = "Could not enable privilege " - } - for i, p := range e.privileges { - if i != 0 { - s += ", " - } - s += `"` - s += getPrivilegeName(p) - s += `"` - } - return s -} - -// RunWithPrivilege enables a single privilege for a function call. -func RunWithPrivilege(name string, fn func() error) error { - return RunWithPrivileges([]string{name}, fn) -} - -// RunWithPrivileges enables privileges for a function call. -func RunWithPrivileges(names []string, fn func() error) error { - privileges, err := mapPrivileges(names) - if err != nil { - return err - } - runtime.LockOSThread() - defer runtime.UnlockOSThread() - token, err := newThreadToken() - if err != nil { - return err - } - defer releaseThreadToken(token) - err = adjustPrivileges(token, privileges, SE_PRIVILEGE_ENABLED) - if err != nil { - return err - } - return fn() -} - -func mapPrivileges(names []string) ([]uint64, error) { - var privileges []uint64 - privNameMutex.Lock() - defer privNameMutex.Unlock() - for _, name := range names { - p, ok := privNames[name] - if !ok { - err := lookupPrivilegeValue("", name, &p) - if err != nil { - return nil, err - } - privNames[name] = p - } - privileges = append(privileges, p) - } - return privileges, nil -} - -// EnableProcessPrivileges enables privileges globally for the process. -func EnableProcessPrivileges(names []string) error { - return enableDisableProcessPrivilege(names, SE_PRIVILEGE_ENABLED) -} - -// DisableProcessPrivileges disables privileges globally for the process. -func DisableProcessPrivileges(names []string) error { - return enableDisableProcessPrivilege(names, 0) -} - -func enableDisableProcessPrivilege(names []string, action uint32) error { - privileges, err := mapPrivileges(names) - if err != nil { - return err - } - - p, _ := windows.GetCurrentProcess() - var token windows.Token - err = windows.OpenProcessToken(p, windows.TOKEN_ADJUST_PRIVILEGES|windows.TOKEN_QUERY, &token) - if err != nil { - return err - } - - defer token.Close() - return adjustPrivileges(token, privileges, action) -} - -func adjustPrivileges(token windows.Token, privileges []uint64, action uint32) error { - var b bytes.Buffer - binary.Write(&b, binary.LittleEndian, uint32(len(privileges))) - for _, p := range privileges { - binary.Write(&b, binary.LittleEndian, p) - binary.Write(&b, binary.LittleEndian, action) - } - prevState := make([]byte, b.Len()) - reqSize := uint32(0) - success, err := adjustTokenPrivileges(token, false, &b.Bytes()[0], uint32(len(prevState)), &prevState[0], &reqSize) - if !success { - return err - } - if err == ERROR_NOT_ALL_ASSIGNED { - return &PrivilegeError{privileges} - } - return nil -} - -func getPrivilegeName(luid uint64) string { - var nameBuffer [256]uint16 - bufSize := uint32(len(nameBuffer)) - err := lookupPrivilegeName("", &luid, &nameBuffer[0], &bufSize) - if err != nil { - return fmt.Sprintf("", luid) - } - - var displayNameBuffer [256]uint16 - displayBufSize := uint32(len(displayNameBuffer)) - var langID uint32 - err = lookupPrivilegeDisplayName("", &nameBuffer[0], &displayNameBuffer[0], &displayBufSize, &langID) - if err != nil { - return fmt.Sprintf("", string(utf16.Decode(nameBuffer[:bufSize]))) - } - - return string(utf16.Decode(displayNameBuffer[:displayBufSize])) -} - -func newThreadToken() (windows.Token, error) { - err := impersonateSelf(securityImpersonation) - if err != nil { - return 0, err - } - - var token windows.Token - err = openThreadToken(getCurrentThread(), syscall.TOKEN_ADJUST_PRIVILEGES|syscall.TOKEN_QUERY, false, &token) - if err != nil { - rerr := revertToSelf() - if rerr != nil { - panic(rerr) - } - return 0, err - } - return token, nil -} - -func releaseThreadToken(h windows.Token) { - err := revertToSelf() - if err != nil { - panic(err) - } - h.Close() -} diff --git a/vendor/github.com/Microsoft/go-winio/reparse.go b/vendor/github.com/Microsoft/go-winio/reparse.go deleted file mode 100644 index fc1ee4d3a..000000000 --- a/vendor/github.com/Microsoft/go-winio/reparse.go +++ /dev/null @@ -1,128 +0,0 @@ -package winio - -import ( - "bytes" - "encoding/binary" - "fmt" - "strings" - "unicode/utf16" - "unsafe" -) - -const ( - reparseTagMountPoint = 0xA0000003 - reparseTagSymlink = 0xA000000C -) - -type reparseDataBuffer struct { - ReparseTag uint32 - ReparseDataLength uint16 - Reserved uint16 - SubstituteNameOffset uint16 - SubstituteNameLength uint16 - PrintNameOffset uint16 - PrintNameLength uint16 -} - -// ReparsePoint describes a Win32 symlink or mount point. -type ReparsePoint struct { - Target string - IsMountPoint bool -} - -// UnsupportedReparsePointError is returned when trying to decode a non-symlink or -// mount point reparse point. -type UnsupportedReparsePointError struct { - Tag uint32 -} - -func (e *UnsupportedReparsePointError) Error() string { - return fmt.Sprintf("unsupported reparse point %x", e.Tag) -} - -// DecodeReparsePoint decodes a Win32 REPARSE_DATA_BUFFER structure containing either a symlink -// or a mount point. -func DecodeReparsePoint(b []byte) (*ReparsePoint, error) { - tag := binary.LittleEndian.Uint32(b[0:4]) - return DecodeReparsePointData(tag, b[8:]) -} - -func DecodeReparsePointData(tag uint32, b []byte) (*ReparsePoint, error) { - isMountPoint := false - switch tag { - case reparseTagMountPoint: - isMountPoint = true - case reparseTagSymlink: - default: - return nil, &UnsupportedReparsePointError{tag} - } - nameOffset := 8 + binary.LittleEndian.Uint16(b[4:6]) - if !isMountPoint { - nameOffset += 4 - } - nameLength := binary.LittleEndian.Uint16(b[6:8]) - name := make([]uint16, nameLength/2) - err := binary.Read(bytes.NewReader(b[nameOffset:nameOffset+nameLength]), binary.LittleEndian, &name) - if err != nil { - return nil, err - } - return &ReparsePoint{string(utf16.Decode(name)), isMountPoint}, nil -} - -func isDriveLetter(c byte) bool { - return (c >= 'a' && c <= 'z') || (c >= 'A' && c <= 'Z') -} - -// EncodeReparsePoint encodes a Win32 REPARSE_DATA_BUFFER structure describing a symlink or -// mount point. -func EncodeReparsePoint(rp *ReparsePoint) []byte { - // Generate an NT path and determine if this is a relative path. - var ntTarget string - relative := false - if strings.HasPrefix(rp.Target, `\\?\`) { - ntTarget = `\??\` + rp.Target[4:] - } else if strings.HasPrefix(rp.Target, `\\`) { - ntTarget = `\??\UNC\` + rp.Target[2:] - } else if len(rp.Target) >= 2 && isDriveLetter(rp.Target[0]) && rp.Target[1] == ':' { - ntTarget = `\??\` + rp.Target - } else { - ntTarget = rp.Target - relative = true - } - - // The paths must be NUL-terminated even though they are counted strings. - target16 := utf16.Encode([]rune(rp.Target + "\x00")) - ntTarget16 := utf16.Encode([]rune(ntTarget + "\x00")) - - size := int(unsafe.Sizeof(reparseDataBuffer{})) - 8 - size += len(ntTarget16)*2 + len(target16)*2 - - tag := uint32(reparseTagMountPoint) - if !rp.IsMountPoint { - tag = reparseTagSymlink - size += 4 // Add room for symlink flags - } - - data := reparseDataBuffer{ - ReparseTag: tag, - ReparseDataLength: uint16(size), - SubstituteNameOffset: 0, - SubstituteNameLength: uint16((len(ntTarget16) - 1) * 2), - PrintNameOffset: uint16(len(ntTarget16) * 2), - PrintNameLength: uint16((len(target16) - 1) * 2), - } - - var b bytes.Buffer - binary.Write(&b, binary.LittleEndian, &data) - if !rp.IsMountPoint { - flags := uint32(0) - if relative { - flags |= 1 - } - binary.Write(&b, binary.LittleEndian, flags) - } - - binary.Write(&b, binary.LittleEndian, ntTarget16) - binary.Write(&b, binary.LittleEndian, target16) - return b.Bytes() -} diff --git a/vendor/github.com/Microsoft/go-winio/sd.go b/vendor/github.com/Microsoft/go-winio/sd.go deleted file mode 100644 index db1b370a1..000000000 --- a/vendor/github.com/Microsoft/go-winio/sd.go +++ /dev/null @@ -1,98 +0,0 @@ -// +build windows - -package winio - -import ( - "syscall" - "unsafe" -) - -//sys lookupAccountName(systemName *uint16, accountName string, sid *byte, sidSize *uint32, refDomain *uint16, refDomainSize *uint32, sidNameUse *uint32) (err error) = advapi32.LookupAccountNameW -//sys convertSidToStringSid(sid *byte, str **uint16) (err error) = advapi32.ConvertSidToStringSidW -//sys convertStringSecurityDescriptorToSecurityDescriptor(str string, revision uint32, sd *uintptr, size *uint32) (err error) = advapi32.ConvertStringSecurityDescriptorToSecurityDescriptorW -//sys convertSecurityDescriptorToStringSecurityDescriptor(sd *byte, revision uint32, secInfo uint32, sddl **uint16, sddlSize *uint32) (err error) = advapi32.ConvertSecurityDescriptorToStringSecurityDescriptorW -//sys localFree(mem uintptr) = LocalFree -//sys getSecurityDescriptorLength(sd uintptr) (len uint32) = advapi32.GetSecurityDescriptorLength - -const ( - cERROR_NONE_MAPPED = syscall.Errno(1332) -) - -type AccountLookupError struct { - Name string - Err error -} - -func (e *AccountLookupError) Error() string { - if e.Name == "" { - return "lookup account: empty account name specified" - } - var s string - switch e.Err { - case cERROR_NONE_MAPPED: - s = "not found" - default: - s = e.Err.Error() - } - return "lookup account " + e.Name + ": " + s -} - -type SddlConversionError struct { - Sddl string - Err error -} - -func (e *SddlConversionError) Error() string { - return "convert " + e.Sddl + ": " + e.Err.Error() -} - -// LookupSidByName looks up the SID of an account by name -func LookupSidByName(name string) (sid string, err error) { - if name == "" { - return "", &AccountLookupError{name, cERROR_NONE_MAPPED} - } - - var sidSize, sidNameUse, refDomainSize uint32 - err = lookupAccountName(nil, name, nil, &sidSize, nil, &refDomainSize, &sidNameUse) - if err != nil && err != syscall.ERROR_INSUFFICIENT_BUFFER { - return "", &AccountLookupError{name, err} - } - sidBuffer := make([]byte, sidSize) - refDomainBuffer := make([]uint16, refDomainSize) - err = lookupAccountName(nil, name, &sidBuffer[0], &sidSize, &refDomainBuffer[0], &refDomainSize, &sidNameUse) - if err != nil { - return "", &AccountLookupError{name, err} - } - var strBuffer *uint16 - err = convertSidToStringSid(&sidBuffer[0], &strBuffer) - if err != nil { - return "", &AccountLookupError{name, err} - } - sid = syscall.UTF16ToString((*[0xffff]uint16)(unsafe.Pointer(strBuffer))[:]) - localFree(uintptr(unsafe.Pointer(strBuffer))) - return sid, nil -} - -func SddlToSecurityDescriptor(sddl string) ([]byte, error) { - var sdBuffer uintptr - err := convertStringSecurityDescriptorToSecurityDescriptor(sddl, 1, &sdBuffer, nil) - if err != nil { - return nil, &SddlConversionError{sddl, err} - } - defer localFree(sdBuffer) - sd := make([]byte, getSecurityDescriptorLength(sdBuffer)) - copy(sd, (*[0xffff]byte)(unsafe.Pointer(sdBuffer))[:len(sd)]) - return sd, nil -} - -func SecurityDescriptorToSddl(sd []byte) (string, error) { - var sddl *uint16 - // The returned string length seems to including an aribtrary number of terminating NULs. - // Don't use it. - err := convertSecurityDescriptorToStringSecurityDescriptor(&sd[0], 1, 0xff, &sddl, nil) - if err != nil { - return "", err - } - defer localFree(uintptr(unsafe.Pointer(sddl))) - return syscall.UTF16ToString((*[0xffff]uint16)(unsafe.Pointer(sddl))[:]), nil -} diff --git a/vendor/github.com/Microsoft/go-winio/syscall.go b/vendor/github.com/Microsoft/go-winio/syscall.go deleted file mode 100644 index 5cb52bc74..000000000 --- a/vendor/github.com/Microsoft/go-winio/syscall.go +++ /dev/null @@ -1,3 +0,0 @@ -package winio - -//go:generate go run $GOROOT/src/syscall/mksyscall_windows.go -output zsyscall_windows.go file.go pipe.go sd.go fileinfo.go privilege.go backup.go hvsock.go diff --git a/vendor/github.com/Microsoft/go-winio/zsyscall_windows.go b/vendor/github.com/Microsoft/go-winio/zsyscall_windows.go deleted file mode 100644 index e26b01faf..000000000 --- a/vendor/github.com/Microsoft/go-winio/zsyscall_windows.go +++ /dev/null @@ -1,562 +0,0 @@ -// Code generated by 'go generate'; DO NOT EDIT. - -package winio - -import ( - "syscall" - "unsafe" - - "golang.org/x/sys/windows" -) - -var _ unsafe.Pointer - -// Do the interface allocations only once for common -// Errno values. -const ( - errnoERROR_IO_PENDING = 997 -) - -var ( - errERROR_IO_PENDING error = syscall.Errno(errnoERROR_IO_PENDING) -) - -// errnoErr returns common boxed Errno values, to prevent -// allocations at runtime. -func errnoErr(e syscall.Errno) error { - switch e { - case 0: - return nil - case errnoERROR_IO_PENDING: - return errERROR_IO_PENDING - } - // TODO: add more here, after collecting data on the common - // error values see on Windows. (perhaps when running - // all.bat?) - return e -} - -var ( - modkernel32 = windows.NewLazySystemDLL("kernel32.dll") - modws2_32 = windows.NewLazySystemDLL("ws2_32.dll") - modntdll = windows.NewLazySystemDLL("ntdll.dll") - modadvapi32 = windows.NewLazySystemDLL("advapi32.dll") - - procCancelIoEx = modkernel32.NewProc("CancelIoEx") - procCreateIoCompletionPort = modkernel32.NewProc("CreateIoCompletionPort") - procGetQueuedCompletionStatus = modkernel32.NewProc("GetQueuedCompletionStatus") - procSetFileCompletionNotificationModes = modkernel32.NewProc("SetFileCompletionNotificationModes") - procWSAGetOverlappedResult = modws2_32.NewProc("WSAGetOverlappedResult") - procConnectNamedPipe = modkernel32.NewProc("ConnectNamedPipe") - procCreateNamedPipeW = modkernel32.NewProc("CreateNamedPipeW") - procCreateFileW = modkernel32.NewProc("CreateFileW") - procGetNamedPipeInfo = modkernel32.NewProc("GetNamedPipeInfo") - procGetNamedPipeHandleStateW = modkernel32.NewProc("GetNamedPipeHandleStateW") - procLocalAlloc = modkernel32.NewProc("LocalAlloc") - procNtCreateNamedPipeFile = modntdll.NewProc("NtCreateNamedPipeFile") - procRtlNtStatusToDosErrorNoTeb = modntdll.NewProc("RtlNtStatusToDosErrorNoTeb") - procRtlDosPathNameToNtPathName_U = modntdll.NewProc("RtlDosPathNameToNtPathName_U") - procRtlDefaultNpAcl = modntdll.NewProc("RtlDefaultNpAcl") - procLookupAccountNameW = modadvapi32.NewProc("LookupAccountNameW") - procConvertSidToStringSidW = modadvapi32.NewProc("ConvertSidToStringSidW") - procConvertStringSecurityDescriptorToSecurityDescriptorW = modadvapi32.NewProc("ConvertStringSecurityDescriptorToSecurityDescriptorW") - procConvertSecurityDescriptorToStringSecurityDescriptorW = modadvapi32.NewProc("ConvertSecurityDescriptorToStringSecurityDescriptorW") - procLocalFree = modkernel32.NewProc("LocalFree") - procGetSecurityDescriptorLength = modadvapi32.NewProc("GetSecurityDescriptorLength") - procGetFileInformationByHandleEx = modkernel32.NewProc("GetFileInformationByHandleEx") - procSetFileInformationByHandle = modkernel32.NewProc("SetFileInformationByHandle") - procAdjustTokenPrivileges = modadvapi32.NewProc("AdjustTokenPrivileges") - procImpersonateSelf = modadvapi32.NewProc("ImpersonateSelf") - procRevertToSelf = modadvapi32.NewProc("RevertToSelf") - procOpenThreadToken = modadvapi32.NewProc("OpenThreadToken") - procGetCurrentThread = modkernel32.NewProc("GetCurrentThread") - procLookupPrivilegeValueW = modadvapi32.NewProc("LookupPrivilegeValueW") - procLookupPrivilegeNameW = modadvapi32.NewProc("LookupPrivilegeNameW") - procLookupPrivilegeDisplayNameW = modadvapi32.NewProc("LookupPrivilegeDisplayNameW") - procBackupRead = modkernel32.NewProc("BackupRead") - procBackupWrite = modkernel32.NewProc("BackupWrite") - procbind = modws2_32.NewProc("bind") -) - -func cancelIoEx(file syscall.Handle, o *syscall.Overlapped) (err error) { - r1, _, e1 := syscall.Syscall(procCancelIoEx.Addr(), 2, uintptr(file), uintptr(unsafe.Pointer(o)), 0) - if r1 == 0 { - if e1 != 0 { - err = errnoErr(e1) - } else { - err = syscall.EINVAL - } - } - return -} - -func createIoCompletionPort(file syscall.Handle, port syscall.Handle, key uintptr, threadCount uint32) (newport syscall.Handle, err error) { - r0, _, e1 := syscall.Syscall6(procCreateIoCompletionPort.Addr(), 4, uintptr(file), uintptr(port), uintptr(key), uintptr(threadCount), 0, 0) - newport = syscall.Handle(r0) - if newport == 0 { - if e1 != 0 { - err = errnoErr(e1) - } else { - err = syscall.EINVAL - } - } - return -} - -func getQueuedCompletionStatus(port syscall.Handle, bytes *uint32, key *uintptr, o **ioOperation, timeout uint32) (err error) { - r1, _, e1 := syscall.Syscall6(procGetQueuedCompletionStatus.Addr(), 5, uintptr(port), uintptr(unsafe.Pointer(bytes)), uintptr(unsafe.Pointer(key)), uintptr(unsafe.Pointer(o)), uintptr(timeout), 0) - if r1 == 0 { - if e1 != 0 { - err = errnoErr(e1) - } else { - err = syscall.EINVAL - } - } - return -} - -func setFileCompletionNotificationModes(h syscall.Handle, flags uint8) (err error) { - r1, _, e1 := syscall.Syscall(procSetFileCompletionNotificationModes.Addr(), 2, uintptr(h), uintptr(flags), 0) - if r1 == 0 { - if e1 != 0 { - err = errnoErr(e1) - } else { - err = syscall.EINVAL - } - } - return -} - -func wsaGetOverlappedResult(h syscall.Handle, o *syscall.Overlapped, bytes *uint32, wait bool, flags *uint32) (err error) { - var _p0 uint32 - if wait { - _p0 = 1 - } else { - _p0 = 0 - } - r1, _, e1 := syscall.Syscall6(procWSAGetOverlappedResult.Addr(), 5, uintptr(h), uintptr(unsafe.Pointer(o)), uintptr(unsafe.Pointer(bytes)), uintptr(_p0), uintptr(unsafe.Pointer(flags)), 0) - if r1 == 0 { - if e1 != 0 { - err = errnoErr(e1) - } else { - err = syscall.EINVAL - } - } - return -} - -func connectNamedPipe(pipe syscall.Handle, o *syscall.Overlapped) (err error) { - r1, _, e1 := syscall.Syscall(procConnectNamedPipe.Addr(), 2, uintptr(pipe), uintptr(unsafe.Pointer(o)), 0) - if r1 == 0 { - if e1 != 0 { - err = errnoErr(e1) - } else { - err = syscall.EINVAL - } - } - return -} - -func createNamedPipe(name string, flags uint32, pipeMode uint32, maxInstances uint32, outSize uint32, inSize uint32, defaultTimeout uint32, sa *syscall.SecurityAttributes) (handle syscall.Handle, err error) { - var _p0 *uint16 - _p0, err = syscall.UTF16PtrFromString(name) - if err != nil { - return - } - return _createNamedPipe(_p0, flags, pipeMode, maxInstances, outSize, inSize, defaultTimeout, sa) -} - -func _createNamedPipe(name *uint16, flags uint32, pipeMode uint32, maxInstances uint32, outSize uint32, inSize uint32, defaultTimeout uint32, sa *syscall.SecurityAttributes) (handle syscall.Handle, err error) { - r0, _, e1 := syscall.Syscall9(procCreateNamedPipeW.Addr(), 8, uintptr(unsafe.Pointer(name)), uintptr(flags), uintptr(pipeMode), uintptr(maxInstances), uintptr(outSize), uintptr(inSize), uintptr(defaultTimeout), uintptr(unsafe.Pointer(sa)), 0) - handle = syscall.Handle(r0) - if handle == syscall.InvalidHandle { - if e1 != 0 { - err = errnoErr(e1) - } else { - err = syscall.EINVAL - } - } - return -} - -func createFile(name string, access uint32, mode uint32, sa *syscall.SecurityAttributes, createmode uint32, attrs uint32, templatefile syscall.Handle) (handle syscall.Handle, err error) { - var _p0 *uint16 - _p0, err = syscall.UTF16PtrFromString(name) - if err != nil { - return - } - return _createFile(_p0, access, mode, sa, createmode, attrs, templatefile) -} - -func _createFile(name *uint16, access uint32, mode uint32, sa *syscall.SecurityAttributes, createmode uint32, attrs uint32, templatefile syscall.Handle) (handle syscall.Handle, err error) { - r0, _, e1 := syscall.Syscall9(procCreateFileW.Addr(), 7, uintptr(unsafe.Pointer(name)), uintptr(access), uintptr(mode), uintptr(unsafe.Pointer(sa)), uintptr(createmode), uintptr(attrs), uintptr(templatefile), 0, 0) - handle = syscall.Handle(r0) - if handle == syscall.InvalidHandle { - if e1 != 0 { - err = errnoErr(e1) - } else { - err = syscall.EINVAL - } - } - return -} - -func getNamedPipeInfo(pipe syscall.Handle, flags *uint32, outSize *uint32, inSize *uint32, maxInstances *uint32) (err error) { - r1, _, e1 := syscall.Syscall6(procGetNamedPipeInfo.Addr(), 5, uintptr(pipe), uintptr(unsafe.Pointer(flags)), uintptr(unsafe.Pointer(outSize)), uintptr(unsafe.Pointer(inSize)), uintptr(unsafe.Pointer(maxInstances)), 0) - if r1 == 0 { - if e1 != 0 { - err = errnoErr(e1) - } else { - err = syscall.EINVAL - } - } - return -} - -func getNamedPipeHandleState(pipe syscall.Handle, state *uint32, curInstances *uint32, maxCollectionCount *uint32, collectDataTimeout *uint32, userName *uint16, maxUserNameSize uint32) (err error) { - r1, _, e1 := syscall.Syscall9(procGetNamedPipeHandleStateW.Addr(), 7, uintptr(pipe), uintptr(unsafe.Pointer(state)), uintptr(unsafe.Pointer(curInstances)), uintptr(unsafe.Pointer(maxCollectionCount)), uintptr(unsafe.Pointer(collectDataTimeout)), uintptr(unsafe.Pointer(userName)), uintptr(maxUserNameSize), 0, 0) - if r1 == 0 { - if e1 != 0 { - err = errnoErr(e1) - } else { - err = syscall.EINVAL - } - } - return -} - -func localAlloc(uFlags uint32, length uint32) (ptr uintptr) { - r0, _, _ := syscall.Syscall(procLocalAlloc.Addr(), 2, uintptr(uFlags), uintptr(length), 0) - ptr = uintptr(r0) - return -} - -func ntCreateNamedPipeFile(pipe *syscall.Handle, access uint32, oa *objectAttributes, iosb *ioStatusBlock, share uint32, disposition uint32, options uint32, typ uint32, readMode uint32, completionMode uint32, maxInstances uint32, inboundQuota uint32, outputQuota uint32, timeout *int64) (status ntstatus) { - r0, _, _ := syscall.Syscall15(procNtCreateNamedPipeFile.Addr(), 14, uintptr(unsafe.Pointer(pipe)), uintptr(access), uintptr(unsafe.Pointer(oa)), uintptr(unsafe.Pointer(iosb)), uintptr(share), uintptr(disposition), uintptr(options), uintptr(typ), uintptr(readMode), uintptr(completionMode), uintptr(maxInstances), uintptr(inboundQuota), uintptr(outputQuota), uintptr(unsafe.Pointer(timeout)), 0) - status = ntstatus(r0) - return -} - -func rtlNtStatusToDosError(status ntstatus) (winerr error) { - r0, _, _ := syscall.Syscall(procRtlNtStatusToDosErrorNoTeb.Addr(), 1, uintptr(status), 0, 0) - if r0 != 0 { - winerr = syscall.Errno(r0) - } - return -} - -func rtlDosPathNameToNtPathName(name *uint16, ntName *unicodeString, filePart uintptr, reserved uintptr) (status ntstatus) { - r0, _, _ := syscall.Syscall6(procRtlDosPathNameToNtPathName_U.Addr(), 4, uintptr(unsafe.Pointer(name)), uintptr(unsafe.Pointer(ntName)), uintptr(filePart), uintptr(reserved), 0, 0) - status = ntstatus(r0) - return -} - -func rtlDefaultNpAcl(dacl *uintptr) (status ntstatus) { - r0, _, _ := syscall.Syscall(procRtlDefaultNpAcl.Addr(), 1, uintptr(unsafe.Pointer(dacl)), 0, 0) - status = ntstatus(r0) - return -} - -func lookupAccountName(systemName *uint16, accountName string, sid *byte, sidSize *uint32, refDomain *uint16, refDomainSize *uint32, sidNameUse *uint32) (err error) { - var _p0 *uint16 - _p0, err = syscall.UTF16PtrFromString(accountName) - if err != nil { - return - } - return _lookupAccountName(systemName, _p0, sid, sidSize, refDomain, refDomainSize, sidNameUse) -} - -func _lookupAccountName(systemName *uint16, accountName *uint16, sid *byte, sidSize *uint32, refDomain *uint16, refDomainSize *uint32, sidNameUse *uint32) (err error) { - r1, _, e1 := syscall.Syscall9(procLookupAccountNameW.Addr(), 7, uintptr(unsafe.Pointer(systemName)), uintptr(unsafe.Pointer(accountName)), uintptr(unsafe.Pointer(sid)), uintptr(unsafe.Pointer(sidSize)), uintptr(unsafe.Pointer(refDomain)), uintptr(unsafe.Pointer(refDomainSize)), uintptr(unsafe.Pointer(sidNameUse)), 0, 0) - if r1 == 0 { - if e1 != 0 { - err = errnoErr(e1) - } else { - err = syscall.EINVAL - } - } - return -} - -func convertSidToStringSid(sid *byte, str **uint16) (err error) { - r1, _, e1 := syscall.Syscall(procConvertSidToStringSidW.Addr(), 2, uintptr(unsafe.Pointer(sid)), uintptr(unsafe.Pointer(str)), 0) - if r1 == 0 { - if e1 != 0 { - err = errnoErr(e1) - } else { - err = syscall.EINVAL - } - } - return -} - -func convertStringSecurityDescriptorToSecurityDescriptor(str string, revision uint32, sd *uintptr, size *uint32) (err error) { - var _p0 *uint16 - _p0, err = syscall.UTF16PtrFromString(str) - if err != nil { - return - } - return _convertStringSecurityDescriptorToSecurityDescriptor(_p0, revision, sd, size) -} - -func _convertStringSecurityDescriptorToSecurityDescriptor(str *uint16, revision uint32, sd *uintptr, size *uint32) (err error) { - r1, _, e1 := syscall.Syscall6(procConvertStringSecurityDescriptorToSecurityDescriptorW.Addr(), 4, uintptr(unsafe.Pointer(str)), uintptr(revision), uintptr(unsafe.Pointer(sd)), uintptr(unsafe.Pointer(size)), 0, 0) - if r1 == 0 { - if e1 != 0 { - err = errnoErr(e1) - } else { - err = syscall.EINVAL - } - } - return -} - -func convertSecurityDescriptorToStringSecurityDescriptor(sd *byte, revision uint32, secInfo uint32, sddl **uint16, sddlSize *uint32) (err error) { - r1, _, e1 := syscall.Syscall6(procConvertSecurityDescriptorToStringSecurityDescriptorW.Addr(), 5, uintptr(unsafe.Pointer(sd)), uintptr(revision), uintptr(secInfo), uintptr(unsafe.Pointer(sddl)), uintptr(unsafe.Pointer(sddlSize)), 0) - if r1 == 0 { - if e1 != 0 { - err = errnoErr(e1) - } else { - err = syscall.EINVAL - } - } - return -} - -func localFree(mem uintptr) { - syscall.Syscall(procLocalFree.Addr(), 1, uintptr(mem), 0, 0) - return -} - -func getSecurityDescriptorLength(sd uintptr) (len uint32) { - r0, _, _ := syscall.Syscall(procGetSecurityDescriptorLength.Addr(), 1, uintptr(sd), 0, 0) - len = uint32(r0) - return -} - -func getFileInformationByHandleEx(h syscall.Handle, class uint32, buffer *byte, size uint32) (err error) { - r1, _, e1 := syscall.Syscall6(procGetFileInformationByHandleEx.Addr(), 4, uintptr(h), uintptr(class), uintptr(unsafe.Pointer(buffer)), uintptr(size), 0, 0) - if r1 == 0 { - if e1 != 0 { - err = errnoErr(e1) - } else { - err = syscall.EINVAL - } - } - return -} - -func setFileInformationByHandle(h syscall.Handle, class uint32, buffer *byte, size uint32) (err error) { - r1, _, e1 := syscall.Syscall6(procSetFileInformationByHandle.Addr(), 4, uintptr(h), uintptr(class), uintptr(unsafe.Pointer(buffer)), uintptr(size), 0, 0) - if r1 == 0 { - if e1 != 0 { - err = errnoErr(e1) - } else { - err = syscall.EINVAL - } - } - return -} - -func adjustTokenPrivileges(token windows.Token, releaseAll bool, input *byte, outputSize uint32, output *byte, requiredSize *uint32) (success bool, err error) { - var _p0 uint32 - if releaseAll { - _p0 = 1 - } else { - _p0 = 0 - } - r0, _, e1 := syscall.Syscall6(procAdjustTokenPrivileges.Addr(), 6, uintptr(token), uintptr(_p0), uintptr(unsafe.Pointer(input)), uintptr(outputSize), uintptr(unsafe.Pointer(output)), uintptr(unsafe.Pointer(requiredSize))) - success = r0 != 0 - if true { - if e1 != 0 { - err = errnoErr(e1) - } else { - err = syscall.EINVAL - } - } - return -} - -func impersonateSelf(level uint32) (err error) { - r1, _, e1 := syscall.Syscall(procImpersonateSelf.Addr(), 1, uintptr(level), 0, 0) - if r1 == 0 { - if e1 != 0 { - err = errnoErr(e1) - } else { - err = syscall.EINVAL - } - } - return -} - -func revertToSelf() (err error) { - r1, _, e1 := syscall.Syscall(procRevertToSelf.Addr(), 0, 0, 0, 0) - if r1 == 0 { - if e1 != 0 { - err = errnoErr(e1) - } else { - err = syscall.EINVAL - } - } - return -} - -func openThreadToken(thread syscall.Handle, accessMask uint32, openAsSelf bool, token *windows.Token) (err error) { - var _p0 uint32 - if openAsSelf { - _p0 = 1 - } else { - _p0 = 0 - } - r1, _, e1 := syscall.Syscall6(procOpenThreadToken.Addr(), 4, uintptr(thread), uintptr(accessMask), uintptr(_p0), uintptr(unsafe.Pointer(token)), 0, 0) - if r1 == 0 { - if e1 != 0 { - err = errnoErr(e1) - } else { - err = syscall.EINVAL - } - } - return -} - -func getCurrentThread() (h syscall.Handle) { - r0, _, _ := syscall.Syscall(procGetCurrentThread.Addr(), 0, 0, 0, 0) - h = syscall.Handle(r0) - return -} - -func lookupPrivilegeValue(systemName string, name string, luid *uint64) (err error) { - var _p0 *uint16 - _p0, err = syscall.UTF16PtrFromString(systemName) - if err != nil { - return - } - var _p1 *uint16 - _p1, err = syscall.UTF16PtrFromString(name) - if err != nil { - return - } - return _lookupPrivilegeValue(_p0, _p1, luid) -} - -func _lookupPrivilegeValue(systemName *uint16, name *uint16, luid *uint64) (err error) { - r1, _, e1 := syscall.Syscall(procLookupPrivilegeValueW.Addr(), 3, uintptr(unsafe.Pointer(systemName)), uintptr(unsafe.Pointer(name)), uintptr(unsafe.Pointer(luid))) - if r1 == 0 { - if e1 != 0 { - err = errnoErr(e1) - } else { - err = syscall.EINVAL - } - } - return -} - -func lookupPrivilegeName(systemName string, luid *uint64, buffer *uint16, size *uint32) (err error) { - var _p0 *uint16 - _p0, err = syscall.UTF16PtrFromString(systemName) - if err != nil { - return - } - return _lookupPrivilegeName(_p0, luid, buffer, size) -} - -func _lookupPrivilegeName(systemName *uint16, luid *uint64, buffer *uint16, size *uint32) (err error) { - r1, _, e1 := syscall.Syscall6(procLookupPrivilegeNameW.Addr(), 4, uintptr(unsafe.Pointer(systemName)), uintptr(unsafe.Pointer(luid)), uintptr(unsafe.Pointer(buffer)), uintptr(unsafe.Pointer(size)), 0, 0) - if r1 == 0 { - if e1 != 0 { - err = errnoErr(e1) - } else { - err = syscall.EINVAL - } - } - return -} - -func lookupPrivilegeDisplayName(systemName string, name *uint16, buffer *uint16, size *uint32, languageId *uint32) (err error) { - var _p0 *uint16 - _p0, err = syscall.UTF16PtrFromString(systemName) - if err != nil { - return - } - return _lookupPrivilegeDisplayName(_p0, name, buffer, size, languageId) -} - -func _lookupPrivilegeDisplayName(systemName *uint16, name *uint16, buffer *uint16, size *uint32, languageId *uint32) (err error) { - r1, _, e1 := syscall.Syscall6(procLookupPrivilegeDisplayNameW.Addr(), 5, uintptr(unsafe.Pointer(systemName)), uintptr(unsafe.Pointer(name)), uintptr(unsafe.Pointer(buffer)), uintptr(unsafe.Pointer(size)), uintptr(unsafe.Pointer(languageId)), 0) - if r1 == 0 { - if e1 != 0 { - err = errnoErr(e1) - } else { - err = syscall.EINVAL - } - } - return -} - -func backupRead(h syscall.Handle, b []byte, bytesRead *uint32, abort bool, processSecurity bool, context *uintptr) (err error) { - var _p0 *byte - if len(b) > 0 { - _p0 = &b[0] - } - var _p1 uint32 - if abort { - _p1 = 1 - } else { - _p1 = 0 - } - var _p2 uint32 - if processSecurity { - _p2 = 1 - } else { - _p2 = 0 - } - r1, _, e1 := syscall.Syscall9(procBackupRead.Addr(), 7, uintptr(h), uintptr(unsafe.Pointer(_p0)), uintptr(len(b)), uintptr(unsafe.Pointer(bytesRead)), uintptr(_p1), uintptr(_p2), uintptr(unsafe.Pointer(context)), 0, 0) - if r1 == 0 { - if e1 != 0 { - err = errnoErr(e1) - } else { - err = syscall.EINVAL - } - } - return -} - -func backupWrite(h syscall.Handle, b []byte, bytesWritten *uint32, abort bool, processSecurity bool, context *uintptr) (err error) { - var _p0 *byte - if len(b) > 0 { - _p0 = &b[0] - } - var _p1 uint32 - if abort { - _p1 = 1 - } else { - _p1 = 0 - } - var _p2 uint32 - if processSecurity { - _p2 = 1 - } else { - _p2 = 0 - } - r1, _, e1 := syscall.Syscall9(procBackupWrite.Addr(), 7, uintptr(h), uintptr(unsafe.Pointer(_p0)), uintptr(len(b)), uintptr(unsafe.Pointer(bytesWritten)), uintptr(_p1), uintptr(_p2), uintptr(unsafe.Pointer(context)), 0, 0) - if r1 == 0 { - if e1 != 0 { - err = errnoErr(e1) - } else { - err = syscall.EINVAL - } - } - return -} - -func bind(s syscall.Handle, name unsafe.Pointer, namelen int32) (err error) { - r1, _, e1 := syscall.Syscall(procbind.Addr(), 3, uintptr(s), uintptr(name), uintptr(namelen)) - if r1 == socketError { - if e1 != 0 { - err = errnoErr(e1) - } else { - err = syscall.EINVAL - } - } - return -} diff --git a/vendor/github.com/kubernetes-csi/csi-driver-smb/LICENSE b/vendor/github.com/kubernetes-csi/csi-driver-smb/LICENSE deleted file mode 100644 index 261eeb9e9..000000000 --- a/vendor/github.com/kubernetes-csi/csi-driver-smb/LICENSE +++ /dev/null @@ -1,201 +0,0 @@ - Apache License - Version 2.0, January 2004 - http://www.apache.org/licenses/ - - TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION - - 1. Definitions. - - "License" shall mean the terms and conditions for use, reproduction, - and distribution as defined by Sections 1 through 9 of this document. - - "Licensor" shall mean the copyright owner or entity authorized by - the copyright owner that is granting the License. - - "Legal Entity" shall mean the union of the acting entity and all - other entities that control, are controlled by, or are under common - control with that entity. For the purposes of this definition, - "control" means (i) the power, direct or indirect, to cause the - direction or management of such entity, whether by contract or - otherwise, or (ii) ownership of fifty percent (50%) or more of the - outstanding shares, or (iii) beneficial ownership of such entity. - - "You" (or "Your") shall mean an individual or Legal Entity - exercising permissions granted by this License. - - "Source" form shall mean the preferred form for making modifications, - including but not limited to software source code, documentation - source, and configuration files. - - "Object" form shall mean any form resulting from mechanical - transformation or translation of a Source form, including but - not limited to compiled object code, generated documentation, - and conversions to other media types. - - "Work" shall mean the work of authorship, whether in Source or - Object form, made available under the License, as indicated by a - copyright notice that is included in or attached to the work - (an example is provided in the Appendix below). - - "Derivative Works" shall mean any work, whether in Source or Object - form, that is based on (or derived from) the Work and for which the - editorial revisions, annotations, elaborations, or other modifications - represent, as a whole, an original work of authorship. For the purposes - of this License, Derivative Works shall not include works that remain - separable from, or merely link (or bind by name) to the interfaces of, - the Work and Derivative Works thereof. - - "Contribution" shall mean any work of authorship, including - the original version of the Work and any modifications or additions - to that Work or Derivative Works thereof, that is intentionally - submitted to Licensor for inclusion in the Work by the copyright owner - or by an individual or Legal Entity authorized to submit on behalf of - the copyright owner. For the purposes of this definition, "submitted" - means any form of electronic, verbal, or written communication sent - to the Licensor or its representatives, including but not limited to - communication on electronic mailing lists, source code control systems, - and issue tracking systems that are managed by, or on behalf of, the - Licensor for the purpose of discussing and improving the Work, but - excluding communication that is conspicuously marked or otherwise - designated in writing by the copyright owner as "Not a Contribution." - - "Contributor" shall mean Licensor and any individual or Legal Entity - on behalf of whom a Contribution has been received by Licensor and - subsequently incorporated within the Work. - - 2. Grant of Copyright License. Subject to the terms and conditions of - this License, each Contributor hereby grants to You a perpetual, - worldwide, non-exclusive, no-charge, royalty-free, irrevocable - copyright license to reproduce, prepare Derivative Works of, - publicly display, publicly perform, sublicense, and distribute the - Work and such Derivative Works in Source or Object form. - - 3. Grant of Patent License. Subject to the terms and conditions of - this License, each Contributor hereby grants to You a perpetual, - worldwide, non-exclusive, no-charge, royalty-free, irrevocable - (except as stated in this section) patent license to make, have made, - use, offer to sell, sell, import, and otherwise transfer the Work, - where such license applies only to those patent claims licensable - by such Contributor that are necessarily infringed by their - Contribution(s) alone or by combination of their Contribution(s) - with the Work to which such Contribution(s) was submitted. If You - institute patent litigation against any entity (including a - cross-claim or counterclaim in a lawsuit) alleging that the Work - or a Contribution incorporated within the Work constitutes direct - or contributory patent infringement, then any patent licenses - granted to You under this License for that Work shall terminate - as of the date such litigation is filed. - - 4. Redistribution. You may reproduce and distribute copies of the - Work or Derivative Works thereof in any medium, with or without - modifications, and in Source or Object form, provided that You - meet the following conditions: - - (a) You must give any other recipients of the Work or - Derivative Works a copy of this License; and - - (b) You must cause any modified files to carry prominent notices - stating that You changed the files; and - - (c) You must retain, in the Source form of any Derivative Works - that You distribute, all copyright, patent, trademark, and - attribution notices from the Source form of the Work, - excluding those notices that do not pertain to any part of - the Derivative Works; and - - (d) If the Work includes a "NOTICE" text file as part of its - distribution, then any Derivative Works that You distribute must - include a readable copy of the attribution notices contained - within such NOTICE file, excluding those notices that do not - pertain to any part of the Derivative Works, in at least one - of the following places: within a NOTICE text file distributed - as part of the Derivative Works; within the Source form or - documentation, if provided along with the Derivative Works; or, - within a display generated by the Derivative Works, if and - wherever such third-party notices normally appear. The contents - of the NOTICE file are for informational purposes only and - do not modify the License. You may add Your own attribution - notices within Derivative Works that You distribute, alongside - or as an addendum to the NOTICE text from the Work, provided - that such additional attribution notices cannot be construed - as modifying the License. - - You may add Your own copyright statement to Your modifications and - may provide additional or different license terms and conditions - for use, reproduction, or distribution of Your modifications, or - for any such Derivative Works as a whole, provided Your use, - reproduction, and distribution of the Work otherwise complies with - the conditions stated in this License. - - 5. Submission of Contributions. Unless You explicitly state otherwise, - any Contribution intentionally submitted for inclusion in the Work - by You to the Licensor shall be under the terms and conditions of - this License, without any additional terms or conditions. - Notwithstanding the above, nothing herein shall supersede or modify - the terms of any separate license agreement you may have executed - with Licensor regarding such Contributions. - - 6. Trademarks. This License does not grant permission to use the trade - names, trademarks, service marks, or product names of the Licensor, - except as required for reasonable and customary use in describing the - origin of the Work and reproducing the content of the NOTICE file. - - 7. Disclaimer of Warranty. Unless required by applicable law or - agreed to in writing, Licensor provides the Work (and each - Contributor provides its Contributions) on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or - implied, including, without limitation, any warranties or conditions - of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A - PARTICULAR PURPOSE. You are solely responsible for determining the - appropriateness of using or redistributing the Work and assume any - risks associated with Your exercise of permissions under this License. - - 8. Limitation of Liability. In no event and under no legal theory, - whether in tort (including negligence), contract, or otherwise, - unless required by applicable law (such as deliberate and grossly - negligent acts) or agreed to in writing, shall any Contributor be - liable to You for damages, including any direct, indirect, special, - incidental, or consequential damages of any character arising as a - result of this License or out of the use or inability to use the - Work (including but not limited to damages for loss of goodwill, - work stoppage, computer failure or malfunction, or any and all - other commercial damages or losses), even if such Contributor - has been advised of the possibility of such damages. - - 9. Accepting Warranty or Additional Liability. While redistributing - the Work or Derivative Works thereof, You may choose to offer, - and charge a fee for, acceptance of support, warranty, indemnity, - or other liability obligations and/or rights consistent with this - License. However, in accepting such obligations, You may act only - on Your own behalf and on Your sole responsibility, not on behalf - of any other Contributor, and only if You agree to indemnify, - defend, and hold each Contributor harmless for any liability - incurred by, or claims asserted against, such Contributor by reason - of your accepting any such warranty or additional liability. - - END OF TERMS AND CONDITIONS - - APPENDIX: How to apply the Apache License to your work. - - To apply the Apache License to your work, attach the following - boilerplate notice, with the fields enclosed by brackets "[]" - replaced with your own identifying information. (Don't include - the brackets!) The text should be enclosed in the appropriate - comment syntax for the file format. We also recommend that a - file or class name and description of purpose be included on the - same "printed page" as the copyright notice for easier - identification within third-party archives. - - Copyright [yyyy] [name of copyright owner] - - 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. diff --git a/vendor/github.com/kubernetes-csi/csi-driver-smb/pkg/csi-common/controllerserver-default.go b/vendor/github.com/kubernetes-csi/csi-driver-smb/pkg/csi-common/controllerserver-default.go deleted file mode 100644 index 151b82055..000000000 --- a/vendor/github.com/kubernetes-csi/csi-driver-smb/pkg/csi-common/controllerserver-default.go +++ /dev/null @@ -1,101 +0,0 @@ -/* -Copyright 2017 The Kubernetes Authors. - -Licensed under the Apache License, Version 2.0 (the "License"); -you may not use this file except in compliance with the License. -You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - -Unless required by applicable law or agreed to in writing, software -distributed under the License is distributed on an "AS IS" BASIS, -WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -See the License for the specific language governing permissions and -limitations under the License. -*/ - -package csicommon - -import ( - "k8s.io/klog/v2" - - "context" - "github.com/container-storage-interface/spec/lib/go/csi" - "google.golang.org/grpc/codes" - "google.golang.org/grpc/status" -) - -type DefaultControllerServer struct { - Driver *CSIDriver -} - -func (cs *DefaultControllerServer) CreateVolume(ctx context.Context, req *csi.CreateVolumeRequest) (*csi.CreateVolumeResponse, error) { - return nil, status.Error(codes.Unimplemented, "") -} - -func (cs *DefaultControllerServer) DeleteVolume(ctx context.Context, req *csi.DeleteVolumeRequest) (*csi.DeleteVolumeResponse, error) { - return nil, status.Error(codes.Unimplemented, "") -} - -func (cs *DefaultControllerServer) ControllerPublishVolume(ctx context.Context, req *csi.ControllerPublishVolumeRequest) (*csi.ControllerPublishVolumeResponse, error) { - return nil, status.Error(codes.Unimplemented, "") -} - -func (cs *DefaultControllerServer) ControllerUnpublishVolume(ctx context.Context, req *csi.ControllerUnpublishVolumeRequest) (*csi.ControllerUnpublishVolumeResponse, error) { - return nil, status.Error(codes.Unimplemented, "") -} - -func (cs *DefaultControllerServer) ValidateVolumeCapabilities(ctx context.Context, req *csi.ValidateVolumeCapabilitiesRequest) (*csi.ValidateVolumeCapabilitiesResponse, error) { - klog.V(5).Infof("Using default ValidateVolumeCapabilities") - - for _, c := range req.GetVolumeCapabilities() { - found := false - for _, c1 := range cs.Driver.VC { - if c1.GetMode() == c.GetAccessMode().GetMode() { - found = true - } - } - if !found { - return &csi.ValidateVolumeCapabilitiesResponse{ - Message: "Driver doesnot support mode:" + c.GetAccessMode().GetMode().String(), - }, status.Error(codes.InvalidArgument, "Driver doesnot support mode:"+c.GetAccessMode().GetMode().String()) - } - // TODO: Ignoring mount & block tyeps for now. - } - - return &csi.ValidateVolumeCapabilitiesResponse{}, nil -} - -func (cs *DefaultControllerServer) ListVolumes(ctx context.Context, req *csi.ListVolumesRequest) (*csi.ListVolumesResponse, error) { - return nil, status.Error(codes.Unimplemented, "") -} - -func (cs *DefaultControllerServer) GetCapacity(ctx context.Context, req *csi.GetCapacityRequest) (*csi.GetCapacityResponse, error) { - return nil, status.Error(codes.Unimplemented, "") -} - -// ControllerGetCapabilities implements the default GRPC callout. -// Default supports all capabilities -func (cs *DefaultControllerServer) ControllerGetCapabilities(ctx context.Context, req *csi.ControllerGetCapabilitiesRequest) (*csi.ControllerGetCapabilitiesResponse, error) { - klog.V(5).Infof("Using default ControllerGetCapabilities") - - return &csi.ControllerGetCapabilitiesResponse{ - Capabilities: cs.Driver.Cap, - }, nil -} - -func (cs *DefaultControllerServer) CreateSnapshot(ctx context.Context, req *csi.CreateSnapshotRequest) (*csi.CreateSnapshotResponse, error) { - return nil, status.Error(codes.Unimplemented, "") -} - -func (cs *DefaultControllerServer) DeleteSnapshot(ctx context.Context, req *csi.DeleteSnapshotRequest) (*csi.DeleteSnapshotResponse, error) { - return nil, status.Error(codes.Unimplemented, "") -} - -func (cs *DefaultControllerServer) ListSnapshots(ctx context.Context, req *csi.ListSnapshotsRequest) (*csi.ListSnapshotsResponse, error) { - return nil, status.Error(codes.Unimplemented, "") -} - -func (cs *DefaultControllerServer) ControllerExpandVolume(ctx context.Context, req *csi.ControllerExpandVolumeRequest) (*csi.ControllerExpandVolumeResponse, error) { - return nil, status.Error(codes.Unimplemented, "") -} diff --git a/vendor/github.com/kubernetes-csi/csi-driver-smb/pkg/csi-common/driver.go b/vendor/github.com/kubernetes-csi/csi-driver-smb/pkg/csi-common/driver.go deleted file mode 100644 index d70c58caf..000000000 --- a/vendor/github.com/kubernetes-csi/csi-driver-smb/pkg/csi-common/driver.go +++ /dev/null @@ -1,121 +0,0 @@ -/* -Copyright 2017 The Kubernetes Authors. - -Licensed under the Apache License, Version 2.0 (the "License"); -you may not use this file except in compliance with the License. -You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - -Unless required by applicable law or agreed to in writing, software -distributed under the License is distributed on an "AS IS" BASIS, -WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -See the License for the specific language governing permissions and -limitations under the License. -*/ - -package csicommon - -import ( - "github.com/container-storage-interface/spec/lib/go/csi" - "k8s.io/klog/v2" - - "google.golang.org/grpc/codes" - "google.golang.org/grpc/status" -) - -type CSIDriver struct { - Name string - NodeID string - Version string - Cap []*csi.ControllerServiceCapability - VC []*csi.VolumeCapability_AccessMode - NSCap []*csi.NodeServiceCapability -} - -// Creates a NewCSIDriver object. Assumes vendor version is equal to driver version & -// does not support optional driver plugin info manifest field. Refer to CSI spec for more details. -func NewCSIDriver(name string, v string, nodeID string) *CSIDriver { - if name == "" { - klog.Errorf("Driver name missing") - return nil - } - - if nodeID == "" { - klog.Errorf("NodeID missing") - return nil - } - // TODO version format and validation - if len(v) == 0 { - klog.Errorf("Version argument missing, now skip it") - //return nil - } - - driver := CSIDriver{ - Name: name, - Version: v, - NodeID: nodeID, - } - - return &driver -} - -func (d *CSIDriver) ValidateControllerServiceRequest(c csi.ControllerServiceCapability_RPC_Type) error { - if c == csi.ControllerServiceCapability_RPC_UNKNOWN { - return nil - } - - for _, cap := range d.Cap { - if c == cap.GetRpc().GetType() { - return nil - } - } - return status.Error(codes.InvalidArgument, c.String()) -} - -func (d *CSIDriver) ValidateNodeServiceRequest(c csi.NodeServiceCapability_RPC_Type) error { - if c == csi.NodeServiceCapability_RPC_UNKNOWN { - return nil - } - - for _, cap := range d.NSCap { - if c == cap.GetRpc().GetType() { - return nil - } - } - return status.Error(codes.InvalidArgument, c.String()) -} - -func (d *CSIDriver) AddControllerServiceCapabilities(cl []csi.ControllerServiceCapability_RPC_Type) { - var csc []*csi.ControllerServiceCapability - - for _, c := range cl { - klog.Infof("Enabling controller service capability: %v", c.String()) - csc = append(csc, NewControllerServiceCapability(c)) - } - - d.Cap = csc -} - -func (d *CSIDriver) AddNodeServiceCapabilities(nl []csi.NodeServiceCapability_RPC_Type) { - var nsc []*csi.NodeServiceCapability - for _, n := range nl { - klog.V(2).Infof("Enabling node service capability: %v", n.String()) - nsc = append(nsc, NewNodeServiceCapability(n)) - } - d.NSCap = nsc -} - -func (d *CSIDriver) AddVolumeCapabilityAccessModes(vc []csi.VolumeCapability_AccessMode_Mode) []*csi.VolumeCapability_AccessMode { - var vca []*csi.VolumeCapability_AccessMode - for _, c := range vc { - klog.Infof("Enabling volume access mode: %v", c.String()) - vca = append(vca, NewVolumeCapabilityAccessMode(c)) - } - d.VC = vca - return vca -} - -func (d *CSIDriver) GetVolumeCapabilityAccessModes() []*csi.VolumeCapability_AccessMode { - return d.VC -} diff --git a/vendor/github.com/kubernetes-csi/csi-driver-smb/pkg/csi-common/identityserver-default.go b/vendor/github.com/kubernetes-csi/csi-driver-smb/pkg/csi-common/identityserver-default.go deleted file mode 100644 index d60357df1..000000000 --- a/vendor/github.com/kubernetes-csi/csi-driver-smb/pkg/csi-common/identityserver-default.go +++ /dev/null @@ -1,65 +0,0 @@ -/* -Copyright 2017 The Kubernetes Authors. - -Licensed under the Apache License, Version 2.0 (the "License"); -you may not use this file except in compliance with the License. -You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - -Unless required by applicable law or agreed to in writing, software -distributed under the License is distributed on an "AS IS" BASIS, -WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -See the License for the specific language governing permissions and -limitations under the License. -*/ - -package csicommon - -import ( - "context" - "github.com/container-storage-interface/spec/lib/go/csi" - "google.golang.org/grpc/codes" - "google.golang.org/grpc/status" - "k8s.io/klog/v2" -) - -type DefaultIdentityServer struct { - Driver *CSIDriver -} - -func (ids *DefaultIdentityServer) GetPluginInfo(ctx context.Context, req *csi.GetPluginInfoRequest) (*csi.GetPluginInfoResponse, error) { - klog.V(5).Infof("Using default GetPluginInfo") - - if ids.Driver.Name == "" { - return nil, status.Error(codes.Unavailable, "Driver name not configured") - } - - if ids.Driver.Version == "" { - return nil, status.Error(codes.Unavailable, "Driver is missing version") - } - - return &csi.GetPluginInfoResponse{ - Name: ids.Driver.Name, - VendorVersion: ids.Driver.Version, - }, nil -} - -func (ids *DefaultIdentityServer) Probe(ctx context.Context, req *csi.ProbeRequest) (*csi.ProbeResponse, error) { - return &csi.ProbeResponse{}, nil -} - -func (ids *DefaultIdentityServer) GetPluginCapabilities(ctx context.Context, req *csi.GetPluginCapabilitiesRequest) (*csi.GetPluginCapabilitiesResponse, error) { - klog.V(5).Infof("Using default capabilities") - return &csi.GetPluginCapabilitiesResponse{ - Capabilities: []*csi.PluginCapability{ - { - Type: &csi.PluginCapability_Service_{ - Service: &csi.PluginCapability_Service{ - Type: csi.PluginCapability_Service_CONTROLLER_SERVICE, - }, - }, - }, - }, - }, nil -} diff --git a/vendor/github.com/kubernetes-csi/csi-driver-smb/pkg/csi-common/nodeserver-default.go b/vendor/github.com/kubernetes-csi/csi-driver-smb/pkg/csi-common/nodeserver-default.go deleted file mode 100644 index 19fe641ad..000000000 --- a/vendor/github.com/kubernetes-csi/csi-driver-smb/pkg/csi-common/nodeserver-default.go +++ /dev/null @@ -1,43 +0,0 @@ -/* -Copyright 2017 The Kubernetes Authors. - -Licensed under the Apache License, Version 2.0 (the "License"); -you may not use this file except in compliance with the License. -You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - -Unless required by applicable law or agreed to in writing, software -distributed under the License is distributed on an "AS IS" BASIS, -WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -See the License for the specific language governing permissions and -limitations under the License. -*/ - -package csicommon - -import ( - "context" - "github.com/container-storage-interface/spec/lib/go/csi" - "k8s.io/klog/v2" -) - -type DefaultNodeServer struct { - Driver *CSIDriver -} - -func (ns *DefaultNodeServer) NodeGetInfo(ctx context.Context, req *csi.NodeGetInfoRequest) (*csi.NodeGetInfoResponse, error) { - klog.V(5).Infof("Using default NodeGetInfo") - - return &csi.NodeGetInfoResponse{ - NodeId: ns.Driver.NodeID, - }, nil -} - -func (ns *DefaultNodeServer) NodeGetCapabilities(ctx context.Context, req *csi.NodeGetCapabilitiesRequest) (*csi.NodeGetCapabilitiesResponse, error) { - klog.V(2).Infof("Using default NodeGetCapabilities") - - return &csi.NodeGetCapabilitiesResponse{ - Capabilities: ns.Driver.NSCap, - }, nil -} diff --git a/vendor/github.com/kubernetes-csi/csi-driver-smb/pkg/csi-common/server.go b/vendor/github.com/kubernetes-csi/csi-driver-smb/pkg/csi-common/server.go deleted file mode 100644 index 5d3209a15..000000000 --- a/vendor/github.com/kubernetes-csi/csi-driver-smb/pkg/csi-common/server.go +++ /dev/null @@ -1,122 +0,0 @@ -/* -Copyright 2017 The Kubernetes Authors. - -Licensed under the Apache License, Version 2.0 (the "License"); -you may not use this file except in compliance with the License. -You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - -Unless required by applicable law or agreed to in writing, software -distributed under the License is distributed on an "AS IS" BASIS, -WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -See the License for the specific language governing permissions and -limitations under the License. -*/ - -package csicommon - -import ( - "net" - "os" - "runtime" - "sync" - "time" - - "google.golang.org/grpc" - "k8s.io/klog/v2" - - "github.com/container-storage-interface/spec/lib/go/csi" -) - -// Defines Non blocking GRPC server interfaces -type NonBlockingGRPCServer interface { - // Start services at the endpoint - Start(endpoint string, ids csi.IdentityServer, cs csi.ControllerServer, ns csi.NodeServer, testMode bool) - // Waits for the service to stop - Wait() - // Stops the service gracefully - Stop() - // Stops the service forcefully - ForceStop() -} - -func NewNonBlockingGRPCServer() NonBlockingGRPCServer { - return &nonBlockingGRPCServer{} -} - -// NonBlocking server -type nonBlockingGRPCServer struct { - wg sync.WaitGroup - server *grpc.Server -} - -func (s *nonBlockingGRPCServer) Start(endpoint string, ids csi.IdentityServer, cs csi.ControllerServer, ns csi.NodeServer, testMode bool) { - s.wg.Add(1) - go s.serve(endpoint, ids, cs, ns, testMode) -} - -func (s *nonBlockingGRPCServer) Wait() { - s.wg.Wait() -} - -func (s *nonBlockingGRPCServer) Stop() { - s.server.GracefulStop() -} - -func (s *nonBlockingGRPCServer) ForceStop() { - s.server.Stop() -} - -func (s *nonBlockingGRPCServer) serve(endpoint string, ids csi.IdentityServer, cs csi.ControllerServer, ns csi.NodeServer, testMode bool) { - - proto, addr, err := ParseEndpoint(endpoint) - if err != nil { - klog.Fatal(err.Error()) - } - - if proto == "unix" { - if runtime.GOOS != "windows" { - addr = "/" + addr - } - if err := os.Remove(addr); err != nil && !os.IsNotExist(err) { - klog.Fatalf("Failed to remove %s, error: %s", addr, err.Error()) - } - } - - listener, err := net.Listen(proto, addr) - if err != nil { - klog.Fatalf("Failed to listen: %v", err) - } - - opts := []grpc.ServerOption{ - grpc.UnaryInterceptor(logGRPC), - } - server := grpc.NewServer(opts...) - s.server = server - - if ids != nil { - csi.RegisterIdentityServer(server, ids) - } - if cs != nil { - csi.RegisterControllerServer(server, cs) - } - if ns != nil { - csi.RegisterNodeServer(server, ns) - } - // Used to stop the server while running tests - if testMode { - s.wg.Done() - go func() { - // make sure Serve() is called - s.wg.Wait() - time.Sleep(time.Millisecond * 1000) - s.server.GracefulStop() - }() - } - - klog.Infof("Listening for connections on address: %#v", listener.Addr()) - if err := server.Serve(listener); err != nil { - klog.Errorf("Listening for connections on address: %#v, error: %v", listener.Addr(), err) - } -} diff --git a/vendor/github.com/kubernetes-csi/csi-driver-smb/pkg/csi-common/utils.go b/vendor/github.com/kubernetes-csi/csi-driver-smb/pkg/csi-common/utils.go deleted file mode 100644 index f71ba8900..000000000 --- a/vendor/github.com/kubernetes-csi/csi-driver-smb/pkg/csi-common/utils.go +++ /dev/null @@ -1,116 +0,0 @@ -/* -Copyright 2017 The Kubernetes Authors. - -Licensed under the Apache License, Version 2.0 (the "License"); -you may not use this file except in compliance with the License. -You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - -Unless required by applicable law or agreed to in writing, software -distributed under the License is distributed on an "AS IS" BASIS, -WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -See the License for the specific language governing permissions and -limitations under the License. -*/ - -package csicommon - -import ( - "fmt" - "strings" - - "context" - "github.com/container-storage-interface/spec/lib/go/csi" - "github.com/kubernetes-csi/csi-lib-utils/protosanitizer" - "google.golang.org/grpc" - "k8s.io/klog/v2" -) - -func ParseEndpoint(ep string) (string, string, error) { - if strings.HasPrefix(strings.ToLower(ep), "unix://") || strings.HasPrefix(strings.ToLower(ep), "tcp://") { - s := strings.SplitN(ep, "://", 2) - if s[1] != "" { - return s[0], s[1], nil - } - } - return "", "", fmt.Errorf("Invalid endpoint: %v", ep) -} - -func NewVolumeCapabilityAccessMode(mode csi.VolumeCapability_AccessMode_Mode) *csi.VolumeCapability_AccessMode { - return &csi.VolumeCapability_AccessMode{Mode: mode} -} - -func NewDefaultNodeServer(d *CSIDriver) *DefaultNodeServer { - return &DefaultNodeServer{ - Driver: d, - } -} - -func NewDefaultIdentityServer(d *CSIDriver) *DefaultIdentityServer { - return &DefaultIdentityServer{ - Driver: d, - } -} - -func NewDefaultControllerServer(d *CSIDriver) *DefaultControllerServer { - return &DefaultControllerServer{ - Driver: d, - } -} - -func NewControllerServiceCapability(cap csi.ControllerServiceCapability_RPC_Type) *csi.ControllerServiceCapability { - return &csi.ControllerServiceCapability{ - Type: &csi.ControllerServiceCapability_Rpc{ - Rpc: &csi.ControllerServiceCapability_RPC{ - Type: cap, - }, - }, - } -} - -func NewNodeServiceCapability(cap csi.NodeServiceCapability_RPC_Type) *csi.NodeServiceCapability { - return &csi.NodeServiceCapability{ - Type: &csi.NodeServiceCapability_Rpc{ - Rpc: &csi.NodeServiceCapability_RPC{ - Type: cap, - }, - }, - } -} - -func RunNodePublishServer(endpoint string, d *CSIDriver, ns csi.NodeServer, testMode bool) { - ids := NewDefaultIdentityServer(d) - - s := NewNonBlockingGRPCServer() - s.Start(endpoint, ids, nil, ns, testMode) - s.Wait() -} - -func RunControllerPublishServer(endpoint string, d *CSIDriver, cs csi.ControllerServer, testMode bool) { - ids := NewDefaultIdentityServer(d) - - s := NewNonBlockingGRPCServer() - s.Start(endpoint, ids, cs, nil, testMode) - s.Wait() -} - -func RunControllerandNodePublishServer(endpoint string, d *CSIDriver, cs csi.ControllerServer, ns csi.NodeServer, testMode bool) { - ids := NewDefaultIdentityServer(d) - - s := NewNonBlockingGRPCServer() - s.Start(endpoint, ids, cs, ns, testMode) - s.Wait() -} - -func logGRPC(ctx context.Context, req interface{}, info *grpc.UnaryServerInfo, handler grpc.UnaryHandler) (interface{}, error) { - klog.V(3).Infof("GRPC call: %s", info.FullMethod) - klog.V(5).Infof("GRPC request: %s", protosanitizer.StripSecrets(req)) - resp, err := handler(ctx, req) - if err != nil { - klog.Errorf("GRPC error: %v", err) - } else { - klog.V(5).Infof("GRPC response: %s", protosanitizer.StripSecrets(resp)) - } - return resp, err -} diff --git a/vendor/github.com/kubernetes-csi/csi-driver-smb/pkg/mounter/safe_mounter_unix.go b/vendor/github.com/kubernetes-csi/csi-driver-smb/pkg/mounter/safe_mounter_unix.go deleted file mode 100644 index f816a9b4f..000000000 --- a/vendor/github.com/kubernetes-csi/csi-driver-smb/pkg/mounter/safe_mounter_unix.go +++ /dev/null @@ -1,31 +0,0 @@ -// +build linux darwin - -/* -Copyright 2020 The Kubernetes Authors. - -Licensed under the Apache License, Version 2.0 (the "License"); -you may not use this file except in compliance with the License. -You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - -Unless required by applicable law or agreed to in writing, software -distributed under the License is distributed on an "AS IS" BASIS, -WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -See the License for the specific language governing permissions and -limitations under the License. -*/ - -package mounter - -import ( - utilexec "k8s.io/utils/exec" - "k8s.io/utils/mount" -) - -func NewSafeMounter() (*mount.SafeFormatAndMount, error) { - return &mount.SafeFormatAndMount{ - Interface: mount.New(""), - Exec: utilexec.New(), - }, nil -} diff --git a/vendor/github.com/kubernetes-csi/csi-driver-smb/pkg/mounter/safe_mounter_windows.go b/vendor/github.com/kubernetes-csi/csi-driver-smb/pkg/mounter/safe_mounter_windows.go deleted file mode 100644 index 5ae9f14fc..000000000 --- a/vendor/github.com/kubernetes-csi/csi-driver-smb/pkg/mounter/safe_mounter_windows.go +++ /dev/null @@ -1,264 +0,0 @@ -// +build windows - -/* -Copyright 2020 The Kubernetes Authors. - -Licensed under the Apache License, Version 2.0 (the "License"); -you may not use this file except in compliance with the License. -You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - -Unless required by applicable law or agreed to in writing, software -distributed under the License is distributed on an "AS IS" BASIS, -WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -See the License for the specific language governing permissions and -limitations under the License. -*/ - -package mounter - -import ( - "context" - "fmt" - "os" - filepath "path/filepath" - "strings" - - fsv1alpha1 "github.com/kubernetes-csi/csi-proxy/client/api/filesystem/v1alpha1" - fsclientv1alpha1 "github.com/kubernetes-csi/csi-proxy/client/groups/filesystem/v1alpha1" - - smbv1alpha1 "github.com/kubernetes-csi/csi-proxy/client/api/smb/v1alpha1" - smbclientv1alpha1 "github.com/kubernetes-csi/csi-proxy/client/groups/smb/v1alpha1" - - "k8s.io/klog/v2" - utilexec "k8s.io/utils/exec" - "k8s.io/utils/mount" -) - -var _ mount.Interface = &CSIProxyMounter{} - -type CSIProxyMounter struct { - FsClient *fsclientv1alpha1.Client - SMBClient *smbclientv1alpha1.Client -} - -func normalizeWindowsPath(path string) string { - normalizedPath := strings.Replace(path, "/", "\\", -1) - if strings.HasPrefix(normalizedPath, "\\") { - normalizedPath = "c:" + normalizedPath - } - return normalizedPath -} - -func (mounter *CSIProxyMounter) SMBMount(source, target, fsType string, mountOptions, sensitiveMountOptions []string) error { - klog.V(4).Infof("SMBMount: remote path: %s. local path: %s", source, target) - - if len(mountOptions) == 0 || len(sensitiveMountOptions) == 0 { - return fmt.Errorf("empty mountOptions(len: %d) or sensitiveMountOptions(len: %d) is not allowed", len(mountOptions), len(sensitiveMountOptions)) - } - - parentDir := filepath.Dir(target) - parentExists, err := mounter.ExistsPath(parentDir) - if err != nil { - return fmt.Errorf("parent dir: %s exist check failed with err: %v", parentDir, err) - } - - if !parentExists { - klog.Infof("Parent directory %s does not exists. Creating the directory", parentDir) - err := mounter.MakeDir(parentDir) - if err != nil { - return fmt.Errorf("create of parent dir: %s dailed with error: %v", parentDir, err) - } - } - - smbMountRequest := &smbv1alpha1.NewSmbGlobalMappingRequest{ - LocalPath: normalizeWindowsPath(target), - RemotePath: source, - Username: mountOptions[0], - Password: sensitiveMountOptions[0], - } - _, err = mounter.SMBClient.NewSmbGlobalMapping(context.Background(), smbMountRequest) - if err != nil { - return fmt.Errorf("smb mapping failed with error: %v", err) - } - return nil -} - -func (mounter *CSIProxyMounter) SMBUnmount(target string) error { - klog.V(4).Infof("SMBUnmount: local path: %s", target) - // TODO: We need to remove the SMB mapping. The change to remove the - // directory brings the CSI code in parity with the in-tree. - return mounter.Rmdir(target) -} - -// Mount just creates a soft link at target pointing to source. -func (mounter *CSIProxyMounter) Mount(source string, target string, fstype string, options []string) error { - klog.V(4).Infof("Mount: old name: %s. new name: %s", source, target) - // Mount is called after the format is done. - // TODO: Confirm that fstype is empty. - linkRequest := &fsv1alpha1.LinkPathRequest{ - SourcePath: normalizeWindowsPath(source), - TargetPath: normalizeWindowsPath(target), - } - _, err := mounter.FsClient.LinkPath(context.Background(), linkRequest) - if err != nil { - return err - } - return nil -} - -// Rmdir - delete the given directory -// TODO: Call separate rmdir for pod context and plugin context. v1alpha1 for CSI -// proxy does a relaxed check for prefix as c:\var\lib\kubelet, so we can do -// rmdir with either pod or plugin context. -func (mounter *CSIProxyMounter) Rmdir(path string) error { - klog.V(4).Infof("Remove directory: %s", path) - rmdirRequest := &fsv1alpha1.RmdirRequest{ - Path: normalizeWindowsPath(path), - Context: fsv1alpha1.PathContext_POD, - Force: true, - } - _, err := mounter.FsClient.Rmdir(context.Background(), rmdirRequest) - if err != nil { - return err - } - return nil -} - -// Unmount - Removes the directory - equivalent to unmount on Linux. -func (mounter *CSIProxyMounter) Unmount(target string) error { - klog.V(4).Infof("Unmount: %s", target) - return mounter.Rmdir(target) -} - -func (mounter *CSIProxyMounter) List() ([]mount.MountPoint, error) { - return []mount.MountPoint{}, fmt.Errorf("List not implemented for CSIProxyMounter") -} - -func (mounter *CSIProxyMounter) IsMountPointMatch(mp mount.MountPoint, dir string) bool { - return mp.Path == dir -} - -// IsLikelyMountPoint - If the directory does not exists, the function will return os.ErrNotExist error. -// If the path exists, call to CSI proxy will check if its a link, if its a link then existence of target -// path is checked. -func (mounter *CSIProxyMounter) IsLikelyNotMountPoint(path string) (bool, error) { - klog.V(4).Infof("IsLikelyNotMountPoint: %s", path) - isExists, err := mounter.ExistsPath(path) - if err != nil { - return false, err - } - if !isExists { - return true, os.ErrNotExist - } - - response, err := mounter.FsClient.IsMountPoint(context.Background(), - &fsv1alpha1.IsMountPointRequest{ - Path: normalizeWindowsPath(path), - }) - if err != nil { - return false, err - } - return !response.IsMountPoint, nil -} - -func (mounter *CSIProxyMounter) PathIsDevice(pathname string) (bool, error) { - return false, fmt.Errorf("PathIsDevice not implemented for CSIProxyMounter") -} - -func (mounter *CSIProxyMounter) DeviceOpened(pathname string) (bool, error) { - return false, fmt.Errorf("DeviceOpened not implemented for CSIProxyMounter") -} - -func (mounter *CSIProxyMounter) GetDeviceNameFromMount(mountPath, pluginMountDir string) (string, error) { - return "", fmt.Errorf("GetDeviceNameFromMount not implemented for CSIProxyMounter") -} - -func (mounter *CSIProxyMounter) MakeRShared(path string) error { - return fmt.Errorf("MakeRShared not implemented for CSIProxyMounter") -} - -func (mounter *CSIProxyMounter) MakeFile(pathname string) error { - return fmt.Errorf("MakeFile not implemented for CSIProxyMounter") -} - -// MakeDir - Creates a directory. The CSI proxy takes in context information. -// Currently the make dir is only used from the staging code path, hence we call it -// with Plugin context.. -func (mounter *CSIProxyMounter) MakeDir(path string) error { - klog.V(4).Infof("Make directory: %s", path) - mkdirReq := &fsv1alpha1.MkdirRequest{ - Path: normalizeWindowsPath(path), - Context: fsv1alpha1.PathContext_PLUGIN, - } - _, err := mounter.FsClient.Mkdir(context.Background(), mkdirReq) - if err != nil { - return err - } - - return nil -} - -// ExistsPath - Checks if a path exists. Unlike util ExistsPath, this call does not perform follow link. -func (mounter *CSIProxyMounter) ExistsPath(path string) (bool, error) { - klog.V(4).Infof("Exists path: %s", path) - isExistsResponse, err := mounter.FsClient.PathExists(context.Background(), - &fsv1alpha1.PathExistsRequest{ - Path: normalizeWindowsPath(path), - }) - return isExistsResponse.Exists, err -} - -func (mounter *CSIProxyMounter) EvalHostSymlinks(pathname string) (string, error) { - return "", fmt.Errorf("EvalHostSymlinks not implemented for CSIProxyMounter") -} - -func (mounter *CSIProxyMounter) GetMountRefs(pathname string) ([]string, error) { - return []string{}, fmt.Errorf("GetMountRefs not implemented for CSIProxyMounter") -} - -func (mounter *CSIProxyMounter) GetFSGroup(pathname string) (int64, error) { - return -1, fmt.Errorf("GetFSGroup not implemented for CSIProxyMounter") -} - -func (mounter *CSIProxyMounter) GetSELinuxSupport(pathname string) (bool, error) { - return false, fmt.Errorf("GetSELinuxSupport not implemented for CSIProxyMounter") -} - -func (mounter *CSIProxyMounter) GetMode(pathname string) (os.FileMode, error) { - return 0, fmt.Errorf("GetMode not implemented for CSIProxyMounter") -} - -func (mounter *CSIProxyMounter) MountSensitive(source string, target string, fstype string, options []string, sensitiveOptions []string) error { - return fmt.Errorf("MountSensitive not implemented for CSIProxyMounter") -} - -// NewCSIProxyMounter - creates a new CSI Proxy mounter struct which encompassed all the -// clients to the CSI proxy - filesystem, disk and volume clients. -func NewCSIProxyMounter() (*CSIProxyMounter, error) { - fsClient, err := fsclientv1alpha1.NewClient() - if err != nil { - return nil, err - } - smbClient, err := smbclientv1alpha1.NewClient() - if err != nil { - return nil, err - } - - return &CSIProxyMounter{ - FsClient: fsClient, - SMBClient: smbClient, - }, nil -} - -func NewSafeMounter() (*mount.SafeFormatAndMount, error) { - csiProxyMounter, err := NewCSIProxyMounter() - if err != nil { - return nil, err - } - return &mount.SafeFormatAndMount{ - Interface: csiProxyMounter, - Exec: utilexec.New(), - }, nil -} diff --git a/vendor/github.com/kubernetes-csi/csi-driver-smb/pkg/smb/controllerserver.go b/vendor/github.com/kubernetes-csi/csi-driver-smb/pkg/smb/controllerserver.go deleted file mode 100644 index 133f8c6bf..000000000 --- a/vendor/github.com/kubernetes-csi/csi-driver-smb/pkg/smb/controllerserver.go +++ /dev/null @@ -1,107 +0,0 @@ -/* -Copyright 2017 The Kubernetes Authors. - -Licensed under the Apache License, Version 2.0 (the "License"); -you may not use this file except in compliance with the License. -You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - -Unless required by applicable law or agreed to in writing, software -distributed under the License is distributed on an "AS IS" BASIS, -WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -See the License for the specific language governing permissions and -limitations under the License. -*/ - -package smb - -import ( - "context" - - "github.com/container-storage-interface/spec/lib/go/csi" - "google.golang.org/grpc/codes" - "google.golang.org/grpc/status" -) - -// CreateVolume only supports static provisioning, no create volume action -func (d *Driver) CreateVolume(ctx context.Context, req *csi.CreateVolumeRequest) (*csi.CreateVolumeResponse, error) { - volumeCapabilities := req.GetVolumeCapabilities() - if len(volumeCapabilities) == 0 { - return nil, status.Error(codes.InvalidArgument, "CreateVolume Volume capabilities must be provided") - } - return &csi.CreateVolumeResponse{ - Volume: &csi.Volume{ - VolumeId: req.GetName(), - CapacityBytes: req.GetCapacityRange().GetRequiredBytes(), - VolumeContext: req.GetParameters(), - }, - }, nil -} - -// DeleteVolume only supports static provisioning, no delete volume action -func (d *Driver) DeleteVolume(ctx context.Context, req *csi.DeleteVolumeRequest) (*csi.DeleteVolumeResponse, error) { - if len(req.GetVolumeId()) == 0 { - return nil, status.Error(codes.InvalidArgument, "Volume ID missing in request") - } - return &csi.DeleteVolumeResponse{}, nil -} - -// ControllerGetVolume get volume -func (d *Driver) ControllerGetVolume(context.Context, *csi.ControllerGetVolumeRequest) (*csi.ControllerGetVolumeResponse, error) { - return nil, status.Error(codes.Unimplemented, "") -} - -func (d *Driver) ControllerPublishVolume(ctx context.Context, req *csi.ControllerPublishVolumeRequest) (*csi.ControllerPublishVolumeResponse, error) { - return nil, status.Error(codes.Unimplemented, "") -} - -func (d *Driver) ControllerUnpublishVolume(ctx context.Context, req *csi.ControllerUnpublishVolumeRequest) (*csi.ControllerUnpublishVolumeResponse, error) { - return nil, status.Error(codes.Unimplemented, "") -} - -// ControllerGetCapabilities returns the capabilities of the Controller plugin -func (d *Driver) ControllerGetCapabilities(ctx context.Context, req *csi.ControllerGetCapabilitiesRequest) (*csi.ControllerGetCapabilitiesResponse, error) { - return &csi.ControllerGetCapabilitiesResponse{ - Capabilities: d.Cap, - }, nil -} - -func (d *Driver) ValidateVolumeCapabilities(ctx context.Context, req *csi.ValidateVolumeCapabilitiesRequest) (*csi.ValidateVolumeCapabilitiesResponse, error) { - if len(req.GetVolumeId()) == 0 { - return nil, status.Error(codes.InvalidArgument, "Volume ID missing in request") - } - if req.GetVolumeCapabilities() == nil { - return nil, status.Error(codes.InvalidArgument, "Volume capabilities missing in request") - } - - // supports all AccessModes, no need to check capabilities here - return &csi.ValidateVolumeCapabilitiesResponse{Message: ""}, nil -} - -// GetCapacity returns the capacity of the total available storage pool -func (d *Driver) GetCapacity(ctx context.Context, req *csi.GetCapacityRequest) (*csi.GetCapacityResponse, error) { - return nil, status.Error(codes.Unimplemented, "") -} - -// ListVolumes return all available volumes -func (d *Driver) ListVolumes(ctx context.Context, req *csi.ListVolumesRequest) (*csi.ListVolumesResponse, error) { - return nil, status.Error(codes.Unimplemented, "") -} - -// ControllerExpandVolume expand volume -func (d *Driver) ControllerExpandVolume(ctx context.Context, req *csi.ControllerExpandVolumeRequest) (*csi.ControllerExpandVolumeResponse, error) { - return nil, status.Error(codes.Unimplemented, "") -} - -func (d *Driver) CreateSnapshot(ctx context.Context, req *csi.CreateSnapshotRequest) (*csi.CreateSnapshotResponse, error) { - return nil, status.Error(codes.Unimplemented, "") -} - -func (d *Driver) DeleteSnapshot(ctx context.Context, req *csi.DeleteSnapshotRequest) (*csi.DeleteSnapshotResponse, error) { - return nil, status.Error(codes.Unimplemented, "") -} - -func (d *Driver) ListSnapshots(ctx context.Context, req *csi.ListSnapshotsRequest) (*csi.ListSnapshotsResponse, error) { - return nil, status.Error(codes.Unimplemented, "") -} diff --git a/vendor/github.com/kubernetes-csi/csi-driver-smb/pkg/smb/fake_mounter.go b/vendor/github.com/kubernetes-csi/csi-driver-smb/pkg/smb/fake_mounter.go deleted file mode 100644 index 1a63713cd..000000000 --- a/vendor/github.com/kubernetes-csi/csi-driver-smb/pkg/smb/fake_mounter.go +++ /dev/null @@ -1,72 +0,0 @@ -/* -Copyright 2020 The Kubernetes Authors. - -Licensed under the Apache License, Version 2.0 (the "License"); -you may not use this file except in compliance with the License. -You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - -Unless required by applicable law or agreed to in writing, software -distributed under the License is distributed on an "AS IS" BASIS, -WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -See the License for the specific language governing permissions and -limitations under the License. -*/ - -package smb - -import ( - "fmt" - "github.com/kubernetes-csi/csi-driver-smb/pkg/mounter" - "runtime" - "strings" - - "k8s.io/utils/mount" -) - -type fakeMounter struct { - mount.FakeMounter -} - -// Mount overrides mount.FakeMounter.Mount. -func (f *fakeMounter) Mount(source string, target string, fstype string, options []string) error { - if strings.Contains(source, "error_mount") { - return fmt.Errorf("fake Mount: source error") - } else if strings.Contains(target, "error_mount") { - return fmt.Errorf("fake Mount: target error") - } - - return nil -} - -// MountSensitive overrides mount.FakeMounter.MountSensitive. -func (f *fakeMounter) MountSensitive(source string, target string, fstype string, options []string, sensitiveOptions []string) error { - if strings.Contains(source, "error_mount_sens") { - return fmt.Errorf("fake MountSensitive: source error") - } else if strings.Contains(target, "error_mount_sens") { - return fmt.Errorf("fake MountSensitive: target error") - } - - return nil -} - -//IsLikelyNotMountPoint overrides mount.FakeMounter.IsLikelyNotMountPoint. -func (f *fakeMounter) IsLikelyNotMountPoint(file string) (bool, error) { - if strings.Contains(file, "error_is_likely") { - return false, fmt.Errorf("fake IsLikelyNotMountPoint: fake error") - } - if strings.Contains(file, "false_is_likely") { - return false, nil - } - return true, nil -} - -func NewFakeMounter() (*mount.SafeFormatAndMount, error) { - if runtime.GOOS == "windows" { - return mounter.NewSafeMounter() - } - return &mount.SafeFormatAndMount{ - Interface: &fakeMounter{}, - }, nil -} diff --git a/vendor/github.com/kubernetes-csi/csi-driver-smb/pkg/smb/identityserver.go b/vendor/github.com/kubernetes-csi/csi-driver-smb/pkg/smb/identityserver.go deleted file mode 100644 index db8025f23..000000000 --- a/vendor/github.com/kubernetes-csi/csi-driver-smb/pkg/smb/identityserver.go +++ /dev/null @@ -1,70 +0,0 @@ -/* -Copyright 2017 The Kubernetes Authors. - -Licensed under the Apache License, Version 2.0 (the "License"); -you may not use this file except in compliance with the License. -You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - -Unless required by applicable law or agreed to in writing, software -distributed under the License is distributed on an "AS IS" BASIS, -WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -See the License for the specific language governing permissions and -limitations under the License. -*/ - -package smb - -import ( - "context" - - "google.golang.org/grpc/codes" - "google.golang.org/grpc/status" - - "github.com/container-storage-interface/spec/lib/go/csi" - "github.com/golang/protobuf/ptypes/wrappers" - "k8s.io/klog/v2" -) - -// GetPluginInfo return the version and name of the plugin -func (f *Driver) GetPluginInfo(ctx context.Context, req *csi.GetPluginInfoRequest) (*csi.GetPluginInfoResponse, error) { - klog.V(2).Infof("Using default GetPluginInfo") - - if f.Name == "" { - return nil, status.Error(codes.Unavailable, "Driver name not configured") - } - - if f.Version == "" { - return nil, status.Error(codes.Unavailable, "Driver is missing version") - } - - return &csi.GetPluginInfoResponse{ - Name: f.Name, - VendorVersion: f.Version, - }, nil -} - -// Probe check whether the plugin is running or not. -// This method does not need to return anything. -// Currently the spec does not dictate what you should return either. -// Hence, return an empty response -func (f *Driver) Probe(ctx context.Context, req *csi.ProbeRequest) (*csi.ProbeResponse, error) { - return &csi.ProbeResponse{Ready: &wrappers.BoolValue{Value: true}}, nil -} - -// GetPluginCapabilities returns the capabilities of the plugin -func (f *Driver) GetPluginCapabilities(ctx context.Context, req *csi.GetPluginCapabilitiesRequest) (*csi.GetPluginCapabilitiesResponse, error) { - klog.V(2).Infof("Using default capabilities") - return &csi.GetPluginCapabilitiesResponse{ - Capabilities: []*csi.PluginCapability{ - { - Type: &csi.PluginCapability_Service_{ - Service: &csi.PluginCapability_Service{ - Type: csi.PluginCapability_Service_CONTROLLER_SERVICE, - }, - }, - }, - }, - }, nil -} diff --git a/vendor/github.com/kubernetes-csi/csi-driver-smb/pkg/smb/nodeserver.go b/vendor/github.com/kubernetes-csi/csi-driver-smb/pkg/smb/nodeserver.go deleted file mode 100644 index 85b2d0f42..000000000 --- a/vendor/github.com/kubernetes-csi/csi-driver-smb/pkg/smb/nodeserver.go +++ /dev/null @@ -1,317 +0,0 @@ -/* -Copyright 2017 The Kubernetes Authors. - -Licensed under the Apache License, Version 2.0 (the "License"); -you may not use this file except in compliance with the License. -You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - -Unless required by applicable law or agreed to in writing, software -distributed under the License is distributed on an "AS IS" BASIS, -WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -See the License for the specific language governing permissions and -limitations under the License. -*/ - -package smb - -import ( - "fmt" - "io/ioutil" - "os" - "path/filepath" - "runtime" - "strings" - "time" - - "github.com/container-storage-interface/spec/lib/go/csi" - - "k8s.io/apimachinery/pkg/util/wait" - "k8s.io/klog/v2" - - "google.golang.org/grpc/codes" - "google.golang.org/grpc/status" - - "golang.org/x/net/context" -) - -const ( - usernameField = "username" - passwordField = "password" - sourceField = "source" - domainField = "domain" - defaultNetworkName = "AZURE" -) - -// NodePublishVolume mount the volume from staging to target path -func (d *Driver) NodePublishVolume(ctx context.Context, req *csi.NodePublishVolumeRequest) (*csi.NodePublishVolumeResponse, error) { - if req.GetVolumeCapability() == nil { - return nil, status.Error(codes.InvalidArgument, "Volume capability missing in request") - } - if len(req.GetVolumeId()) == 0 { - return nil, status.Error(codes.InvalidArgument, "Volume ID missing in request") - } - - target := req.GetTargetPath() - if len(target) == 0 { - return nil, status.Error(codes.InvalidArgument, "Target path not provided") - } - - source := req.GetStagingTargetPath() - if len(source) == 0 { - return nil, status.Error(codes.InvalidArgument, "Staging target not provided") - } - - mountOptions := []string{"bind"} - if req.GetReadonly() { - mountOptions = append(mountOptions, "ro") - } - - mnt, err := d.ensureMountPoint(target) - if err != nil { - return nil, status.Errorf(codes.Internal, "Could not mount target %q: %v", target, err) - } - if mnt { - klog.V(2).Infof("NodePublishVolume: %s is already mounted", target) - return &csi.NodePublishVolumeResponse{}, nil - } - - if err = preparePublishPath(target, d.mounter); err != nil { - return nil, fmt.Errorf("prepare publish failed for %s with error: %v", target, err) - } - - context := req.GetVolumeContext() - var createSubDir string - for k, v := range context { - switch strings.ToLower(k) { - case createSubDirField: - createSubDir = v - } - } - - if strings.EqualFold(createSubDir, "true") { - source = filepath.Join(source, req.GetVolumeId()) - klog.V(2).Infof("NodePublishVolume: createSubDir(%s) MkdirAll(%s)", createSubDir, source) - if err := Mkdir(d.mounter, source, 0750); err != nil { - if os.IsExist(err) { - klog.Warningf("Mkdir(%s) failed with error: %v", source, err) - } else { - return nil, status.Errorf(codes.Internal, "Mkdir(%s) failed with error: %v", source, err) - } - } - } - - klog.V(2).Infof("NodePublishVolume: mounting %s at %s with mountOptions: %v", source, target, mountOptions) - if err := d.mounter.Mount(source, target, "", mountOptions); err != nil { - if removeErr := os.Remove(target); removeErr != nil { - return nil, status.Errorf(codes.Internal, "Could not remove mount target %q: %v", target, removeErr) - } - return nil, status.Errorf(codes.Internal, "Could not mount %q at %q: %v", source, target, err) - } - klog.V(2).Infof("NodePublishVolume: mount %s at %s successfully", source, target) - - return &csi.NodePublishVolumeResponse{}, nil -} - -// NodeUnpublishVolume unmount the volume from the target path -func (d *Driver) NodeUnpublishVolume(ctx context.Context, req *csi.NodeUnpublishVolumeRequest) (*csi.NodeUnpublishVolumeResponse, error) { - klog.V(2).Infof("NodeUnPublishVolume: called with args %+v", *req) - if len(req.GetVolumeId()) == 0 { - return nil, status.Error(codes.InvalidArgument, "Volume ID missing in request") - } - if len(req.GetTargetPath()) == 0 { - return nil, status.Error(codes.InvalidArgument, "Target path missing in request") - } - targetPath := req.GetTargetPath() - volumeID := req.GetVolumeId() - - klog.V(2).Infof("NodeUnpublishVolume: unmounting volume %s on %s", volumeID, targetPath) - err := CleanupMountPoint(d.mounter, targetPath, false) - if err != nil { - return nil, status.Errorf(codes.Internal, "failed to unmount target %q: %v", targetPath, err) - } - klog.V(2).Infof("NodeUnpublishVolume: unmount volume %s on %s successfully", volumeID, targetPath) - - return &csi.NodeUnpublishVolumeResponse{}, nil -} - -// NodeStageVolume mount the volume to a staging path -func (d *Driver) NodeStageVolume(ctx context.Context, req *csi.NodeStageVolumeRequest) (*csi.NodeStageVolumeResponse, error) { - if len(req.GetVolumeId()) == 0 { - return nil, status.Error(codes.InvalidArgument, "Volume ID missing in request") - } - - volumeCapability := req.GetVolumeCapability() - if volumeCapability == nil { - return nil, status.Error(codes.InvalidArgument, "Volume capability not provided") - } - - targetPath := req.GetStagingTargetPath() - if len(targetPath) == 0 { - return nil, status.Error(codes.InvalidArgument, "Staging target not provided") - } - - volumeID := req.GetVolumeId() - context := req.GetVolumeContext() - mountFlags := req.GetVolumeCapability().GetMount().GetMountFlags() - secrets := req.GetSecrets() - - source, ok := context[sourceField] - if !ok { - return nil, status.Error(codes.InvalidArgument, fmt.Sprintf("%s field is missing, current context: %v", sourceField, context)) - } - - var username, password, domain string - for k, v := range secrets { - switch strings.ToLower(k) { - case usernameField: - username = strings.TrimSpace(v) - case passwordField: - password = strings.TrimSpace(v) - case domainField: - domain = strings.TrimSpace(v) - } - } - - var mountOptions, sensitiveMountOptions []string - if runtime.GOOS == "windows" { - if !strings.Contains(username, "\\") { - username = fmt.Sprintf("%s\\%s", defaultNetworkName, username) - } - mountOptions = []string{username} - sensitiveMountOptions = []string{password} - } else { - if err := os.MkdirAll(targetPath, 0750); err != nil { - return nil, status.Error(codes.Internal, fmt.Sprintf("MkdirAll %s failed with error: %v", targetPath, err)) - } - sensitiveMountOptions = []string{fmt.Sprintf("%s=%s,%s=%s", usernameField, username, passwordField, password)} - mountOptions = mountFlags - } - if domain != "" { - mountOptions = append(mountOptions, fmt.Sprintf("%s=%s", domainField, domain)) - } - - klog.V(2).Infof("targetPath(%v) volumeID(%v) context(%v) mountflags(%v) mountOptions(%v)", - targetPath, volumeID, context, mountFlags, mountOptions) - - isDirMounted, err := d.ensureMountPoint(targetPath) - if err != nil { - return nil, status.Errorf(codes.Internal, "Could not mount target %s: %v", targetPath, err) - } - - if !isDirMounted { - if err = prepareStagePath(targetPath, d.mounter); err != nil { - return nil, fmt.Errorf("prepare stage path failed for %s with error: %v", targetPath, err) - } - mountComplete := false - err = wait.PollImmediate(1*time.Second, 2*time.Minute, func() (bool, error) { - err := Mount(d.mounter, source, targetPath, "cifs", mountOptions, sensitiveMountOptions) - mountComplete = true - return true, err - }) - if !mountComplete { - return nil, status.Error(codes.Internal, fmt.Sprintf("volume(%s) mount %q on %q failed with timeout(10m)", volumeID, source, targetPath)) - } - if err != nil { - return nil, status.Error(codes.Internal, fmt.Sprintf("volume(%s) mount %q on %q failed with %v", volumeID, source, targetPath, err)) - } - klog.V(2).Infof("volume(%s) mount %q on %q succeeded", volumeID, source, targetPath) - } - - return &csi.NodeStageVolumeResponse{}, nil -} - -// NodeUnstageVolume unmount the volume from the staging path -func (d *Driver) NodeUnstageVolume(ctx context.Context, req *csi.NodeUnstageVolumeRequest) (*csi.NodeUnstageVolumeResponse, error) { - klog.V(2).Infof("NodeUnstageVolume: called with args %+v", *req) - if len(req.GetVolumeId()) == 0 { - return nil, status.Error(codes.InvalidArgument, "Volume ID missing in request") - } - stagingTargetPath := req.GetStagingTargetPath() - if len(stagingTargetPath) == 0 { - return nil, status.Error(codes.InvalidArgument, "Staging target not provided") - } - - klog.V(2).Infof("NodeUnstageVolume: CleanupMountPoint %s", stagingTargetPath) - if err := CleanupSMBMountPoint(d.mounter, stagingTargetPath, false); err != nil { - return nil, status.Errorf(codes.Internal, "failed to unmount staging target %q: %v", stagingTargetPath, err) - } - - klog.V(2).Infof("NodeUnstageVolume: unmount %s successfully", stagingTargetPath) - - return &csi.NodeUnstageVolumeResponse{}, nil -} - -// NodeGetCapabilities return the capabilities of the Node plugin -func (d *Driver) NodeGetCapabilities(ctx context.Context, req *csi.NodeGetCapabilitiesRequest) (*csi.NodeGetCapabilitiesResponse, error) { - return &csi.NodeGetCapabilitiesResponse{ - Capabilities: d.NSCap, - }, nil -} - -// NodeGetInfo return info of the node on which this plugin is running -func (d *Driver) NodeGetInfo(ctx context.Context, req *csi.NodeGetInfoRequest) (*csi.NodeGetInfoResponse, error) { - return &csi.NodeGetInfoResponse{ - NodeId: d.NodeID, - }, nil -} - -// NodeGetVolumeStats get volume stats -func (d *Driver) NodeGetVolumeStats(ctx context.Context, in *csi.NodeGetVolumeStatsRequest) (*csi.NodeGetVolumeStatsResponse, error) { - return nil, status.Error(codes.Unimplemented, "") -} - -// NodeExpandVolume node expand volume -// N/A for smb -func (d *Driver) NodeExpandVolume(ctx context.Context, req *csi.NodeExpandVolumeRequest) (*csi.NodeExpandVolumeResponse, error) { - return nil, status.Error(codes.Unimplemented, "") -} - -// ensureMountPoint: create mount point if not exists -// return if it's already a mounted point otherwise return -func (d *Driver) ensureMountPoint(target string) (bool, error) { - notMnt, err := d.mounter.IsLikelyNotMountPoint(target) - if err != nil && !os.IsNotExist(err) { - if IsCorruptedDir(target) { - notMnt = false - klog.Warningf("detected corrupted mount for targetPath [%s]", target) - } else { - return !notMnt, err - } - } - - if !notMnt { - // testing original mount point, make sure the mount link is valid - _, err := ioutil.ReadDir(target) - if err == nil { - klog.V(2).Infof("already mounted to target %s", target) - return !notMnt, nil - } - // mount link is invalid, now unmount and remount later - klog.Warningf("ReadDir %s failed with %v, unmount this directory", target, err) - if err := d.mounter.Unmount(target); err != nil { - klog.Errorf("Unmount directory %s failed with %v", target, err) - return !notMnt, err - } - notMnt = true - return !notMnt, err - } - - if err := makeDir(target); err != nil { - klog.Errorf("MakeDir failed on target: %s (%v)", target, err) - return !notMnt, err - } - - return false, nil -} - -func makeDir(pathname string) error { - err := os.MkdirAll(pathname, os.FileMode(0755)) - if err != nil { - if !os.IsExist(err) { - return err - } - } - return nil -} diff --git a/vendor/github.com/kubernetes-csi/csi-driver-smb/pkg/smb/smb.go b/vendor/github.com/kubernetes-csi/csi-driver-smb/pkg/smb/smb.go deleted file mode 100644 index c934054f3..000000000 --- a/vendor/github.com/kubernetes-csi/csi-driver-smb/pkg/smb/smb.go +++ /dev/null @@ -1,93 +0,0 @@ -/* -Copyright 2019 The Kubernetes Authors. - -Licensed under the Apache License, Version 2.0 (the "License"); -you may not use this file except in compliance with the License. -You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - -Unless required by applicable law or agreed to in writing, software -distributed under the License is distributed on an "AS IS" BASIS, -WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -See the License for the specific language governing permissions and -limitations under the License. -*/ - -package smb - -import ( - "fmt" - - "github.com/container-storage-interface/spec/lib/go/csi" - - "k8s.io/klog/v2" - "k8s.io/utils/mount" - - csicommon "github.com/kubernetes-csi/csi-driver-smb/pkg/csi-common" - "github.com/kubernetes-csi/csi-driver-smb/pkg/mounter" -) - -const ( - DriverName = "smb.csi.k8s.io" - createSubDirField = "createsubdir" -) - -// Driver implements all interfaces of CSI drivers -type Driver struct { - csicommon.CSIDriver - mounter *mount.SafeFormatAndMount -} - -// NewDriver Creates a NewCSIDriver object. Assumes vendor version is equal to driver version & -// does not support optional driver plugin info manifest field. Refer to CSI spec for more details. -func NewDriver(nodeID string) *Driver { - driver := Driver{} - driver.Name = DriverName - driver.Version = driverVersion - driver.NodeID = nodeID - return &driver -} - -// Run driver initialization -func (d *Driver) Run(endpoint, kubeconfig string, testMode bool) { - versionMeta, err := GetVersionYAML() - if err != nil { - klog.Fatalf("%v", err) - } - klog.Infof("\nDRIVER INFORMATION:\n-------------------\n%s\n\nStreaming logs below:", versionMeta) - - d.mounter, err = mounter.NewSafeMounter() - if err != nil { - klog.Fatalf("Failed to get safe mounter. Error: %v", err) - } - - // Initialize default library driver - d.AddControllerServiceCapabilities( - []csi.ControllerServiceCapability_RPC_Type{ - csi.ControllerServiceCapability_RPC_CREATE_DELETE_VOLUME, - }) - - d.AddVolumeCapabilityAccessModes([]csi.VolumeCapability_AccessMode_Mode{ - csi.VolumeCapability_AccessMode_SINGLE_NODE_WRITER, - csi.VolumeCapability_AccessMode_SINGLE_NODE_READER_ONLY, - csi.VolumeCapability_AccessMode_MULTI_NODE_READER_ONLY, - csi.VolumeCapability_AccessMode_MULTI_NODE_SINGLE_WRITER, - csi.VolumeCapability_AccessMode_MULTI_NODE_MULTI_WRITER, - }) - - d.AddNodeServiceCapabilities([]csi.NodeServiceCapability_RPC_Type{ - csi.NodeServiceCapability_RPC_STAGE_UNSTAGE_VOLUME, - }) - - s := csicommon.NewNonBlockingGRPCServer() - // Driver d act as IdentityServer, ControllerServer and NodeServer - s.Start(endpoint, d, d, d, testMode) - s.Wait() -} - -func IsCorruptedDir(dir string) bool { - _, pathErr := mount.PathExists(dir) - fmt.Printf("IsCorruptedDir(%s) returned with error: %v", dir, pathErr) - return pathErr != nil && mount.IsCorruptedMnt(pathErr) -} diff --git a/vendor/github.com/kubernetes-csi/csi-driver-smb/pkg/smb/smb_common_darwin.go b/vendor/github.com/kubernetes-csi/csi-driver-smb/pkg/smb/smb_common_darwin.go deleted file mode 100644 index b32977e6c..000000000 --- a/vendor/github.com/kubernetes-csi/csi-driver-smb/pkg/smb/smb_common_darwin.go +++ /dev/null @@ -1,57 +0,0 @@ -// +build darwin - -/* -Copyright 2020 The Kubernetes Authors. - -Licensed under the Apache License, Version 2.0 (the "License"); -you may not use this file except in compliance with the License. -You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - -Unless required by applicable law or agreed to in writing, software -distributed under the License is distributed on an "AS IS" BASIS, -WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -See the License for the specific language governing permissions and -limitations under the License. -*/ - -package smb - -import ( - "os" - - "k8s.io/utils/mount" -) - -func Mount(m *mount.SafeFormatAndMount, source, target, fsType string, options []string, sensitiveMountOptions []string) error { - return m.MountSensitive(source, target, fsType, options, sensitiveMountOptions) -} - -func Unmount(m *mount.SafeFormatAndMount, target string) error { - return m.Unmount(target) -} - -func RemoveStageTarget(m *mount.SafeFormatAndMount, target string) error { - return os.Remove(target) -} - -func CleanupSMBMountPoint(m *mount.SafeFormatAndMount, target string, extensiveMountCheck bool) error { - return mount.CleanupMountPoint(target, m, extensiveMountCheck) -} - -func CleanupMountPoint(m *mount.SafeFormatAndMount, target string, extensiveMountCheck bool) error { - return mount.CleanupMountPoint(target, m, extensiveMountCheck) -} - -func preparePublishPath(path string, m *mount.SafeFormatAndMount) error { - return nil -} - -func prepareStagePath(path string, m *mount.SafeFormatAndMount) error { - return nil -} - -func Mkdir(m *mount.SafeFormatAndMount, name string, perm os.FileMode) error { - return os.Mkdir(name, perm) -} diff --git a/vendor/github.com/kubernetes-csi/csi-driver-smb/pkg/smb/smb_common_linux.go b/vendor/github.com/kubernetes-csi/csi-driver-smb/pkg/smb/smb_common_linux.go deleted file mode 100644 index 751a2ca74..000000000 --- a/vendor/github.com/kubernetes-csi/csi-driver-smb/pkg/smb/smb_common_linux.go +++ /dev/null @@ -1,57 +0,0 @@ -// +build linux - -/* -Copyright 2020 The Kubernetes Authors. - -Licensed under the Apache License, Version 2.0 (the "License"); -you may not use this file except in compliance with the License. -You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - -Unless required by applicable law or agreed to in writing, software -distributed under the License is distributed on an "AS IS" BASIS, -WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -See the License for the specific language governing permissions and -limitations under the License. -*/ - -package smb - -import ( - "os" - - "k8s.io/utils/mount" -) - -func Mount(m *mount.SafeFormatAndMount, source, target, fsType string, options, sensitiveMountOptions []string) error { - return m.MountSensitive(source, target, fsType, options, sensitiveMountOptions) -} - -func Unmount(m *mount.SafeFormatAndMount, target string) error { - return m.Unmount(target) -} - -func RemoveStageTarget(m *mount.SafeFormatAndMount, target string) error { - return os.Remove(target) -} - -func CleanupSMBMountPoint(m *mount.SafeFormatAndMount, target string, extensiveMountCheck bool) error { - return mount.CleanupMountPoint(target, m, extensiveMountCheck) -} - -func CleanupMountPoint(m *mount.SafeFormatAndMount, target string, extensiveMountCheck bool) error { - return mount.CleanupMountPoint(target, m, extensiveMountCheck) -} - -func preparePublishPath(path string, m *mount.SafeFormatAndMount) error { - return nil -} - -func prepareStagePath(path string, m *mount.SafeFormatAndMount) error { - return nil -} - -func Mkdir(m *mount.SafeFormatAndMount, name string, perm os.FileMode) error { - return os.Mkdir(name, perm) -} diff --git a/vendor/github.com/kubernetes-csi/csi-driver-smb/pkg/smb/smb_common_windows.go b/vendor/github.com/kubernetes-csi/csi-driver-smb/pkg/smb/smb_common_windows.go deleted file mode 100644 index a37bf7bdf..000000000 --- a/vendor/github.com/kubernetes-csi/csi-driver-smb/pkg/smb/smb_common_windows.go +++ /dev/null @@ -1,107 +0,0 @@ -// +build windows - -/* -Copyright 2020 The Kubernetes Authors. - -Licensed under the Apache License, Version 2.0 (the "License"); -you may not use this file except in compliance with the License. -You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - -Unless required by applicable law or agreed to in writing, software -distributed under the License is distributed on an "AS IS" BASIS, -WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -See the License for the specific language governing permissions and -limitations under the License. -*/ - -package smb - -import ( - "fmt" - "os" - - "github.com/kubernetes-csi/csi-driver-smb/pkg/mounter" - "k8s.io/klog/v2" - "k8s.io/utils/mount" -) - -func Mount(m *mount.SafeFormatAndMount, source, target, fsType string, mountOptions, sensitiveMountOptions []string) error { - proxy, ok := m.Interface.(*mounter.CSIProxyMounter) - if !ok { - return fmt.Errorf("could not cast to csi proxy class") - } - return proxy.SMBMount(source, target, fsType, mountOptions, sensitiveMountOptions) -} - -func Unmount(m *mount.SafeFormatAndMount, target string) error { - proxy, ok := m.Interface.(*mounter.CSIProxyMounter) - if !ok { - return fmt.Errorf("could not cast to csi proxy class") - } - return proxy.SMBUnmount(target) -} - -func RemoveStageTarget(m *mount.SafeFormatAndMount, target string) error { - proxy, ok := m.Interface.(*mounter.CSIProxyMounter) - if !ok { - return fmt.Errorf("could not cast to csi proxy class") - } - return proxy.Rmdir(target) -} - -// CleanupSMBMountPoint - In windows CSI proxy call to umount is used to unmount the SMB. -// The clean up mount point point calls is supposed for fix the corrupted directories as well. -// For alpha CSI proxy integration, we only do an unmount. -func CleanupSMBMountPoint(m *mount.SafeFormatAndMount, target string, extensiveMountCheck bool) error { - return Unmount(m, target) -} - -func CleanupMountPoint(m *mount.SafeFormatAndMount, target string, extensiveMountCheck bool) error { - proxy, ok := m.Interface.(*mounter.CSIProxyMounter) - if !ok { - return fmt.Errorf("could not cast to csi proxy class") - } - return proxy.Rmdir(target) -} - -func removeDir(path string, m *mount.SafeFormatAndMount) error { - proxy, ok := m.Interface.(*mounter.CSIProxyMounter) - if !ok { - return fmt.Errorf("could not cast to csi proxy class") - } - - isExists, err := proxy.ExistsPath(path) - if err != nil { - return err - } - - if isExists { - klog.V(4).Infof("Removing path: %s", path) - err = proxy.Rmdir(path) - if err != nil { - return err - } - } - return nil -} - -// preparePublishPath - In case of windows, the publish code path creates a soft link -// from global stage path to the publish path. But kubelet creates the directory in advance. -// We work around this issue by deleting the publish path then recreating the link. -func preparePublishPath(path string, m *mount.SafeFormatAndMount) error { - return removeDir(path, m) -} - -func prepareStagePath(path string, m *mount.SafeFormatAndMount) error { - return removeDir(path, m) -} - -func Mkdir(m *mount.SafeFormatAndMount, name string, perm os.FileMode) error { - proxy, ok := m.Interface.(*mounter.CSIProxyMounter) - if !ok { - return fmt.Errorf("could not cast to csi proxy class") - } - return proxy.MakeDir(name) -} diff --git a/vendor/github.com/kubernetes-csi/csi-driver-smb/pkg/smb/version.go b/vendor/github.com/kubernetes-csi/csi-driver-smb/pkg/smb/version.go deleted file mode 100644 index fec5db295..000000000 --- a/vendor/github.com/kubernetes-csi/csi-driver-smb/pkg/smb/version.go +++ /dev/null @@ -1,67 +0,0 @@ -/* -Copyright 2019 The Kubernetes Authors. - -Licensed under the Apache License, Version 2.0 (the "License"); -you may not use this file except in compliance with the License. -You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - -Unless required by applicable law or agreed to in writing, software -distributed under the License is distributed on an "AS IS" BASIS, -WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -See the License for the specific language governing permissions and -limitations under the License. -*/ - -package smb - -import ( - "fmt" - "runtime" - "strings" - - "sigs.k8s.io/yaml" -) - -// These are set during build time via -ldflags -var ( - driverVersion = "N/A" - gitCommit = "N/A" - buildDate = "N/A" -) - -// VersionInfo holds the version information of the driver -type VersionInfo struct { - DriverName string `json:"Driver Name"` - DriverVersion string `json:"Driver Version"` - GitCommit string `json:"Git Commit"` - BuildDate string `json:"Build Date"` - GoVersion string `json:"Go Version"` - Compiler string `json:"Compiler"` - Platform string `json:"Platform"` -} - -// GetVersion returns the version information of the driver -func GetVersion() VersionInfo { - return VersionInfo{ - DriverName: DriverName, - DriverVersion: driverVersion, - GitCommit: gitCommit, - BuildDate: buildDate, - GoVersion: runtime.Version(), - Compiler: runtime.Compiler, - Platform: fmt.Sprintf("%s/%s", runtime.GOOS, runtime.GOARCH), - } -} - -// GetVersionYAML returns the version information of the driver -// in YAML format -func GetVersionYAML() (string, error) { - info := GetVersion() - marshalled, err := yaml.Marshal(&info) - if err != nil { - return "", err - } - return strings.TrimSpace(string(marshalled)), nil -} diff --git a/vendor/github.com/kubernetes-csi/csi-driver-smb/test/e2e/driver/driver.go b/vendor/github.com/kubernetes-csi/csi-driver-smb/test/e2e/driver/driver.go deleted file mode 100644 index 6820aea1b..000000000 --- a/vendor/github.com/kubernetes-csi/csi-driver-smb/test/e2e/driver/driver.go +++ /dev/null @@ -1,100 +0,0 @@ -/* -Copyright 2020 The Kubernetes Authors. - -Licensed under the Apache License, Version 2.0 (the "License"); -you may not use this file except in compliance with the License. -You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - -Unless required by applicable law or agreed to in writing, software -distributed under the License is distributed on an "AS IS" BASIS, -WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -See the License for the specific language governing permissions and -limitations under the License. -*/ - -package driver - -import ( - "github.com/kubernetes-csi/external-snapshotter/v2/pkg/apis/volumesnapshot/v1beta1" - v1 "k8s.io/api/core/v1" - storagev1 "k8s.io/api/storage/v1" - metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" -) - -const ( - VolumeSnapshotClassKind = "VolumeSnapshotClass" - SnapshotAPIVersion = "snapshot.storage.k8s.io/v1beta1" -) - -type PVTestDriver interface { - DynamicPVTestDriver - PreProvisionedVolumeTestDriver - VolumeSnapshotTestDriver -} - -// DynamicPVTestDriver represents an interface for a CSI driver that supports DynamicPV -type DynamicPVTestDriver interface { - // GetDynamicProvisionStorageClass returns a StorageClass dynamic provision Persistent Volume - GetDynamicProvisionStorageClass(parameters map[string]string, mountOptions []string, reclaimPolicy *v1.PersistentVolumeReclaimPolicy, bindingMode *storagev1.VolumeBindingMode, allowedTopologyValues []string, namespace string) *storagev1.StorageClass -} - -// PreProvisionedVolumeTestDriver represents an interface for a CSI driver that supports pre-provisioned volume -type PreProvisionedVolumeTestDriver interface { - // GetPersistentVolume returns a PersistentVolume with pre-provisioned volumeHandle - GetPersistentVolume(volumeID string, fsType string, size string, reclaimPolicy *v1.PersistentVolumeReclaimPolicy, namespace string, attrib map[string]string, nodeStageSecretRef string) *v1.PersistentVolume - // GetPreProvisionStorageClass returns a StorageClass with existing file share - GetPreProvisionStorageClass(parameters map[string]string, mountOptions []string, reclaimPolicy *v1.PersistentVolumeReclaimPolicy, bindingMode *storagev1.VolumeBindingMode, allowedTopologyValues []string, namespace string) *storagev1.StorageClass -} - -type VolumeSnapshotTestDriver interface { - GetVolumeSnapshotClass(namespace string) *v1beta1.VolumeSnapshotClass -} - -func getStorageClass( - generateName string, - provisioner string, - parameters map[string]string, - mountOptions []string, - reclaimPolicy *v1.PersistentVolumeReclaimPolicy, - bindingMode *storagev1.VolumeBindingMode, - allowedTopologies []v1.TopologySelectorTerm, -) *storagev1.StorageClass { - if reclaimPolicy == nil { - defaultReclaimPolicy := v1.PersistentVolumeReclaimDelete - reclaimPolicy = &defaultReclaimPolicy - } - if bindingMode == nil { - defaultBindingMode := storagev1.VolumeBindingImmediate - bindingMode = &defaultBindingMode - } - allowVolumeExpansion := true - return &storagev1.StorageClass{ - ObjectMeta: metav1.ObjectMeta{ - GenerateName: generateName, - }, - Provisioner: provisioner, - Parameters: parameters, - MountOptions: mountOptions, - ReclaimPolicy: reclaimPolicy, - VolumeBindingMode: bindingMode, - AllowedTopologies: allowedTopologies, - AllowVolumeExpansion: &allowVolumeExpansion, - } -} - -func getVolumeSnapshotClass(generateName string, provisioner string) *v1beta1.VolumeSnapshotClass { - return &v1beta1.VolumeSnapshotClass{ - TypeMeta: metav1.TypeMeta{ - Kind: VolumeSnapshotClassKind, - APIVersion: SnapshotAPIVersion, - }, - - ObjectMeta: metav1.ObjectMeta{ - GenerateName: generateName, - }, - Driver: provisioner, - DeletionPolicy: v1beta1.VolumeSnapshotContentDelete, - } -} diff --git a/vendor/github.com/kubernetes-csi/csi-driver-smb/test/e2e/driver/smb_driver.go b/vendor/github.com/kubernetes-csi/csi-driver-smb/test/e2e/driver/smb_driver.go deleted file mode 100644 index 2954731b3..000000000 --- a/vendor/github.com/kubernetes-csi/csi-driver-smb/test/e2e/driver/smb_driver.go +++ /dev/null @@ -1,125 +0,0 @@ -/* -Copyright 2020 The Kubernetes Authors. - -Licensed under the Apache License, Version 2.0 (the "License"); -you may not use this file except in compliance with the License. -You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - -Unless required by applicable law or agreed to in writing, software -distributed under the License is distributed on an "AS IS" BASIS, -WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -See the License for the specific language governing permissions and -limitations under the License. -*/ - -package driver - -import ( - "fmt" - "os" - "strings" - - "github.com/kubernetes-csi/csi-driver-smb/pkg/smb" - "github.com/kubernetes-csi/external-snapshotter/v2/pkg/apis/volumesnapshot/v1beta1" - v1 "k8s.io/api/core/v1" - storagev1 "k8s.io/api/storage/v1" - "k8s.io/apimachinery/pkg/api/resource" - metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" - "k8s.io/klog/v2" -) - -// SMBDriverNameVar is the environment variable use to switch the driver to be used. -const SMBDriverNameVar = "SMB_CSI_DRIVER" - -// Implement DynamicPVTestDriver interface -type SMBDriver struct { - driverName string -} - -// InitSMBDriver returns SMBDriver that implements DynamicPVTestDriver interface -func InitSMBDriver() PVTestDriver { - driverName := os.Getenv(SMBDriverNameVar) - if driverName == "" { - driverName = smb.DriverName - } - - klog.Infof("Using smb driver: %s", driverName) - return &SMBDriver{ - driverName: driverName, - } -} - -// normalizeProvisioner extracts any '/' character in the provisioner name to '-'. -// StorageClass name cannot container '/' character. -func normalizeProvisioner(provisioner string) string { - return strings.ReplaceAll(provisioner, "/", "-") -} - -func (d *SMBDriver) GetDynamicProvisionStorageClass(parameters map[string]string, mountOptions []string, reclaimPolicy *v1.PersistentVolumeReclaimPolicy, bindingMode *storagev1.VolumeBindingMode, allowedTopologyValues []string, namespace string) *storagev1.StorageClass { - provisioner := d.driverName - generateName := fmt.Sprintf("%s-%s-dynamic-sc-", namespace, normalizeProvisioner(provisioner)) - return getStorageClass(generateName, provisioner, parameters, mountOptions, reclaimPolicy, bindingMode, nil) -} - -func (d *SMBDriver) GetPreProvisionStorageClass(parameters map[string]string, mountOptions []string, reclaimPolicy *v1.PersistentVolumeReclaimPolicy, bindingMode *storagev1.VolumeBindingMode, allowedTopologyValues []string, namespace string) *storagev1.StorageClass { - provisioner := d.driverName - generateName := fmt.Sprintf("%s-%s-pre-provisioned-sc-", namespace, provisioner) - return getStorageClass(generateName, provisioner, parameters, mountOptions, reclaimPolicy, bindingMode, nil) -} - -func (d *SMBDriver) GetVolumeSnapshotClass(namespace string) *v1beta1.VolumeSnapshotClass { - provisioner := d.driverName - generateName := fmt.Sprintf("%s-%s-dynamic-sc-", namespace, normalizeProvisioner(provisioner)) - return getVolumeSnapshotClass(generateName, provisioner) -} - -func (d *SMBDriver) GetPersistentVolume(volumeID string, fsType string, size string, reclaimPolicy *v1.PersistentVolumeReclaimPolicy, namespace string, attrib map[string]string, nodeStageSecretRef string) *v1.PersistentVolume { - provisioner := d.driverName - generateName := fmt.Sprintf("%s-%s-preprovsioned-pv-", namespace, normalizeProvisioner(provisioner)) - // Default to Retain ReclaimPolicy for pre-provisioned volumes - pvReclaimPolicy := v1.PersistentVolumeReclaimRetain - if reclaimPolicy != nil { - pvReclaimPolicy = *reclaimPolicy - } - stageSecretRef := &v1.SecretReference{} - if nodeStageSecretRef != "" { - stageSecretRef.Name = nodeStageSecretRef - stageSecretRef.Namespace = namespace - } else { - stageSecretRef = nil - } - return &v1.PersistentVolume{ - ObjectMeta: metav1.ObjectMeta{ - GenerateName: generateName, - Namespace: namespace, - // TODO remove if https://github.com/kubernetes-csi/external-provisioner/issues/202 is fixed - Annotations: map[string]string{ - "pv.kubernetes.io/provisioned-by": provisioner, - }, - }, - Spec: v1.PersistentVolumeSpec{ - AccessModes: []v1.PersistentVolumeAccessMode{v1.ReadWriteOnce}, - Capacity: v1.ResourceList{ - v1.ResourceName(v1.ResourceStorage): resource.MustParse(size), - }, - PersistentVolumeReclaimPolicy: pvReclaimPolicy, - PersistentVolumeSource: v1.PersistentVolumeSource{ - CSI: &v1.CSIPersistentVolumeSource{ - Driver: provisioner, - VolumeHandle: volumeID, - FSType: fsType, - VolumeAttributes: attrib, - NodeStageSecretRef: stageSecretRef, - }, - }, - }, - } -} - -func GetParameters() map[string]string { - return map[string]string{ - "skuName": "Standard_LRS", - } -} diff --git a/vendor/github.com/kubernetes-csi/csi-proxy/client/LICENSE b/vendor/github.com/kubernetes-csi/csi-proxy/client/LICENSE deleted file mode 100644 index 8dada3eda..000000000 --- a/vendor/github.com/kubernetes-csi/csi-proxy/client/LICENSE +++ /dev/null @@ -1,201 +0,0 @@ - Apache License - Version 2.0, January 2004 - http://www.apache.org/licenses/ - - TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION - - 1. Definitions. - - "License" shall mean the terms and conditions for use, reproduction, - and distribution as defined by Sections 1 through 9 of this document. - - "Licensor" shall mean the copyright owner or entity authorized by - the copyright owner that is granting the License. - - "Legal Entity" shall mean the union of the acting entity and all - other entities that control, are controlled by, or are under common - control with that entity. For the purposes of this definition, - "control" means (i) the power, direct or indirect, to cause the - direction or management of such entity, whether by contract or - otherwise, or (ii) ownership of fifty percent (50%) or more of the - outstanding shares, or (iii) beneficial ownership of such entity. - - "You" (or "Your") shall mean an individual or Legal Entity - exercising permissions granted by this License. - - "Source" form shall mean the preferred form for making modifications, - including but not limited to software source code, documentation - source, and configuration files. - - "Object" form shall mean any form resulting from mechanical - transformation or translation of a Source form, including but - not limited to compiled object code, generated documentation, - and conversions to other media types. - - "Work" shall mean the work of authorship, whether in Source or - Object form, made available under the License, as indicated by a - copyright notice that is included in or attached to the work - (an example is provided in the Appendix below). - - "Derivative Works" shall mean any work, whether in Source or Object - form, that is based on (or derived from) the Work and for which the - editorial revisions, annotations, elaborations, or other modifications - represent, as a whole, an original work of authorship. For the purposes - of this License, Derivative Works shall not include works that remain - separable from, or merely link (or bind by name) to the interfaces of, - the Work and Derivative Works thereof. - - "Contribution" shall mean any work of authorship, including - the original version of the Work and any modifications or additions - to that Work or Derivative Works thereof, that is intentionally - submitted to Licensor for inclusion in the Work by the copyright owner - or by an individual or Legal Entity authorized to submit on behalf of - the copyright owner. For the purposes of this definition, "submitted" - means any form of electronic, verbal, or written communication sent - to the Licensor or its representatives, including but not limited to - communication on electronic mailing lists, source code control systems, - and issue tracking systems that are managed by, or on behalf of, the - Licensor for the purpose of discussing and improving the Work, but - excluding communication that is conspicuously marked or otherwise - designated in writing by the copyright owner as "Not a Contribution." - - "Contributor" shall mean Licensor and any individual or Legal Entity - on behalf of whom a Contribution has been received by Licensor and - subsequently incorporated within the Work. - - 2. Grant of Copyright License. Subject to the terms and conditions of - this License, each Contributor hereby grants to You a perpetual, - worldwide, non-exclusive, no-charge, royalty-free, irrevocable - copyright license to reproduce, prepare Derivative Works of, - publicly display, publicly perform, sublicense, and distribute the - Work and such Derivative Works in Source or Object form. - - 3. Grant of Patent License. Subject to the terms and conditions of - this License, each Contributor hereby grants to You a perpetual, - worldwide, non-exclusive, no-charge, royalty-free, irrevocable - (except as stated in this section) patent license to make, have made, - use, offer to sell, sell, import, and otherwise transfer the Work, - where such license applies only to those patent claims licensable - by such Contributor that are necessarily infringed by their - Contribution(s) alone or by combination of their Contribution(s) - with the Work to which such Contribution(s) was submitted. If You - institute patent litigation against any entity (including a - cross-claim or counterclaim in a lawsuit) alleging that the Work - or a Contribution incorporated within the Work constitutes direct - or contributory patent infringement, then any patent licenses - granted to You under this License for that Work shall terminate - as of the date such litigation is filed. - - 4. Redistribution. You may reproduce and distribute copies of the - Work or Derivative Works thereof in any medium, with or without - modifications, and in Source or Object form, provided that You - meet the following conditions: - - (a) You must give any other recipients of the Work or - Derivative Works a copy of this License; and - - (b) You must cause any modified files to carry prominent notices - stating that You changed the files; and - - (c) You must retain, in the Source form of any Derivative Works - that You distribute, all copyright, patent, trademark, and - attribution notices from the Source form of the Work, - excluding those notices that do not pertain to any part of - the Derivative Works; and - - (d) If the Work includes a "NOTICE" text file as part of its - distribution, then any Derivative Works that You distribute must - include a readable copy of the attribution notices contained - within such NOTICE file, excluding those notices that do not - pertain to any part of the Derivative Works, in at least one - of the following places: within a NOTICE text file distributed - as part of the Derivative Works; within the Source form or - documentation, if provided along with the Derivative Works; or, - within a display generated by the Derivative Works, if and - wherever such third-party notices normally appear. The contents - of the NOTICE file are for informational purposes only and - do not modify the License. You may add Your own attribution - notices within Derivative Works that You distribute, alongside - or as an addendum to the NOTICE text from the Work, provided - that such additional attribution notices cannot be construed - as modifying the License. - - You may add Your own copyright statement to Your modifications and - may provide additional or different license terms and conditions - for use, reproduction, or distribution of Your modifications, or - for any such Derivative Works as a whole, provided Your use, - reproduction, and distribution of the Work otherwise complies with - the conditions stated in this License. - - 5. Submission of Contributions. Unless You explicitly state otherwise, - any Contribution intentionally submitted for inclusion in the Work - by You to the Licensor shall be under the terms and conditions of - this License, without any additional terms or conditions. - Notwithstanding the above, nothing herein shall supersede or modify - the terms of any separate license agreement you may have executed - with Licensor regarding such Contributions. - - 6. Trademarks. This License does not grant permission to use the trade - names, trademarks, service marks, or product names of the Licensor, - except as required for reasonable and customary use in describing the - origin of the Work and reproducing the content of the NOTICE file. - - 7. Disclaimer of Warranty. Unless required by applicable law or - agreed to in writing, Licensor provides the Work (and each - Contributor provides its Contributions) on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or - implied, including, without limitation, any warranties or conditions - of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A - PARTICULAR PURPOSE. You are solely responsible for determining the - appropriateness of using or redistributing the Work and assume any - risks associated with Your exercise of permissions under this License. - - 8. Limitation of Liability. In no event and under no legal theory, - whether in tort (including negligence), contract, or otherwise, - unless required by applicable law (such as deliberate and grossly - negligent acts) or agreed to in writing, shall any Contributor be - liable to You for damages, including any direct, indirect, special, - incidental, or consequential damages of any character arising as a - result of this License or out of the use or inability to use the - Work (including but not limited to damages for loss of goodwill, - work stoppage, computer failure or malfunction, or any and all - other commercial damages or losses), even if such Contributor - has been advised of the possibility of such damages. - - 9. Accepting Warranty or Additional Liability. While redistributing - the Work or Derivative Works thereof, You may choose to offer, - and charge a fee for, acceptance of support, warranty, indemnity, - or other liability obligations and/or rights consistent with this - License. However, in accepting such obligations, You may act only - on Your own behalf and on Your sole responsibility, not on behalf - of any other Contributor, and only if You agree to indemnify, - defend, and hold each Contributor harmless for any liability - incurred by, or claims asserted against, such Contributor by reason - of your accepting any such warranty or additional liability. - - END OF TERMS AND CONDITIONS - - APPENDIX: How to apply the Apache License to your work. - - To apply the Apache License to your work, attach the following - boilerplate notice, with the fields enclosed by brackets "{}" - replaced with your own identifying information. (Don't include - the brackets!) The text should be enclosed in the appropriate - comment syntax for the file format. We also recommend that a - file or class name and description of purpose be included on the - same "printed page" as the copyright notice for easier - identification within third-party archives. - - Copyright {yyyy} {name of copyright owner} - - 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. diff --git a/vendor/github.com/kubernetes-csi/csi-proxy/client/README.md b/vendor/github.com/kubernetes-csi/csi-proxy/client/README.md deleted file mode 100644 index 147ae4ba9..000000000 --- a/vendor/github.com/kubernetes-csi/csi-proxy/client/README.md +++ /dev/null @@ -1,5 +0,0 @@ -# Client go module - -This separate go module is intended to be imported by clients that want to use the CSI-proxy. - -It should strive to keep as few dependencies as possible, to make it easy to import in other repositories. diff --git a/vendor/github.com/kubernetes-csi/csi-proxy/client/api/filesystem/v1alpha1/api.pb.go b/vendor/github.com/kubernetes-csi/csi-proxy/client/api/filesystem/v1alpha1/api.pb.go deleted file mode 100644 index 9d10268b3..000000000 --- a/vendor/github.com/kubernetes-csi/csi-proxy/client/api/filesystem/v1alpha1/api.pb.go +++ /dev/null @@ -1,872 +0,0 @@ -// Code generated by protoc-gen-go. DO NOT EDIT. -// source: github.com/kubernetes-csi/csi-proxy/client/api/filesystem/v1alpha1/api.proto - -package v1alpha1 - -import ( - context "context" - fmt "fmt" - proto "github.com/golang/protobuf/proto" - grpc "google.golang.org/grpc" - codes "google.golang.org/grpc/codes" - status "google.golang.org/grpc/status" - math "math" -) - -// Reference imports to suppress errors if they are not otherwise used. -var _ = proto.Marshal -var _ = fmt.Errorf -var _ = math.Inf - -// This is a compile-time assertion to ensure that this generated file -// is compatible with the proto package it is being compiled against. -// A compilation error at this line likely means your copy of the -// proto package needs to be updated. -const _ = proto.ProtoPackageIsVersion3 // please upgrade the proto package - -// Context of the paths used for path prefix validation -type PathContext int32 - -const ( - // Indicates the kubelet-csi-plugins-path parameter of csi-proxy be used as - // the path context. This may be used while handling NodeStageVolume where - // a volume may need to be mounted at a plugin-specific path like: - // kubelet\plugins\kubernetes.io\csi\pv\\globalmount - PathContext_PLUGIN PathContext = 0 - // Indicates the kubelet-pod-path parameter of csi-proxy be used as the path - // context. This may be used while handling NodePublishVolume where a staged - // volume may be need to be symlinked to a pod-specific path like: - // kubelet\pods\\volumes\kubernetes.io~csi\\mount - PathContext_POD PathContext = 1 -) - -var PathContext_name = map[int32]string{ - 0: "PLUGIN", - 1: "POD", -} - -var PathContext_value = map[string]int32{ - "PLUGIN": 0, - "POD": 1, -} - -func (x PathContext) String() string { - return proto.EnumName(PathContext_name, int32(x)) -} - -func (PathContext) EnumDescriptor() ([]byte, []int) { - return fileDescriptor_78274760fcbff95c, []int{0} -} - -type PathExistsRequest struct { - // The path whose existence we want to check in the host's filesystem - Path string `protobuf:"bytes,1,opt,name=path,proto3" json:"path,omitempty"` - // Context of the path parameter. - // This is used to validate prefix for absolute paths passed - Context PathContext `protobuf:"varint,2,opt,name=context,proto3,enum=v1alpha1.PathContext" json:"context,omitempty"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` -} - -func (m *PathExistsRequest) Reset() { *m = PathExistsRequest{} } -func (m *PathExistsRequest) String() string { return proto.CompactTextString(m) } -func (*PathExistsRequest) ProtoMessage() {} -func (*PathExistsRequest) Descriptor() ([]byte, []int) { - return fileDescriptor_78274760fcbff95c, []int{0} -} - -func (m *PathExistsRequest) XXX_Unmarshal(b []byte) error { - return xxx_messageInfo_PathExistsRequest.Unmarshal(m, b) -} -func (m *PathExistsRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - return xxx_messageInfo_PathExistsRequest.Marshal(b, m, deterministic) -} -func (m *PathExistsRequest) XXX_Merge(src proto.Message) { - xxx_messageInfo_PathExistsRequest.Merge(m, src) -} -func (m *PathExistsRequest) XXX_Size() int { - return xxx_messageInfo_PathExistsRequest.Size(m) -} -func (m *PathExistsRequest) XXX_DiscardUnknown() { - xxx_messageInfo_PathExistsRequest.DiscardUnknown(m) -} - -var xxx_messageInfo_PathExistsRequest proto.InternalMessageInfo - -func (m *PathExistsRequest) GetPath() string { - if m != nil { - return m.Path - } - return "" -} - -func (m *PathExistsRequest) GetContext() PathContext { - if m != nil { - return m.Context - } - return PathContext_PLUGIN -} - -type PathExistsResponse struct { - // Error message if any. Empty string indicates success - Error string `protobuf:"bytes,1,opt,name=error,proto3" json:"error,omitempty"` - // Indicates whether the path in PathExistsRequest exists in the host's filesystem - Exists bool `protobuf:"varint,2,opt,name=exists,proto3" json:"exists,omitempty"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` -} - -func (m *PathExistsResponse) Reset() { *m = PathExistsResponse{} } -func (m *PathExistsResponse) String() string { return proto.CompactTextString(m) } -func (*PathExistsResponse) ProtoMessage() {} -func (*PathExistsResponse) Descriptor() ([]byte, []int) { - return fileDescriptor_78274760fcbff95c, []int{1} -} - -func (m *PathExistsResponse) XXX_Unmarshal(b []byte) error { - return xxx_messageInfo_PathExistsResponse.Unmarshal(m, b) -} -func (m *PathExistsResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - return xxx_messageInfo_PathExistsResponse.Marshal(b, m, deterministic) -} -func (m *PathExistsResponse) XXX_Merge(src proto.Message) { - xxx_messageInfo_PathExistsResponse.Merge(m, src) -} -func (m *PathExistsResponse) XXX_Size() int { - return xxx_messageInfo_PathExistsResponse.Size(m) -} -func (m *PathExistsResponse) XXX_DiscardUnknown() { - xxx_messageInfo_PathExistsResponse.DiscardUnknown(m) -} - -var xxx_messageInfo_PathExistsResponse proto.InternalMessageInfo - -func (m *PathExistsResponse) GetError() string { - if m != nil { - return m.Error - } - return "" -} - -func (m *PathExistsResponse) GetExists() bool { - if m != nil { - return m.Exists - } - return false -} - -type MkdirRequest struct { - // The path to create in the host's filesystem. - // All special characters allowed by Windows in path names will be allowed - // except for restrictions noted below. For details, please check: - // https://docs.microsoft.com/en-us/windows/win32/fileio/naming-a-file - // Non-existent parent directories in the path will be automatically created. - // Directories will be created with Read and Write privileges of the Windows - // User account under which csi-proxy is started (typically LocalSystem). - // - // Restrictions: - // Only absolute path (indicated by a drive letter prefix: e.g. "C:\") is accepted. - // Depending on the context parameter of this function, the path prefix needs - // to match the paths specified either as kubelet-csi-plugins-path - // or as kubelet-pod-path parameters of csi-proxy. - // The path parameter cannot already exist in the host's filesystem. - // UNC paths of the form "\\server\share\path\file" are not allowed. - // All directory separators need to be backslash character: "\". - // Characters: .. / : | ? * in the path are not allowed. - // Maximum path length will be capped to 260 characters. - Path string `protobuf:"bytes,1,opt,name=path,proto3" json:"path,omitempty"` - // Context of the path parameter. - // This is used to validate prefix for absolute paths passed - Context PathContext `protobuf:"varint,2,opt,name=context,proto3,enum=v1alpha1.PathContext" json:"context,omitempty"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` -} - -func (m *MkdirRequest) Reset() { *m = MkdirRequest{} } -func (m *MkdirRequest) String() string { return proto.CompactTextString(m) } -func (*MkdirRequest) ProtoMessage() {} -func (*MkdirRequest) Descriptor() ([]byte, []int) { - return fileDescriptor_78274760fcbff95c, []int{2} -} - -func (m *MkdirRequest) XXX_Unmarshal(b []byte) error { - return xxx_messageInfo_MkdirRequest.Unmarshal(m, b) -} -func (m *MkdirRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - return xxx_messageInfo_MkdirRequest.Marshal(b, m, deterministic) -} -func (m *MkdirRequest) XXX_Merge(src proto.Message) { - xxx_messageInfo_MkdirRequest.Merge(m, src) -} -func (m *MkdirRequest) XXX_Size() int { - return xxx_messageInfo_MkdirRequest.Size(m) -} -func (m *MkdirRequest) XXX_DiscardUnknown() { - xxx_messageInfo_MkdirRequest.DiscardUnknown(m) -} - -var xxx_messageInfo_MkdirRequest proto.InternalMessageInfo - -func (m *MkdirRequest) GetPath() string { - if m != nil { - return m.Path - } - return "" -} - -func (m *MkdirRequest) GetContext() PathContext { - if m != nil { - return m.Context - } - return PathContext_PLUGIN -} - -type MkdirResponse struct { - // Error message if any. Empty string indicates success - Error string `protobuf:"bytes,1,opt,name=error,proto3" json:"error,omitempty"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` -} - -func (m *MkdirResponse) Reset() { *m = MkdirResponse{} } -func (m *MkdirResponse) String() string { return proto.CompactTextString(m) } -func (*MkdirResponse) ProtoMessage() {} -func (*MkdirResponse) Descriptor() ([]byte, []int) { - return fileDescriptor_78274760fcbff95c, []int{3} -} - -func (m *MkdirResponse) XXX_Unmarshal(b []byte) error { - return xxx_messageInfo_MkdirResponse.Unmarshal(m, b) -} -func (m *MkdirResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - return xxx_messageInfo_MkdirResponse.Marshal(b, m, deterministic) -} -func (m *MkdirResponse) XXX_Merge(src proto.Message) { - xxx_messageInfo_MkdirResponse.Merge(m, src) -} -func (m *MkdirResponse) XXX_Size() int { - return xxx_messageInfo_MkdirResponse.Size(m) -} -func (m *MkdirResponse) XXX_DiscardUnknown() { - xxx_messageInfo_MkdirResponse.DiscardUnknown(m) -} - -var xxx_messageInfo_MkdirResponse proto.InternalMessageInfo - -func (m *MkdirResponse) GetError() string { - if m != nil { - return m.Error - } - return "" -} - -type RmdirRequest struct { - // The path to remove in the host's filesystem. - // All special characters allowed by Windows in path names will be allowed - // except for restrictions noted below. For details, please check: - // https://docs.microsoft.com/en-us/windows/win32/fileio/naming-a-file - // - // Restrictions: - // Only absolute path (indicated by a drive letter prefix: e.g. "C:\") is accepted. - // Depending on the context parameter of this function, the path prefix needs - // to match the paths specified either as kubelet-csi-plugins-path - // or as kubelet-pod-path parameters of csi-proxy. - // UNC paths of the form "\\server\share\path\file" are not allowed. - // All directory separators need to be backslash character: "\". - // Characters: .. / : | ? * in the path are not allowed. - // Path cannot be a file of type symlink. - // Maximum path length will be capped to 260 characters. - Path string `protobuf:"bytes,1,opt,name=path,proto3" json:"path,omitempty"` - // Context of the path parameter. - // This is used to validate prefix for absolute paths passed - Context PathContext `protobuf:"varint,2,opt,name=context,proto3,enum=v1alpha1.PathContext" json:"context,omitempty"` - // Force remove all contents under path (if any). - Force bool `protobuf:"varint,3,opt,name=force,proto3" json:"force,omitempty"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` -} - -func (m *RmdirRequest) Reset() { *m = RmdirRequest{} } -func (m *RmdirRequest) String() string { return proto.CompactTextString(m) } -func (*RmdirRequest) ProtoMessage() {} -func (*RmdirRequest) Descriptor() ([]byte, []int) { - return fileDescriptor_78274760fcbff95c, []int{4} -} - -func (m *RmdirRequest) XXX_Unmarshal(b []byte) error { - return xxx_messageInfo_RmdirRequest.Unmarshal(m, b) -} -func (m *RmdirRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - return xxx_messageInfo_RmdirRequest.Marshal(b, m, deterministic) -} -func (m *RmdirRequest) XXX_Merge(src proto.Message) { - xxx_messageInfo_RmdirRequest.Merge(m, src) -} -func (m *RmdirRequest) XXX_Size() int { - return xxx_messageInfo_RmdirRequest.Size(m) -} -func (m *RmdirRequest) XXX_DiscardUnknown() { - xxx_messageInfo_RmdirRequest.DiscardUnknown(m) -} - -var xxx_messageInfo_RmdirRequest proto.InternalMessageInfo - -func (m *RmdirRequest) GetPath() string { - if m != nil { - return m.Path - } - return "" -} - -func (m *RmdirRequest) GetContext() PathContext { - if m != nil { - return m.Context - } - return PathContext_PLUGIN -} - -func (m *RmdirRequest) GetForce() bool { - if m != nil { - return m.Force - } - return false -} - -type RmdirResponse struct { - // Error message if any. Empty string indicates success - Error string `protobuf:"bytes,1,opt,name=error,proto3" json:"error,omitempty"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` -} - -func (m *RmdirResponse) Reset() { *m = RmdirResponse{} } -func (m *RmdirResponse) String() string { return proto.CompactTextString(m) } -func (*RmdirResponse) ProtoMessage() {} -func (*RmdirResponse) Descriptor() ([]byte, []int) { - return fileDescriptor_78274760fcbff95c, []int{5} -} - -func (m *RmdirResponse) XXX_Unmarshal(b []byte) error { - return xxx_messageInfo_RmdirResponse.Unmarshal(m, b) -} -func (m *RmdirResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - return xxx_messageInfo_RmdirResponse.Marshal(b, m, deterministic) -} -func (m *RmdirResponse) XXX_Merge(src proto.Message) { - xxx_messageInfo_RmdirResponse.Merge(m, src) -} -func (m *RmdirResponse) XXX_Size() int { - return xxx_messageInfo_RmdirResponse.Size(m) -} -func (m *RmdirResponse) XXX_DiscardUnknown() { - xxx_messageInfo_RmdirResponse.DiscardUnknown(m) -} - -var xxx_messageInfo_RmdirResponse proto.InternalMessageInfo - -func (m *RmdirResponse) GetError() string { - if m != nil { - return m.Error - } - return "" -} - -type LinkPathRequest struct { - // The path where the symlink is created in the host's filesystem. - // All special characters allowed by Windows in path names will be allowed - // except for restrictions noted below. For details, please check: - // https://docs.microsoft.com/en-us/windows/win32/fileio/naming-a-file - // - // Restrictions: - // Only absolute path (indicated by a drive letter prefix: e.g. "C:\") is accepted. - // The path prefix needs needs to match the paths specified as - // kubelet-csi-plugins-path parameter of csi-proxy. - // UNC paths of the form "\\server\share\path\file" are not allowed. - // All directory separators need to be backslash character: "\". - // Characters: .. / : | ? * in the path are not allowed. - // source_path cannot already exist in the host filesystem. - // Maximum path length will be capped to 260 characters. - SourcePath string `protobuf:"bytes,1,opt,name=source_path,json=sourcePath,proto3" json:"source_path,omitempty"` - // Target path in the host's filesystem used for the symlink creation. - // All special characters allowed by Windows in path names will be allowed - // except for restrictions noted below. For details, please check: - // https://docs.microsoft.com/en-us/windows/win32/fileio/naming-a-file - // - // Restrictions: - // Only absolute path (indicated by a drive letter prefix: e.g. "C:\") is accepted. - // The path prefix needs to match the paths specified as - // kubelet-pod-path parameter of csi-proxy. - // UNC paths of the form "\\server\share\path\file" are not allowed. - // All directory separators need to be backslash character: "\". - // Characters: .. / : | ? * in the path are not allowed. - // target_path needs to exist as a directory in the host that is empty. - // target_path cannot be a symbolic link. - // Maximum path length will be capped to 260 characters. - TargetPath string `protobuf:"bytes,2,opt,name=target_path,json=targetPath,proto3" json:"target_path,omitempty"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` -} - -func (m *LinkPathRequest) Reset() { *m = LinkPathRequest{} } -func (m *LinkPathRequest) String() string { return proto.CompactTextString(m) } -func (*LinkPathRequest) ProtoMessage() {} -func (*LinkPathRequest) Descriptor() ([]byte, []int) { - return fileDescriptor_78274760fcbff95c, []int{6} -} - -func (m *LinkPathRequest) XXX_Unmarshal(b []byte) error { - return xxx_messageInfo_LinkPathRequest.Unmarshal(m, b) -} -func (m *LinkPathRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - return xxx_messageInfo_LinkPathRequest.Marshal(b, m, deterministic) -} -func (m *LinkPathRequest) XXX_Merge(src proto.Message) { - xxx_messageInfo_LinkPathRequest.Merge(m, src) -} -func (m *LinkPathRequest) XXX_Size() int { - return xxx_messageInfo_LinkPathRequest.Size(m) -} -func (m *LinkPathRequest) XXX_DiscardUnknown() { - xxx_messageInfo_LinkPathRequest.DiscardUnknown(m) -} - -var xxx_messageInfo_LinkPathRequest proto.InternalMessageInfo - -func (m *LinkPathRequest) GetSourcePath() string { - if m != nil { - return m.SourcePath - } - return "" -} - -func (m *LinkPathRequest) GetTargetPath() string { - if m != nil { - return m.TargetPath - } - return "" -} - -type LinkPathResponse struct { - // Error message if any. Empty string indicates success - Error string `protobuf:"bytes,1,opt,name=error,proto3" json:"error,omitempty"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` -} - -func (m *LinkPathResponse) Reset() { *m = LinkPathResponse{} } -func (m *LinkPathResponse) String() string { return proto.CompactTextString(m) } -func (*LinkPathResponse) ProtoMessage() {} -func (*LinkPathResponse) Descriptor() ([]byte, []int) { - return fileDescriptor_78274760fcbff95c, []int{7} -} - -func (m *LinkPathResponse) XXX_Unmarshal(b []byte) error { - return xxx_messageInfo_LinkPathResponse.Unmarshal(m, b) -} -func (m *LinkPathResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - return xxx_messageInfo_LinkPathResponse.Marshal(b, m, deterministic) -} -func (m *LinkPathResponse) XXX_Merge(src proto.Message) { - xxx_messageInfo_LinkPathResponse.Merge(m, src) -} -func (m *LinkPathResponse) XXX_Size() int { - return xxx_messageInfo_LinkPathResponse.Size(m) -} -func (m *LinkPathResponse) XXX_DiscardUnknown() { - xxx_messageInfo_LinkPathResponse.DiscardUnknown(m) -} - -var xxx_messageInfo_LinkPathResponse proto.InternalMessageInfo - -func (m *LinkPathResponse) GetError() string { - if m != nil { - return m.Error - } - return "" -} - -type IsMountPointRequest struct { - // The path whose existence we want to check in the host's filesystem - Path string `protobuf:"bytes,1,opt,name=path,proto3" json:"path,omitempty"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` -} - -func (m *IsMountPointRequest) Reset() { *m = IsMountPointRequest{} } -func (m *IsMountPointRequest) String() string { return proto.CompactTextString(m) } -func (*IsMountPointRequest) ProtoMessage() {} -func (*IsMountPointRequest) Descriptor() ([]byte, []int) { - return fileDescriptor_78274760fcbff95c, []int{8} -} - -func (m *IsMountPointRequest) XXX_Unmarshal(b []byte) error { - return xxx_messageInfo_IsMountPointRequest.Unmarshal(m, b) -} -func (m *IsMountPointRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - return xxx_messageInfo_IsMountPointRequest.Marshal(b, m, deterministic) -} -func (m *IsMountPointRequest) XXX_Merge(src proto.Message) { - xxx_messageInfo_IsMountPointRequest.Merge(m, src) -} -func (m *IsMountPointRequest) XXX_Size() int { - return xxx_messageInfo_IsMountPointRequest.Size(m) -} -func (m *IsMountPointRequest) XXX_DiscardUnknown() { - xxx_messageInfo_IsMountPointRequest.DiscardUnknown(m) -} - -var xxx_messageInfo_IsMountPointRequest proto.InternalMessageInfo - -func (m *IsMountPointRequest) GetPath() string { - if m != nil { - return m.Path - } - return "" -} - -type IsMountPointResponse struct { - // Error message if any. Empty string indicates success - Error string `protobuf:"bytes,1,opt,name=error,proto3" json:"error,omitempty"` - // Indicates whether the path in PathExistsRequest exists in the host's filesystem - IsMountPoint bool `protobuf:"varint,2,opt,name=is_mount_point,json=isMountPoint,proto3" json:"is_mount_point,omitempty"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` -} - -func (m *IsMountPointResponse) Reset() { *m = IsMountPointResponse{} } -func (m *IsMountPointResponse) String() string { return proto.CompactTextString(m) } -func (*IsMountPointResponse) ProtoMessage() {} -func (*IsMountPointResponse) Descriptor() ([]byte, []int) { - return fileDescriptor_78274760fcbff95c, []int{9} -} - -func (m *IsMountPointResponse) XXX_Unmarshal(b []byte) error { - return xxx_messageInfo_IsMountPointResponse.Unmarshal(m, b) -} -func (m *IsMountPointResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - return xxx_messageInfo_IsMountPointResponse.Marshal(b, m, deterministic) -} -func (m *IsMountPointResponse) XXX_Merge(src proto.Message) { - xxx_messageInfo_IsMountPointResponse.Merge(m, src) -} -func (m *IsMountPointResponse) XXX_Size() int { - return xxx_messageInfo_IsMountPointResponse.Size(m) -} -func (m *IsMountPointResponse) XXX_DiscardUnknown() { - xxx_messageInfo_IsMountPointResponse.DiscardUnknown(m) -} - -var xxx_messageInfo_IsMountPointResponse proto.InternalMessageInfo - -func (m *IsMountPointResponse) GetError() string { - if m != nil { - return m.Error - } - return "" -} - -func (m *IsMountPointResponse) GetIsMountPoint() bool { - if m != nil { - return m.IsMountPoint - } - return false -} - -func init() { - proto.RegisterEnum("v1alpha1.PathContext", PathContext_name, PathContext_value) - proto.RegisterType((*PathExistsRequest)(nil), "v1alpha1.PathExistsRequest") - proto.RegisterType((*PathExistsResponse)(nil), "v1alpha1.PathExistsResponse") - proto.RegisterType((*MkdirRequest)(nil), "v1alpha1.MkdirRequest") - proto.RegisterType((*MkdirResponse)(nil), "v1alpha1.MkdirResponse") - proto.RegisterType((*RmdirRequest)(nil), "v1alpha1.RmdirRequest") - proto.RegisterType((*RmdirResponse)(nil), "v1alpha1.RmdirResponse") - proto.RegisterType((*LinkPathRequest)(nil), "v1alpha1.LinkPathRequest") - proto.RegisterType((*LinkPathResponse)(nil), "v1alpha1.LinkPathResponse") - proto.RegisterType((*IsMountPointRequest)(nil), "v1alpha1.IsMountPointRequest") - proto.RegisterType((*IsMountPointResponse)(nil), "v1alpha1.IsMountPointResponse") -} - -func init() { - proto.RegisterFile("github.com/kubernetes-csi/csi-proxy/client/api/filesystem/v1alpha1/api.proto", fileDescriptor_78274760fcbff95c) -} - -var fileDescriptor_78274760fcbff95c = []byte{ - // 463 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xac, 0x94, 0x5f, 0x6f, 0xd3, 0x30, - 0x14, 0xc5, 0xdb, 0x8e, 0x75, 0xe5, 0xae, 0x8c, 0x72, 0x19, 0xa3, 0x84, 0x7f, 0x93, 0x05, 0x52, - 0x41, 0x5a, 0xa2, 0x8d, 0x37, 0x1e, 0x19, 0x7f, 0x54, 0xa9, 0x63, 0x51, 0x26, 0x24, 0xde, 0xaa, - 0x34, 0x78, 0x8b, 0xd5, 0x26, 0x0e, 0xb6, 0x83, 0xba, 0x0f, 0xcc, 0xf7, 0x40, 0x8e, 0x93, 0xc5, - 0x81, 0x92, 0xa7, 0xbd, 0xd5, 0xf7, 0xfe, 0x7c, 0xee, 0xa9, 0xef, 0x51, 0x60, 0x76, 0xc5, 0x54, - 0x9c, 0x2f, 0xdc, 0x88, 0x27, 0xde, 0x32, 0x5f, 0x50, 0x91, 0x52, 0x45, 0xe5, 0x51, 0x24, 0x99, - 0x17, 0x49, 0x76, 0x94, 0x09, 0xbe, 0xbe, 0xf6, 0xa2, 0x15, 0xa3, 0xa9, 0xf2, 0xc2, 0x8c, 0x79, - 0x97, 0x6c, 0x45, 0xe5, 0xb5, 0x54, 0x34, 0xf1, 0x7e, 0x1d, 0x87, 0xab, 0x2c, 0x0e, 0x8f, 0x75, - 0xdd, 0xcd, 0x04, 0x57, 0x1c, 0x07, 0x55, 0x8d, 0x7c, 0x87, 0x07, 0x7e, 0xa8, 0xe2, 0x4f, 0x6b, - 0x26, 0x95, 0x0c, 0xe8, 0xcf, 0x9c, 0x4a, 0x85, 0x08, 0x77, 0xb2, 0x50, 0xc5, 0xe3, 0xee, 0x61, - 0x77, 0x72, 0x37, 0x28, 0x7e, 0xa3, 0x07, 0x3b, 0x11, 0x4f, 0x15, 0x5d, 0xab, 0x71, 0xef, 0xb0, - 0x3b, 0xd9, 0x3b, 0x79, 0xe4, 0x56, 0x22, 0xae, 0x56, 0x38, 0x35, 0xcd, 0xa0, 0xa2, 0xc8, 0x07, - 0x40, 0x5b, 0x59, 0x66, 0x3c, 0x95, 0x14, 0xf7, 0x61, 0x9b, 0x0a, 0xc1, 0x45, 0xa9, 0x6d, 0x0e, - 0x78, 0x00, 0x7d, 0x5a, 0x70, 0x85, 0xf6, 0x20, 0x28, 0x4f, 0xe4, 0x02, 0x86, 0x67, 0xcb, 0x1f, - 0x4c, 0xdc, 0xaa, 0xb1, 0xd7, 0x70, 0xaf, 0x14, 0x6d, 0xf3, 0x44, 0x18, 0x0c, 0x83, 0xe4, 0x96, - 0x67, 0xeb, 0x51, 0x97, 0x5c, 0x44, 0x74, 0xbc, 0x55, 0xfc, 0x4f, 0x73, 0xd0, 0x8e, 0xca, 0x51, - 0xad, 0x8e, 0x2e, 0xe0, 0xfe, 0x8c, 0xa5, 0x4b, 0x2d, 0x5c, 0x99, 0x7a, 0x09, 0xbb, 0x92, 0xe7, - 0x22, 0xa2, 0x73, 0xcb, 0x1b, 0x98, 0x92, 0xe6, 0x34, 0xa0, 0x42, 0x71, 0x45, 0x95, 0x01, 0x7a, - 0x06, 0x30, 0x25, 0x0d, 0x90, 0x09, 0x8c, 0x6a, 0xd1, 0xd6, 0xf1, 0x6f, 0xe0, 0xe1, 0x54, 0x9e, - 0xf1, 0x3c, 0x55, 0x3e, 0x67, 0xa9, 0x6a, 0x79, 0x17, 0x12, 0xc0, 0x7e, 0x13, 0x6d, 0xdd, 0xfe, - 0x2b, 0xd8, 0x63, 0x72, 0x9e, 0x68, 0x7c, 0x9e, 0x69, 0xbe, 0x4c, 0xc1, 0x90, 0x59, 0x1a, 0x6f, - 0x09, 0xec, 0x5a, 0x4f, 0x8a, 0x00, 0x7d, 0x7f, 0xf6, 0xed, 0xcb, 0xf4, 0xeb, 0xa8, 0x83, 0x3b, - 0xb0, 0xe5, 0x9f, 0x7f, 0x1c, 0x75, 0x4f, 0x7e, 0xf7, 0x00, 0x3e, 0xdf, 0x24, 0x1f, 0xa7, 0x00, - 0x75, 0x04, 0xf1, 0x69, 0x73, 0x37, 0x8d, 0xc8, 0x3b, 0xcf, 0x36, 0x37, 0x8d, 0x6f, 0xd2, 0xc1, - 0xf7, 0xb0, 0x5d, 0x84, 0x06, 0x0f, 0x6a, 0xd0, 0x8e, 0xa6, 0xf3, 0xf8, 0x9f, 0xba, 0x7d, 0xb7, - 0x58, 0xaf, 0x7d, 0xd7, 0x8e, 0x96, 0x7d, 0xb7, 0x91, 0x03, 0xd2, 0xc1, 0x53, 0x18, 0x54, 0xeb, - 0xc1, 0x27, 0x35, 0xf6, 0x57, 0x0e, 0x1c, 0x67, 0x53, 0xeb, 0x46, 0xe4, 0x1c, 0x86, 0xf6, 0x3a, - 0xf0, 0x79, 0x4d, 0x6f, 0xd8, 0xa8, 0xf3, 0xe2, 0x7f, 0xed, 0x4a, 0x70, 0xd1, 0x2f, 0x3e, 0x23, - 0xef, 0xfe, 0x04, 0x00, 0x00, 0xff, 0xff, 0x34, 0xc0, 0xa2, 0x65, 0x96, 0x04, 0x00, 0x00, -} - -// Reference imports to suppress errors if they are not otherwise used. -var _ context.Context -var _ grpc.ClientConnInterface - -// This is a compile-time assertion to ensure that this generated file -// is compatible with the grpc package it is being compiled against. -const _ = grpc.SupportPackageIsVersion6 - -// FilesystemClient is the client API for Filesystem service. -// -// For semantics around ctx use and closing/ending streaming RPCs, please refer to https://godoc.org/google.golang.org/grpc#ClientConn.NewStream. -type FilesystemClient interface { - // PathExists checks if the requested path exists in the host's filesystem - PathExists(ctx context.Context, in *PathExistsRequest, opts ...grpc.CallOption) (*PathExistsResponse, error) - // Mkdir creates a directory at the requested path in the host's filesystem - Mkdir(ctx context.Context, in *MkdirRequest, opts ...grpc.CallOption) (*MkdirResponse, error) - // Rmdir removes the directory at the requested path in the host's filesystem. - // This may be used for unlinking a symlink created through LinkPath - Rmdir(ctx context.Context, in *RmdirRequest, opts ...grpc.CallOption) (*RmdirResponse, error) - // LinkPath creates a local directory symbolic link between a source path - // and target path in the host's filesystem - LinkPath(ctx context.Context, in *LinkPathRequest, opts ...grpc.CallOption) (*LinkPathResponse, error) - //IsMountPoint checks if a given path is mount or not - IsMountPoint(ctx context.Context, in *IsMountPointRequest, opts ...grpc.CallOption) (*IsMountPointResponse, error) -} - -type filesystemClient struct { - cc grpc.ClientConnInterface -} - -func NewFilesystemClient(cc grpc.ClientConnInterface) FilesystemClient { - return &filesystemClient{cc} -} - -func (c *filesystemClient) PathExists(ctx context.Context, in *PathExistsRequest, opts ...grpc.CallOption) (*PathExistsResponse, error) { - out := new(PathExistsResponse) - err := c.cc.Invoke(ctx, "/v1alpha1.Filesystem/PathExists", in, out, opts...) - if err != nil { - return nil, err - } - return out, nil -} - -func (c *filesystemClient) Mkdir(ctx context.Context, in *MkdirRequest, opts ...grpc.CallOption) (*MkdirResponse, error) { - out := new(MkdirResponse) - err := c.cc.Invoke(ctx, "/v1alpha1.Filesystem/Mkdir", in, out, opts...) - if err != nil { - return nil, err - } - return out, nil -} - -func (c *filesystemClient) Rmdir(ctx context.Context, in *RmdirRequest, opts ...grpc.CallOption) (*RmdirResponse, error) { - out := new(RmdirResponse) - err := c.cc.Invoke(ctx, "/v1alpha1.Filesystem/Rmdir", in, out, opts...) - if err != nil { - return nil, err - } - return out, nil -} - -func (c *filesystemClient) LinkPath(ctx context.Context, in *LinkPathRequest, opts ...grpc.CallOption) (*LinkPathResponse, error) { - out := new(LinkPathResponse) - err := c.cc.Invoke(ctx, "/v1alpha1.Filesystem/LinkPath", in, out, opts...) - if err != nil { - return nil, err - } - return out, nil -} - -func (c *filesystemClient) IsMountPoint(ctx context.Context, in *IsMountPointRequest, opts ...grpc.CallOption) (*IsMountPointResponse, error) { - out := new(IsMountPointResponse) - err := c.cc.Invoke(ctx, "/v1alpha1.Filesystem/IsMountPoint", in, out, opts...) - if err != nil { - return nil, err - } - return out, nil -} - -// FilesystemServer is the server API for Filesystem service. -type FilesystemServer interface { - // PathExists checks if the requested path exists in the host's filesystem - PathExists(context.Context, *PathExistsRequest) (*PathExistsResponse, error) - // Mkdir creates a directory at the requested path in the host's filesystem - Mkdir(context.Context, *MkdirRequest) (*MkdirResponse, error) - // Rmdir removes the directory at the requested path in the host's filesystem. - // This may be used for unlinking a symlink created through LinkPath - Rmdir(context.Context, *RmdirRequest) (*RmdirResponse, error) - // LinkPath creates a local directory symbolic link between a source path - // and target path in the host's filesystem - LinkPath(context.Context, *LinkPathRequest) (*LinkPathResponse, error) - //IsMountPoint checks if a given path is mount or not - IsMountPoint(context.Context, *IsMountPointRequest) (*IsMountPointResponse, error) -} - -// UnimplementedFilesystemServer can be embedded to have forward compatible implementations. -type UnimplementedFilesystemServer struct { -} - -func (*UnimplementedFilesystemServer) PathExists(ctx context.Context, req *PathExistsRequest) (*PathExistsResponse, error) { - return nil, status.Errorf(codes.Unimplemented, "method PathExists not implemented") -} -func (*UnimplementedFilesystemServer) Mkdir(ctx context.Context, req *MkdirRequest) (*MkdirResponse, error) { - return nil, status.Errorf(codes.Unimplemented, "method Mkdir not implemented") -} -func (*UnimplementedFilesystemServer) Rmdir(ctx context.Context, req *RmdirRequest) (*RmdirResponse, error) { - return nil, status.Errorf(codes.Unimplemented, "method Rmdir not implemented") -} -func (*UnimplementedFilesystemServer) LinkPath(ctx context.Context, req *LinkPathRequest) (*LinkPathResponse, error) { - return nil, status.Errorf(codes.Unimplemented, "method LinkPath not implemented") -} -func (*UnimplementedFilesystemServer) IsMountPoint(ctx context.Context, req *IsMountPointRequest) (*IsMountPointResponse, error) { - return nil, status.Errorf(codes.Unimplemented, "method IsMountPoint not implemented") -} - -func RegisterFilesystemServer(s *grpc.Server, srv FilesystemServer) { - s.RegisterService(&_Filesystem_serviceDesc, srv) -} - -func _Filesystem_PathExists_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { - in := new(PathExistsRequest) - if err := dec(in); err != nil { - return nil, err - } - if interceptor == nil { - return srv.(FilesystemServer).PathExists(ctx, in) - } - info := &grpc.UnaryServerInfo{ - Server: srv, - FullMethod: "/v1alpha1.Filesystem/PathExists", - } - handler := func(ctx context.Context, req interface{}) (interface{}, error) { - return srv.(FilesystemServer).PathExists(ctx, req.(*PathExistsRequest)) - } - return interceptor(ctx, in, info, handler) -} - -func _Filesystem_Mkdir_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { - in := new(MkdirRequest) - if err := dec(in); err != nil { - return nil, err - } - if interceptor == nil { - return srv.(FilesystemServer).Mkdir(ctx, in) - } - info := &grpc.UnaryServerInfo{ - Server: srv, - FullMethod: "/v1alpha1.Filesystem/Mkdir", - } - handler := func(ctx context.Context, req interface{}) (interface{}, error) { - return srv.(FilesystemServer).Mkdir(ctx, req.(*MkdirRequest)) - } - return interceptor(ctx, in, info, handler) -} - -func _Filesystem_Rmdir_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { - in := new(RmdirRequest) - if err := dec(in); err != nil { - return nil, err - } - if interceptor == nil { - return srv.(FilesystemServer).Rmdir(ctx, in) - } - info := &grpc.UnaryServerInfo{ - Server: srv, - FullMethod: "/v1alpha1.Filesystem/Rmdir", - } - handler := func(ctx context.Context, req interface{}) (interface{}, error) { - return srv.(FilesystemServer).Rmdir(ctx, req.(*RmdirRequest)) - } - return interceptor(ctx, in, info, handler) -} - -func _Filesystem_LinkPath_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { - in := new(LinkPathRequest) - if err := dec(in); err != nil { - return nil, err - } - if interceptor == nil { - return srv.(FilesystemServer).LinkPath(ctx, in) - } - info := &grpc.UnaryServerInfo{ - Server: srv, - FullMethod: "/v1alpha1.Filesystem/LinkPath", - } - handler := func(ctx context.Context, req interface{}) (interface{}, error) { - return srv.(FilesystemServer).LinkPath(ctx, req.(*LinkPathRequest)) - } - return interceptor(ctx, in, info, handler) -} - -func _Filesystem_IsMountPoint_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { - in := new(IsMountPointRequest) - if err := dec(in); err != nil { - return nil, err - } - if interceptor == nil { - return srv.(FilesystemServer).IsMountPoint(ctx, in) - } - info := &grpc.UnaryServerInfo{ - Server: srv, - FullMethod: "/v1alpha1.Filesystem/IsMountPoint", - } - handler := func(ctx context.Context, req interface{}) (interface{}, error) { - return srv.(FilesystemServer).IsMountPoint(ctx, req.(*IsMountPointRequest)) - } - return interceptor(ctx, in, info, handler) -} - -var _Filesystem_serviceDesc = grpc.ServiceDesc{ - ServiceName: "v1alpha1.Filesystem", - HandlerType: (*FilesystemServer)(nil), - Methods: []grpc.MethodDesc{ - { - MethodName: "PathExists", - Handler: _Filesystem_PathExists_Handler, - }, - { - MethodName: "Mkdir", - Handler: _Filesystem_Mkdir_Handler, - }, - { - MethodName: "Rmdir", - Handler: _Filesystem_Rmdir_Handler, - }, - { - MethodName: "LinkPath", - Handler: _Filesystem_LinkPath_Handler, - }, - { - MethodName: "IsMountPoint", - Handler: _Filesystem_IsMountPoint_Handler, - }, - }, - Streams: []grpc.StreamDesc{}, - Metadata: "github.com/kubernetes-csi/csi-proxy/client/api/filesystem/v1alpha1/api.proto", -} diff --git a/vendor/github.com/kubernetes-csi/csi-proxy/client/api/filesystem/v1alpha1/api.proto b/vendor/github.com/kubernetes-csi/csi-proxy/client/api/filesystem/v1alpha1/api.proto deleted file mode 100644 index 8856da5c4..000000000 --- a/vendor/github.com/kubernetes-csi/csi-proxy/client/api/filesystem/v1alpha1/api.proto +++ /dev/null @@ -1,168 +0,0 @@ -syntax = "proto3"; - -package v1alpha1; - -service Filesystem { - // PathExists checks if the requested path exists in the host's filesystem - rpc PathExists(PathExistsRequest) returns (PathExistsResponse) {} - - // Mkdir creates a directory at the requested path in the host's filesystem - rpc Mkdir(MkdirRequest) returns (MkdirResponse) {} - - // Rmdir removes the directory at the requested path in the host's filesystem. - // This may be used for unlinking a symlink created through LinkPath - rpc Rmdir(RmdirRequest) returns (RmdirResponse) {} - - // LinkPath creates a local directory symbolic link between a source path - // and target path in the host's filesystem - rpc LinkPath(LinkPathRequest) returns (LinkPathResponse) {} - - //IsMountPoint checks if a given path is mount or not - rpc IsMountPoint(IsMountPointRequest) returns (IsMountPointResponse) {} -} - -// Context of the paths used for path prefix validation -enum PathContext { - // Indicates the kubelet-csi-plugins-path parameter of csi-proxy be used as - // the path context. This may be used while handling NodeStageVolume where - // a volume may need to be mounted at a plugin-specific path like: - // kubelet\plugins\kubernetes.io\csi\pv\\globalmount - PLUGIN = 0; - // Indicates the kubelet-pod-path parameter of csi-proxy be used as the path - // context. This may be used while handling NodePublishVolume where a staged - // volume may be need to be symlinked to a pod-specific path like: - // kubelet\pods\\volumes\kubernetes.io~csi\\mount - POD = 1; -} - -message PathExistsRequest { - // The path whose existence we want to check in the host's filesystem - string path = 1; - - // Context of the path parameter. - // This is used to validate prefix for absolute paths passed - PathContext context = 2; -} - -message PathExistsResponse { - // Error message if any. Empty string indicates success - string error = 1; - - // Indicates whether the path in PathExistsRequest exists in the host's filesystem - bool exists = 2; -} - -message MkdirRequest { - // The path to create in the host's filesystem. - // All special characters allowed by Windows in path names will be allowed - // except for restrictions noted below. For details, please check: - // https://docs.microsoft.com/en-us/windows/win32/fileio/naming-a-file - // Non-existent parent directories in the path will be automatically created. - // Directories will be created with Read and Write privileges of the Windows - // User account under which csi-proxy is started (typically LocalSystem). - // - // Restrictions: - // Only absolute path (indicated by a drive letter prefix: e.g. "C:\") is accepted. - // Depending on the context parameter of this function, the path prefix needs - // to match the paths specified either as kubelet-csi-plugins-path - // or as kubelet-pod-path parameters of csi-proxy. - // The path parameter cannot already exist in the host's filesystem. - // UNC paths of the form "\\server\share\path\file" are not allowed. - // All directory separators need to be backslash character: "\". - // Characters: .. / : | ? * in the path are not allowed. - // Maximum path length will be capped to 260 characters. - string path = 1; - - // Context of the path parameter. - // This is used to validate prefix for absolute paths passed - PathContext context = 2; -} - -message MkdirResponse { - // Error message if any. Empty string indicates success - string error = 1; -} - -message RmdirRequest { - // The path to remove in the host's filesystem. - // All special characters allowed by Windows in path names will be allowed - // except for restrictions noted below. For details, please check: - // https://docs.microsoft.com/en-us/windows/win32/fileio/naming-a-file - // - // Restrictions: - // Only absolute path (indicated by a drive letter prefix: e.g. "C:\") is accepted. - // Depending on the context parameter of this function, the path prefix needs - // to match the paths specified either as kubelet-csi-plugins-path - // or as kubelet-pod-path parameters of csi-proxy. - // UNC paths of the form "\\server\share\path\file" are not allowed. - // All directory separators need to be backslash character: "\". - // Characters: .. / : | ? * in the path are not allowed. - // Path cannot be a file of type symlink. - // Maximum path length will be capped to 260 characters. - string path = 1; - - // Context of the path parameter. - // This is used to validate prefix for absolute paths passed - PathContext context = 2; - - // Force remove all contents under path (if any). - bool force = 3; -} - -message RmdirResponse { - // Error message if any. Empty string indicates success - string error = 1; -} - -message LinkPathRequest { - // The path where the symlink is created in the host's filesystem. - // All special characters allowed by Windows in path names will be allowed - // except for restrictions noted below. For details, please check: - // https://docs.microsoft.com/en-us/windows/win32/fileio/naming-a-file - // - // Restrictions: - // Only absolute path (indicated by a drive letter prefix: e.g. "C:\") is accepted. - // The path prefix needs needs to match the paths specified as - // kubelet-csi-plugins-path parameter of csi-proxy. - // UNC paths of the form "\\server\share\path\file" are not allowed. - // All directory separators need to be backslash character: "\". - // Characters: .. / : | ? * in the path are not allowed. - // source_path cannot already exist in the host filesystem. - // Maximum path length will be capped to 260 characters. - string source_path = 1; - - // Target path in the host's filesystem used for the symlink creation. - // All special characters allowed by Windows in path names will be allowed - // except for restrictions noted below. For details, please check: - // https://docs.microsoft.com/en-us/windows/win32/fileio/naming-a-file - // - // Restrictions: - // Only absolute path (indicated by a drive letter prefix: e.g. "C:\") is accepted. - // The path prefix needs to match the paths specified as - // kubelet-pod-path parameter of csi-proxy. - // UNC paths of the form "\\server\share\path\file" are not allowed. - // All directory separators need to be backslash character: "\". - // Characters: .. / : | ? * in the path are not allowed. - // target_path needs to exist as a directory in the host that is empty. - // target_path cannot be a symbolic link. - // Maximum path length will be capped to 260 characters. - string target_path = 2; -} - -message LinkPathResponse { - // Error message if any. Empty string indicates success - string error = 1; -} - -message IsMountPointRequest { - // The path whose existence we want to check in the host's filesystem - string path = 1; -} - -message IsMountPointResponse { - // Error message if any. Empty string indicates success - string error = 1; - - // Indicates whether the path in PathExistsRequest exists in the host's filesystem - bool is_mount_point = 2; -} diff --git a/vendor/github.com/kubernetes-csi/csi-proxy/client/api/smb/v1alpha1/api.pb.go b/vendor/github.com/kubernetes-csi/csi-proxy/client/api/smb/v1alpha1/api.pb.go deleted file mode 100644 index 67c8fffaf..000000000 --- a/vendor/github.com/kubernetes-csi/csi-proxy/client/api/smb/v1alpha1/api.pb.go +++ /dev/null @@ -1,384 +0,0 @@ -// Code generated by protoc-gen-go. DO NOT EDIT. -// source: github.com/kubernetes-csi/csi-proxy/client/api/smb/v1alpha1/api.proto - -package v1alpha1 - -import ( - context "context" - fmt "fmt" - proto "github.com/golang/protobuf/proto" - grpc "google.golang.org/grpc" - codes "google.golang.org/grpc/codes" - status "google.golang.org/grpc/status" - math "math" -) - -// Reference imports to suppress errors if they are not otherwise used. -var _ = proto.Marshal -var _ = fmt.Errorf -var _ = math.Inf - -// This is a compile-time assertion to ensure that this generated file -// is compatible with the proto package it is being compiled against. -// A compilation error at this line likely means your copy of the -// proto package needs to be updated. -const _ = proto.ProtoPackageIsVersion3 // please upgrade the proto package - -type NewSmbGlobalMappingRequest struct { - // A remote SMB share to mount - // All unicode characters allowed in SMB server name specifications are - // permitted except for restrictions below - // - // Restrictions: - // SMB remote path specified in the format: \\server-name\sharename, \\server.fqdn\sharename or \\a.b.c.d\sharename - // If not an IP address, share name has to be a valid DNS name. - // UNC specifications to local paths or prefix: \\?\ is not allowed. - // Characters: + [ ] " / : ; | < > , ? * = $ are not allowed. - RemotePath string `protobuf:"bytes,1,opt,name=remote_path,json=remotePath,proto3" json:"remote_path,omitempty"` - // Optional local path to mount the smb on - LocalPath string `protobuf:"bytes,2,opt,name=local_path,json=localPath,proto3" json:"local_path,omitempty"` - // Username credential associated with the share - Username string `protobuf:"bytes,3,opt,name=username,proto3" json:"username,omitempty"` - // Password credential associated with the share - Password string `protobuf:"bytes,4,opt,name=password,proto3" json:"password,omitempty"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` -} - -func (m *NewSmbGlobalMappingRequest) Reset() { *m = NewSmbGlobalMappingRequest{} } -func (m *NewSmbGlobalMappingRequest) String() string { return proto.CompactTextString(m) } -func (*NewSmbGlobalMappingRequest) ProtoMessage() {} -func (*NewSmbGlobalMappingRequest) Descriptor() ([]byte, []int) { - return fileDescriptor_76c5c101454f8b9a, []int{0} -} - -func (m *NewSmbGlobalMappingRequest) XXX_Unmarshal(b []byte) error { - return xxx_messageInfo_NewSmbGlobalMappingRequest.Unmarshal(m, b) -} -func (m *NewSmbGlobalMappingRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - return xxx_messageInfo_NewSmbGlobalMappingRequest.Marshal(b, m, deterministic) -} -func (m *NewSmbGlobalMappingRequest) XXX_Merge(src proto.Message) { - xxx_messageInfo_NewSmbGlobalMappingRequest.Merge(m, src) -} -func (m *NewSmbGlobalMappingRequest) XXX_Size() int { - return xxx_messageInfo_NewSmbGlobalMappingRequest.Size(m) -} -func (m *NewSmbGlobalMappingRequest) XXX_DiscardUnknown() { - xxx_messageInfo_NewSmbGlobalMappingRequest.DiscardUnknown(m) -} - -var xxx_messageInfo_NewSmbGlobalMappingRequest proto.InternalMessageInfo - -func (m *NewSmbGlobalMappingRequest) GetRemotePath() string { - if m != nil { - return m.RemotePath - } - return "" -} - -func (m *NewSmbGlobalMappingRequest) GetLocalPath() string { - if m != nil { - return m.LocalPath - } - return "" -} - -func (m *NewSmbGlobalMappingRequest) GetUsername() string { - if m != nil { - return m.Username - } - return "" -} - -func (m *NewSmbGlobalMappingRequest) GetPassword() string { - if m != nil { - return m.Password - } - return "" -} - -type NewSmbGlobalMappingResponse struct { - // Windows error code - // Success is represented as 0 - Error string `protobuf:"bytes,1,opt,name=error,proto3" json:"error,omitempty"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` -} - -func (m *NewSmbGlobalMappingResponse) Reset() { *m = NewSmbGlobalMappingResponse{} } -func (m *NewSmbGlobalMappingResponse) String() string { return proto.CompactTextString(m) } -func (*NewSmbGlobalMappingResponse) ProtoMessage() {} -func (*NewSmbGlobalMappingResponse) Descriptor() ([]byte, []int) { - return fileDescriptor_76c5c101454f8b9a, []int{1} -} - -func (m *NewSmbGlobalMappingResponse) XXX_Unmarshal(b []byte) error { - return xxx_messageInfo_NewSmbGlobalMappingResponse.Unmarshal(m, b) -} -func (m *NewSmbGlobalMappingResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - return xxx_messageInfo_NewSmbGlobalMappingResponse.Marshal(b, m, deterministic) -} -func (m *NewSmbGlobalMappingResponse) XXX_Merge(src proto.Message) { - xxx_messageInfo_NewSmbGlobalMappingResponse.Merge(m, src) -} -func (m *NewSmbGlobalMappingResponse) XXX_Size() int { - return xxx_messageInfo_NewSmbGlobalMappingResponse.Size(m) -} -func (m *NewSmbGlobalMappingResponse) XXX_DiscardUnknown() { - xxx_messageInfo_NewSmbGlobalMappingResponse.DiscardUnknown(m) -} - -var xxx_messageInfo_NewSmbGlobalMappingResponse proto.InternalMessageInfo - -func (m *NewSmbGlobalMappingResponse) GetError() string { - if m != nil { - return m.Error - } - return "" -} - -type RemoveSmbGlobalMappingRequest struct { - // A remote SMB share mapping to remove - // All unicode characters allowed in SMB server name specifications are - // permitted except for restrictions below - // - // Restrictions: - // SMB share specified in the format: \\server-name\sharename, \\server.fqdn\sharename or \\a.b.c.d\sharename - // If not an IP address, share name has to be a valid DNS name. - // UNC specifications to local paths or prefix: \\?\ is not allowed. - // Characters: + [ ] " / : ; | < > , ? * = $ are not allowed. - RemotePath string `protobuf:"bytes,1,opt,name=remote_path,json=remotePath,proto3" json:"remote_path,omitempty"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` -} - -func (m *RemoveSmbGlobalMappingRequest) Reset() { *m = RemoveSmbGlobalMappingRequest{} } -func (m *RemoveSmbGlobalMappingRequest) String() string { return proto.CompactTextString(m) } -func (*RemoveSmbGlobalMappingRequest) ProtoMessage() {} -func (*RemoveSmbGlobalMappingRequest) Descriptor() ([]byte, []int) { - return fileDescriptor_76c5c101454f8b9a, []int{2} -} - -func (m *RemoveSmbGlobalMappingRequest) XXX_Unmarshal(b []byte) error { - return xxx_messageInfo_RemoveSmbGlobalMappingRequest.Unmarshal(m, b) -} -func (m *RemoveSmbGlobalMappingRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - return xxx_messageInfo_RemoveSmbGlobalMappingRequest.Marshal(b, m, deterministic) -} -func (m *RemoveSmbGlobalMappingRequest) XXX_Merge(src proto.Message) { - xxx_messageInfo_RemoveSmbGlobalMappingRequest.Merge(m, src) -} -func (m *RemoveSmbGlobalMappingRequest) XXX_Size() int { - return xxx_messageInfo_RemoveSmbGlobalMappingRequest.Size(m) -} -func (m *RemoveSmbGlobalMappingRequest) XXX_DiscardUnknown() { - xxx_messageInfo_RemoveSmbGlobalMappingRequest.DiscardUnknown(m) -} - -var xxx_messageInfo_RemoveSmbGlobalMappingRequest proto.InternalMessageInfo - -func (m *RemoveSmbGlobalMappingRequest) GetRemotePath() string { - if m != nil { - return m.RemotePath - } - return "" -} - -type RemoveSmbGlobalMappingResponse struct { - // Windows error code - // Success is represented as 0 - Error string `protobuf:"bytes,1,opt,name=error,proto3" json:"error,omitempty"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` -} - -func (m *RemoveSmbGlobalMappingResponse) Reset() { *m = RemoveSmbGlobalMappingResponse{} } -func (m *RemoveSmbGlobalMappingResponse) String() string { return proto.CompactTextString(m) } -func (*RemoveSmbGlobalMappingResponse) ProtoMessage() {} -func (*RemoveSmbGlobalMappingResponse) Descriptor() ([]byte, []int) { - return fileDescriptor_76c5c101454f8b9a, []int{3} -} - -func (m *RemoveSmbGlobalMappingResponse) XXX_Unmarshal(b []byte) error { - return xxx_messageInfo_RemoveSmbGlobalMappingResponse.Unmarshal(m, b) -} -func (m *RemoveSmbGlobalMappingResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - return xxx_messageInfo_RemoveSmbGlobalMappingResponse.Marshal(b, m, deterministic) -} -func (m *RemoveSmbGlobalMappingResponse) XXX_Merge(src proto.Message) { - xxx_messageInfo_RemoveSmbGlobalMappingResponse.Merge(m, src) -} -func (m *RemoveSmbGlobalMappingResponse) XXX_Size() int { - return xxx_messageInfo_RemoveSmbGlobalMappingResponse.Size(m) -} -func (m *RemoveSmbGlobalMappingResponse) XXX_DiscardUnknown() { - xxx_messageInfo_RemoveSmbGlobalMappingResponse.DiscardUnknown(m) -} - -var xxx_messageInfo_RemoveSmbGlobalMappingResponse proto.InternalMessageInfo - -func (m *RemoveSmbGlobalMappingResponse) GetError() string { - if m != nil { - return m.Error - } - return "" -} - -func init() { - proto.RegisterType((*NewSmbGlobalMappingRequest)(nil), "v1alpha1.NewSmbGlobalMappingRequest") - proto.RegisterType((*NewSmbGlobalMappingResponse)(nil), "v1alpha1.NewSmbGlobalMappingResponse") - proto.RegisterType((*RemoveSmbGlobalMappingRequest)(nil), "v1alpha1.RemoveSmbGlobalMappingRequest") - proto.RegisterType((*RemoveSmbGlobalMappingResponse)(nil), "v1alpha1.RemoveSmbGlobalMappingResponse") -} - -func init() { - proto.RegisterFile("github.com/kubernetes-csi/csi-proxy/client/api/smb/v1alpha1/api.proto", fileDescriptor_76c5c101454f8b9a) -} - -var fileDescriptor_76c5c101454f8b9a = []byte{ - // 297 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x9c, 0x92, 0xcf, 0x4a, 0x03, 0x31, - 0x10, 0xc6, 0x5d, 0xab, 0xd2, 0x8e, 0xb7, 0x28, 0x52, 0x56, 0xaa, 0xb2, 0x28, 0xf6, 0xd2, 0x0d, - 0xb5, 0xe0, 0xd9, 0x8b, 0x78, 0x52, 0xa4, 0x7d, 0x00, 0x49, 0xb6, 0x43, 0x37, 0x98, 0xec, 0xc4, - 0x24, 0xdb, 0xea, 0x7b, 0xf8, 0x74, 0x3e, 0x8d, 0x74, 0xd7, 0xd5, 0x4b, 0xff, 0x80, 0xc7, 0xef, - 0xfb, 0x0d, 0x33, 0x5f, 0x3e, 0x02, 0xf7, 0x33, 0x15, 0xf2, 0x52, 0xa6, 0x19, 0x19, 0xfe, 0x5a, - 0x4a, 0x74, 0x05, 0x06, 0xf4, 0x83, 0xcc, 0x2b, 0x9e, 0x79, 0x35, 0xb0, 0x8e, 0xde, 0x3f, 0x78, - 0xa6, 0x15, 0x16, 0x81, 0x0b, 0xab, 0xb8, 0x37, 0x92, 0xcf, 0x87, 0x42, 0xdb, 0x5c, 0x0c, 0x97, - 0x46, 0x6a, 0x1d, 0x05, 0x62, 0xed, 0xc6, 0x4b, 0x3e, 0x23, 0x88, 0x9f, 0x70, 0x31, 0x31, 0xf2, - 0x41, 0x93, 0x14, 0xfa, 0x51, 0x58, 0xab, 0x8a, 0xd9, 0x18, 0xdf, 0x4a, 0xf4, 0x81, 0x9d, 0xc3, - 0xa1, 0x43, 0x43, 0x01, 0x5f, 0xac, 0x08, 0x79, 0x37, 0xba, 0x88, 0xfa, 0x9d, 0x31, 0xd4, 0xd6, - 0xb3, 0x08, 0x39, 0xeb, 0x01, 0x68, 0xca, 0x84, 0xae, 0xf9, 0x6e, 0xc5, 0x3b, 0x95, 0x53, 0xe1, - 0x18, 0xda, 0xa5, 0x47, 0x57, 0x08, 0x83, 0xdd, 0x56, 0x05, 0x7f, 0xf5, 0x92, 0x59, 0xe1, 0xfd, - 0x82, 0xdc, 0xb4, 0xbb, 0x57, 0xb3, 0x46, 0x27, 0x23, 0x38, 0x5d, 0x99, 0xca, 0x5b, 0x2a, 0x3c, - 0xb2, 0x63, 0xd8, 0x47, 0xe7, 0xc8, 0xfd, 0x04, 0xaa, 0x45, 0x72, 0x07, 0xbd, 0x31, 0x1a, 0x9a, - 0xe3, 0x7f, 0x5f, 0x93, 0xdc, 0xc2, 0xd9, 0xba, 0x0d, 0x9b, 0x2e, 0xdf, 0x7c, 0x45, 0xd0, 0x9a, - 0x18, 0xc9, 0xa6, 0x70, 0xb4, 0x22, 0x36, 0xbb, 0x4c, 0x9b, 0xbe, 0xd3, 0xf5, 0x5d, 0xc7, 0x57, - 0x5b, 0xa6, 0xea, 0x04, 0xc9, 0x0e, 0x33, 0x70, 0xb2, 0x3a, 0x25, 0xbb, 0xfe, 0x5b, 0xb1, 0xb1, - 0x89, 0xb8, 0xbf, 0x7d, 0xb0, 0x39, 0x27, 0x0f, 0xaa, 0x3f, 0x33, 0xfa, 0x0e, 0x00, 0x00, 0xff, - 0xff, 0x75, 0x05, 0x64, 0xd1, 0x7c, 0x02, 0x00, 0x00, -} - -// Reference imports to suppress errors if they are not otherwise used. -var _ context.Context -var _ grpc.ClientConnInterface - -// This is a compile-time assertion to ensure that this generated file -// is compatible with the grpc package it is being compiled against. -const _ = grpc.SupportPackageIsVersion6 - -// SmbClient is the client API for Smb service. -// -// For semantics around ctx use and closing/ending streaming RPCs, please refer to https://godoc.org/google.golang.org/grpc#ClientConn.NewStream. -type SmbClient interface { - // NewSmbGlobalMapping creates an SMB mapping on the SMB client to an SMB share. - NewSmbGlobalMapping(ctx context.Context, in *NewSmbGlobalMappingRequest, opts ...grpc.CallOption) (*NewSmbGlobalMappingResponse, error) - // RemoveSmbGlobalMapping removes the SMB mapping to an SMB share. - RemoveSmbGlobalMapping(ctx context.Context, in *RemoveSmbGlobalMappingRequest, opts ...grpc.CallOption) (*RemoveSmbGlobalMappingResponse, error) -} - -type smbClient struct { - cc grpc.ClientConnInterface -} - -func NewSmbClient(cc grpc.ClientConnInterface) SmbClient { - return &smbClient{cc} -} - -func (c *smbClient) NewSmbGlobalMapping(ctx context.Context, in *NewSmbGlobalMappingRequest, opts ...grpc.CallOption) (*NewSmbGlobalMappingResponse, error) { - out := new(NewSmbGlobalMappingResponse) - err := c.cc.Invoke(ctx, "/v1alpha1.Smb/NewSmbGlobalMapping", in, out, opts...) - if err != nil { - return nil, err - } - return out, nil -} - -func (c *smbClient) RemoveSmbGlobalMapping(ctx context.Context, in *RemoveSmbGlobalMappingRequest, opts ...grpc.CallOption) (*RemoveSmbGlobalMappingResponse, error) { - out := new(RemoveSmbGlobalMappingResponse) - err := c.cc.Invoke(ctx, "/v1alpha1.Smb/RemoveSmbGlobalMapping", in, out, opts...) - if err != nil { - return nil, err - } - return out, nil -} - -// SmbServer is the server API for Smb service. -type SmbServer interface { - // NewSmbGlobalMapping creates an SMB mapping on the SMB client to an SMB share. - NewSmbGlobalMapping(context.Context, *NewSmbGlobalMappingRequest) (*NewSmbGlobalMappingResponse, error) - // RemoveSmbGlobalMapping removes the SMB mapping to an SMB share. - RemoveSmbGlobalMapping(context.Context, *RemoveSmbGlobalMappingRequest) (*RemoveSmbGlobalMappingResponse, error) -} - -// UnimplementedSmbServer can be embedded to have forward compatible implementations. -type UnimplementedSmbServer struct { -} - -func (*UnimplementedSmbServer) NewSmbGlobalMapping(ctx context.Context, req *NewSmbGlobalMappingRequest) (*NewSmbGlobalMappingResponse, error) { - return nil, status.Errorf(codes.Unimplemented, "method NewSmbGlobalMapping not implemented") -} -func (*UnimplementedSmbServer) RemoveSmbGlobalMapping(ctx context.Context, req *RemoveSmbGlobalMappingRequest) (*RemoveSmbGlobalMappingResponse, error) { - return nil, status.Errorf(codes.Unimplemented, "method RemoveSmbGlobalMapping not implemented") -} - -func RegisterSmbServer(s *grpc.Server, srv SmbServer) { - s.RegisterService(&_Smb_serviceDesc, srv) -} - -func _Smb_NewSmbGlobalMapping_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { - in := new(NewSmbGlobalMappingRequest) - if err := dec(in); err != nil { - return nil, err - } - if interceptor == nil { - return srv.(SmbServer).NewSmbGlobalMapping(ctx, in) - } - info := &grpc.UnaryServerInfo{ - Server: srv, - FullMethod: "/v1alpha1.Smb/NewSmbGlobalMapping", - } - handler := func(ctx context.Context, req interface{}) (interface{}, error) { - return srv.(SmbServer).NewSmbGlobalMapping(ctx, req.(*NewSmbGlobalMappingRequest)) - } - return interceptor(ctx, in, info, handler) -} - -func _Smb_RemoveSmbGlobalMapping_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { - in := new(RemoveSmbGlobalMappingRequest) - if err := dec(in); err != nil { - return nil, err - } - if interceptor == nil { - return srv.(SmbServer).RemoveSmbGlobalMapping(ctx, in) - } - info := &grpc.UnaryServerInfo{ - Server: srv, - FullMethod: "/v1alpha1.Smb/RemoveSmbGlobalMapping", - } - handler := func(ctx context.Context, req interface{}) (interface{}, error) { - return srv.(SmbServer).RemoveSmbGlobalMapping(ctx, req.(*RemoveSmbGlobalMappingRequest)) - } - return interceptor(ctx, in, info, handler) -} - -var _Smb_serviceDesc = grpc.ServiceDesc{ - ServiceName: "v1alpha1.Smb", - HandlerType: (*SmbServer)(nil), - Methods: []grpc.MethodDesc{ - { - MethodName: "NewSmbGlobalMapping", - Handler: _Smb_NewSmbGlobalMapping_Handler, - }, - { - MethodName: "RemoveSmbGlobalMapping", - Handler: _Smb_RemoveSmbGlobalMapping_Handler, - }, - }, - Streams: []grpc.StreamDesc{}, - Metadata: "github.com/kubernetes-csi/csi-proxy/client/api/smb/v1alpha1/api.proto", -} diff --git a/vendor/github.com/kubernetes-csi/csi-proxy/client/api/smb/v1alpha1/api.proto b/vendor/github.com/kubernetes-csi/csi-proxy/client/api/smb/v1alpha1/api.proto deleted file mode 100644 index f4d96e9c3..000000000 --- a/vendor/github.com/kubernetes-csi/csi-proxy/client/api/smb/v1alpha1/api.proto +++ /dev/null @@ -1,59 +0,0 @@ -syntax = "proto3"; - -package v1alpha1; - -service Smb { - // NewSmbGlobalMapping creates an SMB mapping on the SMB client to an SMB share. - rpc NewSmbGlobalMapping(NewSmbGlobalMappingRequest) returns (NewSmbGlobalMappingResponse) {} - - // RemoveSmbGlobalMapping removes the SMB mapping to an SMB share. - rpc RemoveSmbGlobalMapping(RemoveSmbGlobalMappingRequest) returns (RemoveSmbGlobalMappingResponse) {} -} - - -message NewSmbGlobalMappingRequest { - // A remote SMB share to mount - // All unicode characters allowed in SMB server name specifications are - // permitted except for restrictions below - // - // Restrictions: - // SMB remote path specified in the format: \\server-name\sharename, \\server.fqdn\sharename or \\a.b.c.d\sharename - // If not an IP address, share name has to be a valid DNS name. - // UNC specifications to local paths or prefix: \\?\ is not allowed. - // Characters: + [ ] " / : ; | < > , ? * = $ are not allowed. - string remote_path = 1; - // Optional local path to mount the smb on - string local_path = 2; - - // Username credential associated with the share - string username = 3; - - // Password credential associated with the share - string password = 4; -} - -message NewSmbGlobalMappingResponse { - // Windows error code - // Success is represented as 0 - string error = 1; -} - - -message RemoveSmbGlobalMappingRequest { - // A remote SMB share mapping to remove - // All unicode characters allowed in SMB server name specifications are - // permitted except for restrictions below - // - // Restrictions: - // SMB share specified in the format: \\server-name\sharename, \\server.fqdn\sharename or \\a.b.c.d\sharename - // If not an IP address, share name has to be a valid DNS name. - // UNC specifications to local paths or prefix: \\?\ is not allowed. - // Characters: + [ ] " / : ; | < > , ? * = $ are not allowed. - string remote_path = 1; -} - -message RemoveSmbGlobalMappingResponse { - // Windows error code - // Success is represented as 0 - string error = 1; -} \ No newline at end of file diff --git a/vendor/github.com/kubernetes-csi/csi-proxy/client/apiversion/version.go b/vendor/github.com/kubernetes-csi/csi-proxy/client/apiversion/version.go deleted file mode 100644 index bce18ef62..000000000 --- a/vendor/github.com/kubernetes-csi/csi-proxy/client/apiversion/version.go +++ /dev/null @@ -1,128 +0,0 @@ -package apiversion - -import ( - "fmt" - "regexp" - "strconv" - - "github.com/pkg/errors" -) - -// API version names follow k8s style version names: -// valid API version names examples: "v1", "v1alpha2", "v2beta3", etc... -var nameRegex = regexp.MustCompile("^v([1-9][0-9]*)(?:(alpha|beta)([1-9][0-9]*))?$") - -type qualifier uint - -const ( - alpha qualifier = iota - beta - stable -) - -type Version struct { - // major version number, eg 1 for "v1", 2 for "v2beta3" - major uint - - // qualifier is "alpha" or "beta" - qualifier qualifier - - // the qualifier's version, eg 2 for "v1alpha2" or 3 for "v2beta3" - qualifierVersion uint - - rawName string -} - -// NewVersion builds a Version from a version string, eg "v1alpha2" -func NewVersion(name string) (version Version, err error) { - matches := nameRegex.FindStringSubmatch(name) - if len(matches) < 2 || matches[1] == "" { - err = fmt.Errorf("invalid version name: %q", name) - return - } - - major, err := toUint(matches[1], name) - if err != nil { - return - } - - qualifier := stable - var qualifierVersion uint - if len(matches) >= 4 && matches[2] != "" { - switch matches[2] { - case "alpha": - qualifier = alpha - case "beta": - qualifier = beta - } - - qualifierVersion, err = toUint(matches[3], name) - if err != nil { - return - } - } - - version.major = major - version.qualifier = qualifier - version.qualifierVersion = qualifierVersion - version.rawName = name - - return -} - -// NewVersionOrPanic is the same as NewVersion, but panics if -// passed an invalid version name. -func NewVersionOrPanic(name string) Version { - version, err := NewVersion(name) - if err != nil { - panic(err) - } - return version -} - -// IsValidVersion returns true iff the input is a valid version name. -func IsValidVersion(name string) bool { - return nameRegex.MatchString(name) -} - -func toUint(s, name string) (uint, error) { - i, err := strconv.ParseUint(s, 10, 0) - if err != nil { - return 0, errors.Wrapf(err, "unable to convert %q from version name %q to int", s, name) - } - return uint(i), nil -} - -type Comparison int - -const ( - Lesser Comparison = -1 - Equal Comparison = 0 - Greater Comparison = 1 -) - -// Compare return Lesser if v < other (ie other is more recent), Equal if v == other, -// and Greater if v > other (ie v is more recent) -func (v Version) Compare(other Version) Comparison { - if cmp := compareUints(v.major, other.major); cmp != Equal { - return cmp - } - if cmp := compareUints(uint(v.qualifier), uint(other.qualifier)); cmp != Equal { - return cmp - } - return compareUints(v.qualifierVersion, other.qualifierVersion) -} - -func compareUints(a, b uint) Comparison { - if a < b { - return Lesser - } - if a > b { - return Greater - } - return Equal -} - -func (v Version) String() string { - return v.rawName -} diff --git a/vendor/github.com/kubernetes-csi/csi-proxy/client/go.mod b/vendor/github.com/kubernetes-csi/csi-proxy/client/go.mod deleted file mode 100644 index 85501884a..000000000 --- a/vendor/github.com/kubernetes-csi/csi-proxy/client/go.mod +++ /dev/null @@ -1,12 +0,0 @@ -module github.com/kubernetes-csi/csi-proxy/client - -go 1.12 - -require ( - github.com/Microsoft/go-winio v0.4.14 - github.com/golang/protobuf v1.4.1 - github.com/pkg/errors v0.8.1 - github.com/stretchr/testify v1.2.2 - google.golang.org/grpc v1.27.0 - google.golang.org/protobuf v1.25.0 -) diff --git a/vendor/github.com/kubernetes-csi/csi-proxy/client/go.sum b/vendor/github.com/kubernetes-csi/csi-proxy/client/go.sum deleted file mode 100644 index 7b2beee32..000000000 --- a/vendor/github.com/kubernetes-csi/csi-proxy/client/go.sum +++ /dev/null @@ -1,88 +0,0 @@ -cloud.google.com/go v0.26.0/go.mod h1:aQUYkXzVsufM+DwF1aE+0xfcU+56JwCaLick0ClmMTw= -github.com/BurntSushi/toml v0.3.1/go.mod h1:xHWCNGjB5oqiDr8zfno3MHue2Ht5sIBksp03qcyfWMU= -github.com/Microsoft/go-winio v0.4.14 h1:+hMXMk01us9KgxGb7ftKQt2Xpf5hH/yky+TDA+qxleU= -github.com/Microsoft/go-winio v0.4.14/go.mod h1:qXqCSQ3Xa7+6tgxaGTIe4Kpcdsi+P8jBhyzoq1bpyYA= -github.com/census-instrumentation/opencensus-proto v0.2.1/go.mod h1:f6KPmirojxKA12rnyqOA5BBL4O983OfeGPqjHWSTneU= -github.com/client9/misspell v0.3.4/go.mod h1:qj6jICC3Q7zFZvVWo7KLAzC3yx5G7kyvSDkc90ppPyw= -github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c= -github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= -github.com/envoyproxy/go-control-plane v0.9.1-0.20191026205805-5f8ba28d4473/go.mod h1:YTl/9mNaCwkRvm6d1a2C3ymFceY/DCBVvsKhRF0iEA4= -github.com/envoyproxy/protoc-gen-validate v0.1.0/go.mod h1:iSmxcyjqTsJpI2R4NaDN7+kN2VEUnK/pcBlmesArF7c= -github.com/golang/glog v0.0.0-20160126235308-23def4e6c14b h1:VKtxabqXZkF25pY9ekfRL6a582T4P37/31XEstQ5p58= -github.com/golang/glog v0.0.0-20160126235308-23def4e6c14b/go.mod h1:SBH7ygxi8pfUlaOkMMuAQtPIUF8ecWP5IEl/CR7VP2Q= -github.com/golang/mock v1.1.1/go.mod h1:oTYuIxOrZwtPieC+H1uAHpcLFnEyAGVDL/k47Jfbm0A= -github.com/golang/protobuf v1.2.0/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U= -github.com/golang/protobuf v1.3.2 h1:6nsPYzhq5kReh6QImI3k5qWzO4PEbvbIW2cwSfR/6xs= -github.com/golang/protobuf v1.3.2/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U= -github.com/golang/protobuf v1.4.0-rc.1/go.mod h1:ceaxUfeHdC40wWswd/P6IGgMaK3YpKi5j83Wpe3EHw8= -github.com/golang/protobuf v1.4.0-rc.1.0.20200221234624-67d41d38c208/go.mod h1:xKAWHe0F5eneWXFV3EuXVDTCmh+JuBKY0li0aMyXATA= -github.com/golang/protobuf v1.4.0-rc.2/go.mod h1:LlEzMj4AhA7rCAGe4KMBDvJI+AwstrUpVNzEA03Pprs= -github.com/golang/protobuf v1.4.0-rc.4.0.20200313231945-b860323f09d0/go.mod h1:WU3c8KckQ9AFe+yFwt9sWVRKCVIyN9cPHBJSNnbL67w= -github.com/golang/protobuf v1.4.0/go.mod h1:jodUvKwWbYaEsadDk5Fwe5c77LiNKVO9IDvqG2KuDX0= -github.com/golang/protobuf v1.4.1 h1:ZFgWrT+bLgsYPirOnRfKLYJLvssAegOj/hgyMFdJZe0= -github.com/golang/protobuf v1.4.1/go.mod h1:U8fpvMrcmy5pZrNK1lt4xCsGvpyWQ/VVv6QDs8UjoX8= -github.com/google/go-cmp v0.2.0 h1:+dTQ8DZQJz0Mb/HjFlkptS1FeQ4cWSnN941F8aEG4SQ= -github.com/google/go-cmp v0.2.0/go.mod h1:oXzfMopK8JAjlY9xF4vHSVASa0yLyX7SntLO5aqRK0M= -github.com/google/go-cmp v0.3.0/go.mod h1:8QqcDgzrUqlUb/G2PQTWiueGozuR1884gddMywk6iLU= -github.com/google/go-cmp v0.3.1/go.mod h1:8QqcDgzrUqlUb/G2PQTWiueGozuR1884gddMywk6iLU= -github.com/google/go-cmp v0.4.0/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= -github.com/google/go-cmp v0.5.0/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= -github.com/konsorten/go-windows-terminal-sequences v1.0.1/go.mod h1:T0+1ngSBFLxvqU3pZ+m/2kptfBszLMUkC4ZK/EgS/cQ= -github.com/pkg/errors v0.8.1 h1:iURUrRGxPUNPdy5/HRSm+Yj6okJ6UtLINN0Q9M4+h3I= -github.com/pkg/errors v0.8.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0= -github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM= -github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= -github.com/prometheus/client_model v0.0.0-20190812154241-14fe0d1b01d4/go.mod h1:xMI15A0UPsDsEKsMN9yxemIoYk6Tm2C1GtYGdfGttqA= -github.com/sirupsen/logrus v1.4.1/go.mod h1:ni0Sbl8bgC9z8RoU9G6nDWqqs/fq4eDPysMBDgk/93Q= -github.com/stretchr/objx v0.1.1/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= -github.com/stretchr/testify v1.2.2 h1:bSDNvY7ZPG5RlJ8otE/7V6gMiyenm9RtJ7IUVIAoJ1w= -github.com/stretchr/testify v1.2.2/go.mod h1:a8OnRcib4nhh0OaRAV+Yts87kKdq0PP7pXfy6kDkUVs= -golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w= -golang.org/x/exp v0.0.0-20190121172915-509febef88a4/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA= -golang.org/x/lint v0.0.0-20181026193005-c67002cb31c3/go.mod h1:UVdnD1Gm6xHRNCYTkRU2/jEulfH38KcIWyp/GAMgvoE= -golang.org/x/lint v0.0.0-20190227174305-5b3e6a55c961/go.mod h1:wehouNa3lNwaWXcvxsM5YxQ5yQlVC4a0KAMCusXpPoU= -golang.org/x/lint v0.0.0-20190313153728-d0100b6bd8b3/go.mod h1:6SW0HCj/g11FgYtHlgUYUwCkIfeOF89ocIRzGO/8vkc= -golang.org/x/net v0.0.0-20180724234803-3673e40ba225/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= -golang.org/x/net v0.0.0-20180826012351-8a410e7b638d/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= -golang.org/x/net v0.0.0-20190213061140-3a22650c66bd/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= -golang.org/x/net v0.0.0-20190311183353-d8887717615a h1:oWX7TPOiFAMXLq8o0ikBYfCJVlRHBcsciT5bXOrH628= -golang.org/x/net v0.0.0-20190311183353-d8887717615a/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg= -golang.org/x/oauth2 v0.0.0-20180821212333-d2e6202438be/go.mod h1:N/0e6XlmueqKjAGxoOufVs8QHGRruUQn6yWY3a++T0U= -golang.org/x/sync v0.0.0-20180314180146-1d60e4601c6f/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= -golang.org/x/sync v0.0.0-20181108010431-42b317875d0f/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= -golang.org/x/sync v0.0.0-20190423024810-112230192c58/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= -golang.org/x/sys v0.0.0-20180830151530-49385e6e1522/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= -golang.org/x/sys v0.0.0-20180905080454-ebe1bf3edb33/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= -golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= -golang.org/x/sys v0.0.0-20190507160741-ecd444e8653b h1:ag/x1USPSsqHud38I9BAC88qdNLDHHtQ4mlgQIZPPNA= -golang.org/x/sys v0.0.0-20190507160741-ecd444e8653b/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/text v0.3.0 h1:g61tztE5qeGQ89tm6NTjjM9VPIm088od1l6aSorWRWg= -golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= -golang.org/x/tools v0.0.0-20190114222345-bf090417da8b/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= -golang.org/x/tools v0.0.0-20190226205152-f727befe758c/go.mod h1:9Yl7xja0Znq3iFh3HoIrodX9oNMXvdceNzlUR8zjMvY= -golang.org/x/tools v0.0.0-20190311212946-11955173bddd/go.mod h1:LCzVGOaR6xXOjkQ3onu1FJEFr0SW1gC7cKk1uF8kGRs= -golang.org/x/tools v0.0.0-20190524140312-2c0ae7006135/go.mod h1:RgjU9mgBXZiqYHBnxXauZ1Gv1EHHAz9KjViQ78xBX0Q= -golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= -google.golang.org/appengine v1.1.0/go.mod h1:EbEs0AVv82hx2wNQdGPgUI5lhzA/G0D9YwlJXL52JkM= -google.golang.org/appengine v1.4.0/go.mod h1:xpcJRLb0r/rnEns0DIKYYv+WjYCduHsrkT7/EB5XEv4= -google.golang.org/genproto v0.0.0-20180817151627-c66870c02cf8 h1:Nw54tB0rB7hY/N0NQvRW8DG4Yk3Q6T9cu9RcFQDu1tc= -google.golang.org/genproto v0.0.0-20180817151627-c66870c02cf8/go.mod h1:JiN7NxoALGmiZfu7CAH4rXhgtRTLTxftemlI0sWmxmc= -google.golang.org/genproto v0.0.0-20190819201941-24fa4b261c55 h1:gSJIx1SDwno+2ElGhA4+qG2zF97qiUzTM+rQ0klBOcE= -google.golang.org/genproto v0.0.0-20190819201941-24fa4b261c55/go.mod h1:DMBHOl98Agz4BDEuKkezgsaosCRResVns1a3J2ZsMNc= -google.golang.org/genproto v0.0.0-20200526211855-cb27e3aa2013 h1:+kGHl1aib/qcwaRi1CbqBZ1rk19r85MNUf8HaBghugY= -google.golang.org/genproto v0.0.0-20200526211855-cb27e3aa2013/go.mod h1:NbSheEEYHJ7i3ixzK3sjbqSGDJWnxyFXZblF3eUsNvo= -google.golang.org/grpc v1.19.0/go.mod h1:mqu4LbDTu4XGKhr4mRzUsmM4RtVoemTSY81AxZiDr8c= -google.golang.org/grpc v1.23.0/go.mod h1:Y5yQAOtifL1yxbo5wqy6BxZv8vAUGQwXBOALyacEbxg= -google.golang.org/grpc v1.27.0 h1:rRYRFMVgRv6E0D70Skyfsr28tDXIuuPZyWGMPdMcnXg= -google.golang.org/grpc v1.27.0/go.mod h1:qbnxyOmOxrQa7FizSgH+ReBfzJrCY1pSN7KXBS8abTk= -google.golang.org/protobuf v0.0.0-20200109180630-ec00e32a8dfd/go.mod h1:DFci5gLYBciE7Vtevhsrf46CRTquxDuWsQurQQe4oz8= -google.golang.org/protobuf v0.0.0-20200221191635-4d8936d0db64/go.mod h1:kwYJMbMJ01Woi6D6+Kah6886xMZcty6N08ah7+eCXa0= -google.golang.org/protobuf v0.0.0-20200228230310-ab0ca4ff8a60/go.mod h1:cfTl7dwQJ+fmap5saPgwCLgHXTUD7jkjRqWcaiX5VyM= -google.golang.org/protobuf v1.20.1-0.20200309200217-e05f789c0967/go.mod h1:A+miEFZTKqfCUM6K7xSMQL9OKL/b6hQv+e19PK+JZNE= -google.golang.org/protobuf v1.21.0/go.mod h1:47Nbq4nVaFHyn7ilMalzfO3qCViNmqZ2kzikPIcrTAo= -google.golang.org/protobuf v1.22.0/go.mod h1:EGpADcykh3NcUnDUJcl1+ZksZNG86OlYog2l/sGQquU= -google.golang.org/protobuf v1.23.1-0.20200526195155-81db48ad09cc/go.mod h1:EGpADcykh3NcUnDUJcl1+ZksZNG86OlYog2l/sGQquU= -google.golang.org/protobuf v1.25.0 h1:Ejskq+SyPohKW+1uil0JJMtmHCgJPJ/qWTxr8qp+R4c= -google.golang.org/protobuf v1.25.0/go.mod h1:9JNX74DMeImyA3h4bdi1ymwjUzf21/xIlbajtzgsN7c= -honnef.co/go/tools v0.0.0-20190102054323-c2f93a96b099/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4= -honnef.co/go/tools v0.0.0-20190523083050-ea95bdfd59fc/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4= diff --git a/vendor/github.com/kubernetes-csi/csi-proxy/client/groups/filesystem/v1alpha1/client_generated.go b/vendor/github.com/kubernetes-csi/csi-proxy/client/groups/filesystem/v1alpha1/client_generated.go deleted file mode 100644 index b6f23557d..000000000 --- a/vendor/github.com/kubernetes-csi/csi-proxy/client/groups/filesystem/v1alpha1/client_generated.go +++ /dev/null @@ -1,72 +0,0 @@ -// Code generated by csi-proxy-api-gen. DO NOT EDIT. - -package v1alpha1 - -import ( - "context" - "net" - - "github.com/Microsoft/go-winio" - "github.com/kubernetes-csi/csi-proxy/client" - "github.com/kubernetes-csi/csi-proxy/client/api/filesystem/v1alpha1" - "github.com/kubernetes-csi/csi-proxy/client/apiversion" - "google.golang.org/grpc" -) - -const groupName = "filesystem" - -var version = apiversion.NewVersionOrPanic("v1alpha1") - -type Client struct { - client v1alpha1.FilesystemClient - connection *grpc.ClientConn -} - -// NewClient returns a client to make calls to the filesystem API group version v1alpha1. -// It's the caller's responsibility to Close the client when done. -func NewClient() (*Client, error) { - pipePath := client.PipePath(groupName, version) - - connection, err := grpc.Dial(pipePath, - grpc.WithContextDialer(func(context context.Context, s string) (net.Conn, error) { - return winio.DialPipeContext(context, s) - }), - grpc.WithInsecure()) - if err != nil { - return nil, err - } - - client := v1alpha1.NewFilesystemClient(connection) - return &Client{ - client: client, - connection: connection, - }, nil -} - -// Close closes the client. It must be called before the client gets GC-ed. -func (w *Client) Close() error { - return w.connection.Close() -} - -// ensures we implement all the required methods -var _ v1alpha1.FilesystemClient = &Client{} - -func (w *Client) IsMountPoint(context context.Context, request *v1alpha1.IsMountPointRequest, opts ...grpc.CallOption) (*v1alpha1.IsMountPointResponse, error) { - return w.client.IsMountPoint(context, request, opts...) -} - -func (w *Client) LinkPath(context context.Context, request *v1alpha1.LinkPathRequest, opts ...grpc.CallOption) (*v1alpha1.LinkPathResponse, error) { - return w.client.LinkPath(context, request, opts...) -} - -func (w *Client) Mkdir(context context.Context, request *v1alpha1.MkdirRequest, opts ...grpc.CallOption) (*v1alpha1.MkdirResponse, error) { - return w.client.Mkdir(context, request, opts...) -} - -func (w *Client) PathExists(context context.Context, request *v1alpha1.PathExistsRequest, opts ...grpc.CallOption) (*v1alpha1.PathExistsResponse, error) { - return w.client.PathExists(context, request, opts...) -} - -func (w *Client) Rmdir(context context.Context, request *v1alpha1.RmdirRequest, opts ...grpc.CallOption) (*v1alpha1.RmdirResponse, error) { - return w.client.Rmdir(context, request, opts...) -} diff --git a/vendor/github.com/kubernetes-csi/csi-proxy/client/groups/smb/v1alpha1/client_generated.go b/vendor/github.com/kubernetes-csi/csi-proxy/client/groups/smb/v1alpha1/client_generated.go deleted file mode 100644 index 4cdc0e832..000000000 --- a/vendor/github.com/kubernetes-csi/csi-proxy/client/groups/smb/v1alpha1/client_generated.go +++ /dev/null @@ -1,60 +0,0 @@ -// Code generated by csi-proxy-api-gen. DO NOT EDIT. - -package v1alpha1 - -import ( - "context" - "net" - - "github.com/Microsoft/go-winio" - "github.com/kubernetes-csi/csi-proxy/client" - "github.com/kubernetes-csi/csi-proxy/client/api/smb/v1alpha1" - "github.com/kubernetes-csi/csi-proxy/client/apiversion" - "google.golang.org/grpc" -) - -const groupName = "smb" - -var version = apiversion.NewVersionOrPanic("v1alpha1") - -type Client struct { - client v1alpha1.SmbClient - connection *grpc.ClientConn -} - -// NewClient returns a client to make calls to the smb API group version v1alpha1. -// It's the caller's responsibility to Close the client when done. -func NewClient() (*Client, error) { - pipePath := client.PipePath(groupName, version) - - connection, err := grpc.Dial(pipePath, - grpc.WithContextDialer(func(context context.Context, s string) (net.Conn, error) { - return winio.DialPipeContext(context, s) - }), - grpc.WithInsecure()) - if err != nil { - return nil, err - } - - client := v1alpha1.NewSmbClient(connection) - return &Client{ - client: client, - connection: connection, - }, nil -} - -// Close closes the client. It must be called before the client gets GC-ed. -func (w *Client) Close() error { - return w.connection.Close() -} - -// ensures we implement all the required methods -var _ v1alpha1.SmbClient = &Client{} - -func (w *Client) NewSmbGlobalMapping(context context.Context, request *v1alpha1.NewSmbGlobalMappingRequest, opts ...grpc.CallOption) (*v1alpha1.NewSmbGlobalMappingResponse, error) { - return w.client.NewSmbGlobalMapping(context, request, opts...) -} - -func (w *Client) RemoveSmbGlobalMapping(context context.Context, request *v1alpha1.RemoveSmbGlobalMappingRequest, opts ...grpc.CallOption) (*v1alpha1.RemoveSmbGlobalMappingResponse, error) { - return w.client.RemoveSmbGlobalMapping(context, request, opts...) -} diff --git a/vendor/github.com/kubernetes-csi/csi-proxy/client/utils.go b/vendor/github.com/kubernetes-csi/csi-proxy/client/utils.go deleted file mode 100644 index 39f45c165..000000000 --- a/vendor/github.com/kubernetes-csi/csi-proxy/client/utils.go +++ /dev/null @@ -1,19 +0,0 @@ -package client - -import ( - "github.com/kubernetes-csi/csi-proxy/client/apiversion" -) - -const ( - // pipePrefix is the prefix for Windows named pipes' names - pipePrefix = `\\.\\pipe\\` - - // CsiProxyNamedPipePrefix is the prefix for the named pipes the proxy creates. - // The suffix will be the API group and version, - // e.g. "\\.\\pipe\\csi-proxy-iscsi-v1", "\\.\\pipe\\csi-proxy-filesystem-v2alpha1", etc. - csiProxyNamedPipePrefix = "csi-proxy-" -) - -func PipePath(apiGroupName string, apiVersion apiversion.Version) string { - return pipePrefix + csiProxyNamedPipePrefix + apiGroupName + "-" + apiVersion.String() -} diff --git a/vendor/golang.org/x/crypto/poly1305/sum_noasm.go b/vendor/golang.org/x/crypto/poly1305/sum_noasm.go deleted file mode 100644 index 32a9cef6b..000000000 --- a/vendor/golang.org/x/crypto/poly1305/sum_noasm.go +++ /dev/null @@ -1,13 +0,0 @@ -// Copyright 2018 The Go Authors. All rights reserved. -// Use of this source code is governed by a BSD-style -// license that can be found in the LICENSE file. - -// +build s390x,!go1.11 !amd64,!s390x,!ppc64le gccgo appengine nacl - -package poly1305 - -func sum(out *[TagSize]byte, msg []byte, key *[32]byte) { - h := newMAC(key) - h.Write(msg) - h.Sum(out) -} diff --git a/vendor/golang.org/x/crypto/poly1305/sum_vmsl_s390x.s b/vendor/golang.org/x/crypto/poly1305/sum_vmsl_s390x.s deleted file mode 100644 index e60bbc1d7..000000000 --- a/vendor/golang.org/x/crypto/poly1305/sum_vmsl_s390x.s +++ /dev/null @@ -1,909 +0,0 @@ -// Copyright 2018 The Go Authors. All rights reserved. -// Use of this source code is governed by a BSD-style -// license that can be found in the LICENSE file. - -// +build s390x,go1.11,!gccgo,!appengine - -#include "textflag.h" - -// Implementation of Poly1305 using the vector facility (vx) and the VMSL instruction. - -// constants -#define EX0 V1 -#define EX1 V2 -#define EX2 V3 - -// temporaries -#define T_0 V4 -#define T_1 V5 -#define T_2 V6 -#define T_3 V7 -#define T_4 V8 -#define T_5 V9 -#define T_6 V10 -#define T_7 V11 -#define T_8 V12 -#define T_9 V13 -#define T_10 V14 - -// r**2 & r**4 -#define R_0 V15 -#define R_1 V16 -#define R_2 V17 -#define R5_1 V18 -#define R5_2 V19 -// key (r) -#define RSAVE_0 R7 -#define RSAVE_1 R8 -#define RSAVE_2 R9 -#define R5SAVE_1 R10 -#define R5SAVE_2 R11 - -// message block -#define M0 V20 -#define M1 V21 -#define M2 V22 -#define M3 V23 -#define M4 V24 -#define M5 V25 - -// accumulator -#define H0_0 V26 -#define H1_0 V27 -#define H2_0 V28 -#define H0_1 V29 -#define H1_1 V30 -#define H2_1 V31 - -GLOBL ·keyMask<>(SB), RODATA, $16 -DATA ·keyMask<>+0(SB)/8, $0xffffff0ffcffff0f -DATA ·keyMask<>+8(SB)/8, $0xfcffff0ffcffff0f - -GLOBL ·bswapMask<>(SB), RODATA, $16 -DATA ·bswapMask<>+0(SB)/8, $0x0f0e0d0c0b0a0908 -DATA ·bswapMask<>+8(SB)/8, $0x0706050403020100 - -GLOBL ·constants<>(SB), RODATA, $48 -// EX0 -DATA ·constants<>+0(SB)/8, $0x18191a1b1c1d1e1f -DATA ·constants<>+8(SB)/8, $0x0000050403020100 -// EX1 -DATA ·constants<>+16(SB)/8, $0x18191a1b1c1d1e1f -DATA ·constants<>+24(SB)/8, $0x00000a0908070605 -// EX2 -DATA ·constants<>+32(SB)/8, $0x18191a1b1c1d1e1f -DATA ·constants<>+40(SB)/8, $0x0000000f0e0d0c0b - -GLOBL ·c<>(SB), RODATA, $48 -// EX0 -DATA ·c<>+0(SB)/8, $0x0000050403020100 -DATA ·c<>+8(SB)/8, $0x0000151413121110 -// EX1 -DATA ·c<>+16(SB)/8, $0x00000a0908070605 -DATA ·c<>+24(SB)/8, $0x00001a1918171615 -// EX2 -DATA ·c<>+32(SB)/8, $0x0000000f0e0d0c0b -DATA ·c<>+40(SB)/8, $0x0000001f1e1d1c1b - -GLOBL ·reduce<>(SB), RODATA, $32 -// 44 bit -DATA ·reduce<>+0(SB)/8, $0x0 -DATA ·reduce<>+8(SB)/8, $0xfffffffffff -// 42 bit -DATA ·reduce<>+16(SB)/8, $0x0 -DATA ·reduce<>+24(SB)/8, $0x3ffffffffff - -// h = (f*g) % (2**130-5) [partial reduction] -// uses T_0...T_9 temporary registers -// input: m02_0, m02_1, m02_2, m13_0, m13_1, m13_2, r_0, r_1, r_2, r5_1, r5_2, m4_0, m4_1, m4_2, m5_0, m5_1, m5_2 -// temp: t0, t1, t2, t3, t4, t5, t6, t7, t8, t9 -// output: m02_0, m02_1, m02_2, m13_0, m13_1, m13_2 -#define MULTIPLY(m02_0, m02_1, m02_2, m13_0, m13_1, m13_2, r_0, r_1, r_2, r5_1, r5_2, m4_0, m4_1, m4_2, m5_0, m5_1, m5_2, t0, t1, t2, t3, t4, t5, t6, t7, t8, t9) \ - \ // Eliminate the dependency for the last 2 VMSLs - VMSLG m02_0, r_2, m4_2, m4_2 \ - VMSLG m13_0, r_2, m5_2, m5_2 \ // 8 VMSLs pipelined - VMSLG m02_0, r_0, m4_0, m4_0 \ - VMSLG m02_1, r5_2, V0, T_0 \ - VMSLG m02_0, r_1, m4_1, m4_1 \ - VMSLG m02_1, r_0, V0, T_1 \ - VMSLG m02_1, r_1, V0, T_2 \ - VMSLG m02_2, r5_1, V0, T_3 \ - VMSLG m02_2, r5_2, V0, T_4 \ - VMSLG m13_0, r_0, m5_0, m5_0 \ - VMSLG m13_1, r5_2, V0, T_5 \ - VMSLG m13_0, r_1, m5_1, m5_1 \ - VMSLG m13_1, r_0, V0, T_6 \ - VMSLG m13_1, r_1, V0, T_7 \ - VMSLG m13_2, r5_1, V0, T_8 \ - VMSLG m13_2, r5_2, V0, T_9 \ - VMSLG m02_2, r_0, m4_2, m4_2 \ - VMSLG m13_2, r_0, m5_2, m5_2 \ - VAQ m4_0, T_0, m02_0 \ - VAQ m4_1, T_1, m02_1 \ - VAQ m5_0, T_5, m13_0 \ - VAQ m5_1, T_6, m13_1 \ - VAQ m02_0, T_3, m02_0 \ - VAQ m02_1, T_4, m02_1 \ - VAQ m13_0, T_8, m13_0 \ - VAQ m13_1, T_9, m13_1 \ - VAQ m4_2, T_2, m02_2 \ - VAQ m5_2, T_7, m13_2 \ - -// SQUARE uses three limbs of r and r_2*5 to output square of r -// uses T_1, T_5 and T_7 temporary registers -// input: r_0, r_1, r_2, r5_2 -// temp: TEMP0, TEMP1, TEMP2 -// output: p0, p1, p2 -#define SQUARE(r_0, r_1, r_2, r5_2, p0, p1, p2, TEMP0, TEMP1, TEMP2) \ - VMSLG r_0, r_0, p0, p0 \ - VMSLG r_1, r5_2, V0, TEMP0 \ - VMSLG r_2, r5_2, p1, p1 \ - VMSLG r_0, r_1, V0, TEMP1 \ - VMSLG r_1, r_1, p2, p2 \ - VMSLG r_0, r_2, V0, TEMP2 \ - VAQ TEMP0, p0, p0 \ - VAQ TEMP1, p1, p1 \ - VAQ TEMP2, p2, p2 \ - VAQ TEMP0, p0, p0 \ - VAQ TEMP1, p1, p1 \ - VAQ TEMP2, p2, p2 \ - -// carry h0->h1->h2->h0 || h3->h4->h5->h3 -// uses T_2, T_4, T_5, T_7, T_8, T_9 -// t6, t7, t8, t9, t10, t11 -// input: h0, h1, h2, h3, h4, h5 -// temp: t0, t1, t2, t3, t4, t5, t6, t7, t8, t9, t10, t11 -// output: h0, h1, h2, h3, h4, h5 -#define REDUCE(h0, h1, h2, h3, h4, h5, t0, t1, t2, t3, t4, t5, t6, t7, t8, t9, t10, t11) \ - VLM (R12), t6, t7 \ // 44 and 42 bit clear mask - VLEIB $7, $0x28, t10 \ // 5 byte shift mask - VREPIB $4, t8 \ // 4 bit shift mask - VREPIB $2, t11 \ // 2 bit shift mask - VSRLB t10, h0, t0 \ // h0 byte shift - VSRLB t10, h1, t1 \ // h1 byte shift - VSRLB t10, h2, t2 \ // h2 byte shift - VSRLB t10, h3, t3 \ // h3 byte shift - VSRLB t10, h4, t4 \ // h4 byte shift - VSRLB t10, h5, t5 \ // h5 byte shift - VSRL t8, t0, t0 \ // h0 bit shift - VSRL t8, t1, t1 \ // h2 bit shift - VSRL t11, t2, t2 \ // h2 bit shift - VSRL t8, t3, t3 \ // h3 bit shift - VSRL t8, t4, t4 \ // h4 bit shift - VESLG $2, t2, t9 \ // h2 carry x5 - VSRL t11, t5, t5 \ // h5 bit shift - VN t6, h0, h0 \ // h0 clear carry - VAQ t2, t9, t2 \ // h2 carry x5 - VESLG $2, t5, t9 \ // h5 carry x5 - VN t6, h1, h1 \ // h1 clear carry - VN t7, h2, h2 \ // h2 clear carry - VAQ t5, t9, t5 \ // h5 carry x5 - VN t6, h3, h3 \ // h3 clear carry - VN t6, h4, h4 \ // h4 clear carry - VN t7, h5, h5 \ // h5 clear carry - VAQ t0, h1, h1 \ // h0->h1 - VAQ t3, h4, h4 \ // h3->h4 - VAQ t1, h2, h2 \ // h1->h2 - VAQ t4, h5, h5 \ // h4->h5 - VAQ t2, h0, h0 \ // h2->h0 - VAQ t5, h3, h3 \ // h5->h3 - VREPG $1, t6, t6 \ // 44 and 42 bit masks across both halves - VREPG $1, t7, t7 \ - VSLDB $8, h0, h0, h0 \ // set up [h0/1/2, h3/4/5] - VSLDB $8, h1, h1, h1 \ - VSLDB $8, h2, h2, h2 \ - VO h0, h3, h3 \ - VO h1, h4, h4 \ - VO h2, h5, h5 \ - VESRLG $44, h3, t0 \ // 44 bit shift right - VESRLG $44, h4, t1 \ - VESRLG $42, h5, t2 \ - VN t6, h3, h3 \ // clear carry bits - VN t6, h4, h4 \ - VN t7, h5, h5 \ - VESLG $2, t2, t9 \ // multiply carry by 5 - VAQ t9, t2, t2 \ - VAQ t0, h4, h4 \ - VAQ t1, h5, h5 \ - VAQ t2, h3, h3 \ - -// carry h0->h1->h2->h0 -// input: h0, h1, h2 -// temp: t0, t1, t2, t3, t4, t5, t6, t7, t8 -// output: h0, h1, h2 -#define REDUCE2(h0, h1, h2, t0, t1, t2, t3, t4, t5, t6, t7, t8) \ - VLEIB $7, $0x28, t3 \ // 5 byte shift mask - VREPIB $4, t4 \ // 4 bit shift mask - VREPIB $2, t7 \ // 2 bit shift mask - VGBM $0x003F, t5 \ // mask to clear carry bits - VSRLB t3, h0, t0 \ - VSRLB t3, h1, t1 \ - VSRLB t3, h2, t2 \ - VESRLG $4, t5, t5 \ // 44 bit clear mask - VSRL t4, t0, t0 \ - VSRL t4, t1, t1 \ - VSRL t7, t2, t2 \ - VESRLG $2, t5, t6 \ // 42 bit clear mask - VESLG $2, t2, t8 \ - VAQ t8, t2, t2 \ - VN t5, h0, h0 \ - VN t5, h1, h1 \ - VN t6, h2, h2 \ - VAQ t0, h1, h1 \ - VAQ t1, h2, h2 \ - VAQ t2, h0, h0 \ - VSRLB t3, h0, t0 \ - VSRLB t3, h1, t1 \ - VSRLB t3, h2, t2 \ - VSRL t4, t0, t0 \ - VSRL t4, t1, t1 \ - VSRL t7, t2, t2 \ - VN t5, h0, h0 \ - VN t5, h1, h1 \ - VESLG $2, t2, t8 \ - VN t6, h2, h2 \ - VAQ t0, h1, h1 \ - VAQ t8, t2, t2 \ - VAQ t1, h2, h2 \ - VAQ t2, h0, h0 \ - -// expands two message blocks into the lower halfs of the d registers -// moves the contents of the d registers into upper halfs -// input: in1, in2, d0, d1, d2, d3, d4, d5 -// temp: TEMP0, TEMP1, TEMP2, TEMP3 -// output: d0, d1, d2, d3, d4, d5 -#define EXPACC(in1, in2, d0, d1, d2, d3, d4, d5, TEMP0, TEMP1, TEMP2, TEMP3) \ - VGBM $0xff3f, TEMP0 \ - VGBM $0xff1f, TEMP1 \ - VESLG $4, d1, TEMP2 \ - VESLG $4, d4, TEMP3 \ - VESRLG $4, TEMP0, TEMP0 \ - VPERM in1, d0, EX0, d0 \ - VPERM in2, d3, EX0, d3 \ - VPERM in1, d2, EX2, d2 \ - VPERM in2, d5, EX2, d5 \ - VPERM in1, TEMP2, EX1, d1 \ - VPERM in2, TEMP3, EX1, d4 \ - VN TEMP0, d0, d0 \ - VN TEMP0, d3, d3 \ - VESRLG $4, d1, d1 \ - VESRLG $4, d4, d4 \ - VN TEMP1, d2, d2 \ - VN TEMP1, d5, d5 \ - VN TEMP0, d1, d1 \ - VN TEMP0, d4, d4 \ - -// expands one message block into the lower halfs of the d registers -// moves the contents of the d registers into upper halfs -// input: in, d0, d1, d2 -// temp: TEMP0, TEMP1, TEMP2 -// output: d0, d1, d2 -#define EXPACC2(in, d0, d1, d2, TEMP0, TEMP1, TEMP2) \ - VGBM $0xff3f, TEMP0 \ - VESLG $4, d1, TEMP2 \ - VGBM $0xff1f, TEMP1 \ - VPERM in, d0, EX0, d0 \ - VESRLG $4, TEMP0, TEMP0 \ - VPERM in, d2, EX2, d2 \ - VPERM in, TEMP2, EX1, d1 \ - VN TEMP0, d0, d0 \ - VN TEMP1, d2, d2 \ - VESRLG $4, d1, d1 \ - VN TEMP0, d1, d1 \ - -// pack h2:h0 into h1:h0 (no carry) -// input: h0, h1, h2 -// output: h0, h1, h2 -#define PACK(h0, h1, h2) \ - VMRLG h1, h2, h2 \ // copy h1 to upper half h2 - VESLG $44, h1, h1 \ // shift limb 1 44 bits, leaving 20 - VO h0, h1, h0 \ // combine h0 with 20 bits from limb 1 - VESRLG $20, h2, h1 \ // put top 24 bits of limb 1 into h1 - VLEIG $1, $0, h1 \ // clear h2 stuff from lower half of h1 - VO h0, h1, h0 \ // h0 now has 88 bits (limb 0 and 1) - VLEIG $0, $0, h2 \ // clear upper half of h2 - VESRLG $40, h2, h1 \ // h1 now has upper two bits of result - VLEIB $7, $88, h1 \ // for byte shift (11 bytes) - VSLB h1, h2, h2 \ // shift h2 11 bytes to the left - VO h0, h2, h0 \ // combine h0 with 20 bits from limb 1 - VLEIG $0, $0, h1 \ // clear upper half of h1 - -// if h > 2**130-5 then h -= 2**130-5 -// input: h0, h1 -// temp: t0, t1, t2 -// output: h0 -#define MOD(h0, h1, t0, t1, t2) \ - VZERO t0 \ - VLEIG $1, $5, t0 \ - VACCQ h0, t0, t1 \ - VAQ h0, t0, t0 \ - VONE t2 \ - VLEIG $1, $-4, t2 \ - VAQ t2, t1, t1 \ - VACCQ h1, t1, t1 \ - VONE t2 \ - VAQ t2, t1, t1 \ - VN h0, t1, t2 \ - VNC t0, t1, t1 \ - VO t1, t2, h0 \ - -// func poly1305vmsl(out *[16]byte, m *byte, mlen uint64, key *[32]key) -TEXT ·poly1305vmsl(SB), $0-32 - // This code processes 6 + up to 4 blocks (32 bytes) per iteration - // using the algorithm described in: - // NEON crypto, Daniel J. Bernstein & Peter Schwabe - // https://cryptojedi.org/papers/neoncrypto-20120320.pdf - // And as moddified for VMSL as described in - // Accelerating Poly1305 Cryptographic Message Authentication on the z14 - // O'Farrell et al, CASCON 2017, p48-55 - // https://ibm.ent.box.com/s/jf9gedj0e9d2vjctfyh186shaztavnht - - LMG out+0(FP), R1, R4 // R1=out, R2=m, R3=mlen, R4=key - VZERO V0 // c - - // load EX0, EX1 and EX2 - MOVD $·constants<>(SB), R5 - VLM (R5), EX0, EX2 // c - - // setup r - VL (R4), T_0 - MOVD $·keyMask<>(SB), R6 - VL (R6), T_1 - VN T_0, T_1, T_0 - VZERO T_2 // limbs for r - VZERO T_3 - VZERO T_4 - EXPACC2(T_0, T_2, T_3, T_4, T_1, T_5, T_7) - - // T_2, T_3, T_4: [0, r] - - // setup r*20 - VLEIG $0, $0, T_0 - VLEIG $1, $20, T_0 // T_0: [0, 20] - VZERO T_5 - VZERO T_6 - VMSLG T_0, T_3, T_5, T_5 - VMSLG T_0, T_4, T_6, T_6 - - // store r for final block in GR - VLGVG $1, T_2, RSAVE_0 // c - VLGVG $1, T_3, RSAVE_1 // c - VLGVG $1, T_4, RSAVE_2 // c - VLGVG $1, T_5, R5SAVE_1 // c - VLGVG $1, T_6, R5SAVE_2 // c - - // initialize h - VZERO H0_0 - VZERO H1_0 - VZERO H2_0 - VZERO H0_1 - VZERO H1_1 - VZERO H2_1 - - // initialize pointer for reduce constants - MOVD $·reduce<>(SB), R12 - - // calculate r**2 and 20*(r**2) - VZERO R_0 - VZERO R_1 - VZERO R_2 - SQUARE(T_2, T_3, T_4, T_6, R_0, R_1, R_2, T_1, T_5, T_7) - REDUCE2(R_0, R_1, R_2, M0, M1, M2, M3, M4, R5_1, R5_2, M5, T_1) - VZERO R5_1 - VZERO R5_2 - VMSLG T_0, R_1, R5_1, R5_1 - VMSLG T_0, R_2, R5_2, R5_2 - - // skip r**4 calculation if 3 blocks or less - CMPBLE R3, $48, b4 - - // calculate r**4 and 20*(r**4) - VZERO T_8 - VZERO T_9 - VZERO T_10 - SQUARE(R_0, R_1, R_2, R5_2, T_8, T_9, T_10, T_1, T_5, T_7) - REDUCE2(T_8, T_9, T_10, M0, M1, M2, M3, M4, T_2, T_3, M5, T_1) - VZERO T_2 - VZERO T_3 - VMSLG T_0, T_9, T_2, T_2 - VMSLG T_0, T_10, T_3, T_3 - - // put r**2 to the right and r**4 to the left of R_0, R_1, R_2 - VSLDB $8, T_8, T_8, T_8 - VSLDB $8, T_9, T_9, T_9 - VSLDB $8, T_10, T_10, T_10 - VSLDB $8, T_2, T_2, T_2 - VSLDB $8, T_3, T_3, T_3 - - VO T_8, R_0, R_0 - VO T_9, R_1, R_1 - VO T_10, R_2, R_2 - VO T_2, R5_1, R5_1 - VO T_3, R5_2, R5_2 - - CMPBLE R3, $80, load // less than or equal to 5 blocks in message - - // 6(or 5+1) blocks - SUB $81, R3 - VLM (R2), M0, M4 - VLL R3, 80(R2), M5 - ADD $1, R3 - MOVBZ $1, R0 - CMPBGE R3, $16, 2(PC) - VLVGB R3, R0, M5 - MOVD $96(R2), R2 - EXPACC(M0, M1, H0_0, H1_0, H2_0, H0_1, H1_1, H2_1, T_0, T_1, T_2, T_3) - EXPACC(M2, M3, H0_0, H1_0, H2_0, H0_1, H1_1, H2_1, T_0, T_1, T_2, T_3) - VLEIB $2, $1, H2_0 - VLEIB $2, $1, H2_1 - VLEIB $10, $1, H2_0 - VLEIB $10, $1, H2_1 - - VZERO M0 - VZERO M1 - VZERO M2 - VZERO M3 - VZERO T_4 - VZERO T_10 - EXPACC(M4, M5, M0, M1, M2, M3, T_4, T_10, T_0, T_1, T_2, T_3) - VLR T_4, M4 - VLEIB $10, $1, M2 - CMPBLT R3, $16, 2(PC) - VLEIB $10, $1, T_10 - MULTIPLY(H0_0, H1_0, H2_0, H0_1, H1_1, H2_1, R_0, R_1, R_2, R5_1, R5_2, M0, M1, M2, M3, M4, T_10, T_0, T_1, T_2, T_3, T_4, T_5, T_6, T_7, T_8, T_9) - REDUCE(H0_0, H1_0, H2_0, H0_1, H1_1, H2_1, T_10, M0, M1, M2, M3, M4, T_4, T_5, T_2, T_7, T_8, T_9) - VMRHG V0, H0_1, H0_0 - VMRHG V0, H1_1, H1_0 - VMRHG V0, H2_1, H2_0 - VMRLG V0, H0_1, H0_1 - VMRLG V0, H1_1, H1_1 - VMRLG V0, H2_1, H2_1 - - SUB $16, R3 - CMPBLE R3, $0, square - -load: - // load EX0, EX1 and EX2 - MOVD $·c<>(SB), R5 - VLM (R5), EX0, EX2 - -loop: - CMPBLE R3, $64, add // b4 // last 4 or less blocks left - - // next 4 full blocks - VLM (R2), M2, M5 - SUB $64, R3 - MOVD $64(R2), R2 - REDUCE(H0_0, H1_0, H2_0, H0_1, H1_1, H2_1, T_10, M0, M1, T_0, T_1, T_3, T_4, T_5, T_2, T_7, T_8, T_9) - - // expacc in-lined to create [m2, m3] limbs - VGBM $0x3f3f, T_0 // 44 bit clear mask - VGBM $0x1f1f, T_1 // 40 bit clear mask - VPERM M2, M3, EX0, T_3 - VESRLG $4, T_0, T_0 // 44 bit clear mask ready - VPERM M2, M3, EX1, T_4 - VPERM M2, M3, EX2, T_5 - VN T_0, T_3, T_3 - VESRLG $4, T_4, T_4 - VN T_1, T_5, T_5 - VN T_0, T_4, T_4 - VMRHG H0_1, T_3, H0_0 - VMRHG H1_1, T_4, H1_0 - VMRHG H2_1, T_5, H2_0 - VMRLG H0_1, T_3, H0_1 - VMRLG H1_1, T_4, H1_1 - VMRLG H2_1, T_5, H2_1 - VLEIB $10, $1, H2_0 - VLEIB $10, $1, H2_1 - VPERM M4, M5, EX0, T_3 - VPERM M4, M5, EX1, T_4 - VPERM M4, M5, EX2, T_5 - VN T_0, T_3, T_3 - VESRLG $4, T_4, T_4 - VN T_1, T_5, T_5 - VN T_0, T_4, T_4 - VMRHG V0, T_3, M0 - VMRHG V0, T_4, M1 - VMRHG V0, T_5, M2 - VMRLG V0, T_3, M3 - VMRLG V0, T_4, M4 - VMRLG V0, T_5, M5 - VLEIB $10, $1, M2 - VLEIB $10, $1, M5 - - MULTIPLY(H0_0, H1_0, H2_0, H0_1, H1_1, H2_1, R_0, R_1, R_2, R5_1, R5_2, M0, M1, M2, M3, M4, M5, T_0, T_1, T_2, T_3, T_4, T_5, T_6, T_7, T_8, T_9) - CMPBNE R3, $0, loop - REDUCE(H0_0, H1_0, H2_0, H0_1, H1_1, H2_1, T_10, M0, M1, M3, M4, M5, T_4, T_5, T_2, T_7, T_8, T_9) - VMRHG V0, H0_1, H0_0 - VMRHG V0, H1_1, H1_0 - VMRHG V0, H2_1, H2_0 - VMRLG V0, H0_1, H0_1 - VMRLG V0, H1_1, H1_1 - VMRLG V0, H2_1, H2_1 - - // load EX0, EX1, EX2 - MOVD $·constants<>(SB), R5 - VLM (R5), EX0, EX2 - - // sum vectors - VAQ H0_0, H0_1, H0_0 - VAQ H1_0, H1_1, H1_0 - VAQ H2_0, H2_1, H2_0 - - // h may be >= 2*(2**130-5) so we need to reduce it again - // M0...M4 are used as temps here - REDUCE2(H0_0, H1_0, H2_0, M0, M1, M2, M3, M4, T_9, T_10, H0_1, M5) - -next: // carry h1->h2 - VLEIB $7, $0x28, T_1 - VREPIB $4, T_2 - VGBM $0x003F, T_3 - VESRLG $4, T_3 - - // byte shift - VSRLB T_1, H1_0, T_4 - - // bit shift - VSRL T_2, T_4, T_4 - - // clear h1 carry bits - VN T_3, H1_0, H1_0 - - // add carry - VAQ T_4, H2_0, H2_0 - - // h is now < 2*(2**130-5) - // pack h into h1 (hi) and h0 (lo) - PACK(H0_0, H1_0, H2_0) - - // if h > 2**130-5 then h -= 2**130-5 - MOD(H0_0, H1_0, T_0, T_1, T_2) - - // h += s - MOVD $·bswapMask<>(SB), R5 - VL (R5), T_1 - VL 16(R4), T_0 - VPERM T_0, T_0, T_1, T_0 // reverse bytes (to big) - VAQ T_0, H0_0, H0_0 - VPERM H0_0, H0_0, T_1, H0_0 // reverse bytes (to little) - VST H0_0, (R1) - RET - -add: - // load EX0, EX1, EX2 - MOVD $·constants<>(SB), R5 - VLM (R5), EX0, EX2 - - REDUCE(H0_0, H1_0, H2_0, H0_1, H1_1, H2_1, T_10, M0, M1, M3, M4, M5, T_4, T_5, T_2, T_7, T_8, T_9) - VMRHG V0, H0_1, H0_0 - VMRHG V0, H1_1, H1_0 - VMRHG V0, H2_1, H2_0 - VMRLG V0, H0_1, H0_1 - VMRLG V0, H1_1, H1_1 - VMRLG V0, H2_1, H2_1 - CMPBLE R3, $64, b4 - -b4: - CMPBLE R3, $48, b3 // 3 blocks or less - - // 4(3+1) blocks remaining - SUB $49, R3 - VLM (R2), M0, M2 - VLL R3, 48(R2), M3 - ADD $1, R3 - MOVBZ $1, R0 - CMPBEQ R3, $16, 2(PC) - VLVGB R3, R0, M3 - MOVD $64(R2), R2 - EXPACC(M0, M1, H0_0, H1_0, H2_0, H0_1, H1_1, H2_1, T_0, T_1, T_2, T_3) - VLEIB $10, $1, H2_0 - VLEIB $10, $1, H2_1 - VZERO M0 - VZERO M1 - VZERO M4 - VZERO M5 - VZERO T_4 - VZERO T_10 - EXPACC(M2, M3, M0, M1, M4, M5, T_4, T_10, T_0, T_1, T_2, T_3) - VLR T_4, M2 - VLEIB $10, $1, M4 - CMPBNE R3, $16, 2(PC) - VLEIB $10, $1, T_10 - MULTIPLY(H0_0, H1_0, H2_0, H0_1, H1_1, H2_1, R_0, R_1, R_2, R5_1, R5_2, M0, M1, M4, M5, M2, T_10, T_0, T_1, T_2, T_3, T_4, T_5, T_6, T_7, T_8, T_9) - REDUCE(H0_0, H1_0, H2_0, H0_1, H1_1, H2_1, T_10, M0, M1, M3, M4, M5, T_4, T_5, T_2, T_7, T_8, T_9) - VMRHG V0, H0_1, H0_0 - VMRHG V0, H1_1, H1_0 - VMRHG V0, H2_1, H2_0 - VMRLG V0, H0_1, H0_1 - VMRLG V0, H1_1, H1_1 - VMRLG V0, H2_1, H2_1 - SUB $16, R3 - CMPBLE R3, $0, square // this condition must always hold true! - -b3: - CMPBLE R3, $32, b2 - - // 3 blocks remaining - - // setup [r²,r] - VSLDB $8, R_0, R_0, R_0 - VSLDB $8, R_1, R_1, R_1 - VSLDB $8, R_2, R_2, R_2 - VSLDB $8, R5_1, R5_1, R5_1 - VSLDB $8, R5_2, R5_2, R5_2 - - VLVGG $1, RSAVE_0, R_0 - VLVGG $1, RSAVE_1, R_1 - VLVGG $1, RSAVE_2, R_2 - VLVGG $1, R5SAVE_1, R5_1 - VLVGG $1, R5SAVE_2, R5_2 - - // setup [h0, h1] - VSLDB $8, H0_0, H0_0, H0_0 - VSLDB $8, H1_0, H1_0, H1_0 - VSLDB $8, H2_0, H2_0, H2_0 - VO H0_1, H0_0, H0_0 - VO H1_1, H1_0, H1_0 - VO H2_1, H2_0, H2_0 - VZERO H0_1 - VZERO H1_1 - VZERO H2_1 - - VZERO M0 - VZERO M1 - VZERO M2 - VZERO M3 - VZERO M4 - VZERO M5 - - // H*[r**2, r] - MULTIPLY(H0_0, H1_0, H2_0, H0_1, H1_1, H2_1, R_0, R_1, R_2, R5_1, R5_2, M0, M1, M2, M3, M4, M5, T_0, T_1, T_2, T_3, T_4, T_5, T_6, T_7, T_8, T_9) - REDUCE2(H0_0, H1_0, H2_0, M0, M1, M2, M3, M4, H0_1, H1_1, T_10, M5) - - SUB $33, R3 - VLM (R2), M0, M1 - VLL R3, 32(R2), M2 - ADD $1, R3 - MOVBZ $1, R0 - CMPBEQ R3, $16, 2(PC) - VLVGB R3, R0, M2 - - // H += m0 - VZERO T_1 - VZERO T_2 - VZERO T_3 - EXPACC2(M0, T_1, T_2, T_3, T_4, T_5, T_6) - VLEIB $10, $1, T_3 - VAG H0_0, T_1, H0_0 - VAG H1_0, T_2, H1_0 - VAG H2_0, T_3, H2_0 - - VZERO M0 - VZERO M3 - VZERO M4 - VZERO M5 - VZERO T_10 - - // (H+m0)*r - MULTIPLY(H0_0, H1_0, H2_0, H0_1, H1_1, H2_1, R_0, R_1, R_2, R5_1, R5_2, M0, M3, M4, M5, V0, T_10, T_0, T_1, T_2, T_3, T_4, T_5, T_6, T_7, T_8, T_9) - REDUCE2(H0_0, H1_0, H2_0, M0, M3, M4, M5, T_10, H0_1, H1_1, H2_1, T_9) - - // H += m1 - VZERO V0 - VZERO T_1 - VZERO T_2 - VZERO T_3 - EXPACC2(M1, T_1, T_2, T_3, T_4, T_5, T_6) - VLEIB $10, $1, T_3 - VAQ H0_0, T_1, H0_0 - VAQ H1_0, T_2, H1_0 - VAQ H2_0, T_3, H2_0 - REDUCE2(H0_0, H1_0, H2_0, M0, M3, M4, M5, T_9, H0_1, H1_1, H2_1, T_10) - - // [H, m2] * [r**2, r] - EXPACC2(M2, H0_0, H1_0, H2_0, T_1, T_2, T_3) - CMPBNE R3, $16, 2(PC) - VLEIB $10, $1, H2_0 - VZERO M0 - VZERO M1 - VZERO M2 - VZERO M3 - VZERO M4 - VZERO M5 - MULTIPLY(H0_0, H1_0, H2_0, H0_1, H1_1, H2_1, R_0, R_1, R_2, R5_1, R5_2, M0, M1, M2, M3, M4, M5, T_0, T_1, T_2, T_3, T_4, T_5, T_6, T_7, T_8, T_9) - REDUCE2(H0_0, H1_0, H2_0, M0, M1, M2, M3, M4, H0_1, H1_1, M5, T_10) - SUB $16, R3 - CMPBLE R3, $0, next // this condition must always hold true! - -b2: - CMPBLE R3, $16, b1 - - // 2 blocks remaining - - // setup [r²,r] - VSLDB $8, R_0, R_0, R_0 - VSLDB $8, R_1, R_1, R_1 - VSLDB $8, R_2, R_2, R_2 - VSLDB $8, R5_1, R5_1, R5_1 - VSLDB $8, R5_2, R5_2, R5_2 - - VLVGG $1, RSAVE_0, R_0 - VLVGG $1, RSAVE_1, R_1 - VLVGG $1, RSAVE_2, R_2 - VLVGG $1, R5SAVE_1, R5_1 - VLVGG $1, R5SAVE_2, R5_2 - - // setup [h0, h1] - VSLDB $8, H0_0, H0_0, H0_0 - VSLDB $8, H1_0, H1_0, H1_0 - VSLDB $8, H2_0, H2_0, H2_0 - VO H0_1, H0_0, H0_0 - VO H1_1, H1_0, H1_0 - VO H2_1, H2_0, H2_0 - VZERO H0_1 - VZERO H1_1 - VZERO H2_1 - - VZERO M0 - VZERO M1 - VZERO M2 - VZERO M3 - VZERO M4 - VZERO M5 - - // H*[r**2, r] - MULTIPLY(H0_0, H1_0, H2_0, H0_1, H1_1, H2_1, R_0, R_1, R_2, R5_1, R5_2, M0, M1, M2, M3, M4, M5, T_0, T_1, T_2, T_3, T_4, T_5, T_6, T_7, T_8, T_9) - REDUCE(H0_0, H1_0, H2_0, H0_1, H1_1, H2_1, T_10, M0, M1, M2, M3, M4, T_4, T_5, T_2, T_7, T_8, T_9) - VMRHG V0, H0_1, H0_0 - VMRHG V0, H1_1, H1_0 - VMRHG V0, H2_1, H2_0 - VMRLG V0, H0_1, H0_1 - VMRLG V0, H1_1, H1_1 - VMRLG V0, H2_1, H2_1 - - // move h to the left and 0s at the right - VSLDB $8, H0_0, H0_0, H0_0 - VSLDB $8, H1_0, H1_0, H1_0 - VSLDB $8, H2_0, H2_0, H2_0 - - // get message blocks and append 1 to start - SUB $17, R3 - VL (R2), M0 - VLL R3, 16(R2), M1 - ADD $1, R3 - MOVBZ $1, R0 - CMPBEQ R3, $16, 2(PC) - VLVGB R3, R0, M1 - VZERO T_6 - VZERO T_7 - VZERO T_8 - EXPACC2(M0, T_6, T_7, T_8, T_1, T_2, T_3) - EXPACC2(M1, T_6, T_7, T_8, T_1, T_2, T_3) - VLEIB $2, $1, T_8 - CMPBNE R3, $16, 2(PC) - VLEIB $10, $1, T_8 - - // add [m0, m1] to h - VAG H0_0, T_6, H0_0 - VAG H1_0, T_7, H1_0 - VAG H2_0, T_8, H2_0 - - VZERO M2 - VZERO M3 - VZERO M4 - VZERO M5 - VZERO T_10 - VZERO M0 - - // at this point R_0 .. R5_2 look like [r**2, r] - MULTIPLY(H0_0, H1_0, H2_0, H0_1, H1_1, H2_1, R_0, R_1, R_2, R5_1, R5_2, M2, M3, M4, M5, T_10, M0, T_0, T_1, T_2, T_3, T_4, T_5, T_6, T_7, T_8, T_9) - REDUCE2(H0_0, H1_0, H2_0, M2, M3, M4, M5, T_9, H0_1, H1_1, H2_1, T_10) - SUB $16, R3, R3 - CMPBLE R3, $0, next - -b1: - CMPBLE R3, $0, next - - // 1 block remaining - - // setup [r²,r] - VSLDB $8, R_0, R_0, R_0 - VSLDB $8, R_1, R_1, R_1 - VSLDB $8, R_2, R_2, R_2 - VSLDB $8, R5_1, R5_1, R5_1 - VSLDB $8, R5_2, R5_2, R5_2 - - VLVGG $1, RSAVE_0, R_0 - VLVGG $1, RSAVE_1, R_1 - VLVGG $1, RSAVE_2, R_2 - VLVGG $1, R5SAVE_1, R5_1 - VLVGG $1, R5SAVE_2, R5_2 - - // setup [h0, h1] - VSLDB $8, H0_0, H0_0, H0_0 - VSLDB $8, H1_0, H1_0, H1_0 - VSLDB $8, H2_0, H2_0, H2_0 - VO H0_1, H0_0, H0_0 - VO H1_1, H1_0, H1_0 - VO H2_1, H2_0, H2_0 - VZERO H0_1 - VZERO H1_1 - VZERO H2_1 - - VZERO M0 - VZERO M1 - VZERO M2 - VZERO M3 - VZERO M4 - VZERO M5 - - // H*[r**2, r] - MULTIPLY(H0_0, H1_0, H2_0, H0_1, H1_1, H2_1, R_0, R_1, R_2, R5_1, R5_2, M0, M1, M2, M3, M4, M5, T_0, T_1, T_2, T_3, T_4, T_5, T_6, T_7, T_8, T_9) - REDUCE2(H0_0, H1_0, H2_0, M0, M1, M2, M3, M4, T_9, T_10, H0_1, M5) - - // set up [0, m0] limbs - SUB $1, R3 - VLL R3, (R2), M0 - ADD $1, R3 - MOVBZ $1, R0 - CMPBEQ R3, $16, 2(PC) - VLVGB R3, R0, M0 - VZERO T_1 - VZERO T_2 - VZERO T_3 - EXPACC2(M0, T_1, T_2, T_3, T_4, T_5, T_6)// limbs: [0, m] - CMPBNE R3, $16, 2(PC) - VLEIB $10, $1, T_3 - - // h+m0 - VAQ H0_0, T_1, H0_0 - VAQ H1_0, T_2, H1_0 - VAQ H2_0, T_3, H2_0 - - VZERO M0 - VZERO M1 - VZERO M2 - VZERO M3 - VZERO M4 - VZERO M5 - MULTIPLY(H0_0, H1_0, H2_0, H0_1, H1_1, H2_1, R_0, R_1, R_2, R5_1, R5_2, M0, M1, M2, M3, M4, M5, T_0, T_1, T_2, T_3, T_4, T_5, T_6, T_7, T_8, T_9) - REDUCE2(H0_0, H1_0, H2_0, M0, M1, M2, M3, M4, T_9, T_10, H0_1, M5) - - BR next - -square: - // setup [r²,r] - VSLDB $8, R_0, R_0, R_0 - VSLDB $8, R_1, R_1, R_1 - VSLDB $8, R_2, R_2, R_2 - VSLDB $8, R5_1, R5_1, R5_1 - VSLDB $8, R5_2, R5_2, R5_2 - - VLVGG $1, RSAVE_0, R_0 - VLVGG $1, RSAVE_1, R_1 - VLVGG $1, RSAVE_2, R_2 - VLVGG $1, R5SAVE_1, R5_1 - VLVGG $1, R5SAVE_2, R5_2 - - // setup [h0, h1] - VSLDB $8, H0_0, H0_0, H0_0 - VSLDB $8, H1_0, H1_0, H1_0 - VSLDB $8, H2_0, H2_0, H2_0 - VO H0_1, H0_0, H0_0 - VO H1_1, H1_0, H1_0 - VO H2_1, H2_0, H2_0 - VZERO H0_1 - VZERO H1_1 - VZERO H2_1 - - VZERO M0 - VZERO M1 - VZERO M2 - VZERO M3 - VZERO M4 - VZERO M5 - - // (h0*r**2) + (h1*r) - MULTIPLY(H0_0, H1_0, H2_0, H0_1, H1_1, H2_1, R_0, R_1, R_2, R5_1, R5_2, M0, M1, M2, M3, M4, M5, T_0, T_1, T_2, T_3, T_4, T_5, T_6, T_7, T_8, T_9) - REDUCE2(H0_0, H1_0, H2_0, M0, M1, M2, M3, M4, T_9, T_10, H0_1, M5) - BR next diff --git a/vendor/modules.txt b/vendor/modules.txt index 67782df4e..e07b4c3b2 100644 --- a/vendor/modules.txt +++ b/vendor/modules.txt @@ -1,6 +1,3 @@ -# github.com/Microsoft/go-winio v0.4.14 -github.com/Microsoft/go-winio -github.com/Microsoft/go-winio/pkg/guid # github.com/beorn7/perks v1.0.1 github.com/beorn7/perks/quantile # github.com/blang/semver v3.5.0+incompatible @@ -72,20 +69,8 @@ github.com/imdario/mergo github.com/inconshreveable/mousetrap # github.com/json-iterator/go v1.1.9 github.com/json-iterator/go -# github.com/kubernetes-csi/csi-driver-smb v0.4.0 -github.com/kubernetes-csi/csi-driver-smb/pkg/csi-common -github.com/kubernetes-csi/csi-driver-smb/pkg/mounter -github.com/kubernetes-csi/csi-driver-smb/pkg/smb -github.com/kubernetes-csi/csi-driver-smb/test/e2e/driver # github.com/kubernetes-csi/csi-lib-utils v0.7.0 github.com/kubernetes-csi/csi-lib-utils/protosanitizer -# github.com/kubernetes-csi/csi-proxy/client v0.0.0-20200907051941-1c32ab57cb4f -github.com/kubernetes-csi/csi-proxy/client -github.com/kubernetes-csi/csi-proxy/client/api/filesystem/v1alpha1 -github.com/kubernetes-csi/csi-proxy/client/api/smb/v1alpha1 -github.com/kubernetes-csi/csi-proxy/client/apiversion -github.com/kubernetes-csi/csi-proxy/client/groups/filesystem/v1alpha1 -github.com/kubernetes-csi/csi-proxy/client/groups/smb/v1alpha1 # github.com/kubernetes-csi/external-snapshotter/v2 v2.0.0-20200617021606-4800ca72d403 github.com/kubernetes-csi/external-snapshotter/v2/pkg/apis/volumesnapshot/v1beta1 # github.com/matttproud/golang_protobuf_extensions v1.0.1 @@ -762,6 +747,7 @@ k8s.io/kubernetes/pkg/volume/util/volumepathhandler k8s.io/kubernetes/test/e2e/framework k8s.io/kubernetes/test/e2e/framework/auth k8s.io/kubernetes/test/e2e/framework/config +k8s.io/kubernetes/test/e2e/framework/deployment k8s.io/kubernetes/test/e2e/framework/ginkgowrapper k8s.io/kubernetes/test/e2e/framework/kubectl k8s.io/kubernetes/test/e2e/framework/log