diff --git a/Gopkg.toml b/Gopkg.toml index 3d859a94b9..b7e4b146fe 100644 --- a/Gopkg.toml +++ b/Gopkg.toml @@ -112,11 +112,11 @@ [[constraint]] name = "github.com/tencentcloud/tencentcloud-sdk-go" - version = "=v3.0.0" + version = "=v3.0.28" [[constraint]] + branch = "master" name = "github.com/nelsonken/cos-go-sdk-v5" - version = "=v1.2.0" [[constraint]] branch = "master" @@ -125,3 +125,7 @@ [[constraint]] branch = "master" name = "golang.org/x/crypto" + +[[constraint]] + branch = "master" + name = "github.com/forhappy/cos-go-sdk" diff --git a/cmd/qcloudcli/main.go b/cmd/qcloudcli/main.go index 7e22889f2e..6764f03e00 100644 --- a/cmd/qcloudcli/main.go +++ b/cmd/qcloudcli/main.go @@ -17,7 +17,7 @@ type BaseOptions struct { AppID string `help:"AppID" default:"$QCLOUD_APPID"` SecretID string `help:"Secret" default:"$QCLOUD_SECRET_ID"` SecretKey string `help:"Access key" default:"$QCLOUD_SECRET_KEY"` - RegionId string `help:"RegionId" default:"$QCLOUD_REGION_ID"` + RegionId string `help:"RegionId" default:"$QCLOUD_REGION"` SUBCOMMAND string `help:"azurecli subcommand" subcommand:"true"` } diff --git a/pkg/compute/guestdrivers/qcloud.go b/pkg/compute/guestdrivers/qcloud.go index b9d0cc8dff..9229ab1fe3 100644 --- a/pkg/compute/guestdrivers/qcloud.go +++ b/pkg/compute/guestdrivers/qcloud.go @@ -37,7 +37,7 @@ func (self *SQcloudGuestDriver) ChooseHostStorage(host *models.SHost, backend st return &storages[i] } } - for _, stype := range []string{"local_basic", "local_ssd", "cloud_basic", "cloud_ssd", "cloud_premium"} { + for _, stype := range []string{"cloud_basic", "cloud_premium", "cloud_ssd", "local_basic", "local_ssd"} { for i := 0; i < len(storages); i++ { if storages[i].StorageType == stype { return &storages[i] @@ -128,8 +128,8 @@ func (self *SQcloudGuestDriver) RequestDeployGuestOnHost(ctx context.Context, gu if err != nil { return nil, err } - log.Debugf("VMcreated %s, wait status ready ...", iVM.GetGlobalId()) - err = cloudprovider.WaitStatus(iVM, models.VM_READY, time.Second*5, time.Second*1800) + log.Debugf("VMcreated %s, wait status running ...", iVM.GetGlobalId()) + err = cloudprovider.WaitStatus(iVM, models.VM_RUNNING, time.Second*5, time.Second*1800) if err != nil { return nil, err } @@ -159,12 +159,13 @@ func (self *SQcloudGuestDriver) RequestDeployGuestOnHost(ctx context.Context, gu deleteKeypair := jsonutils.QueryBoolean(params, "__delete_keypair__", false) taskman.LocalTaskRun(task, func() (jsonutils.JSONObject, error) { - if len(userData) > 0 { - err := iVM.UpdateUserData(userData) - if err != nil { - log.Errorf("update userdata fail %s", err) - } - } + //腾讯云暂不支持更新自定义用户数据 + // if len(userData) > 0 { + // err := iVM.UpdateUserData(userData) + // if err != nil { + // log.Errorf("update userdata fail %s", err) + // } + // } err := iVM.DeployVM(name, passwd, publicKey, deleteKeypair, description) if err != nil { @@ -183,12 +184,13 @@ func (self *SQcloudGuestDriver) RequestDeployGuestOnHost(ctx context.Context, gu } taskman.LocalTaskRun(task, func() (jsonutils.JSONObject, error) { - if len(userData) > 0 { - err := iVM.UpdateUserData(userData) - if err != nil { - log.Errorf("update userdata fail %s", err) - } - } + //腾讯云暂不支持更新自定义用户数据 + // if len(userData) > 0 { + // err := iVM.UpdateUserData(userData) + // if err != nil { + // log.Errorf("update userdata fail %s", err) + // } + // } diskId, err := iVM.RebuildRoot(desc.ExternalImageId, passwd, publicKey, desc.SysDiskSize) if err != nil { @@ -267,7 +269,7 @@ func (self *SQcloudGuestDriver) OnGuestDeployTaskDataReceived(ctx context.Contex disk.Status = models.DISK_READY disk.BillingType = diskInfo[i].BillingType disk.FsFormat = diskInfo[i].FsFromat - disk.AutoDelete = diskInfo[i].AutoDelete + disk.AutoDelete = true disk.TemplateId = diskInfo[i].TemplateId disk.DiskFormat = diskInfo[i].DiskFormat disk.ExpiredAt = diskInfo[i].ExpiredAt diff --git a/pkg/compute/hostdrivers/qcloud.go b/pkg/compute/hostdrivers/qcloud.go new file mode 100644 index 0000000000..536c620c64 --- /dev/null +++ b/pkg/compute/hostdrivers/qcloud.go @@ -0,0 +1,209 @@ +package hostdrivers + +import ( + "context" + "fmt" + "os" + + "yunion.io/x/jsonutils" + "yunion.io/x/log" + "yunion.io/x/onecloud/pkg/cloudcommon/db/lockman" + "yunion.io/x/onecloud/pkg/cloudcommon/db/taskman" + "yunion.io/x/onecloud/pkg/cloudprovider" + "yunion.io/x/onecloud/pkg/compute/models" + "yunion.io/x/onecloud/pkg/compute/options" + "yunion.io/x/onecloud/pkg/httperrors" +) + +type SQcloudHostDriver struct { + SBaseHostDriver +} + +func init() { + driver := SQcloudHostDriver{} + models.RegisterHostDriver(&driver) +} + +func (self *SQcloudHostDriver) GetHostType() string { + return models.HOST_TYPE_QCLOUD +} + +func (self *SQcloudHostDriver) CheckAndSetCacheImage(ctx context.Context, host *models.SHost, storageCache *models.SStoragecache, task taskman.ITask) error { + params := task.GetParams() + imageId, err := params.GetString("image_id") + if err != nil { + return err + } + + osArch, _ := params.GetString("os_arch") + osType, _ := params.GetString("os_type") + osDist, _ := params.GetString("os_distribution") + + isForce := jsonutils.QueryBoolean(params, "is_force", false) + userCred := task.GetUserCred() + taskman.LocalTaskRun(task, func() (jsonutils.JSONObject, error) { + lockman.LockRawObject(ctx, "cachedimages", fmt.Sprintf("%s-%s", storageCache.Id, imageId)) + defer lockman.ReleaseRawObject(ctx, "cachedimages", fmt.Sprintf("%s-%s", storageCache.Id, imageId)) + + scimg := models.StoragecachedimageManager.Register(ctx, task.GetUserCred(), storageCache.Id, imageId) + iStorageCache, err := storageCache.GetIStorageCache() + if err != nil { + return nil, err + } + + extImgId, err := iStorageCache.UploadImage(userCred, imageId, osArch, osType, osDist, scimg.ExternalId, isForce) + if err != nil { + return nil, err + } + scimg.SetExternalId(extImgId) + + ret := jsonutils.NewDict() + ret.Add(jsonutils.NewString(extImgId), "image_id") + return ret, nil + }) + return nil +} + +func (self *SQcloudHostDriver) RequestAllocateDiskOnStorage(ctx context.Context, host *models.SHost, storage *models.SStorage, disk *models.SDisk, task taskman.ITask, content *jsonutils.JSONDict) error { + iCloudStorage, err := storage.GetIStorage() + if err != nil { + return err + } + size, err := content.Int("size") + if err != nil { + return err + } + size = size >> 10 + iDisk, err := iCloudStorage.CreateIDisk(disk.GetName(), int(size), "") + if err != nil { + return err + } + _, err = disk.GetModelManager().TableSpec().Update(disk, func() error { + disk.ExternalId = iDisk.GetGlobalId() + + if metaData := iDisk.GetMetadata(); metaData != nil { + meta := make(map[string]string) + if err := metaData.Unmarshal(meta); err != nil { + log.Errorf("Get disk %s Metadata error: %v", disk.Name, err) + } else { + for key, value := range meta { + if err := disk.SetMetadata(ctx, key, value, task.GetUserCred()); err != nil { + log.Errorf("set disk %s mata %s => %s error: %v", disk.Name, key, value, err) + } + } + } + } + + return nil + }) + if err != nil { + log.Errorf("Update disk externalId err: %v", err) + return err + } + data := jsonutils.NewDict() + data.Add(jsonutils.NewInt(int64(iDisk.GetDiskSizeMB())), "disk_size") + data.Add(jsonutils.NewString(iDisk.GetDiskFormat()), "disk_format") + task.ScheduleRun(data) + return nil +} + +func (self *SQcloudHostDriver) RequestDeallocateDiskOnHost(host *models.SHost, storage *models.SStorage, disk *models.SDisk, task taskman.ITask) error { + data := jsonutils.NewDict() + if iCloudStorage, err := storage.GetIStorage(); err != nil { + return err + } else if iDisk, err := iCloudStorage.GetIDisk(disk.GetExternalId()); err != nil { + if err == cloudprovider.ErrNotFound { + task.ScheduleRun(data) + return nil + } + return err + } else if err := iDisk.Delete(); err != nil { + return err + } + task.ScheduleRun(data) + return nil +} + +func (self *SQcloudHostDriver) RequestResizeDiskOnHostOnline(host *models.SHost, storage *models.SStorage, disk *models.SDisk, size int64, task taskman.ITask) error { + return self.RequestResizeDiskOnHost(host, storage, disk, size, task) +} + +func (self *SQcloudHostDriver) RequestResizeDiskOnHost(host *models.SHost, storage *models.SStorage, disk *models.SDisk, size int64, task taskman.ITask) error { + iCloudStorage, err := storage.GetIStorage() + if err != nil { + return err + } + iDisk, err := iCloudStorage.GetIDisk(disk.GetExternalId()) + if err != nil { + return err + } + err = iDisk.Resize(size >> 10) + if err != nil { + return err + } + task.ScheduleRun(jsonutils.Marshal(map[string]int64{"disk_size": size})) + return nil +} + +func (self *SQcloudHostDriver) RequestPrepareSaveDiskOnHost(ctx context.Context, host *models.SHost, disk *models.SDisk, imageId string, task taskman.ITask) error { + task.ScheduleRun(nil) + return nil +} + +func (self *SQcloudHostDriver) RequestSaveUploadImageOnHost(ctx context.Context, host *models.SHost, disk *models.SDisk, imageId string, task taskman.ITask, data jsonutils.JSONObject) error { + iDisk, err := disk.GetIDisk() + if err != nil { + return err + } + iStorage, err := disk.GetIStorage() + if err != nil { + return err + } + iStoragecache := iStorage.GetIStoragecache() + if iStoragecache == nil { + return httperrors.NewResourceNotFoundError("fail to find iStoragecache for storage: %s", iStorage.GetName()) + } + taskman.LocalTaskRun(task, func() (jsonutils.JSONObject, error) { + snapshot, err := iDisk.CreateISnapshot(fmt.Sprintf("Snapshot-%s", imageId), "PrepareSaveImage") + if err != nil { + return nil, err + } + params := task.GetParams() + osType, _ := params.GetString("properties", "os_type") + + scimg := models.StoragecachedimageManager.Register(ctx, task.GetUserCred(), iStoragecache.GetId(), imageId) + if scimg.Status != models.CACHED_IMAGE_STATUS_READY { + scimg.SetStatus(task.GetUserCred(), models.CACHED_IMAGE_STATUS_CACHING, "request_prepare_save_disk_on_host") + } + iImage, err := iStoragecache.CreateIImage(snapshot.GetId(), fmt.Sprintf("Image-%s", imageId), osType, "") + if err != nil { + log.Errorf("fail to create iImage: %v", err) + scimg.SetStatus(task.GetUserCred(), models.CACHED_IMAGE_STATUS_CACHE_FAILED, err.Error()) + return nil, err + } + scimg.SetExternalId(iImage.GetId()) + if _, err := os.Stat(options.Options.TempPath); os.IsNotExist(err) { + if err = os.MkdirAll(options.Options.TempPath, 0755); err != nil { + return nil, err + } + } + result, err := iStoragecache.DownloadImage(task.GetUserCred(), imageId, iImage.GetId(), options.Options.TempPath) + if err != nil { + scimg.SetStatus(task.GetUserCred(), models.CACHED_IMAGE_STATUS_CACHE_FAILED, err.Error()) + return nil, err + } + if err := iImage.Delete(); err != nil { + log.Errorf("Delete iImage %s failed: %v", iImage.GetId(), err) + } + if err := snapshot.Delete(); err != nil { + log.Errorf("Delete snapshot %s failed: %v", snapshot.GetId(), err) + } + scimg.SetStatus(task.GetUserCred(), models.CACHED_IMAGE_STATUS_READY, "") + return result, nil + }) + return nil +} + +func (self *SQcloudHostDriver) RequestDeleteSnapshotWithStorage(ctx context.Context, host *models.SHost, snapshot *models.SSnapshot, task taskman.ITask) error { + return httperrors.NewNotImplementedError("not implement") +} diff --git a/pkg/mcclient/options/servers.go b/pkg/mcclient/options/servers.go index 30c9f17c76..69793506e6 100644 --- a/pkg/mcclient/options/servers.go +++ b/pkg/mcclient/options/servers.go @@ -115,7 +115,7 @@ type ServerCreateOptions struct { Project string `help:"'Owner project ID or Name" json:"tenant"` User string `help:"Owner user ID or Name"` System *bool `help:"Create a system VM, sysadmin ONLY option" json:"is_system"` - Hypervisor string `help:"Hypervisor type" choices:"kvm|esxi|baremetal|container|aliyun|azure"` + Hypervisor string `help:"Hypervisor type" choices:"kvm|esxi|baremetal|container|aliyun|azure|qcloud"` TaskNotify *bool `help:"Setup task notify" json:"-"` Count *int `help:"Create multiple simultaneously" default:"1" json:"-"` DryRun *bool `help:"Dry run to test scheduler" json:"-"` diff --git a/pkg/scheduler/api/types.go b/pkg/scheduler/api/types.go index 8ad5257f97..9123041abd 100644 --- a/pkg/scheduler/api/types.go +++ b/pkg/scheduler/api/types.go @@ -18,6 +18,7 @@ const ( HostHypervisorForKvm = "hypervisor" HostTypeAliyun = "aliyun" HostTypeAzure = "azure" + HostTypeQcloud = "qcloud" HostTypeKubelet = "kubelet" AggregateStrategyRequire = "require" @@ -50,6 +51,7 @@ var ( PublicCloudProviders = sets.NewString( HostTypeAliyun, HostTypeAzure, + HostTypeQcloud, ) ValidGpuTypes = sets.NewString( diff --git a/pkg/util/aliyun/instance.go b/pkg/util/aliyun/instance.go index 31e7c1b1b2..9d9aab6ccf 100644 --- a/pkg/util/aliyun/instance.go +++ b/pkg/util/aliyun/instance.go @@ -118,8 +118,13 @@ type SInstance struct { // {"AutoReleaseTime":"","ClusterId":"","Cpu":1,"CreationTime":"2018-05-23T07:58Z","DedicatedHostAttribute":{"DedicatedHostId":"","DedicatedHostName":""},"Description":"","DeviceAvailable":true,"EipAddress":{"AllocationId":"","InternetChargeType":"","IpAddress":""},"ExpiredTime":"2018-05-30T16:00Z","GPUAmount":0,"GPUSpec":"","HostName":"iZ2ze57isp1ali72tzkjowZ","ImageId":"centos_7_04_64_20G_alibase_201701015.vhd","InnerIpAddress":{"IpAddress":[]},"InstanceChargeType":"PrePaid","InstanceId":"i-2ze57isp1ali72tzkjow","InstanceName":"gaoxianqi-test-7days","InstanceNetworkType":"vpc","InstanceType":"ecs.t5-lc2m1.nano","InstanceTypeFamily":"ecs.t5","InternetChargeType":"PayByBandwidth","InternetMaxBandwidthIn":-1,"InternetMaxBandwidthOut":0,"IoOptimized":true,"Memory":512,"NetworkInterfaces":{"NetworkInterface":[{"MacAddress":"00:16:3e:10:f0:c9","NetworkInterfaceId":"eni-2zecqsagtpztl6x5hu2r","PrimaryIpAddress":"192.168.220.214"}]},"OSName":"CentOS 7.4 64位","OSType":"linux","OperationLocks":{"LockReason":[]},"PublicIpAddress":{"IpAddress":[]},"Recyclable":false,"RegionId":"cn-beijing","ResourceGroupId":"","SaleCycle":"Week","SecurityGroupIds":{"SecurityGroupId":["sg-2zecqsagtpztl6x9zynl"]},"SerialNumber":"df05d9b4-df3d-4400-88d1-5f843f0dd088","SpotPriceLimit":0.000000,"SpotStrategy":"NoSpot","StartTime":"2018-05-23T07:58Z","Status":"Running","StoppedMode":"Not-applicable","VlanId":"","VpcAttributes":{"NatIpAddress":"","PrivateIpAddress":{"IpAddress":["192.168.220.214"]},"VSwitchId":"vsw-2ze9cqwza4upoyujq1thd","VpcId":"vpc-2zer4jy8ix3i8f0coc5uw"},"ZoneId":"cn-beijing-f"} func (self *SRegion) GetInstances(zoneId string, ids []string, offset int, limit int) ([]SInstance, int, error) { + if limit > 50 || limit <= 0 { + limit = 50 + } params := make(map[string]string) params["RegionId"] = self.RegionId + params["PageSize"] = fmt.Sprintf("%d", limit) + params["PageNumber"] = fmt.Sprintf("%d", (offset/limit)+1) if len(zoneId) > 0 { params["ZoneId"] = zoneId diff --git a/pkg/util/aliyun/shell/image.go b/pkg/util/aliyun/shell/image.go index e73a758878..b02ff69774 100644 --- a/pkg/util/aliyun/shell/image.go +++ b/pkg/util/aliyun/shell/image.go @@ -1,6 +1,8 @@ package shell import ( + "fmt" + "yunion.io/x/onecloud/pkg/util/aliyun" "yunion.io/x/onecloud/pkg/util/shellutils" ) @@ -29,4 +31,47 @@ func init() { shellutils.R(&ImageDeleteOptions{}, "image-delete", "Delete image", func(cli *aliyun.SRegion, args *ImageDeleteOptions) error { return cli.DeleteImage(args.ID) }) + + type ImageCreateOptions struct { + SNAPSHOT string `help:"Snapshot id"` + NAME string `help:"Image name"` + Desc string `help:"Image desc"` + } + shellutils.R(&ImageCreateOptions{}, "image-create", "Create image", func(cli *aliyun.SRegion, args *ImageCreateOptions) error { + imageId, err := cli.CreateImage(args.SNAPSHOT, args.NAME, args.Desc) + if err != nil { + return err + } + fmt.Println(imageId) + return nil + }) + + type ImageExportOptions struct { + ID string `help:"ID or Name to export"` + BUCKET string `help:"Bucket name"` + } + + shellutils.R(&ImageExportOptions{}, "image-export", "Export image", func(cli *aliyun.SRegion, args *ImageExportOptions) error { + oss, err := cli.GetOssClient() + if err != nil { + return err + } + exist, err := oss.IsBucketExist(args.BUCKET) + if err != nil { + return err + } + if !exist { + return fmt.Errorf("not exist bucket %s", args.BUCKET) + } + bucket, err := oss.Bucket(args.BUCKET) + if err != nil { + return err + } + task, err := cli.ExportImage(args.ID, bucket) + if err != nil { + return err + } + printObject(task) + return nil + }) } diff --git a/pkg/util/aliyun/shell/snapshot.go b/pkg/util/aliyun/shell/snapshot.go index 5bfe219871..f1ca285ade 100644 --- a/pkg/util/aliyun/shell/snapshot.go +++ b/pkg/util/aliyun/shell/snapshot.go @@ -1,6 +1,8 @@ package shell import ( + "fmt" + "yunion.io/x/onecloud/pkg/util/aliyun" "yunion.io/x/onecloud/pkg/util/shellutils" ) @@ -38,8 +40,12 @@ func init() { } shellutils.R(&SnapshotCreateOptions{}, "snapshot-create", "Create snapshot", func(cli *aliyun.SRegion, args *SnapshotCreateOptions) error { - _, err := cli.CreateSnapshot(args.DiskId, args.Name, args.Desc) - return err + snapshotId, err := cli.CreateSnapshot(args.DiskId, args.Name, args.Desc) + if err != nil { + return err + } + fmt.Println(snapshotId) + return nil }) } diff --git a/pkg/util/aliyun/storagecache.go b/pkg/util/aliyun/storagecache.go index 960e9cab88..231d5d3623 100644 --- a/pkg/util/aliyun/storagecache.go +++ b/pkg/util/aliyun/storagecache.go @@ -245,6 +245,10 @@ func (self *SRegion) checkBucket(bucketName string) (*oss.Bucket, error) { } } +func (self *SRegion) CreateImage(snapshoutId, imageName, imageDesc string) (string, error) { + return self.createIImage(snapshoutId, imageName, imageDesc) +} + func (self *SRegion) createIImage(snapshoutId, imageName, imageDesc string) (string, error) { params := make(map[string]string) params["RegionId"] = self.RegionId diff --git a/pkg/util/qcloud/disk.go b/pkg/util/qcloud/disk.go index 7a77a638f6..61377bc936 100644 --- a/pkg/util/qcloud/disk.go +++ b/pkg/util/qcloud/disk.go @@ -3,6 +3,7 @@ package qcloud import ( "fmt" "sort" + "strings" "time" "yunion.io/x/jsonutils" @@ -157,13 +158,21 @@ func (self *SRegion) ResizeDisk(diskId string, sizeGb int64) error { params := make(map[string]string) params["DiskId"] = diskId params["DiskSize"] = fmt.Sprintf("%d", sizeGb) - - _, err := self.cbsRequest("ResizeDisk", params) - if err != nil { - log.Errorf("ResizeDisk %s to %s GiB fail %s", diskId, sizeGb, err) + startTime := time.Now() + for { + _, err := self.cbsRequest("ResizeDisk", params) + if err != nil { + if strings.Index(err.Error(), "Code=InvalidDisk.Busy") > 0 { + log.Infof("The disk is busy, try later ...") + time.Sleep(10 * time.Second) + if time.Now().Sub(startTime) > time.Minute*20 { + return cloudprovider.ErrTimeout + } + continue + } + } return err } - return nil } func (self *SDisk) Resize(size int64) error { @@ -354,12 +363,13 @@ func (self *SRegion) CreateDisk(zoneId string, category string, name string, siz if err != nil { return "", err } - diskIdSet, err := body.GetArray("DiskIdSet") + diskIDSet := []string{} + err = body.Unmarshal(&diskIDSet, "DiskIdSet") if err != nil { return "", err } - if len(diskIdSet) < 1 { + if len(diskIDSet) < 1 { return "", fmt.Errorf("Create Disk error") } - return diskIdSet[0].String(), nil + return diskIDSet[0], nil } diff --git a/pkg/util/qcloud/host.go b/pkg/util/qcloud/host.go index 9b84e4f524..67f362deb4 100644 --- a/pkg/util/qcloud/host.go +++ b/pkg/util/qcloud/host.go @@ -2,6 +2,7 @@ package qcloud import ( "fmt" + "strings" "yunion.io/x/jsonutils" "yunion.io/x/log" @@ -69,7 +70,7 @@ func (self *SHost) _createVM(name string, imgId string, sysDiskSize int, cpu int return "", fmt.Errorf("network's wire's vpc is empty") } - // var err error + var err error // if len(secgroupId) == 0 { // secgroups, err := net.wire.vpc.GetISecurityGroups() @@ -90,12 +91,12 @@ func (self *SHost) _createVM(name string, imgId string, sysDiskSize int, cpu int // } keypair := "" - // if len(publicKey) > 0 { - // keypair, err = self.zone.region.syncKeypair(publicKey) - // if err != nil { - // return "", err - // } - // } + if len(publicKey) > 0 { + keypair, err = self.zone.region.syncKeypair(publicKey) + if err != nil { + return "", err + } + } img, err := self.zone.region.GetImage(imgId) if err != nil { @@ -107,7 +108,7 @@ func (self *SHost) _createVM(name string, imgId string, sysDiskSize int, cpu int return "", fmt.Errorf("image not ready") } - _, err = self.zone.getStorageByCategory(storageType) + err = self.zone.validateStorageType(storageType) if err != nil { return "", fmt.Errorf("Storage %s not avaiable: %s", storageType, err) } @@ -117,11 +118,14 @@ func (self *SHost) _createVM(name string, imgId string, sysDiskSize int, cpu int if sysDiskSize > 0 && sysDiskSize > img.ImageSize { disks[0].DiskSize = sysDiskSize } - disks[0].DiskType = storageType + if disks[0].DiskSize < 50 { + disks[0].DiskSize = 50 + } + disks[0].DiskType = strings.ToUpper(storageType) for i, sz := range diskSizes { disks[i+1].DiskSize = sz - disks[i+1].DiskType = storageType + disks[i+1].DiskType = strings.ToUpper(storageType) } instanceTypes, err := self.zone.region.GetMatchInstanceTypes(cpu, memMB, 0, self.zone.Zone) @@ -135,7 +139,7 @@ func (self *SHost) _createVM(name string, imgId string, sysDiskSize int, cpu int for _, instType := range instanceTypes { instanceTypeId := instType.InstanceType log.Debugf("Try instancetype : %s", instanceTypeId) - vmId, err := self.zone.region.CreateInstance(name, imgId, instanceTypeId, secgroupId, self.zone.Zone, desc, passwd, disks, networkId, ipAddr, keypair) + vmId, err := self.zone.region.CreateInstance(name, imgId, instanceTypeId, secgroupId, self.zone.Zone, desc, passwd, disks, networkId, ipAddr, keypair, userData) if err != nil { log.Errorf("Failed for %s: %s", instanceTypeId, err) } else { diff --git a/pkg/util/qcloud/image.go b/pkg/util/qcloud/image.go index 0fe586200a..2d481ab146 100644 --- a/pkg/util/qcloud/image.go +++ b/pkg/util/qcloud/image.go @@ -70,14 +70,19 @@ func (self *SRegion) GetImages(status string, owner string, imageIds []string, n } images := make([]SImage, 0) - if body, err := self.cvmRequest("DescribeImages", params); err != nil { + body, err := self.cvmRequest("DescribeImages", params) + if err != nil { return nil, 0, err - } else if err := body.Unmarshal(&images, "ImageSet"); err != nil { - return nil, 0, err - } else { - total, _ := body.Int("TotalCount") - return images, int(total), nil } + err = body.Unmarshal(&images, "ImageSet") + if err != nil { + return nil, 0, err + } + for i := 0; i < len(images); i++ { + images[i].storageCache = self.getStoragecache() + } + total, _ := body.Int("TotalCount") + return images, int(total), nil } func (self *SImage) GetMetadata() *jsonutils.JSONDict { return nil @@ -164,7 +169,13 @@ func (self *SRegion) ImportImage(name string, osArch string, osType string, osVe osVersion = "-" } params["OsVersion"] = osVersion // "6|7|8|-" - params["OsType"] = osType // "CentOS|Ubuntu|Debian|OpenSUSE|SUSE|CoreOS|FreeBSD|Other Linux|Windows Server 2008|Windows Server 2012|Windows Server 2016" + if len(osType) == 0 || osType == "linux" { + osType = "Other Linux" + } + params["OsType"] = osType // "CentOS|Ubuntu|Debian|OpenSUSE|SUSE|CoreOS|FreeBSD|Other Linux|Windows Server 2008|Windows Server 2012|Windows Server 2016" + if len(osArch) == 0 { + osArch = "x86_64" + } params["Architecture"] = osArch // "x86_64|i386" params["ImageUrl"] = imageUrl params["Force"] = "true" @@ -173,14 +184,13 @@ func (self *SRegion) ImportImage(name string, osArch string, osType string, osVe if _, err := self.cvmRequest("ImportImage", params); err != nil { return nil, err - } else { - for i := 0; i < 3; i++ { - image, err := self.GetImageByName(name) - if err == nil { - return image, nil - } - time.Sleep(time.Minute * time.Duration(i)) - } - return nil, cloudprovider.ErrNotFound } + for i := 0; i < 8; i++ { + image, err := self.GetImageByName(name) + if err == nil { + return image, nil + } + time.Sleep(time.Minute * time.Duration(i)) + } + return nil, cloudprovider.ErrNotFound } diff --git a/pkg/util/qcloud/instance.go b/pkg/util/qcloud/instance.go index 9981d6671a..aa51d86820 100644 --- a/pkg/util/qcloud/instance.go +++ b/pkg/util/qcloud/instance.go @@ -99,6 +99,10 @@ type SInstance struct { func (self *SRegion) GetInstances(zoneId string, ids []string, offset int, limit int) ([]SInstance, int, error) { params := make(map[string]string) + if limit < 1 || limit > 50 { + limit = 50 + } + params["Limit"] = fmt.Sprintf("%d", limit) params["Offset"] = fmt.Sprintf("%d", offset) instances := make([]SInstance, 0) @@ -363,32 +367,40 @@ func (self *SInstance) UpdateVM(name string) error { func (self *SInstance) DeployVM(name string, password string, publicKey string, deleteKeypair bool, description string) error { var keypairName string - // if len(publicKey) > 0 { - // var err error - // keypairName, err = self.host.zone.region.syncKeypair(publicKey) - // if err != nil { - // return err - // } - // } + if len(publicKey) > 0 { + var err error + keypairName, err = self.host.zone.region.syncKeypair(publicKey) + if err != nil { + return err + } + } return self.host.zone.region.DeployVM(self.InstanceId, name, password, keypairName, deleteKeypair, description) } func (self *SInstance) RebuildRoot(imageId string, passwd string, publicKey string, sysSizeGB int) (string, error) { keypair := "" - // if len(publicKey) > 0 { - // var err error - // keypair, err = self.host.zone.region.syncKeypair(publicKey) - // if err != nil { - // return "", err - // } - // } - return self.host.zone.region.ReplaceSystemDisk(self.InstanceId, imageId, passwd, keypair, sysSizeGB) + if len(publicKey) > 0 { + var err error + keypair, err = self.host.zone.region.syncKeypair(publicKey) + if err != nil { + return "", err + } + } + err := self.host.zone.region.ReplaceSystemDisk(self.InstanceId, imageId, passwd, keypair, sysSizeGB) + if err != nil { + return "", err + } + self.StopVM(true) + instance, err := self.host.zone.region.GetInstance(self.InstanceId) + if err != nil { + return "", err + } + return instance.SystemDisk.DiskId, nil } func (self *SInstance) ChangeConfig(instanceId string, ncpu int, vmem int) error { - return nil - //return self.host.zone.region.ChangeVMConfig(self.ZoneId, self.InstanceId, ncpu, vmem, nil) + return self.host.zone.region.ChangeVMConfig(self.Placement.Zone, self.InstanceId, ncpu, vmem, nil) } func (self *SInstance) AttachDisk(diskId string) error { @@ -412,7 +424,7 @@ func (self *SRegion) GetInstance(instanceId string) (*SInstance, error) { func (self *SRegion) CreateInstance(name string, imageId string, instanceType string, securityGroupId string, zoneId string, desc string, passwd string, disks []SDisk, networkId string, ipAddr string, - keypair string) (string, error) { + keypair string, userData string) (string, error) { params := make(map[string]string) params["Region"] = self.Region params["ImageId"] = imageId @@ -423,12 +435,18 @@ func (self *SRegion) CreateInstance(name string, imageId string, instanceType st params["Description"] = desc params["InstanceChargeType"] = "POSTPAID_BY_HOUR" params["InternetAccessible.InternetMaxBandwidthOut"] = "100" + params["InternetAccessible.PublicIpAssigned"] = "FALSE" params["HostName"] = name if len(passwd) > 0 { params["LoginSettings.Password"] = passwd } else { - params["PasswordInherit"] = "True" + params["LoginSettings.KeepImageLogin"] = "TRUE" } + + if len(userData) > 0 { + params["UserData"] = userData + } + //params["IoOptimized"] = "optimized" for i, d := range disks { if i == 0 { @@ -504,9 +522,8 @@ func (self *SRegion) StopVM(instanceId string, isForce bool) error { log.Errorf("Fail to get instance status on StopVM: %s", err) return err } - if status != InstanceStatusRunning { - log.Errorf("StopVM: vm status is %s expect %s", status, InstanceStatusRunning) - return cloudprovider.ErrInvalidStatus + if status == InstanceStatusStopped { + return nil } return self.doStopVM(instanceId, isForce) } @@ -530,45 +547,39 @@ func (self *SRegion) DeployVM(instanceId string, name string, password string, k return err } - // // 修改密钥时直接返回 - // if deleteKeypair { - // err = self.DetachKeyPair(instanceId, instance.KeyPairName) - // if err != nil { - // return err - // } - // } + // 修改密钥时直接返回 + if deleteKeypair { + for i := 0; i < len(instance.LoginSettings.KeyIds); i++ { + err = self.DetachKeyPair(instanceId, instance.LoginSettings.KeyIds[i]) + if err != nil { + return err + } + } + } - // if len(keypairName) > 0 { - // err = self.AttachKeypair(instanceId, keypairName) - // if err != nil { - // return err - // } - // } + if len(keypairName) > 0 { + err = self.AttachKeypair(instanceId, keypairName) + if err != nil { + return err + } + } params := make(map[string]string) - // if resetPassword { - // params["Password"] = seclib2.RandomPassword2(12) - // } - // 指定密码的情况下,使用指定的密码 - if len(password) > 0 { - params["Password"] = password - } - if len(name) > 0 && instance.InstanceName != name { params["InstanceName"] = name - params["HostName"] = name } - // if len(description) > 0 && instance.Description != description { - // params["Description"] = description - // } - if len(params) > 0 { - return self.modifyInstanceAttribute(instanceId, params) - } else { - return nil + err := self.modifyInstanceAttribute(instanceId, params) + if err != nil { + return err + } } + if len(password) > 0 { + return self.instanceOperation(instanceId, "ResetInstancesPassword", map[string]string{"Password": password}) + } + return nil } func (self *SInstance) DeleteVM() error { @@ -595,50 +606,46 @@ func (self *SRegion) UpdateVM(instanceId string, hostname string) error { } func (self *SRegion) modifyInstanceAttribute(instanceId string, params map[string]string) error { - return self.instanceOperation(instanceId, "ModifyInstanceAttribute", params) + return self.instanceOperation(instanceId, "ModifyInstancesAttribute", params) } -func (self *SRegion) ReplaceSystemDisk(instanceId string, imageId string, passwd string, keypairName string, sysDiskSizeGB int) (string, error) { +func (self *SRegion) ReplaceSystemDisk(instanceId string, imageId string, passwd string, keypairName string, sysDiskSizeGB int) error { params := make(map[string]string) - params["RegionId"] = self.Region params["InstanceId"] = instanceId params["ImageId"] = imageId + params["EnhancedService.SecurityService.Enabled"] = "TRUE" + params["EnhancedService.MonitorService.Enabled"] = "TRUE" if len(passwd) > 0 { - params["Password"] = passwd + params["LoginSettings.Password"] = passwd } else { - params["PasswordInherit"] = "True" + params["LoginSettings.KeepImageLogin"] = "TRUE" } if len(keypairName) > 0 { - params["KeyPairName"] = keypairName + params["LoginSettings.KeyIds.0"] = keypairName } if sysDiskSizeGB > 0 { - params["SystemDisk.Size"] = fmt.Sprintf("%d", sysDiskSizeGB) + params["SystemDisk.DiskSize"] = fmt.Sprintf("%d", sysDiskSizeGB) } - body, err := self.cvmRequest("ReplaceSystemDisk", params) - if err != nil { - return "", err - } - // log.Debugf("%s", body.String()) - return body.GetString("DiskId") + _, err := self.cvmRequest("ResetInstance", params) + return err } func (self *SRegion) ChangeVMConfig(zoneId string, instanceId string, ncpu int, vmem int, disks []*SDisk) error { // todo: support change disk config? - // params := make(map[string]string) - // instanceTypes, e := self.GetMatchInstanceTypes(ncpu, vmem, 0, zoneId) - // if e != nil { - // return e - // } + params := make(map[string]string) + instanceTypes, e := self.GetMatchInstanceTypes(ncpu, vmem, 0, zoneId) + if e != nil { + return e + } - // for _, instancetype := range instanceTypes { - // params["InstanceType"] = instancetype.InstanceTypeId - // params["ClientToken"] = utils.GenRequestId(20) - // if err := self.instanceOperation(instanceId, "ModifyInstanceSpec", params); err != nil { - // log.Errorf("Failed for %s: %s", instancetype.InstanceTypeId, err) - // } else { - // return nil - // } - // } + for _, instancetype := range instanceTypes { + params["InstanceType"] = instancetype.InstanceType + err := self.instanceOperation(instanceId, "ResetInstancesType", params) + if err != nil { + log.Errorf("Failed for %s: %s", instancetype.InstanceType, err) + } + return nil + } return fmt.Errorf("Failed to change vm config, specification not supported") } @@ -660,13 +667,12 @@ func (self *SRegion) DetachDisk(instanceId string, diskId string) error { func (self *SRegion) AttachDisk(instanceId string, diskId string) error { params := make(map[string]string) params["InstanceId"] = instanceId - params["DiskId"] = diskId - _, err := self.cvmRequest("AttachDisk", params) + params["DiskIds.0"] = diskId + _, err := self.cbsRequest("AttachDisks", params) if err != nil { - log.Errorf("AttachDisk %s to %s fail %s", diskId, instanceId, err) + log.Errorf("AttachDisks %s to %s fail %s", diskId, instanceId, err) return err } - return nil } @@ -726,5 +732,5 @@ func (self *SInstance) GetExpiredAt() time.Time { } func (self *SInstance) UpdateUserData(userData string) error { - return cloudprovider.ErrNotImplemented + return cloudprovider.ErrNotSupported } diff --git a/pkg/util/qcloud/provider/provider.go b/pkg/util/qcloud/provider/provider.go index b378439509..206fb909bf 100644 --- a/pkg/util/qcloud/provider/provider.go +++ b/pkg/util/qcloud/provider/provider.go @@ -6,44 +6,44 @@ import ( "yunion.io/x/onecloud/pkg/util/qcloud" ) -type STencentProviderFactory struct { - // providerTable map[string]*SAliyunProvider +type SQcloudProviderFactory struct { + // providerTable map[string]*SQcloudProvider } -func (self *STencentProviderFactory) GetId() string { +func (self *SQcloudProviderFactory) GetId() string { return qcloud.CLOUD_PROVIDER_QCLOUD } -func (self *STencentProviderFactory) GetProvider(providerId, providerName, url, account, secret string) (cloudprovider.ICloudProvider, error) { +func (self *SQcloudProviderFactory) GetProvider(providerId, providerName, url, account, secret string) (cloudprovider.ICloudProvider, error) { client, err := qcloud.NewQcloudClient(providerId, providerName, account, secret) if err != nil { return nil, err } - return &STencentProvider{client: client}, nil + return &SQcloudProvider{client: client}, nil } func init() { - factory := STencentProviderFactory{} + factory := SQcloudProviderFactory{} cloudprovider.RegisterFactory(&factory) } -type STencentProvider struct { +type SQcloudProvider struct { client *qcloud.SQcloudClient } -func (self *STencentProvider) IsPublicCloud() bool { +func (self *SQcloudProvider) IsPublicCloud() bool { return true } -func (self *STencentProvider) GetId() string { +func (self *SQcloudProvider) GetId() string { return qcloud.CLOUD_PROVIDER_QCLOUD } -func (self *STencentProvider) GetName() string { +func (self *SQcloudProvider) GetName() string { return qcloud.CLOUD_PROVIDER_QCLOUD_CN } -func (self *STencentProvider) GetSysInfo() (jsonutils.JSONObject, error) { +func (self *SQcloudProvider) GetSysInfo() (jsonutils.JSONObject, error) { regions := self.client.GetIRegions() info := jsonutils.NewDict() info.Add(jsonutils.NewInt(int64(len(regions))), "region_count") @@ -51,34 +51,34 @@ func (self *STencentProvider) GetSysInfo() (jsonutils.JSONObject, error) { return info, nil } -func (self *STencentProvider) GetSubAccounts() ([]cloudprovider.SSubAccount, error) { +func (self *SQcloudProvider) GetSubAccounts() ([]cloudprovider.SSubAccount, error) { return self.client.GetSubAccounts() } -func (self *STencentProvider) GetIRegions() []cloudprovider.ICloudRegion { +func (self *SQcloudProvider) GetIRegions() []cloudprovider.ICloudRegion { return self.client.GetIRegions() } -func (self *STencentProvider) GetIRegionById(id string) (cloudprovider.ICloudRegion, error) { +func (self *SQcloudProvider) GetIRegionById(id string) (cloudprovider.ICloudRegion, error) { return self.client.GetIRegionById(id) } -func (self *STencentProvider) GetIHostById(id string) (cloudprovider.ICloudHost, error) { +func (self *SQcloudProvider) GetIHostById(id string) (cloudprovider.ICloudHost, error) { return self.client.GetIHostById(id) } -func (self *STencentProvider) GetIVpcById(id string) (cloudprovider.ICloudVpc, error) { +func (self *SQcloudProvider) GetIVpcById(id string) (cloudprovider.ICloudVpc, error) { return self.client.GetIVpcById(id) } -func (self *STencentProvider) GetIStorageById(id string) (cloudprovider.ICloudStorage, error) { +func (self *SQcloudProvider) GetIStorageById(id string) (cloudprovider.ICloudStorage, error) { return self.client.GetIStorageById(id) } -func (self *STencentProvider) GetIStoragecacheById(id string) (cloudprovider.ICloudStoragecache, error) { +func (self *SQcloudProvider) GetIStoragecacheById(id string) (cloudprovider.ICloudStoragecache, error) { return self.client.GetIStoragecacheById(id) } -func (self *STencentProvider) GetBalance() (float64, error) { +func (self *SQcloudProvider) GetBalance() (float64, error) { return 0.0, nil } diff --git a/pkg/util/qcloud/qcloud.go b/pkg/util/qcloud/qcloud.go index 7dca5b987e..898087ef40 100644 --- a/pkg/util/qcloud/qcloud.go +++ b/pkg/util/qcloud/qcloud.go @@ -1,6 +1,7 @@ package qcloud import ( + "fmt" "strings" "github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/common" @@ -53,9 +54,9 @@ func jsonRequest(client *common.Client, apiName string, params map[string]string func vpcRequest(client *common.Client, apiName string, params map[string]string) (jsonutils.JSONObject, error) { domain := "vpc.tencentcloudapi.com" - if region, ok := params["Region"]; ok && strings.HasSuffix(region, "-fsi") { - domain = "vpc." + region + ".tencentcloudapi.com" - } + // if region, ok := params["Region"]; ok && strings.HasSuffix(region, "-fsi") { + // domain = "vpc." + region + ".tencentcloudapi.com" + // } return _jsonRequest(client, domain, QCLOUD_API_VERSION, apiName, params) } @@ -90,12 +91,9 @@ func _jsonRequest(client *common.Client, domain string, version string, apiName } err := client.Send(req, resp) if err != nil { - log.Errorf("request error %s", err) + log.Errorf("request url: %s\nparams: %s\nerror: %v", req.GetDomain(), jsonutils.Marshal(req.GetParams()).PrettyString(), err) return nil, err } - - //log.Debugf(jsonutils.Marshal(resp.Response).PrettyString()) - return jsonutils.Marshal(resp.Response), nil } @@ -164,7 +162,10 @@ func (client *SQcloudClient) GetSubAccounts() ([]cloudprovider.SSubAccount, erro } subAccount := cloudprovider.SSubAccount{} subAccount.Name = client.providerName - subAccount.Account = client.SecretKey + subAccount.Account = client.SecretID + if len(client.AppID) > 0 { + subAccount.Account = fmt.Sprintf("%s/%s", client.SecretID, client.AppID) + } return []cloudprovider.SSubAccount{subAccount}, nil } diff --git a/pkg/util/qcloud/region.go b/pkg/util/qcloud/region.go index 3516c436b2..2c74f880b5 100644 --- a/pkg/util/qcloud/region.go +++ b/pkg/util/qcloud/region.go @@ -225,7 +225,16 @@ func (self *SRegion) GetIVpcs() ([]cloudprovider.ICloudVpc, error) { } func (self *SRegion) GetIZoneById(id string) (cloudprovider.ICloudZone, error) { - return nil, nil + izones, err := self.GetIZones() + if err != nil { + return nil, err + } + for i := 0; i < len(izones); i += 1 { + if izones[i].GetGlobalId() == id { + return izones[i], nil + } + } + return nil, cloudprovider.ErrNotFound } func (self *SRegion) GetIZones() ([]cloudprovider.ICloudZone, error) { @@ -241,9 +250,8 @@ func (self *SRegion) GetIZones() ([]cloudprovider.ICloudZone, error) { func (self *SRegion) _fetchZones() error { params := make(map[string]string) - params["Region"] = self.Region zones := make([]SZone, 0) - body, err := self.client.jsonRequest("DescribeZones", params) + body, err := self.cvmRequest("DescribeZones", params) if err != nil { return err } @@ -293,7 +301,10 @@ func (self *SRegion) getVpc(vpcId string) (*SVpc, error) { if err != nil { return nil, err } - if total != 1 { + if total > 1 { + return nil, cloudprovider.ErrDuplicateId + } + if total == 0 { return nil, cloudprovider.ErrNotFound } vpcs[0].region = self @@ -498,7 +509,6 @@ func (self *SRegion) CreateInstanceSimple(name string, imgId string, cpu int, me func (self *SRegion) instanceOperation(instanceId string, opname string, extra map[string]string) error { params := make(map[string]string) - params["Region"] = self.Region params["InstanceIds.0"] = instanceId if extra != nil && len(extra) > 0 { for k, v := range extra { diff --git a/pkg/util/qcloud/storage.go b/pkg/util/qcloud/storage.go index 1f3ddfbb80..a9ebca1bc4 100644 --- a/pkg/util/qcloud/storage.go +++ b/pkg/util/qcloud/storage.go @@ -3,6 +3,7 @@ package qcloud import ( "fmt" "strings" + "time" "yunion.io/x/jsonutils" "yunion.io/x/log" @@ -107,13 +108,17 @@ func (self *SStorage) CreateIDisk(name string, sizeGb int, desc string) (cloudpr log.Errorf("createDisk fail %s", err) return nil, err } - disk, err := self.zone.region.GetDisk(diskId) - if err != nil { - log.Errorf("getDisk fail %s", err) - return nil, err + //腾讯刚创建完成的磁盘,需要稍微等待才能查询 + for i := 0; i < 3; i++ { + disk, err := self.zone.region.GetDisk(diskId) + if err == nil { + disk.storage = self + return disk, nil + } + time.Sleep(time.Second * 3) } - disk.storage = self - return disk, nil + log.Errorf("getDisk fail %s id %s", err, diskId) + return nil, cloudprovider.ErrNotFound } func (self *SStorage) GetIDisk(idStr string) (cloudprovider.ICloudDisk, error) { diff --git a/pkg/util/qcloud/storagecache.go b/pkg/util/qcloud/storagecache.go index 8630752591..f51281d605 100644 --- a/pkg/util/qcloud/storagecache.go +++ b/pkg/util/qcloud/storagecache.go @@ -3,6 +3,8 @@ package qcloud import ( "context" "fmt" + "io" + "os" "strings" "time" @@ -125,7 +127,8 @@ func (self *SStoragecache) UploadImage(userCred mcclient.TokenCredential, imageI } func (self *SRegion) getCosUrl(bucket, object string) string { - return fmt.Sprintf("http://%s-%s.cosd.myqcloud.com/%s", bucket, self.client.AppID, object) + //signature := cosauth.NewSignature(self.client.AppID, bucket, self.client.SecretID, time.Now().Add(time.Minute*30).String(), time.Now().String(), "yunion", object).SignOnce(self.client.SecretKey) + return fmt.Sprintf("http://%s-%s.cos.%s.myqcloud.com/%s", bucket, self.client.AppID, self.Region, object) } func (self *SStoragecache) uploadImage(userCred mcclient.TokenCredential, imageId string, osArch, osType, osDist string, isForce bool) (string, error) { @@ -136,16 +139,30 @@ func (self *SStoragecache) uploadImage(userCred mcclient.TokenCredential, imageI if err != nil { return "", err } + + tmpFile := fmt.Sprintf("%s/%s", options.Options.TempPath, imageId) + defer os.Remove(tmpFile) + f, err := os.Create(tmpFile) + if err != nil { + return "", err + } + defer f.Close() + if _, err := io.Copy(f, reader); err != nil { + return "", err + } + log.Infof("meta data %s", meta) cos, err := self.region.GetCosClient() if err != nil { log.Errorf("GetOssClient err %s", err) return "", err } - bucketName := strings.ToLower(fmt.Sprintf("imgcache-%s-%s", self.region.GetId(), self.region.client.providerId)) - if err := cos.BucketExists(context.Background(), bucketName); err != nil { + bucketName := strings.ToLower(fmt.Sprintf("imgcache-%s", self.region.GetId())) + err = cos.BucketExists(context.Background(), bucketName) + if err != nil { log.Debugf("Bucket %s not exists, to create ...", bucketName) - if err := cos.CreateBucket(context.Background(), bucketName, &coslib.AccessControl{ACL: "public-read"}); err != nil { + err := cos.CreateBucket(context.Background(), bucketName, &coslib.AccessControl{ACL: "public-read"}) + if err != nil { log.Errorf("Create bucket error %s", err) return "", err } @@ -153,13 +170,15 @@ func (self *SStoragecache) uploadImage(userCred mcclient.TokenCredential, imageI log.Debugf("Bucket %s exists", bucketName) } log.Debugf("To upload image to bucket %s ...", bucketName) - if err := cos.Bucket(bucketName).UploadObject(context.Background(), imageId, reader, &coslib.AccessControl{}); err != nil { + err = cos.Bucket(bucketName).UploadObjectBySlice(context.Background(), imageId, tmpFile, 3, map[string]string{}) + if err != nil { log.Errorf("UploadObject error %s %s", imageId, err) return "", err } - imageBaseName := imageId + // 腾讯云镜像名称需要小于20个字符 + imageBaseName := imageId[:10] if imageBaseName[0] >= '0' && imageBaseName[0] <= '9' { - imageBaseName = fmt.Sprintf("img%s", imageId) + imageBaseName = fmt.Sprintf("img%s", imageId[:10]) } imageName := imageBaseName nameIdx := 1 diff --git a/pkg/util/qcloud/zone.go b/pkg/util/qcloud/zone.go index b4eb50f024..95474fbde2 100644 --- a/pkg/util/qcloud/zone.go +++ b/pkg/util/qcloud/zone.go @@ -2,6 +2,7 @@ package qcloud import ( "fmt" + "strings" "time" "yunion.io/x/jsonutils" @@ -114,7 +115,17 @@ func (self *SZone) GetIStorages() ([]cloudprovider.ICloudStorage, error) { } func (self *SZone) getLocalStorageByCategory(category string) (*SLocalStorage, error) { - return &SLocalStorage{zone: self, storageType: category}, nil + if utils.IsInStringArray(strings.ToLower(category), []string{"local_basic", "local_ssd"}) { + return &SLocalStorage{zone: self, storageType: strings.ToUpper(category)}, nil + } + return nil, fmt.Errorf("No such storage %s", category) +} + +func (self *SZone) validateStorageType(category string) error { + if utils.IsInStringArray(strings.ToLower(category), []string{"local_basic", "local_ssd", "cloud_basic", "cloud_ssd", "cloud_permium"}) { + return nil + } + return fmt.Errorf("No such storage %s", category) } func (self *SZone) getStorageByCategory(category string) (*SStorage, error) { @@ -125,6 +136,7 @@ func (self *SZone) getStorageByCategory(category string) (*SStorage, error) { for i := 0; i < len(storages); i++ { if utils.IsInStringArray(storages[i].GetStorageType(), []string{"local_basic", "local_ssd"}) { continue + //return &SStorage{zone: self, storageType: strings.ToUpper(storages[i].GetStorageType())}, nil } storage := storages[i].(*SStorage) if storage.storageType == category { diff --git a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/sdk/endpoints/location_resolver.go b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/sdk/endpoints/location_resolver.go index a7f553d38f..803bc57d5a 100644 --- a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/sdk/endpoints/location_resolver.go +++ b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/sdk/endpoints/location_resolver.go @@ -57,7 +57,7 @@ func (resolver *LocationResolver) TryResolve(param *ResolveParam) (endpoint stri getEndpointRequest.Product = "Location" getEndpointRequest.Version = "2015-06-12" getEndpointRequest.ApiName = "DescribeEndpoints" - getEndpointRequest.Domain = "location-readonly.aliyuncs.com" + getEndpointRequest.Domain = "location.aliyuncs.com" getEndpointRequest.Method = "GET" getEndpointRequest.Scheme = requests.HTTPS diff --git a/vendor/github.com/forhappy/cos-go-sdk/LICENSE b/vendor/github.com/forhappy/cos-go-sdk/LICENSE new file mode 100644 index 0000000000..8dada3edaf --- /dev/null +++ b/vendor/github.com/forhappy/cos-go-sdk/LICENSE @@ -0,0 +1,201 @@ + 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/forhappy/cos-go-sdk/auth/auth.go b/vendor/github.com/forhappy/cos-go-sdk/auth/auth.go new file mode 100644 index 0000000000..397e087015 --- /dev/null +++ b/vendor/github.com/forhappy/cos-go-sdk/auth/auth.go @@ -0,0 +1,99 @@ +package auth + +import ( + "crypto/hmac" + "crypto/sha1" + "encoding/base64" + "fmt" +) + +type Signer interface { + Sign(secretKey string) (string, error) + SignOnce(secretKey string) (string, error) +} + +// 生成签名, 腾讯移动服务通过签名来验证请求的合法性, +// 开发者通过将签名授权给客户端, 使其具备上传下载及管理指定资源的能力, +// 签名分为多次有效签名和单次有效签名. +// 生成签名所需信息包括项目 ID(AppId),空间名称(Bucket,文件资源的组织管理单元),项目的 Secret ID 和 Secret Key, +// 获取这些信息的方法如下: +// 1) 登录 云对象存储, 进入云对象存储空间; +// 2) 如开发者未创建空间,可添加空间,空间名称(Bucket)由用户自行输入 +// 3) 点击“获取secretKey”,获取 Appid,Secret ID 和 Secret Key +type Signature struct { + AppId string + Bucket string + SecretId string + ExpiredTime string + CurrentTime string + Rand string + FileId string +} + +// 构造签名类, 可使用该类的 Sign 和 SignOnce 接口分别进行多次有效签名和单次有效签名 +func NewSignature(appId, bucket, secretId, expiredTime, currentTime, rand, fileId string) *Signature { + return &Signature{ + AppId: appId, + Bucket: bucket, + SecretId: secretId, + ExpiredTime: expiredTime, + CurrentTime: currentTime, + Rand: rand, + FileId: fileId, + } +} + +// 多次有效签名, secretKey 为项目的 Secret Key +func (s *Signature) Sign(secretKey string) string { + stringToSign := fmt.Sprintf("a=%s&k=%s&e=%s&t=%s&r=%s&f=%s&b=%s", + s.AppId, + s.SecretId, + s.ExpiredTime, + s.CurrentTime, + s.Rand, + "", + s.Bucket, + ) + + hmacSha1 := hmac.New(sha1.New, []byte(secretKey)) + hmacSha1.Write([]byte(stringToSign)) + bytesSign := hmacSha1.Sum(nil) + bytesSign = append(bytesSign, []byte(stringToSign)...) + signature := base64.StdEncoding.EncodeToString(bytesSign) + return signature +} + +// 单次有效签名, secretKey 为项目的 Secret Key +func (s *Signature) SignOnce(secretKey string) string { + stringToSign := fmt.Sprintf("a=%s&k=%s&e=%s&t=%s&r=%s&f=%s&b=%s", + s.AppId, + s.SecretId, + "0", + s.CurrentTime, + s.Rand, + s.FileId, + s.Bucket, + ) + + hmacSha1 := hmac.New(sha1.New, []byte(secretKey)) + hmacSha1.Write([]byte(stringToSign)) + bytesSign := hmacSha1.Sum(nil) + bytesSign = append(bytesSign, []byte(stringToSign)...) + signature := base64.StdEncoding.EncodeToString(bytesSign) + return signature +} + +// 字符串签名类 +func (s *Signature) String() string { + str := fmt.Sprintf("a=%s&b=%s&k=%s&e=%s&t=%s&r=%s&f=%s", + s.AppId, + s.SecretId, + s.ExpiredTime, + s.CurrentTime, + s.Rand, + s.FileId, + s.Bucket, + ) + + return str +} diff --git a/vendor/github.com/forhappy/cos-go-sdk/http/LICENSE b/vendor/github.com/forhappy/cos-go-sdk/http/LICENSE new file mode 100644 index 0000000000..b940dd44c9 --- /dev/null +++ b/vendor/github.com/forhappy/cos-go-sdk/http/LICENSE @@ -0,0 +1,24 @@ +The MIT License (MIT) + +Copyright (c) 2013 Jonathan Leibiusky and Marcos Lilljedahl +https://github.com/franela/goreq + +Copyright (c) 2016 Haiping Fu +https://github.com/forhappy/goreq + +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/konsorten/go-windows-terminal-sequences/go.mod b/vendor/github.com/konsorten/go-windows-terminal-sequences/go.mod deleted file mode 100644 index 716c613125..0000000000 --- a/vendor/github.com/konsorten/go-windows-terminal-sequences/go.mod +++ /dev/null @@ -1 +0,0 @@ -module github.com/konsorten/go-windows-terminal-sequences diff --git a/vendor/github.com/miekg/dns/.travis.yml b/vendor/github.com/miekg/dns/.travis.yml index 18259374e5..13e312b4f3 100644 --- a/vendor/github.com/miekg/dns/.travis.yml +++ b/vendor/github.com/miekg/dns/.travis.yml @@ -1,18 +1,21 @@ language: go sudo: false - go: - 1.10.x - 1.11.x - tip +env: + - TESTS="-race -v -bench=. -coverprofile=coverage.txt -covermode=atomic" + - TESTS="-race -v ./..." + before_install: # don't use the miekg/dns when testing forks - mkdir -p $GOPATH/src/github.com/miekg - ln -s $TRAVIS_BUILD_DIR $GOPATH/src/github.com/miekg/ || true script: - - go test -race -v -bench=. -coverprofile=coverage.txt -covermode=atomic ./... + - go test $TESTS after_success: - bash <(curl -s https://codecov.io/bash) diff --git a/vendor/github.com/miekg/dns/Gopkg.lock b/vendor/github.com/miekg/dns/Gopkg.lock index 686632207a..4455c9836f 100644 --- a/vendor/github.com/miekg/dns/Gopkg.lock +++ b/vendor/github.com/miekg/dns/Gopkg.lock @@ -3,55 +3,19 @@ [[projects]] branch = "master" - digest = "1:6914c49eed986dfb8dffb33516fa129c49929d4d873f41e073c83c11c372b870" name = "golang.org/x/crypto" - packages = [ - "ed25519", - "ed25519/internal/edwards25519", - ] - pruneopts = "" - revision = "e3636079e1a4c1f337f212cc5cd2aca108f6c900" + packages = ["ed25519","ed25519/internal/edwards25519"] + revision = "b47b1587369238182299fe4dad77d05b8b461e06" [[projects]] branch = "master" - digest = "1:08e41d63f8dac84d83797368b56cf0b339e42d0224e5e56668963c28aec95685" name = "golang.org/x/net" - packages = [ - "bpf", - "context", - "internal/iana", - "internal/socket", - "ipv4", - "ipv6", - ] - pruneopts = "" - revision = "4dfa2610cdf3b287375bbba5b8f2a14d3b01d8de" - -[[projects]] - branch = "master" - digest = "1:b2ea75de0ccb2db2ac79356407f8a4cd8f798fe15d41b381c00abf3ae8e55ed1" - name = "golang.org/x/sync" - packages = ["errgroup"] - pruneopts = "" - revision = "1d60e4601c6fd243af51cc01ddf169918a5407ca" - -[[projects]] - branch = "master" - digest = "1:149a432fabebb8221a80f77731b1cd63597197ded4f14af606ebe3a0959004ec" - name = "golang.org/x/sys" - packages = ["unix"] - pruneopts = "" - revision = "e4b3c5e9061176387e7cea65e4dc5853801f3fb7" + packages = ["bpf","internal/iana","internal/socket","ipv4","ipv6"] + revision = "1e491301e022f8f977054da4c2d852decd59571f" [solve-meta] analyzer-name = "dep" analyzer-version = 1 - input-imports = [ - "golang.org/x/crypto/ed25519", - "golang.org/x/net/ipv4", - "golang.org/x/net/ipv6", - "golang.org/x/sync/errgroup", - "golang.org/x/sys/unix", - ] + inputs-digest = "c4abc38abaeeeeb9be92455c9c02cae32841122b8982aaa067ef25bb8e86ff9d" solver-name = "gps-cdcl" solver-version = 1 diff --git a/vendor/github.com/miekg/dns/Gopkg.toml b/vendor/github.com/miekg/dns/Gopkg.toml index 85e6ff31b2..2f655b2c7b 100644 --- a/vendor/github.com/miekg/dns/Gopkg.toml +++ b/vendor/github.com/miekg/dns/Gopkg.toml @@ -24,15 +24,3 @@ [[constraint]] branch = "master" name = "golang.org/x/crypto" - -[[constraint]] - branch = "master" - name = "golang.org/x/net" - -[[constraint]] - branch = "master" - name = "golang.org/x/sys" - -[[constraint]] - branch = "master" - name = "golang.org/x/sync" diff --git a/vendor/github.com/miekg/dns/client.go b/vendor/github.com/miekg/dns/client.go index 63ced2bd06..7a319b02c3 100644 --- a/vendor/github.com/miekg/dns/client.go +++ b/vendor/github.com/miekg/dns/client.go @@ -567,7 +567,7 @@ func (c *Client) ExchangeContext(ctx context.Context, m *Msg, a string) (r *Msg, if deadline, ok := ctx.Deadline(); !ok { timeout = 0 } else { - timeout = time.Until(deadline) + timeout = deadline.Sub(time.Now()) } // not passing the context to the underlying calls, as the API does not support // context. For timeouts you should set up Client.Dialer and call Client.Exchange. diff --git a/vendor/github.com/miekg/dns/generate.go b/vendor/github.com/miekg/dns/generate.go index 91d928c834..3a559793ff 100644 --- a/vendor/github.com/miekg/dns/generate.go +++ b/vendor/github.com/miekg/dns/generate.go @@ -107,8 +107,6 @@ BuildRR: mod, offset, err = modToPrintf(s[j+2 : j+2+sep]) if err != nil { return err.Error() - } else if start + offset < 0 || end + offset > 1<<31-1 { - return "bad offset in $GENERATE" } j += 2 + sep // Jump to it } @@ -154,7 +152,7 @@ func modToPrintf(s string) (string, int, error) { return "", 0, errors.New("bad base in $GENERATE") } offset, err := strconv.Atoi(xs[0]) - if err != nil { + if err != nil || offset > 255 { return "", 0, errors.New("bad offset in $GENERATE") } width, err := strconv.Atoi(xs[1]) diff --git a/vendor/github.com/miekg/dns/listen_go111.go b/vendor/github.com/miekg/dns/listen_go111.go index fad195cfeb..bd024c8938 100644 --- a/vendor/github.com/miekg/dns/listen_go111.go +++ b/vendor/github.com/miekg/dns/listen_go111.go @@ -1,5 +1,4 @@ -// +build go1.11 -// +build aix darwin dragonfly freebsd linux netbsd openbsd +// +build go1.11,!windows package dns diff --git a/vendor/github.com/miekg/dns/listen_go_not111.go b/vendor/github.com/miekg/dns/listen_go_not111.go index b9201417ab..f1fc652c4d 100644 --- a/vendor/github.com/miekg/dns/listen_go_not111.go +++ b/vendor/github.com/miekg/dns/listen_go_not111.go @@ -1,4 +1,4 @@ -// +build !go1.11 !aix,!darwin,!dragonfly,!freebsd,!linux,!netbsd,!openbsd +// +build !go1.11 windows package dns diff --git a/vendor/github.com/miekg/dns/msg.go b/vendor/github.com/miekg/dns/msg.go index 47ac6cf281..f8b847650f 100644 --- a/vendor/github.com/miekg/dns/msg.go +++ b/vendor/github.com/miekg/dns/msg.go @@ -302,12 +302,6 @@ func packDomainName(s string, msg []byte, off int, compression map[string]int, c } // If we did compression and we find something add the pointer here if pointer != -1 { - // Clear the msg buffer after the pointer location, otherwise - // packDataNsec writes the wrong data to msg. - tainted := msg[nameoffset:off] - for i := range tainted { - tainted[i] = 0 - } // We have two bytes (14 bits) to put the pointer in // if msg == nil, we will never do compression binary.BigEndian.PutUint16(msg[nameoffset:], uint16(pointer^0xC000)) @@ -373,10 +367,12 @@ Loop: var buf [3]byte bufs := strconv.AppendInt(buf[:0], int64(b), 10) s = append(s, '\\') - for i := len(bufs); i < 3; i++ { + for i := 0; i < 3-len(bufs); i++ { s = append(s, '0') } - s = append(s, bufs...) + for _, r := range bufs { + s = append(s, r) + } // presentation-format \DDD escapes add 3 extra bytes maxLen += 3 } else { @@ -516,7 +512,7 @@ func unpackTxt(msg []byte, off0 int) (ss []string, off int, err error) { off = off0 var s string for off < len(msg) && err == nil { - s, off, err = unpackString(msg, off) + s, off, err = unpackTxtString(msg, off) if err == nil { ss = append(ss, s) } @@ -524,6 +520,39 @@ func unpackTxt(msg []byte, off0 int) (ss []string, off int, err error) { return } +func unpackTxtString(msg []byte, offset int) (string, int, error) { + if offset+1 > len(msg) { + return "", offset, &Error{err: "overflow unpacking txt"} + } + l := int(msg[offset]) + if offset+l+1 > len(msg) { + return "", offset, &Error{err: "overflow unpacking txt"} + } + s := make([]byte, 0, l) + for _, b := range msg[offset+1 : offset+1+l] { + switch b { + case '"', '\\': + s = append(s, '\\', b) + default: + if b < 32 || b > 127 { // unprintable + var buf [3]byte + bufs := strconv.AppendInt(buf[:0], int64(b), 10) + s = append(s, '\\') + for i := 0; i < 3-len(bufs); i++ { + s = append(s, '0') + } + for _, r := range bufs { + s = append(s, r) + } + } else { + s = append(s, b) + } + } + } + offset += 1 + l + return string(s), offset, nil +} + // Helpers for dealing with escaped bytes func isDigit(b byte) bool { return b >= '0' && b <= '9' } @@ -531,10 +560,6 @@ func dddToByte(s []byte) byte { return byte((s[0]-'0')*100 + (s[1]-'0')*10 + (s[2] - '0')) } -func dddStringToByte(s string) byte { - return byte((s[0]-'0')*100 + (s[1]-'0')*10 + (s[2] - '0')) -} - // Helper function for packing and unpacking func intToBytes(i *big.Int, length int) []byte { buf := i.Bytes() diff --git a/vendor/github.com/miekg/dns/msg_helpers.go b/vendor/github.com/miekg/dns/msg_helpers.go index 81fc2b1be3..ec8cd9a851 100644 --- a/vendor/github.com/miekg/dns/msg_helpers.go +++ b/vendor/github.com/miekg/dns/msg_helpers.go @@ -6,7 +6,7 @@ import ( "encoding/binary" "encoding/hex" "net" - "strings" + "strconv" ) // helper functions called from the generated zmsg.go @@ -267,21 +267,29 @@ func unpackString(msg []byte, off int) (string, int, error) { if off+l+1 > len(msg) { return "", off, &Error{err: "overflow unpacking txt"} } - var s strings.Builder - s.Grow(l) + s := make([]byte, 0, l) for _, b := range msg[off+1 : off+1+l] { - switch { - case b == '"' || b == '\\': - s.WriteByte('\\') - s.WriteByte(b) - case b < ' ' || b > '~': // unprintable - writeEscapedByte(&s, b) + switch b { + case '"', '\\': + s = append(s, '\\', b) default: - s.WriteByte(b) + if b < 32 || b > 127 { // unprintable + var buf [3]byte + bufs := strconv.AppendInt(buf[:0], int64(b), 10) + s = append(s, '\\') + for i := 0; i < 3-len(bufs); i++ { + s = append(s, '0') + } + for _, r := range bufs { + s = append(s, r) + } + } else { + s = append(s, b) + } } } off += 1 + l - return s.String(), off, nil + return string(s), off, nil } func packString(s string, msg []byte, off int) (int, error) { diff --git a/vendor/github.com/miekg/dns/privaterr.go b/vendor/github.com/miekg/dns/privaterr.go index d931da7efb..41989e7aee 100644 --- a/vendor/github.com/miekg/dns/privaterr.go +++ b/vendor/github.com/miekg/dns/privaterr.go @@ -134,7 +134,7 @@ func PrivateHandle(rtypestr string, rtype uint16, generator func() PrivateRdata) typeToparserFunc[rtype] = parserFunc{setPrivateRR, true} } -// PrivateHandleRemove removes definitions required to support private RR type. +// PrivateHandleRemove removes defenitions required to support private RR type. func PrivateHandleRemove(rtype uint16) { rtypestr, ok := TypeToString[rtype] if ok { @@ -144,4 +144,5 @@ func PrivateHandleRemove(rtype uint16) { delete(StringToType, rtypestr) delete(typeToUnpack, rtype) } + return } diff --git a/vendor/github.com/miekg/dns/scan.go b/vendor/github.com/miekg/dns/scan.go index a752dbd018..f9cd47401d 100644 --- a/vendor/github.com/miekg/dns/scan.go +++ b/vendor/github.com/miekg/dns/scan.go @@ -10,6 +10,7 @@ import ( ) const maxTok = 2048 // Largest token we can return. +const maxUint16 = 1<<16 - 1 // Tokinize a RFC 1035 zone file. The tokenizer will normalize it: // * Add ownernames if they are left blank; @@ -79,9 +80,9 @@ type lex struct { length int // length of the token err bool // when true, token text has lexer error value uint8 // value: zString, _BLANK, etc. - torc uint16 // type or class as parsed in the lexer, we only need to look this up in the grammar line int // line in the file column int // column in the file + torc uint16 // type or class as parsed in the lexer, we only need to look this up in the grammar comment string // any comment text seen } @@ -208,9 +209,10 @@ func parseZone(r io.Reader, origin, f string, defttl *ttlState, t chan *Token, i var prevName string for l := range c { // Lexer spotted an error already - if l.err { + if l.err == true { t <- &Token{Error: &ParseError{f, l.token, l}} return + } switch st { case zExpectOwnerDir: @@ -637,6 +639,7 @@ func zlexer(s *scan, c chan lex) { if quote { str[stri] = x stri++ + break } // discard if outside of quotes case '\n': diff --git a/vendor/github.com/miekg/dns/scanner.go b/vendor/github.com/miekg/dns/scanner.go index 5b124ec595..424e5af9f5 100644 --- a/vendor/github.com/miekg/dns/scanner.go +++ b/vendor/github.com/miekg/dns/scanner.go @@ -42,7 +42,7 @@ func (s *scan) tokenText() (byte, error) { // delay the newline handling until the next token is delivered, // fixes off-by-one errors when reporting a parse error. - if s.eof { + if s.eof == true { s.position.Line++ s.position.Column = 0 s.eof = false diff --git a/vendor/github.com/miekg/dns/serve_mux.go b/vendor/github.com/miekg/dns/serve_mux.go deleted file mode 100644 index ae304db530..0000000000 --- a/vendor/github.com/miekg/dns/serve_mux.go +++ /dev/null @@ -1,147 +0,0 @@ -package dns - -import ( - "strings" - "sync" -) - -// ServeMux is an DNS request multiplexer. It matches the zone name of -// each incoming request against a list of registered patterns add calls -// the handler for the pattern that most closely matches the zone name. -// -// ServeMux is DNSSEC aware, meaning that queries for the DS record are -// redirected to the parent zone (if that is also registered), otherwise -// the child gets the query. -// -// ServeMux is also safe for concurrent access from multiple goroutines. -// -// The zero ServeMux is empty and ready for use. -type ServeMux struct { - z map[string]Handler - m sync.RWMutex -} - -// NewServeMux allocates and returns a new ServeMux. -func NewServeMux() *ServeMux { - return new(ServeMux) -} - -// DefaultServeMux is the default ServeMux used by Serve. -var DefaultServeMux = NewServeMux() - -func (mux *ServeMux) match(q string, t uint16) Handler { - mux.m.RLock() - defer mux.m.RUnlock() - if mux.z == nil { - return nil - } - - var handler Handler - - // TODO(tmthrgd): Once https://go-review.googlesource.com/c/go/+/137575 - // lands in a go release, replace the following with strings.ToLower. - var sb strings.Builder - for i := 0; i < len(q); i++ { - c := q[i] - if !(c >= 'A' && c <= 'Z') { - continue - } - - sb.Grow(len(q)) - sb.WriteString(q[:i]) - - for ; i < len(q); i++ { - c := q[i] - if c >= 'A' && c <= 'Z' { - c += 'a' - 'A' - } - - sb.WriteByte(c) - } - - q = sb.String() - break - } - - for off, end := 0, false; !end; off, end = NextLabel(q, off) { - if h, ok := mux.z[q[off:]]; ok { - if t != TypeDS { - return h - } - // Continue for DS to see if we have a parent too, if so delegate to the parent - handler = h - } - } - - // Wildcard match, if we have found nothing try the root zone as a last resort. - if h, ok := mux.z["."]; ok { - return h - } - - return handler -} - -// Handle adds a handler to the ServeMux for pattern. -func (mux *ServeMux) Handle(pattern string, handler Handler) { - if pattern == "" { - panic("dns: invalid pattern " + pattern) - } - mux.m.Lock() - if mux.z == nil { - mux.z = make(map[string]Handler) - } - mux.z[Fqdn(pattern)] = handler - mux.m.Unlock() -} - -// HandleFunc adds a handler function to the ServeMux for pattern. -func (mux *ServeMux) HandleFunc(pattern string, handler func(ResponseWriter, *Msg)) { - mux.Handle(pattern, HandlerFunc(handler)) -} - -// HandleRemove deregisters the handler specific for pattern from the ServeMux. -func (mux *ServeMux) HandleRemove(pattern string) { - if pattern == "" { - panic("dns: invalid pattern " + pattern) - } - mux.m.Lock() - delete(mux.z, Fqdn(pattern)) - mux.m.Unlock() -} - -// ServeDNS dispatches the request to the handler whose pattern most -// closely matches the request message. -// -// ServeDNS is DNSSEC aware, meaning that queries for the DS record -// are redirected to the parent zone (if that is also registered), -// otherwise the child gets the query. -// -// If no handler is found, or there is no question, a standard SERVFAIL -// message is returned -func (mux *ServeMux) ServeDNS(w ResponseWriter, req *Msg) { - var h Handler - if len(req.Question) >= 1 { // allow more than one question - h = mux.match(req.Question[0].Name, req.Question[0].Qtype) - } - - if h != nil { - h.ServeDNS(w, req) - } else { - HandleFailed(w, req) - } -} - -// Handle registers the handler with the given pattern -// in the DefaultServeMux. The documentation for -// ServeMux explains how patterns are matched. -func Handle(pattern string, handler Handler) { DefaultServeMux.Handle(pattern, handler) } - -// HandleRemove deregisters the handle with the given pattern -// in the DefaultServeMux. -func HandleRemove(pattern string) { DefaultServeMux.HandleRemove(pattern) } - -// HandleFunc registers the handler function with the given pattern -// in the DefaultServeMux. -func HandleFunc(pattern string, handler func(ResponseWriter, *Msg)) { - DefaultServeMux.HandleFunc(pattern, handler) -} diff --git a/vendor/github.com/miekg/dns/server.go b/vendor/github.com/miekg/dns/server.go index 4b4ec33c8d..2901f8724c 100644 --- a/vendor/github.com/miekg/dns/server.go +++ b/vendor/github.com/miekg/dns/server.go @@ -41,17 +41,6 @@ type Handler interface { ServeDNS(w ResponseWriter, r *Msg) } -// The HandlerFunc type is an adapter to allow the use of -// ordinary functions as DNS handlers. If f is a function -// with the appropriate signature, HandlerFunc(f) is a -// Handler object that calls f. -type HandlerFunc func(ResponseWriter, *Msg) - -// ServeDNS calls f(w, r). -func (f HandlerFunc) ServeDNS(w ResponseWriter, r *Msg) { - f(w, r) -} - // A ResponseWriter interface is used by an DNS handler to // construct an DNS response. type ResponseWriter interface { @@ -83,8 +72,8 @@ type ConnectionStater interface { type response struct { msg []byte hijacked bool // connection has been hijacked by handler - tsigTimersOnly bool tsigStatus error + tsigTimersOnly bool tsigRequestMAC string tsigSecret map[string]string // the tsig secrets udp *net.UDPConn // i/o connection if UDP was used @@ -94,6 +83,35 @@ type response struct { wg *sync.WaitGroup // for gracefull shutdown } +// ServeMux is an DNS request multiplexer. It matches the +// zone name of each incoming request against a list of +// registered patterns add calls the handler for the pattern +// that most closely matches the zone name. ServeMux is DNSSEC aware, meaning +// that queries for the DS record are redirected to the parent zone (if that +// is also registered), otherwise the child gets the query. +// ServeMux is also safe for concurrent access from multiple goroutines. +type ServeMux struct { + z map[string]Handler + m *sync.RWMutex +} + +// NewServeMux allocates and returns a new ServeMux. +func NewServeMux() *ServeMux { return &ServeMux{z: make(map[string]Handler), m: new(sync.RWMutex)} } + +// DefaultServeMux is the default ServeMux used by Serve. +var DefaultServeMux = NewServeMux() + +// The HandlerFunc type is an adapter to allow the use of +// ordinary functions as DNS handlers. If f is a function +// with the appropriate signature, HandlerFunc(f) is a +// Handler object that calls f. +type HandlerFunc func(ResponseWriter, *Msg) + +// ServeDNS calls f(w, r). +func (f HandlerFunc) ServeDNS(w ResponseWriter, r *Msg) { + f(w, r) +} + // HandleFailed returns a HandlerFunc that returns SERVFAIL for every request it gets. func HandleFailed(w ResponseWriter, r *Msg) { m := new(Msg) @@ -102,6 +120,8 @@ func HandleFailed(w ResponseWriter, r *Msg) { w.WriteMsg(m) } +func failedHandler() Handler { return HandlerFunc(HandleFailed) } + // ListenAndServe Starts a server on address and network specified Invoke handler // for incoming queries. func ListenAndServe(addr string, network string, handler Handler) error { @@ -140,6 +160,99 @@ func ActivateAndServe(l net.Listener, p net.PacketConn, handler Handler) error { return server.ActivateAndServe() } +func (mux *ServeMux) match(q string, t uint16) Handler { + mux.m.RLock() + defer mux.m.RUnlock() + var handler Handler + b := make([]byte, len(q)) // worst case, one label of length q + off := 0 + end := false + for { + l := len(q[off:]) + for i := 0; i < l; i++ { + b[i] = q[off+i] + if b[i] >= 'A' && b[i] <= 'Z' { + b[i] |= 'a' - 'A' + } + } + if h, ok := mux.z[string(b[:l])]; ok { // causes garbage, might want to change the map key + if t != TypeDS { + return h + } + // Continue for DS to see if we have a parent too, if so delegeate to the parent + handler = h + } + off, end = NextLabel(q, off) + if end { + break + } + } + // Wildcard match, if we have found nothing try the root zone as a last resort. + if h, ok := mux.z["."]; ok { + return h + } + return handler +} + +// Handle adds a handler to the ServeMux for pattern. +func (mux *ServeMux) Handle(pattern string, handler Handler) { + if pattern == "" { + panic("dns: invalid pattern " + pattern) + } + mux.m.Lock() + mux.z[Fqdn(pattern)] = handler + mux.m.Unlock() +} + +// HandleFunc adds a handler function to the ServeMux for pattern. +func (mux *ServeMux) HandleFunc(pattern string, handler func(ResponseWriter, *Msg)) { + mux.Handle(pattern, HandlerFunc(handler)) +} + +// HandleRemove deregistrars the handler specific for pattern from the ServeMux. +func (mux *ServeMux) HandleRemove(pattern string) { + if pattern == "" { + panic("dns: invalid pattern " + pattern) + } + mux.m.Lock() + delete(mux.z, Fqdn(pattern)) + mux.m.Unlock() +} + +// ServeDNS dispatches the request to the handler whose +// pattern most closely matches the request message. If DefaultServeMux +// is used the correct thing for DS queries is done: a possible parent +// is sought. +// If no handler is found a standard SERVFAIL message is returned +// If the request message does not have exactly one question in the +// question section a SERVFAIL is returned, unlesss Unsafe is true. +func (mux *ServeMux) ServeDNS(w ResponseWriter, request *Msg) { + var h Handler + if len(request.Question) < 1 { // allow more than one question + h = failedHandler() + } else { + if h = mux.match(request.Question[0].Name, request.Question[0].Qtype); h == nil { + h = failedHandler() + } + } + h.ServeDNS(w, request) +} + +// Handle registers the handler with the given pattern +// in the DefaultServeMux. The documentation for +// ServeMux explains how patterns are matched. +func Handle(pattern string, handler Handler) { DefaultServeMux.Handle(pattern, handler) } + +// HandleRemove deregisters the handle with the given pattern +// in the DefaultServeMux. +func HandleRemove(pattern string) { DefaultServeMux.HandleRemove(pattern) } + +// HandleFunc registers the handler function with the given pattern +// in the DefaultServeMux. +func HandleFunc(pattern string, handler func(ResponseWriter, *Msg)) { + DefaultServeMux.HandleFunc(pattern, handler) +} + // Writer writes raw DNS messages; each call to Write should send an entire message. type Writer interface { io.Writer @@ -416,13 +529,14 @@ func (srv *Server) Shutdown() error { // to terminate. func (srv *Server) ShutdownContext(ctx context.Context) error { srv.lock.Lock() - if !srv.started { - srv.lock.Unlock() + started := srv.started + srv.started = false + srv.lock.Unlock() + + if !started { return &Error{err: "server not started"} } - srv.started = false - if srv.PacketConn != nil { srv.PacketConn.SetReadDeadline(aLongTimeAgo) // Unblock reads } @@ -431,10 +545,10 @@ func (srv *Server) ShutdownContext(ctx context.Context) error { srv.Listener.Close() } + srv.lock.Lock() for rw := range srv.conns { rw.SetReadDeadline(aLongTimeAgo) // Unblock reads } - srv.lock.Unlock() if testShutdownNotify != nil { @@ -621,23 +735,20 @@ func (srv *Server) serve(w *response) { } } -func (srv *Server) disposeBuffer(w *response) { +func (srv *Server) serveDNS(w *response) { + req := new(Msg) + err := req.Unpack(w.msg) if w.udp != nil && cap(w.msg) == srv.UDPSize { srv.udpPool.Put(w.msg[:srv.UDPSize]) } w.msg = nil -} - -func (srv *Server) serveDNS(w *response) { - req := new(Msg) - err := req.Unpack(w.msg) if err != nil { // Send a FormatError back x := new(Msg) x.SetRcodeFormatError(req) w.WriteMsg(x) + return } - if err != nil || !srv.Unsafe && req.Response { - srv.disposeBuffer(w) + if !srv.Unsafe && req.Response { return } @@ -654,8 +765,6 @@ func (srv *Server) serveDNS(w *response) { } } - srv.disposeBuffer(w) - handler := srv.Handler if handler == nil { handler = DefaultServeMux @@ -665,16 +774,7 @@ func (srv *Server) serveDNS(w *response) { } func (srv *Server) readTCP(conn net.Conn, timeout time.Duration) ([]byte, error) { - // If we race with ShutdownContext, the read deadline may - // have been set in the distant past to unblock the read - // below. We must not override it, otherwise we may block - // ShutdownContext. - srv.lock.RLock() - if srv.started { - conn.SetReadDeadline(time.Now().Add(timeout)) - } - srv.lock.RUnlock() - + conn.SetReadDeadline(time.Now().Add(timeout)) l := make([]byte, 2) n, err := conn.Read(l) if err != nil || n != 2 { @@ -709,13 +809,7 @@ func (srv *Server) readTCP(conn net.Conn, timeout time.Duration) ([]byte, error) } func (srv *Server) readUDP(conn *net.UDPConn, timeout time.Duration) ([]byte, *SessionUDP, error) { - srv.lock.RLock() - if srv.started { - // See the comment in readTCP above. - conn.SetReadDeadline(time.Now().Add(timeout)) - } - srv.lock.RUnlock() - + conn.SetReadDeadline(time.Now().Add(timeout)) m := srv.udpPool.Get().([]byte) n, s, err := ReadFromSessionUDP(conn, m) if err != nil { @@ -767,33 +861,24 @@ func (w *response) Write(m []byte) (int, error) { n, err := io.Copy(w.tcp, bytes.NewReader(m)) return int(n), err - default: - panic("dns: Write called after Close") } + panic("not reached") } // LocalAddr implements the ResponseWriter.LocalAddr method. func (w *response) LocalAddr() net.Addr { - switch { - case w.udp != nil: - return w.udp.LocalAddr() - case w.tcp != nil: + if w.tcp != nil { return w.tcp.LocalAddr() - default: - panic("dns: LocalAddr called after Close") } + return w.udp.LocalAddr() } // RemoteAddr implements the ResponseWriter.RemoteAddr method. func (w *response) RemoteAddr() net.Addr { - switch { - case w.udpSession != nil: - return w.udpSession.RemoteAddr() - case w.tcp != nil: + if w.tcp != nil { return w.tcp.RemoteAddr() - default: - panic("dns: RemoteAddr called after Close") } + return w.udpSession.RemoteAddr() } // TsigStatus implements the ResponseWriter.TsigStatus method. diff --git a/vendor/github.com/miekg/dns/sig0.go b/vendor/github.com/miekg/dns/sig0.go index 07c2acb196..f31e9e6843 100644 --- a/vendor/github.com/miekg/dns/sig0.go +++ b/vendor/github.com/miekg/dns/sig0.go @@ -127,7 +127,8 @@ func (rr *SIG) Verify(k *KEY, buf []byte) error { if offset+1 >= buflen { continue } - rdlen := binary.BigEndian.Uint16(buf[offset:]) + var rdlen uint16 + rdlen = binary.BigEndian.Uint16(buf[offset:]) offset += 2 offset += int(rdlen) } diff --git a/vendor/github.com/miekg/dns/types.go b/vendor/github.com/miekg/dns/types.go index 115f2c7bd0..a64f4d7d83 100644 --- a/vendor/github.com/miekg/dns/types.go +++ b/vendor/github.com/miekg/dns/types.go @@ -419,130 +419,128 @@ type TXT struct { func (rr *TXT) String() string { return rr.Hdr.String() + sprintTxt(rr.Txt) } func sprintName(s string) string { - var dst strings.Builder - dst.Grow(len(s)) - for i := 0; i < len(s); { - if i+1 < len(s) && s[i] == '\\' && s[i+1] == '.' { - dst.WriteString(s[i : i+2]) + src := []byte(s) + dst := make([]byte, 0, len(src)) + for i := 0; i < len(src); { + if i+1 < len(src) && src[i] == '\\' && src[i+1] == '.' { + dst = append(dst, src[i:i+2]...) i += 2 - continue + } else { + b, n := nextByte(src, i) + if n == 0 { + i++ // dangling back slash + } else if b == '.' { + dst = append(dst, b) + } else { + dst = appendDomainNameByte(dst, b) + } + i += n } - - b, n := nextByte(s, i) - switch { - case n == 0: - i++ // dangling back slash - case b == '.': - dst.WriteByte('.') - default: - writeDomainNameByte(&dst, b) - } - i += n } - return dst.String() + return string(dst) } func sprintTxtOctet(s string) string { - var dst strings.Builder - dst.Grow(2 + len(s)) - dst.WriteByte('"') - for i := 0; i < len(s); { - if i+1 < len(s) && s[i] == '\\' && s[i+1] == '.' { - dst.WriteString(s[i : i+2]) + src := []byte(s) + dst := make([]byte, 0, len(src)) + dst = append(dst, '"') + for i := 0; i < len(src); { + if i+1 < len(src) && src[i] == '\\' && src[i+1] == '.' { + dst = append(dst, src[i:i+2]...) i += 2 - continue + } else { + b, n := nextByte(src, i) + if n == 0 { + i++ // dangling back slash + } else if b == '.' { + dst = append(dst, b) + } else { + if b < ' ' || b > '~' { + dst = appendByte(dst, b) + } else { + dst = append(dst, b) + } + } + i += n } - - b, n := nextByte(s, i) - switch { - case n == 0: - i++ // dangling back slash - case b == '.': - dst.WriteByte('.') - case b < ' ' || b > '~': - writeEscapedByte(&dst, b) - default: - dst.WriteByte(b) - } - i += n } - dst.WriteByte('"') - return dst.String() + dst = append(dst, '"') + return string(dst) } func sprintTxt(txt []string) string { - var out strings.Builder + var out []byte for i, s := range txt { - out.Grow(3 + len(s)) if i > 0 { - out.WriteString(` "`) + out = append(out, ` "`...) } else { - out.WriteByte('"') + out = append(out, '"') } - for j := 0; j < len(s); { - b, n := nextByte(s, j) + bs := []byte(s) + for j := 0; j < len(bs); { + b, n := nextByte(bs, j) if n == 0 { break } - writeTXTStringByte(&out, b) + out = appendTXTStringByte(out, b) j += n } - out.WriteByte('"') + out = append(out, '"') } - return out.String() + return string(out) } -func writeDomainNameByte(s *strings.Builder, b byte) { +func appendDomainNameByte(s []byte, b byte) []byte { switch b { case '.', ' ', '\'', '@', ';', '(', ')': // additional chars to escape - s.WriteByte('\\') - s.WriteByte(b) - default: - writeTXTStringByte(s, b) + return append(s, '\\', b) } + return appendTXTStringByte(s, b) } -func writeTXTStringByte(s *strings.Builder, b byte) { - switch { - case b == '"' || b == '\\': - s.WriteByte('\\') - s.WriteByte(b) - case b < ' ' || b > '~': - writeEscapedByte(s, b) - default: - s.WriteByte(b) +func appendTXTStringByte(s []byte, b byte) []byte { + switch b { + case '"', '\\': + return append(s, '\\', b) } + if b < ' ' || b > '~' { + return appendByte(s, b) + } + return append(s, b) } -func writeEscapedByte(s *strings.Builder, b byte) { +func appendByte(s []byte, b byte) []byte { var buf [3]byte bufs := strconv.AppendInt(buf[:0], int64(b), 10) - s.WriteByte('\\') - for i := len(bufs); i < 3; i++ { - s.WriteByte('0') + s = append(s, '\\') + for i := 0; i < 3-len(bufs); i++ { + s = append(s, '0') } - s.Write(bufs) + for _, r := range bufs { + s = append(s, r) + } + return s } -func nextByte(s string, offset int) (byte, int) { - if offset >= len(s) { +func nextByte(b []byte, offset int) (byte, int) { + if offset >= len(b) { return 0, 0 } - if s[offset] != '\\' { + if b[offset] != '\\' { // not an escape sequence - return s[offset], 1 + return b[offset], 1 } - switch len(s) - offset { + switch len(b) - offset { case 1: // dangling escape return 0, 0 case 2, 3: // too short to be \ddd default: // maybe \ddd - if isDigit(s[offset+1]) && isDigit(s[offset+2]) && isDigit(s[offset+3]) { - return dddStringToByte(s[offset+1:]), 4 + if isDigit(b[offset+1]) && isDigit(b[offset+2]) && isDigit(b[offset+3]) { + return dddToByte(b[offset+1:]), 4 } } // not \ddd, just an RFC 1035 "quoted" character - return s[offset+1], 2 + return b[offset+1], 2 } // SPF RR. See RFC 4408, Section 3.1.1. diff --git a/vendor/github.com/miekg/dns/udp.go b/vendor/github.com/miekg/dns/udp.go index a4826ee2ff..82ead69399 100644 --- a/vendor/github.com/miekg/dns/udp.go +++ b/vendor/github.com/miekg/dns/udp.go @@ -1,5 +1,3 @@ -// +build !windows - package dns import ( diff --git a/vendor/github.com/miekg/dns/udp_windows.go b/vendor/github.com/miekg/dns/udp_windows.go deleted file mode 100644 index 6778c3c6cf..0000000000 --- a/vendor/github.com/miekg/dns/udp_windows.go +++ /dev/null @@ -1,37 +0,0 @@ -// +build windows - -package dns - -import "net" - -// SessionUDP holds the remote address -type SessionUDP struct { - raddr *net.UDPAddr -} - -// RemoteAddr returns the remote network address. -func (s *SessionUDP) RemoteAddr() net.Addr { return s.raddr } - -// ReadFromSessionUDP acts just like net.UDPConn.ReadFrom(), but returns a session object instead of a -// net.UDPAddr. -// TODO(fastest963): Once go1.10 is released, use ReadMsgUDP. -func ReadFromSessionUDP(conn *net.UDPConn, b []byte) (int, *SessionUDP, error) { - n, raddr, err := conn.ReadFrom(b) - if err != nil { - return n, nil, err - } - session := &SessionUDP{raddr.(*net.UDPAddr)} - return n, session, err -} - -// WriteToSessionUDP acts just like net.UDPConn.WriteTo(), but uses a *SessionUDP instead of a net.Addr. -// TODO(fastest963): Once go1.10 is released, use WriteMsgUDP. -func WriteToSessionUDP(conn *net.UDPConn, b []byte, session *SessionUDP) (int, error) { - n, err := conn.WriteTo(b, session.raddr) - return n, err -} - -// TODO(fastest963): Once go1.10 is released and we can use *MsgUDP methods -// use the standard method in udp.go for these. -func setUDPSocketOptions(*net.UDPConn) error { return nil } -func parseDstFromOOB([]byte, net.IP) net.IP { return nil } diff --git a/vendor/github.com/miekg/dns/version.go b/vendor/github.com/miekg/dns/version.go index 403b9ef978..ade7586dc1 100644 --- a/vendor/github.com/miekg/dns/version.go +++ b/vendor/github.com/miekg/dns/version.go @@ -3,7 +3,7 @@ package dns import "fmt" // Version is current version of this library. -var Version = V{1, 0, 13} +var Version = V{1, 0, 10} // V holds the version of this library. type V struct { diff --git a/vendor/github.com/nelsonken/cos-go-sdk-v5/cos/auth.go b/vendor/github.com/nelsonken/cos-go-sdk-v5/cos/auth.go new file mode 100644 index 0000000000..c560caa2c6 --- /dev/null +++ b/vendor/github.com/nelsonken/cos-go-sdk-v5/cos/auth.go @@ -0,0 +1,128 @@ +package cos + +import ( + "crypto/hmac" + "crypto/sha1" + "encoding/hex" + "fmt" + "net/http" + "sort" + "strconv" + "strings" + "time" +) + +func (conn *Conn) signHeader(req *http.Request, params map[string]interface{}, headers map[string]string) { + signTime := getSignTime() + signature := conn.getSignature(req, params, headers, signTime) + authStr := fmt.Sprintf("q-sign-algorithm=sha1&q-ak=%s&q-sign-time=%s&q-key-time=%s&q-header-list=%s&q-url-param-list=%s&q-signature=%s", + conn.conf.SecretID, signTime, signTime, getHeadKeys(headers), getParamKeys(params), signature) + + req.Header.Set("Authorization", authStr) +} + +func getSignTime() string { + now := time.Now() + expired := now.Add(time.Second * 1800) + return fmt.Sprintf("%d;%d", now.Unix(), expired.Unix()) +} + +func getHeadKeys(headers map[string]string) string { + if headers == nil || len(headers) == 0 { + return "" + } + + tmp := []string{} + for k := range headers { + tmp = append(tmp, strings.ToLower(k)) + } + sort.Strings(tmp) + + return strings.Join(tmp, ";") +} + +func getParamKeys(params map[string]interface{}) string { + if params == nil || len(params) == 0 { + return "" + } + + tmp := []string{} + for k := range params { + tmp = append(tmp, strings.ToLower(k)) + } + sort.Strings(tmp) + + return strings.Join(tmp, ";") +} + +func (conn *Conn) getSignature(req *http.Request, params map[string]interface{}, headers map[string]string, signTime string) string { + httpString := fmt.Sprintf("%s\n%s\n%s\n%s\n", strings.ToLower(req.Method), + req.URL.Path, getParamStr(params), getHeadStr(headers)) + + httpString = sha(httpString) + signKey := hmacSha(conn.conf.SecretKey, signTime) + signStr := fmt.Sprintf("sha1\n%s\n%s\n", signTime, httpString) + + return hmacSha(signKey, signStr) +} + +func interfaceToString(i interface{}) string { + switch x := i.(type) { + case string: + return x + case int: + return strconv.Itoa(x) + case int64: + return strconv.FormatInt(x, 10) + case uint64: + return strconv.FormatUint(x, 10) + default: + return "" + } +} + +func getParamStr(params map[string]interface{}) string { + if params == nil || len(params) == 0 { + return "" + } + + tmp := []string{} + for k, v := range params { + str := strings.ToLower(fmt.Sprintf("%s=%s", k, interfaceToString(v))) + tmp = append(tmp, str) + } + sort.Strings(tmp) + + return strings.Join(tmp, "&") +} + +func getHeadStr(headers map[string]string) string { + if headers == nil || len(headers) == 0 { + return "" + } + + tmp := []string{} + for k, v := range headers { + str := fmt.Sprintf("%s=%s", strings.ToLower(k), escape(v)) + tmp = append(tmp, str) + } + sort.Strings(tmp) + + return strings.Join(tmp, "&") +} + +func sha(s string) string { + sha := sha1.New() + sha.Write([]byte(s)) + b := sha.Sum(nil) + + return hex.EncodeToString(b) +} + +func hmacSha(k, s string) string { + enc := hmac.New(sha1.New, []byte(k)) + enc.Write([]byte(s)) + b := enc.Sum(nil) + + return hex.EncodeToString(b) +} diff --git a/vendor/github.com/nelsonken/cos-go-sdk-v5/cos/bucket.go b/vendor/github.com/nelsonken/cos-go-sdk-v5/cos/bucket.go new file mode 100644 index 0000000000..3458f2fb30 --- /dev/null +++ b/vendor/github.com/nelsonken/cos-go-sdk-v5/cos/bucket.go @@ -0,0 +1,315 @@ +package cos + +import ( + "bytes" + "context" + "crypto/md5" + "encoding/hex" + "encoding/xml" + "fmt" + "io" + "net/http" + "os" + "strings" +) + +// Bucket bucket +type Bucket struct { + Name string + conn *Conn +} + +// ObjectSlice object slice +type ObjectSlice struct { + UploadID string + Size int64 + Offset int64 + Number int + MD5 string + Dst string + Result bool +} + +// 获得云存储上文件信息 +func (b *Bucket) HeadObject(ctx context.Context, object string) error { + resq, err := b.conn.Do(ctx, http.MethodHead, b.Name, object, nil, nil, nil) + if err == nil { + defer resq.Body.Close() + } else { + for k, v := range resq.Header { + value := fmt.Sprintf("%s", v) + fmt.Printf("%-18s: %s\n", k, strings.Replace(strings.Replace(value, "[", "", -1), "]", "", -1)) + } + } + + return err +} + +func (b *Bucket) UploadObject(ctx context.Context, object string, content io.Reader, acl *AccessControl) error { + res, err := b.conn.Do(ctx, http.MethodPut, b.Name, object, nil, acl.GenHead(), content) + if err == nil { + defer res.Body.Close() + } + + return err +} + +func (b *Bucket) CopyObject(ctx context.Context, src, dst string, acl *AccessControl) error { + srcURL := fmt.Sprintf("%s-%s.cos.%s.%s/%s", b.Name, b.conn.conf.AppID, b.conn.conf.Region, b.conn.conf.Domain, dst) + header := map[string]string{ + "x-cos-source-url": srcURL, + } + + res, err := b.conn.Do(ctx, http.MethodPut, b.Name, dst, nil, header, nil) + if err == nil { + defer res.Body.Close() + } + + return err +} + +func (b *Bucket) DeleteObject(ctx context.Context, obj string) error { + res, err := b.conn.Do(ctx, http.MethodDelete, b.Name, obj, nil, nil, nil) + if err == nil { + defer res.Body.Close() + } + + return err +} + +func (b *Bucket) DownloadObject(ctx context.Context, object string, w io.Writer) error { + res, err := b.conn.Do(ctx, http.MethodGet, b.Name, object, nil, nil, nil) + if err != nil { + return err + } + + _, err = io.Copy(w, res.Body) + + return err +} + +// UploadObjectBySlice upload by slice +func (b *Bucket) UploadObjectBySlice(ctx context.Context, dst, src string, taskNum int, headers map[string]string) error { + if taskNum < 1 { + return ParamError{"taskNum 必须大于1"} + } + + uploadID, err := b.InitSliceUpload(ctx, dst, headers) + if err != nil { + return err + } + + fd, err := os.Open(src) + if err != nil { + return err + } + defer fd.Close() + + slices, err := b.PerformSliceUpload(ctx, dst, uploadID, fd, taskNum) + if err != nil { + return err + } + + err = b.CompleteSliceUpload(ctx, dst, uploadID, fd, slices) + + return err +} + +// InitSliceUpload init upload by slice +func (b *Bucket) InitSliceUpload(ctx context.Context, obj string, headers map[string]string) (string, error) { + param := map[string]interface{}{ + "uploads": "", + } + res, err := b.conn.Do(ctx, http.MethodPost, b.Name, obj, param, headers, nil) + if err != nil { + return "", err + } + defer res.Body.Close() + + imur := &InitiateMultipartUploadResult{} + err = XMLDecode(res.Body, imur) + if err != nil { + return "", err + } + + return imur.UploadID, nil +} + +// CompleteSliceUpload finish slice Upload +func (b *Bucket) CompleteSliceUpload(ctx context.Context, dst, uploadID string, fd *os.File, slice []*ObjectSlice) error { + cmu := &CompleteMultipartUpload{} + cmu.Part = []struct { + PartNumber int + ETag string + }{} + + for _, osl := range slice { + cmu.Part = append(cmu.Part, struct { + PartNumber int + ETag string + }{PartNumber: osl.Number, ETag: osl.MD5}) + } + + cmuXML, err := xml.Marshal(cmu) + if err != nil { + return err + } + param := map[string]interface{}{ + "uploadId": uploadID, + } + res, err := b.conn.Do(ctx, http.MethodPost, b.Name, dst, param, nil, bytes.NewReader(cmuXML)) + if err == nil { + defer res.Body.Close() + } + + return err +} + +// PerformSliceUpload perform slice upload +func (b *Bucket) PerformSliceUpload(ctx context.Context, dst, uploadID string, fd *os.File, taskNum int) ([]*ObjectSlice, error) { + oss, err := b.getFileSlices(fd, uploadID, dst) + if err != nil { + return nil, err + } + + jobNum := len(oss) + jobs := make(chan *ObjectSlice, jobNum) + result := make(chan *ObjectSlice, jobNum) + + for i := 0; i < taskNum; i++ { + go b.Worker(ctx, fd, jobs, result) + } + + for _, osl := range oss { + jobs <- osl + } + close(jobs) + + for i := 0; i < jobNum; i++ { + res := <-result + if !res.Result { + return nil, SliceError{fmt.Sprintf("part info : num:%d, md5:%s", res.Number, res.MD5)} + } + } + + return oss, nil +} + +// Worker woker for slice upload +func (b *Bucket) Worker(ctx context.Context, fd *os.File, jobs <-chan *ObjectSlice, result chan<- *ObjectSlice) { + for job := range jobs { + content, err := getFilePartContent(fd, job.Offset, job.Size) + if err != nil { + continue + } + + err = b.UploadSlice(ctx, job.UploadID, job.Dst, job.Number, job.MD5, content) + if err == nil { + job.Result = true + } else { + job.Result = false + } + + result <- job + } +} + +// UploadSlice upload one slice +func (b *Bucket) UploadSlice(ctx context.Context, uploadID, dst string, number int, etag string, content io.Reader) error { + param := map[string]interface{}{ + "PartNumber": number, + "uploadId": uploadID, + } + res, err := b.conn.Do(ctx, http.MethodPut, b.Name, dst, param, nil, content) + + if err != nil { + return FileError{"PUT数据错误:" + err.Error()} + } + defer res.Body.Close() + + if strings.Trim(res.Header.Get("Etag"), "\"") != etag { + return FileError{"cos-etag与文件MD5不匹配"} + } + + return err +} + +func (b *Bucket) getFileSlices(fd *os.File, uploadID, dst string) ([]*ObjectSlice, error) { + sliceSize := b.conn.conf.PartSize + fi, err := fd.Stat() + if err != nil { + return nil, err + } + + fileSize := fi.Size() + oss := []*ObjectSlice{} + var i int + var offset int64 + for fileSize > 0 { + var size int64 + if fileSize > sliceSize { + size = sliceSize + } else { + size = fileSize + } + i++ + md5, err := getFileMD5(fd, offset, size) + if err != nil { + return nil, err + } + + osl := &ObjectSlice{} + osl.Size = size + osl.Number = i + osl.Offset = offset + osl.UploadID = uploadID + osl.MD5 = md5 + osl.Dst = dst + oss = append(oss, osl) + + fileSize -= sliceSize + offset += sliceSize + } + + return oss, nil +} + +func getFileMD5(fd *os.File, offset, size int64) (string, error) { + buf := make([]byte, size) + _, err := fd.ReadAt(buf, offset) + if err != nil { + return "", err + } + + encoder := md5.New() + encoder.Write(buf) + b := encoder.Sum(nil) + + return hex.EncodeToString(b), nil +} + +func getFilePartContent(fd *os.File, offset, size int64) (io.Reader, error) { + buf := make([]byte, size) + _, err := fd.ReadAt(buf, offset) + if err != nil { + return nil, err + } + + return bytes.NewReader(buf), nil +} + +func (b *Bucket) AbortUpload(ctx context.Context, obj, uploadID string) error { + param := map[string]interface{}{ + "uploadId": uploadID, + } + _, err := b.conn.Do(ctx, http.MethodDelete, b.Name, obj, param, nil, nil) + + return err +} + +// ObjectExists object exists +func (b *Bucket) ObjectExists(ctx context.Context, obj string) error { + _, err := b.conn.Do(ctx, http.MethodHead, b.Name, obj, nil, nil, nil) + + return err +} diff --git a/vendor/github.com/nelsonken/cos-go-sdk-v5/cos/client.go b/vendor/github.com/nelsonken/cos-go-sdk-v5/cos/client.go new file mode 100644 index 0000000000..18beb021b5 --- /dev/null +++ b/vendor/github.com/nelsonken/cos-go-sdk-v5/cos/client.go @@ -0,0 +1,164 @@ +package cos + +import ( + "context" + "net/http" + "time" +) + +// Client 客户端, cos的句柄 +type Client struct { + conn *Conn +} + +// New cos包的入口 +func New(o *Option) *Client { + client := Client{} + conf := getDefaultConf() + conf.AppID = o.AppID + conf.SecretID = o.SecretID + conf.SecretKey = o.SecretKey + conf.Region = o.Region + + if o.Domain != "" { + conf.Domain = o.Domain + } + + conn := Conn{&http.Client{}, conf} + client.conn = &conn + + return &client +} + +// GetTimeoutCtx 获取一个带超时的context +func GetTimeoutCtx(timeout time.Duration) context.Context { + ctx, _ := context.WithTimeout(context.Background(), timeout) + + return ctx +} + +// Bucket get bucket +func (c *Client) Bucket(name string) *Bucket { + return &Bucket{name, c.conn} +} + +// GetBucketList 获取bucketlist +func (c *Client) GetBucketList(ctx context.Context) (*ListAllMyBucketsResult, error) { + req, err := http.NewRequest(http.MethodGet, "http://service.cos.myqcloud.com/", nil) + if err != nil { + return nil, err + } + + req = req.WithContext(ctx) + c.conn.signHeader(req, nil, nil) + res, err := c.conn.c.Do(req) + if err != nil { + return nil, err + } + defer res.Body.Close() + + res, err = checkHTTPErr(res) + if err != nil { + return nil, err + } + + labr := &ListAllMyBucketsResult{} + err = XMLDecode(res.Body, labr) + if err != nil { + return nil, err + } + + return labr, err +} + +// CreateBucket 建立bucket +func (c *Client) CreateBucket(ctx context.Context, name string, acl *AccessControl) error { + res, err := c.conn.Do(ctx, http.MethodPut, name, "", nil, acl.GenHead(), nil) + if err == nil { + defer res.Body.Close() + } + + return err +} + +// DeleteBucket delete a bucket +func (c *Client) DeleteBucket(ctx context.Context, name string) error { + _, err := c.conn.Do(ctx, http.MethodDelete, name, "", nil, nil, nil) + + return err +} + +// GetBucketACL get bucket's acl +func (c *Client) GetBucketACL(ctx context.Context, name string) (*AccessControlPolicy, error) { + params := map[string]interface{}{"acl": ""} + res, err := c.conn.Do(ctx, http.MethodGet, name, "", params, nil, nil) + + if err != nil { + return nil, err + } + defer res.Body.Close() + + aclp := &AccessControlPolicy{} + + err = XMLDecode(res.Body, aclp) + if err != nil { + return nil, err + } + + return aclp, nil +} + +// SetBucketACL set bucket's acl +func (c *Client) SetBucketACL(ctx context.Context, name string, acl *AccessControl) error { + params := map[string]interface{}{"acl": ""} + res, err := c.conn.Do(ctx, http.MethodPut, name, "", params, acl.GenHead(), nil) + if err == nil { + defer res.Body.Close() + } + + return err +} + +// BucketExists bucket exists? +func (c *Client) BucketExists(ctx context.Context, name string) error { + res, err := c.conn.Do(ctx, http.MethodHead, name, "", nil, nil, nil) + if err == nil { + defer res.Body.Close() + } + + return err +} + +// ListBucketContents list +func (c *Client) ListBucketContents(ctx context.Context, name string, qc *QueryCondition) (*ListBucketResult, error) { + resp, err := c.conn.Do(ctx, http.MethodGet, name, "", qc.GenParams(), nil, nil) + if err != nil { + return nil, err + } + defer resp.Body.Close() + + lbr := &ListBucketResult{} + err = XMLDecode(resp.Body, lbr) + if err != nil { + return nil, err + } + + return lbr, nil +} + +// ListUploading list uploading task +func (c *Client) ListUploading(ctx context.Context, bucket string, lu *ListUploadParam) (*ListMultipartUploadsResult, error) { + res, err := c.conn.Do(ctx, http.MethodGet, bucket, "", lu.GenParams(), nil, nil) + if err != nil { + return nil, err + } + defer res.Body.Close() + + lmur := &ListMultipartUploadsResult{} + err = XMLDecode(res.Body, lmur) + if err != nil { + return nil, err + } + + return lmur, nil +} diff --git a/vendor/github.com/nelsonken/cos-go-sdk-v5/cos/conf.go b/vendor/github.com/nelsonken/cos-go-sdk-v5/cos/conf.go new file mode 100644 index 0000000000..516c013164 --- /dev/null +++ b/vendor/github.com/nelsonken/cos-go-sdk-v5/cos/conf.go @@ -0,0 +1,31 @@ +package cos + +const ( + defaultPartSize = 80 * 1024 * 1024 + defaultRetryTimes = 3 + defaultUA = "cos-go-sdk-v5.2.9" + defaultDomain = "myqcloud.com" +) + +// Conf config struct +type Conf struct { + AppID string + SecretID string + SecretKey string + Region string + PartSize int64 + RetryTimes int + UA string + Domain string + Bucket string +} + +func getDefaultConf() *Conf { + conf := Conf{} + conf.PartSize = defaultPartSize + conf.RetryTimes = defaultRetryTimes + conf.UA = defaultUA + conf.Domain = defaultDomain + + return &conf +} diff --git a/vendor/github.com/nelsonken/cos-go-sdk-v5/cos/conn.go b/vendor/github.com/nelsonken/cos-go-sdk-v5/cos/conn.go new file mode 100644 index 0000000000..bf6380ac0e --- /dev/null +++ b/vendor/github.com/nelsonken/cos-go-sdk-v5/cos/conn.go @@ -0,0 +1,141 @@ +package cos + +import ( + "bytes" + "context" + "encoding/xml" + "fmt" + "io" + "io/ioutil" + "net/http" + "net/url" + "strings" +) + +// Conn http 请求类 +type Conn struct { + c *http.Client + conf *Conf +} + +func (conn *Conn) Do(ctx context.Context, method, bucket, object string, params map[string]interface{}, headers map[string]string, body io.Reader) (*http.Response, error) { + queryStr := getQueryStr(params) + url := conn.buildURL(bucket, object, queryStr) + + switch body.(type) { + case *bytes.Buffer, *bytes.Reader, *strings.Reader: + default: + if body != nil { + b, err := ioutil.ReadAll(body) + if err != nil { + return nil, err + } + body = bytes.NewReader(b) + } + } + + req, err := http.NewRequest(method, url, body) + if err != nil { + return nil, err + } + + conn.signHeader(req, params, headers) + req.Header.Set("User-Agent", conn.conf.UA) + setHeader(req, headers) + + res, err := conn.c.Do(req) + + if err != nil { + return nil, err + } + + if res.StatusCode < 200 || res.StatusCode >= 300 { + defer res.Body.Close() + return checkHTTPErr(res) + } + + return res, nil +} + +func getQueryStr(params map[string]interface{}) string { + if params == nil || len(params) == 0 { + return "" + } + + buf := new(bytes.Buffer) + buf.WriteString("?") + for k, v := range params { + buf.WriteString(k) + vs := interfaceToString(v) + if vs == "" { + buf.WriteString("&") + continue + } + buf.WriteString("=") + buf.WriteString(vs) + buf.WriteString("&") + } + + return strings.Trim(buf.String(), "&") +} + +func (conn *Conn) buildURL(bucket, object, queryStr string) string { + domain := fmt.Sprintf("%s-%s.cos.%s.%s", bucket, conn.conf.AppID, conn.conf.Region, conn.conf.Domain) + url := fmt.Sprintf("http://%s/%s%s", domain, escape(object), queryStr) + + return url +} + +func escape(str string) string { + //go语言中将空格编码为+,需要改为%20 + return strings.Replace(url.QueryEscape(str), "+", "%20", -1) +} + +func setHeader(req *http.Request, headers map[string]string) { + if headers == nil { + return + } + + for k, v := range headers { + req.Header.Set(k, v) + } +} + +func checkHTTPErr(res *http.Response) (*http.Response, error) { + if res.StatusCode >= 200 && res.StatusCode < 300 { + return res, nil + } + + err := HTTPError{} + err.Code = res.StatusCode + if res.StatusCode >= 300 && res.StatusCode < 400 { + err.Message = "资源被重定向" + } + + if res.StatusCode >= 400 && res.StatusCode < 500 { + err.Message = "请求被拒绝" + } + + if res.StatusCode >= 500 { + err.Message = "cos服务器错误" + } + + if res.ContentLength > 0 { + resErr := &Error{} + e := XMLDecode(res.Body, resErr) + if e != nil { + return nil, err + } + err.Message += resErr.Message + } + + return res, err +} + +// XMLDecode xml解析方法 +func XMLDecode(r io.Reader, i interface{}) error { + jd := xml.NewDecoder(r) + err := jd.Decode(i) + + return err +} diff --git a/vendor/github.com/nelsonken/cos-go-sdk-v5/cos/option.go b/vendor/github.com/nelsonken/cos-go-sdk-v5/cos/option.go new file mode 100644 index 0000000000..d6bc8af99b --- /dev/null +++ b/vendor/github.com/nelsonken/cos-go-sdk-v5/cos/option.go @@ -0,0 +1,10 @@ +package cos + +type Option struct { + AppID string `mapstructure:"app_id" json:"app_id"` + SecretID string `mapstructure:"secret_id" json:"secret_id"` + SecretKey string `mapstructure:"secret_key" json:"secret_key"` + Region string `mapstructure:"region" json:"region"` + Domain string `mapstructure:"domain" json:"domain"` + Bucket string `mapstructure:"bucket" json:"bucket"` +} diff --git a/vendor/github.com/nelsonken/cos-go-sdk-v5/cos/requests.go b/vendor/github.com/nelsonken/cos-go-sdk-v5/cos/requests.go new file mode 100644 index 0000000000..e26c6757e9 --- /dev/null +++ b/vendor/github.com/nelsonken/cos-go-sdk-v5/cos/requests.go @@ -0,0 +1,102 @@ +package cos + +// AccessControl privilige +type AccessControl struct { + ACL string + GrantRead string + GrantWrite string + FullControl string +} + +// GenHead 生成http head +func (acl *AccessControl) GenHead() map[string]string { + header := map[string]string{ + "x-cos-acl": acl.ACL, + "x-cos-grant-read": acl.GrantRead, + "x-cos-grant-write": acl.GrantWrite, + "x-cos-grant-full-control": acl.FullControl, + } + + for k, v := range header { + if v == "" { + delete(header, k) + } + } + + return header +} + +// QueryCondition query condition +type QueryCondition struct { + Prefix string + Delimiter string + EncodingType string + Marker string + MaxKeys int +} + +// GenParams generate params:map[string]interface{} +func (qc *QueryCondition) GenParams() map[string]interface{} { + params := map[string]interface{}{ + "prefix": qc.Prefix, + "delimiter": qc.Delimiter, + "encoding-type": qc.EncodingType, + "marker": qc.Marker, + "max-keys": qc.MaxKeys, + } + + for k, v := range params { + if v == "" { + delete(params, k) + } + if v == 0 { + delete(params, k) + } + } + + return params +} + +// ListUploadParam list upload param +type ListUploadParam struct { + Prefix string + Delimiter string + EncodingType string + MaxUploads int + KeyMarker string + UploadIDMarker string +} + +// GenParams generate params for request +func (lup *ListUploadParam) GenParams() map[string]interface{} { + params := map[string]interface{}{ + "prefix": lup.Prefix, + "delimiter": lup.Delimiter, + "encoding-type": lup.EncodingType, + "max-uploads": lup.MaxUploads, + "key-marker": lup.KeyMarker, + "upload-id-marker": lup.UploadIDMarker, + } + + for k, v := range params { + if v == "" { + delete(params, k) + } + + if v == 0 { + delete(params, k) + } + } + params["uploads"] = "" + + return params + +} + +// CompleteMultipartUpload compelete slice upload +type CompleteMultipartUpload struct { + Part []struct { + PartNumber int + ETag string + } +} diff --git a/vendor/github.com/nelsonken/cos-go-sdk-v5/cos/response.go b/vendor/github.com/nelsonken/cos-go-sdk-v5/cos/response.go new file mode 100644 index 0000000000..8c69ab30cd --- /dev/null +++ b/vendor/github.com/nelsonken/cos-go-sdk-v5/cos/response.go @@ -0,0 +1,156 @@ +package cos + +import ( + "fmt" +) + +// ListAllMyBucketsResult 获取bucket列表的结果 +type ListAllMyBucketsResult struct { + Owner struct { + ID string + DisplayName string + } + + Buckets struct { + Bucket []struct { + Name string + Location string + CreateDate string + } + } +} + +// Error 错误消息 +type Error struct { + Code string + Message string + Resource string + RequestID string `xml:"RequestId"` + TraceID string `xml:"TaceId"` +} + +// HTTPError http error struct +type HTTPError struct { + Code int + Message string +} + +// Error error interface +func (he HTTPError) Error() string { + return fmt.Sprintf("%d:%s", he.Code, he.Message) +} + +// AccessControlPolicy acl return +type AccessControlPolicy struct { + Owner struct { + ID string + DisplayName string + } + AccessControlList struct { + Grant []struct { + Grantee struct { + ID string + DisplayName string + } + Permission string + } + } +} + +// ListBucketResult list bucket contents result +type ListBucketResult struct { + Name string + EncodingType string `xml:"Encoding-Type"` + Prefix string + Marker string + MaxKeys int + IsTruncated bool + NextMarker string + Contents []struct { + Key string + LastModified string + ETag string + Size int64 + Owner struct { + ID string + } + StorageClass string + } + CommonPrefixes []struct { + Prefix string + } +} + +// ListMultipartUploadsResult list uploading task +type ListMultipartUploadsResult struct { + Bucket string + EncodingType string `xml:"Encoding-Type"` + KeyMarker string + UploadIDMarker string `xml:"UploadIdMarker"` + NextKeyMarker string + NextUploadIDMarker string `xml:"NextUploadIdMarker"` + MaxUploads int + IsTruncated bool + Prefix string + Delimiter string + Upload []struct { + Key string + UploadID string + StorageClass string + Initiator struct { + UIN string + } + Owner struct { + UID string + } + Initiated string + } + CommonPrefixes []struct { + Prefix string + } +} + +// InitiateMultipartUploadResult init slice upload +type InitiateMultipartUploadResult struct { + Bucket string + Key string + UploadID string `xml:"UploadId"` +} + +// CompleteMultipartUploadResult compeleted slice upload +type CompleteMultipartUploadResult struct { + Location string + Bucket string + Key string + ETag string +} + +// SliceError slice upload err +type SliceError struct { + Message string +} + +// Error implements error +func (se SliceError) Error() string { + return fmt.Sprintf("上传分片失败:%s", se.Message) +} + +// ParamError slice upload err +type ParamError struct { + Message string +} + +// Error implements error +func (pe ParamError) Error() string { + return fmt.Sprintf("参数错误:%s", pe.Message) +} + +// FileError slice upload err +type FileError struct { + Message string +} + +// Error implements error +func (fe FileError) Error() string { + return fmt.Sprintf("文件错误:%s", fe.Message) +} diff --git a/vendor/github.com/pierrec/lz4/block.go b/vendor/github.com/pierrec/lz4/block.go index 00b1111b92..ef24f17e57 100644 --- a/vendor/github.com/pierrec/lz4/block.go +++ b/vendor/github.com/pierrec/lz4/block.go @@ -286,7 +286,7 @@ func CompressBlockHC(src, dst []byte, depth int) (di int, err error) { for ml < sn-si && src[next+ml] == src[si+ml] { ml++ } - if ml < minMatch || ml <= mLen { + if ml+1 < minMatch || ml <= mLen { // Match too small ( 0 && first[0] == '-' { + if first[0] == '-' { //--unknown --next-flag ... return args } //--unknown arg ... (args will be arg ...) - if len(args) > 1 { - return args[1:] - } - return nil + return args[1:] } func (f *FlagSet) parseLongArg(s string, args []string, fn parseFunc) (a []string, err error) { diff --git a/vendor/github.com/spf13/pflag/string_to_int.go b/vendor/github.com/spf13/pflag/string_to_int.go deleted file mode 100644 index 5ceda3965d..0000000000 --- a/vendor/github.com/spf13/pflag/string_to_int.go +++ /dev/null @@ -1,149 +0,0 @@ -package pflag - -import ( - "bytes" - "fmt" - "strconv" - "strings" -) - -// -- stringToInt Value -type stringToIntValue struct { - value *map[string]int - changed bool -} - -func newStringToIntValue(val map[string]int, p *map[string]int) *stringToIntValue { - ssv := new(stringToIntValue) - ssv.value = p - *ssv.value = val - return ssv -} - -// Format: a=1,b=2 -func (s *stringToIntValue) Set(val string) error { - ss := strings.Split(val, ",") - out := make(map[string]int, len(ss)) - for _, pair := range ss { - kv := strings.SplitN(pair, "=", 2) - if len(kv) != 2 { - return fmt.Errorf("%s must be formatted as key=value", pair) - } - var err error - out[kv[0]], err = strconv.Atoi(kv[1]) - if err != nil { - return err - } - } - if !s.changed { - *s.value = out - } else { - for k, v := range out { - (*s.value)[k] = v - } - } - s.changed = true - return nil -} - -func (s *stringToIntValue) Type() string { - return "stringToInt" -} - -func (s *stringToIntValue) String() string { - var buf bytes.Buffer - i := 0 - for k, v := range *s.value { - if i > 0 { - buf.WriteRune(',') - } - buf.WriteString(k) - buf.WriteRune('=') - buf.WriteString(strconv.Itoa(v)) - i++ - } - return "[" + buf.String() + "]" -} - -func stringToIntConv(val string) (interface{}, error) { - val = strings.Trim(val, "[]") - // An empty string would cause an empty map - if len(val) == 0 { - return map[string]int{}, nil - } - ss := strings.Split(val, ",") - out := make(map[string]int, len(ss)) - for _, pair := range ss { - kv := strings.SplitN(pair, "=", 2) - if len(kv) != 2 { - return nil, fmt.Errorf("%s must be formatted as key=value", pair) - } - var err error - out[kv[0]], err = strconv.Atoi(kv[1]) - if err != nil { - return nil, err - } - } - return out, nil -} - -// GetStringToInt return the map[string]int value of a flag with the given name -func (f *FlagSet) GetStringToInt(name string) (map[string]int, error) { - val, err := f.getFlagType(name, "stringToInt", stringToIntConv) - if err != nil { - return map[string]int{}, err - } - return val.(map[string]int), nil -} - -// StringToIntVar defines a string flag with specified name, default value, and usage string. -// The argument p points to a map[string]int variable in which to store the values of the multiple flags. -// The value of each argument will not try to be separated by comma -func (f *FlagSet) StringToIntVar(p *map[string]int, name string, value map[string]int, usage string) { - f.VarP(newStringToIntValue(value, p), name, "", usage) -} - -// StringToIntVarP is like StringToIntVar, but accepts a shorthand letter that can be used after a single dash. -func (f *FlagSet) StringToIntVarP(p *map[string]int, name, shorthand string, value map[string]int, usage string) { - f.VarP(newStringToIntValue(value, p), name, shorthand, usage) -} - -// StringToIntVar defines a string flag with specified name, default value, and usage string. -// The argument p points to a map[string]int variable in which to store the value of the flag. -// The value of each argument will not try to be separated by comma -func StringToIntVar(p *map[string]int, name string, value map[string]int, usage string) { - CommandLine.VarP(newStringToIntValue(value, p), name, "", usage) -} - -// StringToIntVarP is like StringToIntVar, but accepts a shorthand letter that can be used after a single dash. -func StringToIntVarP(p *map[string]int, name, shorthand string, value map[string]int, usage string) { - CommandLine.VarP(newStringToIntValue(value, p), name, shorthand, usage) -} - -// StringToInt defines a string flag with specified name, default value, and usage string. -// The return value is the address of a map[string]int variable that stores the value of the flag. -// The value of each argument will not try to be separated by comma -func (f *FlagSet) StringToInt(name string, value map[string]int, usage string) *map[string]int { - p := map[string]int{} - f.StringToIntVarP(&p, name, "", value, usage) - return &p -} - -// StringToIntP is like StringToInt, but accepts a shorthand letter that can be used after a single dash. -func (f *FlagSet) StringToIntP(name, shorthand string, value map[string]int, usage string) *map[string]int { - p := map[string]int{} - f.StringToIntVarP(&p, name, shorthand, value, usage) - return &p -} - -// StringToInt defines a string flag with specified name, default value, and usage string. -// The return value is the address of a map[string]int variable that stores the value of the flag. -// The value of each argument will not try to be separated by comma -func StringToInt(name string, value map[string]int, usage string) *map[string]int { - return CommandLine.StringToIntP(name, "", value, usage) -} - -// StringToIntP is like StringToInt, but accepts a shorthand letter that can be used after a single dash. -func StringToIntP(name, shorthand string, value map[string]int, usage string) *map[string]int { - return CommandLine.StringToIntP(name, shorthand, value, usage) -} diff --git a/vendor/github.com/spf13/pflag/string_to_string.go b/vendor/github.com/spf13/pflag/string_to_string.go deleted file mode 100644 index 890a01afc0..0000000000 --- a/vendor/github.com/spf13/pflag/string_to_string.go +++ /dev/null @@ -1,160 +0,0 @@ -package pflag - -import ( - "bytes" - "encoding/csv" - "fmt" - "strings" -) - -// -- stringToString Value -type stringToStringValue struct { - value *map[string]string - changed bool -} - -func newStringToStringValue(val map[string]string, p *map[string]string) *stringToStringValue { - ssv := new(stringToStringValue) - ssv.value = p - *ssv.value = val - return ssv -} - -// Format: a=1,b=2 -func (s *stringToStringValue) Set(val string) error { - var ss []string - n := strings.Count(val, "=") - switch n { - case 0: - return fmt.Errorf("%s must be formatted as key=value", val) - case 1: - ss = append(ss, strings.Trim(val, `"`)) - default: - r := csv.NewReader(strings.NewReader(val)) - var err error - ss, err = r.Read() - if err != nil { - return err - } - } - - out := make(map[string]string, len(ss)) - for _, pair := range ss { - kv := strings.SplitN(pair, "=", 2) - if len(kv) != 2 { - return fmt.Errorf("%s must be formatted as key=value", pair) - } - out[kv[0]] = kv[1] - } - if !s.changed { - *s.value = out - } else { - for k, v := range out { - (*s.value)[k] = v - } - } - s.changed = true - return nil -} - -func (s *stringToStringValue) Type() string { - return "stringToString" -} - -func (s *stringToStringValue) String() string { - records := make([]string, 0, len(*s.value)>>1) - for k, v := range *s.value { - records = append(records, k+"="+v) - } - - var buf bytes.Buffer - w := csv.NewWriter(&buf) - if err := w.Write(records); err != nil { - panic(err) - } - w.Flush() - return "[" + strings.TrimSpace(buf.String()) + "]" -} - -func stringToStringConv(val string) (interface{}, error) { - val = strings.Trim(val, "[]") - // An empty string would cause an empty map - if len(val) == 0 { - return map[string]string{}, nil - } - r := csv.NewReader(strings.NewReader(val)) - ss, err := r.Read() - if err != nil { - return nil, err - } - out := make(map[string]string, len(ss)) - for _, pair := range ss { - kv := strings.SplitN(pair, "=", 2) - if len(kv) != 2 { - return nil, fmt.Errorf("%s must be formatted as key=value", pair) - } - out[kv[0]] = kv[1] - } - return out, nil -} - -// GetStringToString return the map[string]string value of a flag with the given name -func (f *FlagSet) GetStringToString(name string) (map[string]string, error) { - val, err := f.getFlagType(name, "stringToString", stringToStringConv) - if err != nil { - return map[string]string{}, err - } - return val.(map[string]string), nil -} - -// StringToStringVar defines a string flag with specified name, default value, and usage string. -// The argument p points to a map[string]string variable in which to store the values of the multiple flags. -// The value of each argument will not try to be separated by comma -func (f *FlagSet) StringToStringVar(p *map[string]string, name string, value map[string]string, usage string) { - f.VarP(newStringToStringValue(value, p), name, "", usage) -} - -// StringToStringVarP is like StringToStringVar, but accepts a shorthand letter that can be used after a single dash. -func (f *FlagSet) StringToStringVarP(p *map[string]string, name, shorthand string, value map[string]string, usage string) { - f.VarP(newStringToStringValue(value, p), name, shorthand, usage) -} - -// StringToStringVar defines a string flag with specified name, default value, and usage string. -// The argument p points to a map[string]string variable in which to store the value of the flag. -// The value of each argument will not try to be separated by comma -func StringToStringVar(p *map[string]string, name string, value map[string]string, usage string) { - CommandLine.VarP(newStringToStringValue(value, p), name, "", usage) -} - -// StringToStringVarP is like StringToStringVar, but accepts a shorthand letter that can be used after a single dash. -func StringToStringVarP(p *map[string]string, name, shorthand string, value map[string]string, usage string) { - CommandLine.VarP(newStringToStringValue(value, p), name, shorthand, usage) -} - -// StringToString defines a string flag with specified name, default value, and usage string. -// The return value is the address of a map[string]string variable that stores the value of the flag. -// The value of each argument will not try to be separated by comma -func (f *FlagSet) StringToString(name string, value map[string]string, usage string) *map[string]string { - p := map[string]string{} - f.StringToStringVarP(&p, name, "", value, usage) - return &p -} - -// StringToStringP is like StringToString, but accepts a shorthand letter that can be used after a single dash. -func (f *FlagSet) StringToStringP(name, shorthand string, value map[string]string, usage string) *map[string]string { - p := map[string]string{} - f.StringToStringVarP(&p, name, shorthand, value, usage) - return &p -} - -// StringToString defines a string flag with specified name, default value, and usage string. -// The return value is the address of a map[string]string variable that stores the value of the flag. -// The value of each argument will not try to be separated by comma -func StringToString(name string, value map[string]string, usage string) *map[string]string { - return CommandLine.StringToStringP(name, "", value, usage) -} - -// StringToStringP is like StringToString, but accepts a shorthand letter that can be used after a single dash. -func StringToStringP(name, shorthand string, value map[string]string, usage string) *map[string]string { - return CommandLine.StringToStringP(name, shorthand, value, usage) -} diff --git a/vendor/github.com/tencentcloud/tencentcloud-sdk-go/LICENSE b/vendor/github.com/tencentcloud/tencentcloud-sdk-go/LICENSE new file mode 100644 index 0000000000..efc75a2253 --- /dev/null +++ b/vendor/github.com/tencentcloud/tencentcloud-sdk-go/LICENSE @@ -0,0 +1,201 @@ + 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 (c) 2017-2018 Tencent Ltd. + + 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/tencentcloud/tencentcloud-sdk-go/tencentcloud/common/client.go b/vendor/github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/common/client.go new file mode 100644 index 0000000000..78f3ce7c72 --- /dev/null +++ b/vendor/github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/common/client.go @@ -0,0 +1,88 @@ +package common + +import ( + "log" + "net/http" + "time" + + tchttp "github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/common/http" + "github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/common/profile" +) + +type Client struct { + region string + httpClient *http.Client + httpProfile *profile.HttpProfile + credential *Credential + signMethod string + debug bool +} + +func (c *Client) Send(request tchttp.Request, response tchttp.Response) (err error) { + if request.GetDomain() == "" { + domain := c.httpProfile.Endpoint + if domain == "" { + domain = tchttp.GetServiceDomain(request.GetService()) + } + request.SetDomain(domain) + } + err = tchttp.ConstructParams(request) + if err != nil { + return + } + tchttp.CompleteCommonParams(request, c.GetRegion()) + err = signRequest(request, c.credential, c.signMethod) + if err != nil { + return + } + httpRequest, err := http.NewRequest(request.GetHttpMethod(), request.GetUrl(), request.GetBodyReader()) + if err != nil { + return + } + if request.GetHttpMethod() == "POST" { + httpRequest.Header["Content-Type"] = []string{"application/x-www-form-urlencoded"} + } + //log.Printf("[DEBUG] http request=%v", httpRequest) + httpResponse, err := c.httpClient.Do(httpRequest) + if err != nil { + return err + } + err = tchttp.ParseFromHttpResponse(httpResponse, response) + return +} + +func (c *Client) GetRegion() string { + return c.region +} + +func (c *Client) Init(region string) *Client { + c.httpClient = &http.Client{} + c.region = region + c.signMethod = "HmacSHA256" + c.debug = false + log.SetFlags(log.LstdFlags | log.Lshortfile) + return c +} + +func (c *Client) WithSecretId(secretId, secretKey string) *Client { + c.credential = NewCredential(secretId, secretKey) + return c +} + +func (c *Client) WithProfile(clientProfile *profile.ClientProfile) *Client { + c.signMethod = clientProfile.SignMethod + c.httpProfile = clientProfile.HttpProfile + c.httpClient.Timeout = time.Duration(c.httpProfile.ReqTimeout) * time.Second + return c +} + +func (c *Client) WithSignatureMethod(method string) *Client { + c.signMethod = method + return c +} + +func NewClientWithSecretId(secretId, secretKey, region string) (client *Client, err error) { + client = &Client{} + client.Init(region).WithSecretId(secretId, secretKey) + return +} diff --git a/vendor/github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/common/credentials.go b/vendor/github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/common/credentials.go new file mode 100644 index 0000000000..19f0722de8 --- /dev/null +++ b/vendor/github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/common/credentials.go @@ -0,0 +1,40 @@ +package common + +type Credential struct { + SecretId string + SecretKey string +} + +func NewCredential(secretId, secretKey string) *Credential { + return &Credential{ + SecretId: secretId, + SecretKey: secretKey, + } +} + +func (c *Credential) GetCredentialParams() map[string]string { + return map[string]string{ + "SecretId": c.SecretId, + } +} + +type TokenCredential struct { + SecretId string + SecretKey string + Token string +} + +func NewTokenCredential(secretId, secretKey, token string) *TokenCredential { + return &TokenCredential{ + SecretId: secretId, + SecretKey: secretKey, + Token: token, + } +} + +func (c *TokenCredential) GetCredentialParams() map[string]string { + return map[string]string{ + "SecretId": c.SecretId, + "Token": c.Token, + } +} diff --git a/vendor/github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/common/errors/errors.go b/vendor/github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/common/errors/errors.go new file mode 100644 index 0000000000..27589e59a1 --- /dev/null +++ b/vendor/github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/common/errors/errors.go @@ -0,0 +1,35 @@ +package errors + +import ( + "fmt" +) + +type TencentCloudSDKError struct { + Code string + Message string + RequestId string +} + +func (e *TencentCloudSDKError) Error() string { + return fmt.Sprintf("[TencentCloudSDKError] Code=%s, Message=%s, RequestId=%s", e.Code, e.Message, e.RequestId) +} + +func NewTencentCloudSDKError(code, message, requestId string) error { + return &TencentCloudSDKError{ + Code: code, + Message: message, + RequestId: requestId, + } +} + +func (e *TencentCloudSDKError) GetCode() string { + return e.Code +} + +func (e *TencentCloudSDKError) GetMessage() string { + return e.Message +} + +func (e *TencentCloudSDKError) GetRequestId() string { + return e.RequestId +} diff --git a/vendor/github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/common/http/request.go b/vendor/github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/common/http/request.go new file mode 100644 index 0000000000..c7a068556a --- /dev/null +++ b/vendor/github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/common/http/request.go @@ -0,0 +1,231 @@ +package common + +import ( + "io" + //"log" + "math/rand" + "net/url" + "reflect" + "strconv" + "strings" + "time" +) + +const ( + POST = "POST" + GET = "GET" + + RootDomain = "tencentcloudapi.com" + Path = "/" +) + +type Request interface { + GetAction() string + GetBodyReader() io.Reader + GetDomain() string + GetHttpMethod() string + GetParams() map[string]string + GetPath() string + GetService() string + GetUrl() string + GetVersion() string + SetDomain(string) + SetHttpMethod(string) +} + +type BaseRequest struct { + httpMethod string + domain string + path string + params map[string]string + formParams map[string]string + + service string + version string + action string +} + +func (r *BaseRequest) GetAction() string { + return r.action +} + +func (r *BaseRequest) GetHttpMethod() string { + return r.httpMethod +} + +func (r *BaseRequest) GetParams() map[string]string { + return r.params +} + +func (r *BaseRequest) GetPath() string { + return r.path +} + +func (r *BaseRequest) GetDomain() string { + return r.domain +} + +func (r *BaseRequest) SetDomain(domain string) { + r.domain = domain +} + +func (r *BaseRequest) SetHttpMethod(method string) { + switch strings.ToUpper(method) { + case POST: + { + r.httpMethod = POST + } + case GET: + { + r.httpMethod = GET + } + default: + { + r.httpMethod = GET + } + } +} + +func (r *BaseRequest) GetService() string { + return r.service +} + +func (r *BaseRequest) GetUrl() string { + if r.httpMethod == GET { + return "https://" + r.domain + r.path + "?" + getUrlQueriesEncoded(r.params) + } else if r.httpMethod == POST { + return "https://" + r.domain + r.path + } else { + return "" + } +} + +func (r *BaseRequest) GetVersion() string { + return r.version +} + +func getUrlQueriesEncoded(params map[string]string) string { + values := url.Values{} + for key, value := range params { + if value != "" { + values.Add(key, value) + } + } + return values.Encode() +} + +func (r *BaseRequest) GetBodyReader() io.Reader { + if r.httpMethod == POST { + s := getUrlQueriesEncoded(r.params) + //log.Printf("[DEBUG] body: %s", s) + return strings.NewReader(s) + } else { + return strings.NewReader("") + } +} + +func (r *BaseRequest) Init() *BaseRequest { + r.httpMethod = GET + r.domain = "" + r.path = Path + r.params = make(map[string]string) + r.formParams = make(map[string]string) + return r +} + +func (r *BaseRequest) WithApiInfo(service, version, action string) *BaseRequest { + r.service = service + r.version = version + r.action = action + return r +} + +func GetServiceDomain(service string) (domain string) { + domain = service + "." + RootDomain + return +} + +func CompleteCommonParams(request Request, region string) { + params := request.GetParams() + params["Region"] = region + if request.GetVersion() != "" { + params["Version"] = request.GetVersion() + } + params["Action"] = request.GetAction() + params["Timestamp"] = strconv.FormatInt(time.Now().Unix(), 10) + params["Nonce"] = strconv.Itoa(rand.Int()) + params["RequestClient"] = "SDK_GO_3.0.28" +} + +func ConstructParams(req Request) (err error) { + value := reflect.ValueOf(req).Elem() + err = flatStructure(value, req, "") + //log.Printf("[DEBUG] params=%s", req.GetParams()) + return +} + +func flatStructure(value reflect.Value, request Request, prefix string) (err error) { + //log.Printf("[DEBUG] reflect value: %v", value.Type()) + valueType := value.Type() + for i := 0; i < valueType.NumField(); i++ { + tag := valueType.Field(i).Tag + nameTag, hasNameTag := tag.Lookup("name") + if !hasNameTag { + continue + } + field := value.Field(i) + kind := field.Kind() + if kind == reflect.Ptr && field.IsNil() { + continue + } + if kind == reflect.Ptr { + field = field.Elem() + kind = field.Kind() + } + key := prefix + nameTag + if kind == reflect.String { + s := field.String() + if s != "" { + request.GetParams()[key] = s + } + } else if kind == reflect.Bool { + request.GetParams()[key] = strconv.FormatBool(field.Bool()) + } else if kind == reflect.Int || kind == reflect.Int64 { + request.GetParams()[key] = strconv.FormatInt(field.Int(), 10) + } else if kind == reflect.Uint || kind == reflect.Uint64 { + request.GetParams()[key] = strconv.FormatUint(field.Uint(), 10) + } else if kind == reflect.Float64 { + request.GetParams()[key] = strconv.FormatFloat(field.Float(), 'f', -1, 64) + } else if kind == reflect.Slice { + list := value.Field(i) + for j := 0; j < list.Len(); j++ { + vj := list.Index(j) + key := prefix + nameTag + "." + strconv.Itoa(j) + kind = vj.Kind() + if kind == reflect.Ptr && vj.IsNil() { + continue + } + if kind == reflect.Ptr { + vj = vj.Elem() + kind = vj.Kind() + } + if kind == reflect.String { + request.GetParams()[key] = vj.String() + } else if kind == reflect.Bool { + request.GetParams()[key] = strconv.FormatBool(vj.Bool()) + } else if kind == reflect.Int || kind == reflect.Int64 { + request.GetParams()[key] = strconv.FormatInt(vj.Int(), 10) + } else if kind == reflect.Uint || kind == reflect.Uint64 { + request.GetParams()[key] = strconv.FormatUint(vj.Uint(), 10) + } else if kind == reflect.Float64 { + request.GetParams()[key] = strconv.FormatFloat(vj.Float(), 'f', -1, 64) + } else { + flatStructure(vj, request, key+".") + } + } + } else { + flatStructure(reflect.ValueOf(field.Interface()), request, prefix+nameTag+".") + } + } + return +} diff --git a/vendor/github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/common/http/response.go b/vendor/github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/common/http/response.go new file mode 100644 index 0000000000..100fca1102 --- /dev/null +++ b/vendor/github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/common/http/response.go @@ -0,0 +1,69 @@ +package common + +import ( + "encoding/json" + "io/ioutil" + // "log" + "net/http" + + "github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/common/errors" +) + +type Response interface { + ParseErrorFromHTTPResponse(body []byte) error +} + +type BaseResponse struct { +} + +type ErrorResponse struct { + Response struct { + Error struct { + Code string `json:"Code"` + Message string `json:"Message"` + } `json:"Error" omitempty` + RequestId string `json:"RequestId"` + } `json:"Response"` +} + +type DeprecatedAPIErrorResponse struct { + Code int `json:"code"` + Message string `json:"message"` + CodeDesc string `json:"codeDesc"` +} + +func (r *BaseResponse) ParseErrorFromHTTPResponse(body []byte) (err error) { + resp := &ErrorResponse{} + err = json.Unmarshal(body, resp) + if err != nil { + return + } + if resp.Response.Error.Code != "" { + return errors.NewTencentCloudSDKError(resp.Response.Error.Code, resp.Response.Error.Message, resp.Response.RequestId) + } + + deprecated := &DeprecatedAPIErrorResponse{} + err = json.Unmarshal(body, deprecated) + if err != nil { + return + } + if deprecated.Code != 0 { + return errors.NewTencentCloudSDKError(deprecated.CodeDesc, deprecated.Message, "") + } + return nil +} + +func ParseFromHttpResponse(hr *http.Response, response Response) (err error) { + defer hr.Body.Close() + body, err := ioutil.ReadAll(hr.Body) + if err != nil { + return + } + //log.Printf("[DEBUG] Response Body=%s", body) + err = response.ParseErrorFromHTTPResponse(body) + if err != nil { + return + } + err = json.Unmarshal(body, &response) + return +} diff --git a/vendor/github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/common/profile/client_profile.go b/vendor/github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/common/profile/client_profile.go new file mode 100644 index 0000000000..94c63b2f03 --- /dev/null +++ b/vendor/github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/common/profile/client_profile.go @@ -0,0 +1,13 @@ +package profile + +type ClientProfile struct { + HttpProfile *HttpProfile + SignMethod string +} + +func NewClientProfile() *ClientProfile { + return &ClientProfile{ + HttpProfile: NewHttpProfile(), + SignMethod: "HmacSHA256", + } +} diff --git a/vendor/github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/common/profile/http_profile.go b/vendor/github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/common/profile/http_profile.go new file mode 100644 index 0000000000..8d4bf8f57b --- /dev/null +++ b/vendor/github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/common/profile/http_profile.go @@ -0,0 +1,17 @@ +package profile + +type HttpProfile struct { + ReqMethod string + ReqTimeout int + Endpoint string + Protocol string +} + +func NewHttpProfile() *HttpProfile { + return &HttpProfile{ + ReqMethod: "POST", + ReqTimeout: 60, + Endpoint: "", + Protocol: "HTTPS", + } +} diff --git a/vendor/github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/common/sign.go b/vendor/github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/common/sign.go new file mode 100644 index 0000000000..450fe2ccde --- /dev/null +++ b/vendor/github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/common/sign.go @@ -0,0 +1,75 @@ +package common + +import ( + "crypto/hmac" + "crypto/sha1" + "crypto/sha256" + "encoding/base64" + "fmt" + "sort" + "strings" + + tchttp "github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/common/http" +) + +const ( + SHA256 = "HmacSHA256" + SHA1 = "HmacSHA1" +) + +func Sign(s, secretKey, method string) string { + hashed := hmac.New(sha1.New, []byte(secretKey)) + if method == SHA256 { + hashed = hmac.New(sha256.New, []byte(secretKey)) + } + hashed.Write([]byte(s)) + + return base64.StdEncoding.EncodeToString(hashed.Sum(nil)) +} + +func signRequest(request tchttp.Request, credential *Credential, method string) (err error) { + if method != SHA256 { + method = SHA1 + } + checkAuthParams(request, credential, method) + s := getStringToSign(request) + signature := Sign(s, credential.SecretKey, method) + request.GetParams()["Signature"] = signature + return +} + +func checkAuthParams(request tchttp.Request, credential *Credential, method string) { + params := request.GetParams() + credentialParams := credential.GetCredentialParams() + for key, value := range credentialParams { + params[key] = value + } + params["SignatureMethod"] = method + delete(params, "Signature") +} + +func getStringToSign(request tchttp.Request) string { + method := request.GetHttpMethod() + domain := request.GetDomain() + path := request.GetPath() + + text := method + domain + path + "?" + + params := request.GetParams() + // sort params + keys := make([]string, 0, len(params)) + for k, _ := range params { + keys = append(keys, k) + } + sort.Strings(keys) + + for i := range keys { + k := keys[i] + if params[k] == "" { + continue + } + text += fmt.Sprintf("%v=%v&", strings.Replace(k, "_", ".", -1), params[k]) + } + text = text[:len(text)-1] + return text +} diff --git a/vendor/github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/common/types.go b/vendor/github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/common/types.go new file mode 100644 index 0000000000..ec2c786dbf --- /dev/null +++ b/vendor/github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/common/types.go @@ -0,0 +1,47 @@ +package common + +func IntPtr(v int) *int { + return &v +} + +func Int64Ptr(v int64) *int64 { + return &v +} + +func UintPtr(v uint) *uint { + return &v +} + +func Uint64Ptr(v uint64) *uint64 { + return &v +} + +func Float64Ptr(v float64) *float64 { + return &v +} + +func StringPtr(v string) *string { + return &v +} + +func StringValues(ptrs []*string) []string { + values := make([]string, len(ptrs)) + for i := 0; i < len(ptrs); i++ { + if ptrs[i] != nil { + values[i] = *ptrs[i] + } + } + return values +} + +func StringPtrs(vals []string) []*string { + ptrs := make([]*string, len(vals)) + for i := 0; i < len(vals); i++ { + ptrs[i] = &vals[i] + } + return ptrs +} + +func BoolPtr(v bool) *bool { + return &v +} diff --git a/vendor/github.com/vmware/govmomi/.mailmap b/vendor/github.com/vmware/govmomi/.mailmap index d3fcbc5bfe..704c5b736c 100644 --- a/vendor/github.com/vmware/govmomi/.mailmap +++ b/vendor/github.com/vmware/govmomi/.mailmap @@ -19,6 +19,3 @@ Anfernee Yongkun Gui Anfernee Yongkun Gui Yongkun Anfernee Gui Zach Tucker Zee Yang -Jiatong Wang jiatongw -Uwe Bessle Uwe Bessle -Uwe Bessle Uwe Bessle diff --git a/vendor/github.com/vmware/govmomi/CHANGELOG.md b/vendor/github.com/vmware/govmomi/CHANGELOG.md index aef1957569..c8afb958f4 100644 --- a/vendor/github.com/vmware/govmomi/CHANGELOG.md +++ b/vendor/github.com/vmware/govmomi/CHANGELOG.md @@ -1,12 +1,6 @@ # changelog -### 0.19.0 (2018-09-30) - -* New vapi/rest and and vapi/tags packages - -* Allowing the use of STS for exchanging tokens - -* Add object.VirtualMachine.UUID method +### unreleased * SetRootCAs on the soap.Client returns an error for invalid certificates diff --git a/vendor/github.com/vmware/govmomi/CONTRIBUTORS b/vendor/github.com/vmware/govmomi/CONTRIBUTORS index d2a9a7aaa9..1fd37b609d 100644 --- a/vendor/github.com/vmware/govmomi/CONTRIBUTORS +++ b/vendor/github.com/vmware/govmomi/CONTRIBUTORS @@ -29,7 +29,6 @@ Cédric Blomart Chris Marchesi Christian Höltje Clint Greenwood -CuiHaozhi Danny Lockard Dave Tucker Davide Agnello @@ -43,7 +42,6 @@ Erik Hollensbe Fabio Rapposelli Faiyaz Ahmed forkbomber -freebsdly Gavin Gray Gavrie Philipson George Hicken @@ -56,27 +54,17 @@ Ivan Porto Carrero Jason Kincl Jeremy Canady jeremy-clerc -Jiatong Wang João Pereira Jorge Sevilla -kayrus -Kevin George leslie-qiwa Louie Jiang Marc Carmier -Maria Ntalla -Marin Atanasov Nikolov Matthew Cosgrove -Matt Moriarity Mevan Samaratunga -Michal Jankowski -mingwei Nicolas Lamirault Omar Kohl Parham Alvani Pieter Noordhuis -prydin -Rowan Jacobs runner.mei S.Çağlar Onur Sergey Ignatov @@ -86,7 +74,6 @@ tanishi Ted Zlatanov Thibaut Ackermann Trevor Dawe -Uwe Bessle Vadim Egorov Volodymyr Bobyr Witold Krecicki diff --git a/vendor/github.com/vmware/govmomi/README.md b/vendor/github.com/vmware/govmomi/README.md index da5d426ea2..5cd8c5adf6 100644 --- a/vendor/github.com/vmware/govmomi/README.md +++ b/vendor/github.com/vmware/govmomi/README.md @@ -75,8 +75,6 @@ Refer to the [CHANGELOG](CHANGELOG.md) for version to version changes. * [Libretto](https://github.com/apcera/libretto/tree/master/virtualmachine/vsphere) -* [Telegraf](https://github.com/influxdata/telegraf/tree/master/plugins/inputs/vsphere) - ## Related projects * [rbvmomi](https://github.com/vmware/rbvmomi) diff --git a/vendor/github.com/vmware/govmomi/session/keep_alive.go b/vendor/github.com/vmware/govmomi/session/keep_alive.go index 3b44f5ffb6..a9d4c141c9 100644 --- a/vendor/github.com/vmware/govmomi/session/keep_alive.go +++ b/vendor/github.com/vmware/govmomi/session/keep_alive.go @@ -114,9 +114,10 @@ func (k *keepAlive) RoundTrip(ctx context.Context, req, res soap.HasFault) error if err != nil { return err } + // Start ticker on login, stop ticker on logout. switch req.(type) { - case *methods.LoginBody, *methods.LoginExtensionByCertificateBody, *methods.LoginByTokenBody: + case *methods.LoginBody, *methods.LoginExtensionByCertificateBody: k.start() case *methods.LogoutBody: k.stop() diff --git a/vendor/golang.org/x/crypto/ssh/server.go b/vendor/golang.org/x/crypto/ssh/server.go index 122c03e70a..d0f4825319 100644 --- a/vendor/golang.org/x/crypto/ssh/server.go +++ b/vendor/golang.org/x/crypto/ssh/server.go @@ -404,7 +404,7 @@ userAuthLoop: perms, authErr = config.PasswordCallback(s, password) case "keyboard-interactive": if config.KeyboardInteractiveCallback == nil { - authErr = errors.New("ssh: keyboard-interactive auth not configured") + authErr = errors.New("ssh: keyboard-interactive auth not configubred") break } diff --git a/vendor/golang.org/x/net/bpf/constants.go b/vendor/golang.org/x/net/bpf/constants.go index 12f3ee835a..b89ca35239 100644 --- a/vendor/golang.org/x/net/bpf/constants.go +++ b/vendor/golang.org/x/net/bpf/constants.go @@ -38,7 +38,6 @@ const ( type JumpTest uint16 // Supported operators for conditional jumps. -// K can be RegX for JumpIfX const ( // K == A JumpEqual JumpTest = iota @@ -135,9 +134,12 @@ const ( opMaskLoadDest = 0x01 opMaskLoadWidth = 0x18 opMaskLoadMode = 0xe0 - // opClsALU & opClsJump - opMaskOperand = 0x08 - opMaskOperator = 0xf0 + // opClsALU + opMaskOperandSrc = 0x08 + opMaskOperator = 0xf0 + // opClsJump + opMaskJumpConst = 0x0f + opMaskJumpCond = 0xf0 ) const ( @@ -190,21 +192,15 @@ const ( opLoadWidth1 ) -// Operand for ALU and Jump instructions -type opOperand uint16 +// Operator defined by ALUOp* -// Supported operand sources. const ( - opOperandConstant opOperand = iota << 3 - opOperandX + opALUSrcConstant uint16 = iota << 3 + opALUSrcX ) -// An jumpOp is a conditional jump condition. -type jumpOp uint16 - -// Supported jump conditions. const ( - opJumpAlways jumpOp = iota << 4 + opJumpAlways = iota << 4 opJumpEqual opJumpGT opJumpGE diff --git a/vendor/golang.org/x/net/bpf/instructions.go b/vendor/golang.org/x/net/bpf/instructions.go index 3cffcaa014..f9dc0e8ee7 100644 --- a/vendor/golang.org/x/net/bpf/instructions.go +++ b/vendor/golang.org/x/net/bpf/instructions.go @@ -89,14 +89,10 @@ func (ri RawInstruction) Disassemble() Instruction { case opClsALU: switch op := ALUOp(ri.Op & opMaskOperator); op { case ALUOpAdd, ALUOpSub, ALUOpMul, ALUOpDiv, ALUOpOr, ALUOpAnd, ALUOpShiftLeft, ALUOpShiftRight, ALUOpMod, ALUOpXor: - switch operand := opOperand(ri.Op & opMaskOperand); operand { - case opOperandX: + if ri.Op&opMaskOperandSrc != 0 { return ALUOpX{Op: op} - case opOperandConstant: - return ALUOpConstant{Op: op, Val: ri.K} - default: - return ri } + return ALUOpConstant{Op: op, Val: ri.K} case aluOpNeg: return NegateA{} default: @@ -104,18 +100,63 @@ func (ri RawInstruction) Disassemble() Instruction { } case opClsJump: - switch op := jumpOp(ri.Op & opMaskOperator); op { + if ri.Op&opMaskJumpConst != opClsJump { + return ri + } + switch ri.Op & opMaskJumpCond { case opJumpAlways: return Jump{Skip: ri.K} - case opJumpEqual, opJumpGT, opJumpGE, opJumpSet: - cond, skipTrue, skipFalse := jumpOpToTest(op, ri.Jt, ri.Jf) - switch operand := opOperand(ri.Op & opMaskOperand); operand { - case opOperandX: - return JumpIfX{Cond: cond, SkipTrue: skipTrue, SkipFalse: skipFalse} - case opOperandConstant: - return JumpIf{Cond: cond, Val: ri.K, SkipTrue: skipTrue, SkipFalse: skipFalse} - default: - return ri + case opJumpEqual: + if ri.Jt == 0 { + return JumpIf{ + Cond: JumpNotEqual, + Val: ri.K, + SkipTrue: ri.Jf, + SkipFalse: 0, + } + } + return JumpIf{ + Cond: JumpEqual, + Val: ri.K, + SkipTrue: ri.Jt, + SkipFalse: ri.Jf, + } + case opJumpGT: + if ri.Jt == 0 { + return JumpIf{ + Cond: JumpLessOrEqual, + Val: ri.K, + SkipTrue: ri.Jf, + SkipFalse: 0, + } + } + return JumpIf{ + Cond: JumpGreaterThan, + Val: ri.K, + SkipTrue: ri.Jt, + SkipFalse: ri.Jf, + } + case opJumpGE: + if ri.Jt == 0 { + return JumpIf{ + Cond: JumpLessThan, + Val: ri.K, + SkipTrue: ri.Jf, + SkipFalse: 0, + } + } + return JumpIf{ + Cond: JumpGreaterOrEqual, + Val: ri.K, + SkipTrue: ri.Jt, + SkipFalse: ri.Jf, + } + case opJumpSet: + return JumpIf{ + Cond: JumpBitsSet, + Val: ri.K, + SkipTrue: ri.Jt, + SkipFalse: ri.Jf, } default: return ri @@ -146,41 +187,6 @@ func (ri RawInstruction) Disassemble() Instruction { } } -func jumpOpToTest(op jumpOp, skipTrue uint8, skipFalse uint8) (JumpTest, uint8, uint8) { - var test JumpTest - - // Decode "fake" jump conditions that don't appear in machine code - // Ensures the Assemble -> Disassemble stage recreates the same instructions - // See https://github.com/golang/go/issues/18470 - if skipTrue == 0 { - switch op { - case opJumpEqual: - test = JumpNotEqual - case opJumpGT: - test = JumpLessOrEqual - case opJumpGE: - test = JumpLessThan - case opJumpSet: - test = JumpBitsNotSet - } - - return test, skipFalse, 0 - } - - switch op { - case opJumpEqual: - test = JumpEqual - case opJumpGT: - test = JumpGreaterThan - case opJumpGE: - test = JumpGreaterOrEqual - case opJumpSet: - test = JumpBitsSet - } - - return test, skipTrue, skipFalse -} - // LoadConstant loads Val into register Dst. type LoadConstant struct { Dst Register @@ -407,7 +413,7 @@ type ALUOpConstant struct { // Assemble implements the Instruction Assemble method. func (a ALUOpConstant) Assemble() (RawInstruction, error) { return RawInstruction{ - Op: opClsALU | uint16(opOperandConstant) | uint16(a.Op), + Op: opClsALU | opALUSrcConstant | uint16(a.Op), K: a.Val, }, nil } @@ -448,7 +454,7 @@ type ALUOpX struct { // Assemble implements the Instruction Assemble method. func (a ALUOpX) Assemble() (RawInstruction, error) { return RawInstruction{ - Op: opClsALU | uint16(opOperandX) | uint16(a.Op), + Op: opClsALU | opALUSrcX | uint16(a.Op), }, nil } @@ -503,7 +509,7 @@ type Jump struct { // Assemble implements the Instruction Assemble method. func (a Jump) Assemble() (RawInstruction, error) { return RawInstruction{ - Op: opClsJump | uint16(opJumpAlways), + Op: opClsJump | opJumpAlways, K: a.Skip, }, nil } @@ -524,39 +530,11 @@ type JumpIf struct { // Assemble implements the Instruction Assemble method. func (a JumpIf) Assemble() (RawInstruction, error) { - return jumpToRaw(a.Cond, opOperandConstant, a.Val, a.SkipTrue, a.SkipFalse) -} - -// String returns the instruction in assembler notation. -func (a JumpIf) String() string { - return jumpToString(a.Cond, fmt.Sprintf("#%d", a.Val), a.SkipTrue, a.SkipFalse) -} - -// JumpIfX skips the following Skip instructions in the program if A -// X is true. -type JumpIfX struct { - Cond JumpTest - SkipTrue uint8 - SkipFalse uint8 -} - -// Assemble implements the Instruction Assemble method. -func (a JumpIfX) Assemble() (RawInstruction, error) { - return jumpToRaw(a.Cond, opOperandX, 0, a.SkipTrue, a.SkipFalse) -} - -// String returns the instruction in assembler notation. -func (a JumpIfX) String() string { - return jumpToString(a.Cond, "x", a.SkipTrue, a.SkipFalse) -} - -// jumpToRaw assembles a jump instruction into a RawInstruction -func jumpToRaw(test JumpTest, operand opOperand, k uint32, skipTrue, skipFalse uint8) (RawInstruction, error) { var ( - cond jumpOp + cond uint16 flip bool ) - switch test { + switch a.Cond { case JumpEqual: cond = opJumpEqual case JumpNotEqual: @@ -574,63 +552,63 @@ func jumpToRaw(test JumpTest, operand opOperand, k uint32, skipTrue, skipFalse u case JumpBitsNotSet: cond, flip = opJumpSet, true default: - return RawInstruction{}, fmt.Errorf("unknown JumpTest %v", test) + return RawInstruction{}, fmt.Errorf("unknown JumpTest %v", a.Cond) } - jt, jf := skipTrue, skipFalse + jt, jf := a.SkipTrue, a.SkipFalse if flip { jt, jf = jf, jt } return RawInstruction{ - Op: opClsJump | uint16(cond) | uint16(operand), + Op: opClsJump | cond, Jt: jt, Jf: jf, - K: k, + K: a.Val, }, nil } -// jumpToString converts a jump instruction to assembler notation -func jumpToString(cond JumpTest, operand string, skipTrue, skipFalse uint8) string { - switch cond { +// String returns the instruction in assembler notation. +func (a JumpIf) String() string { + switch a.Cond { // K == A case JumpEqual: - return conditionalJump(operand, skipTrue, skipFalse, "jeq", "jneq") + return conditionalJump(a, "jeq", "jneq") // K != A case JumpNotEqual: - return fmt.Sprintf("jneq %s,%d", operand, skipTrue) + return fmt.Sprintf("jneq #%d,%d", a.Val, a.SkipTrue) // K > A case JumpGreaterThan: - return conditionalJump(operand, skipTrue, skipFalse, "jgt", "jle") + return conditionalJump(a, "jgt", "jle") // K < A case JumpLessThan: - return fmt.Sprintf("jlt %s,%d", operand, skipTrue) + return fmt.Sprintf("jlt #%d,%d", a.Val, a.SkipTrue) // K >= A case JumpGreaterOrEqual: - return conditionalJump(operand, skipTrue, skipFalse, "jge", "jlt") + return conditionalJump(a, "jge", "jlt") // K <= A case JumpLessOrEqual: - return fmt.Sprintf("jle %s,%d", operand, skipTrue) + return fmt.Sprintf("jle #%d,%d", a.Val, a.SkipTrue) // K & A != 0 case JumpBitsSet: - if skipFalse > 0 { - return fmt.Sprintf("jset %s,%d,%d", operand, skipTrue, skipFalse) + if a.SkipFalse > 0 { + return fmt.Sprintf("jset #%d,%d,%d", a.Val, a.SkipTrue, a.SkipFalse) } - return fmt.Sprintf("jset %s,%d", operand, skipTrue) + return fmt.Sprintf("jset #%d,%d", a.Val, a.SkipTrue) // K & A == 0, there is no assembler instruction for JumpBitNotSet, use JumpBitSet and invert skips case JumpBitsNotSet: - return jumpToString(JumpBitsSet, operand, skipFalse, skipTrue) + return JumpIf{Cond: JumpBitsSet, SkipTrue: a.SkipFalse, SkipFalse: a.SkipTrue, Val: a.Val}.String() default: - return fmt.Sprintf("unknown JumpTest %#v", cond) + return fmt.Sprintf("unknown instruction: %#v", a) } } -func conditionalJump(operand string, skipTrue, skipFalse uint8, positiveJump, negativeJump string) string { - if skipTrue > 0 { - if skipFalse > 0 { - return fmt.Sprintf("%s %s,%d,%d", positiveJump, operand, skipTrue, skipFalse) +func conditionalJump(inst JumpIf, positiveJump, negativeJump string) string { + if inst.SkipTrue > 0 { + if inst.SkipFalse > 0 { + return fmt.Sprintf("%s #%d,%d,%d", positiveJump, inst.Val, inst.SkipTrue, inst.SkipFalse) } - return fmt.Sprintf("%s %s,%d", positiveJump, operand, skipTrue) + return fmt.Sprintf("%s #%d,%d", positiveJump, inst.Val, inst.SkipTrue) } - return fmt.Sprintf("%s %s,%d", negativeJump, operand, skipFalse) + return fmt.Sprintf("%s #%d,%d", negativeJump, inst.Val, inst.SkipFalse) } // RetA exits the BPF program, returning the value of register A. diff --git a/vendor/golang.org/x/net/bpf/vm.go b/vendor/golang.org/x/net/bpf/vm.go index 73f57f1f72..4c656f1e12 100644 --- a/vendor/golang.org/x/net/bpf/vm.go +++ b/vendor/golang.org/x/net/bpf/vm.go @@ -35,13 +35,6 @@ func NewVM(filter []Instruction) (*VM, error) { if check <= int(ins.SkipFalse) { return nil, fmt.Errorf("cannot jump %d instructions in false case; jumping past program bounds", ins.SkipFalse) } - case JumpIfX: - if check <= int(ins.SkipTrue) { - return nil, fmt.Errorf("cannot jump %d instructions in true case; jumping past program bounds", ins.SkipTrue) - } - if check <= int(ins.SkipFalse) { - return nil, fmt.Errorf("cannot jump %d instructions in false case; jumping past program bounds", ins.SkipFalse) - } // Check for division or modulus by zero case ALUOpConstant: if ins.Val != 0 { @@ -116,9 +109,6 @@ func (v *VM) Run(in []byte) (int, error) { case JumpIf: jump := jumpIf(ins, regA) i += jump - case JumpIfX: - jump := jumpIfX(ins, regA, regX) - i += jump case LoadAbsolute: regA, ok = loadAbsolute(ins, in) case LoadConstant: diff --git a/vendor/golang.org/x/net/bpf/vm_instructions.go b/vendor/golang.org/x/net/bpf/vm_instructions.go index f0d2e55bdc..516f9462b9 100644 --- a/vendor/golang.org/x/net/bpf/vm_instructions.go +++ b/vendor/golang.org/x/net/bpf/vm_instructions.go @@ -55,41 +55,34 @@ func aluOpCommon(op ALUOp, regA uint32, value uint32) uint32 { } } -func jumpIf(ins JumpIf, regA uint32) int { - return jumpIfCommon(ins.Cond, ins.SkipTrue, ins.SkipFalse, regA, ins.Val) -} - -func jumpIfX(ins JumpIfX, regA uint32, regX uint32) int { - return jumpIfCommon(ins.Cond, ins.SkipTrue, ins.SkipFalse, regA, regX) -} - -func jumpIfCommon(cond JumpTest, skipTrue, skipFalse uint8, regA uint32, value uint32) int { +func jumpIf(ins JumpIf, value uint32) int { var ok bool + inV := uint32(ins.Val) - switch cond { + switch ins.Cond { case JumpEqual: - ok = regA == value + ok = value == inV case JumpNotEqual: - ok = regA != value + ok = value != inV case JumpGreaterThan: - ok = regA > value + ok = value > inV case JumpLessThan: - ok = regA < value + ok = value < inV case JumpGreaterOrEqual: - ok = regA >= value + ok = value >= inV case JumpLessOrEqual: - ok = regA <= value + ok = value <= inV case JumpBitsSet: - ok = (regA & value) != 0 + ok = (value & inV) != 0 case JumpBitsNotSet: - ok = (regA & value) == 0 + ok = (value & inV) == 0 } if ok { - return int(skipTrue) + return int(ins.SkipTrue) } - return int(skipFalse) + return int(ins.SkipFalse) } func loadAbsolute(ins LoadAbsolute, in []byte) (uint32, bool) { diff --git a/vendor/golang.org/x/sys/unix/mkerrors.sh b/vendor/golang.org/x/sys/unix/mkerrors.sh index 7943853ff1..ec8e613226 100755 --- a/vendor/golang.org/x/sys/unix/mkerrors.sh +++ b/vendor/golang.org/x/sys/unix/mkerrors.sh @@ -193,7 +193,6 @@ struct ltchars { #include #include #include -#include #include #include #include @@ -446,7 +445,6 @@ ccflags="$@" $2 ~ /^(MS|MNT|UMOUNT)_/ || $2 ~ /^TUN(SET|GET|ATTACH|DETACH)/ || $2 ~ /^(O|F|E?FD|NAME|S|PTRACE|PT)_/ || - $2 ~ /^KEXEC_/ || $2 ~ /^LINUX_REBOOT_CMD_/ || $2 ~ /^LINUX_REBOOT_MAGIC[12]$/ || $2 !~ "NLA_TYPE_MASK" && diff --git a/vendor/golang.org/x/sys/unix/mksyscall_solaris.pl b/vendor/golang.org/x/sys/unix/mksyscall_solaris.pl index a354df5a6b..3e6ed9df8e 100755 --- a/vendor/golang.org/x/sys/unix/mksyscall_solaris.pl +++ b/vendor/golang.org/x/sys/unix/mksyscall_solaris.pl @@ -92,11 +92,6 @@ while(<>) { my @in = parseparamlist($in); my @out = parseparamlist($out); - # Try in vain to keep people from editing this file. - # The theory is that they jump into the middle of the file - # without reading the header. - $text .= "// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT\n\n"; - # So file name. if($modname eq "") { $modname = "libc"; diff --git a/vendor/golang.org/x/sys/unix/mksysctl_openbsd.pl b/vendor/golang.org/x/sys/unix/mksysctl_openbsd.pl index 20632e1460..49f186f832 100755 --- a/vendor/golang.org/x/sys/unix/mksysctl_openbsd.pl +++ b/vendor/golang.org/x/sys/unix/mksysctl_openbsd.pl @@ -32,7 +32,6 @@ my @headers = qw ( sys/sem.h sys/shm.h sys/vmmeter.h - uvm/uvmexp.h uvm/uvm_param.h uvm/uvm_swap_encrypt.h ddb/db_var.h diff --git a/vendor/golang.org/x/sys/unix/sockcmsg_unix.go b/vendor/golang.org/x/sys/unix/sockcmsg_unix.go index 9dd2f32f50..f153c0673d 100644 --- a/vendor/golang.org/x/sys/unix/sockcmsg_unix.go +++ b/vendor/golang.org/x/sys/unix/sockcmsg_unix.go @@ -12,7 +12,7 @@ import "unsafe" // Round the length of a raw sockaddr up to align it properly. func cmsgAlignOf(salen int) int { - salign := SizeofPtr + salign := sizeofPtr // NOTE: It seems like 64-bit Darwin, DragonFly BSD and // Solaris kernels still require 32-bit aligned access to // network subsystem. diff --git a/vendor/golang.org/x/sys/unix/syscall_linux.go b/vendor/golang.org/x/sys/unix/syscall_linux.go index bfa20a971d..02cf204a12 100644 --- a/vendor/golang.org/x/sys/unix/syscall_linux.go +++ b/vendor/golang.org/x/sys/unix/syscall_linux.go @@ -1122,7 +1122,7 @@ func ptracePeek(req int, pid int, addr uintptr, out []byte) (count int, err erro // The ptrace syscall differs from glibc's ptrace. // Peeks returns the word in *data, not as the return value. - var buf [SizeofPtr]byte + var buf [sizeofPtr]byte // Leading edge. PEEKTEXT/PEEKDATA don't require aligned // access (PEEKUSER warns that it might), but if we don't @@ -1130,12 +1130,12 @@ func ptracePeek(req int, pid int, addr uintptr, out []byte) (count int, err erro // boundary and not get the bytes leading up to the page // boundary. n := 0 - if addr%SizeofPtr != 0 { - err = ptrace(req, pid, addr-addr%SizeofPtr, uintptr(unsafe.Pointer(&buf[0]))) + if addr%sizeofPtr != 0 { + err = ptrace(req, pid, addr-addr%sizeofPtr, uintptr(unsafe.Pointer(&buf[0]))) if err != nil { return 0, err } - n += copy(out, buf[addr%SizeofPtr:]) + n += copy(out, buf[addr%sizeofPtr:]) out = out[n:] } @@ -1173,15 +1173,15 @@ func ptracePoke(pokeReq int, peekReq int, pid int, addr uintptr, data []byte) (c // Leading edge. n := 0 - if addr%SizeofPtr != 0 { - var buf [SizeofPtr]byte - err = ptrace(peekReq, pid, addr-addr%SizeofPtr, uintptr(unsafe.Pointer(&buf[0]))) + if addr%sizeofPtr != 0 { + var buf [sizeofPtr]byte + err = ptrace(peekReq, pid, addr-addr%sizeofPtr, uintptr(unsafe.Pointer(&buf[0]))) if err != nil { return 0, err } - n += copy(buf[addr%SizeofPtr:], data) + n += copy(buf[addr%sizeofPtr:], data) word := *((*uintptr)(unsafe.Pointer(&buf[0]))) - err = ptrace(pokeReq, pid, addr-addr%SizeofPtr, word) + err = ptrace(pokeReq, pid, addr-addr%sizeofPtr, word) if err != nil { return 0, err } @@ -1189,19 +1189,19 @@ func ptracePoke(pokeReq int, peekReq int, pid int, addr uintptr, data []byte) (c } // Interior. - for len(data) > SizeofPtr { + for len(data) > sizeofPtr { word := *((*uintptr)(unsafe.Pointer(&data[0]))) err = ptrace(pokeReq, pid, addr+uintptr(n), word) if err != nil { return n, err } - n += SizeofPtr - data = data[SizeofPtr:] + n += sizeofPtr + data = data[sizeofPtr:] } // Trailing edge. if len(data) > 0 { - var buf [SizeofPtr]byte + var buf [sizeofPtr]byte err = ptrace(peekReq, pid, addr+uintptr(n), uintptr(unsafe.Pointer(&buf[0]))) if err != nil { return n, err diff --git a/vendor/golang.org/x/sys/unix/syscall_linux_amd64.go b/vendor/golang.org/x/sys/unix/syscall_linux_amd64.go index 5247d9f908..5f9b2454ad 100644 --- a/vendor/golang.org/x/sys/unix/syscall_linux_amd64.go +++ b/vendor/golang.org/x/sys/unix/syscall_linux_amd64.go @@ -160,16 +160,3 @@ func Poll(fds []PollFd, timeout int) (n int, err error) { } return poll(&fds[0], len(fds), timeout) } - -//sys kexecFileLoad(kernelFd int, initrdFd int, cmdlineLen int, cmdline string, flags int) (err error) - -func KexecFileLoad(kernelFd int, initrdFd int, cmdline string, flags int) error { - cmdlineLen := len(cmdline) - if cmdlineLen > 0 { - // Account for the additional NULL byte added by - // BytePtrFromString in kexecFileLoad. The kexec_file_load - // syscall expects a NULL-terminated string. - cmdlineLen++ - } - return kexecFileLoad(kernelFd, initrdFd, cmdlineLen, cmdline, flags) -} diff --git a/vendor/golang.org/x/sys/unix/syscall_linux_ppc64x.go b/vendor/golang.org/x/sys/unix/syscall_linux_ppc64x.go index 41451854bc..6a38dfd5b1 100644 --- a/vendor/golang.org/x/sys/unix/syscall_linux_ppc64x.go +++ b/vendor/golang.org/x/sys/unix/syscall_linux_ppc64x.go @@ -136,16 +136,3 @@ func SyncFileRange(fd int, off int64, n int64, flags int) error { // order of their arguments. return syncFileRange2(fd, flags, off, n) } - -//sys kexecFileLoad(kernelFd int, initrdFd int, cmdlineLen int, cmdline string, flags int) (err error) - -func KexecFileLoad(kernelFd int, initrdFd int, cmdline string, flags int) error { - cmdlineLen := len(cmdline) - if cmdlineLen > 0 { - // Account for the additional NULL byte added by - // BytePtrFromString in kexecFileLoad. The kexec_file_load - // syscall expects a NULL-terminated string. - cmdlineLen++ - } - return kexecFileLoad(kernelFd, initrdFd, cmdlineLen, cmdline, flags) -} diff --git a/vendor/golang.org/x/sys/unix/syscall_linux_s390x.go b/vendor/golang.org/x/sys/unix/syscall_linux_s390x.go index f52f148f9f..6e4ee0cf2a 100644 --- a/vendor/golang.org/x/sys/unix/syscall_linux_s390x.go +++ b/vendor/golang.org/x/sys/unix/syscall_linux_s390x.go @@ -322,16 +322,3 @@ func Poll(fds []PollFd, timeout int) (n int, err error) { } return poll(&fds[0], len(fds), timeout) } - -//sys kexecFileLoad(kernelFd int, initrdFd int, cmdlineLen int, cmdline string, flags int) (err error) - -func KexecFileLoad(kernelFd int, initrdFd int, cmdline string, flags int) error { - cmdlineLen := len(cmdline) - if cmdlineLen > 0 { - // Account for the additional NULL byte added by - // BytePtrFromString in kexecFileLoad. The kexec_file_load - // syscall expects a NULL-terminated string. - cmdlineLen++ - } - return kexecFileLoad(kernelFd, initrdFd, cmdlineLen, cmdline, flags) -} diff --git a/vendor/golang.org/x/sys/unix/syscall_netbsd.go b/vendor/golang.org/x/sys/unix/syscall_netbsd.go index 206ce2af80..639bcdef74 100644 --- a/vendor/golang.org/x/sys/unix/syscall_netbsd.go +++ b/vendor/golang.org/x/sys/unix/syscall_netbsd.go @@ -100,14 +100,14 @@ func SysctlClockinfo(name string) (*Clockinfo, error) { } n := uintptr(SizeofClockinfo) - var ci Clockinfo - if err := sysctl(mib, (*byte)(unsafe.Pointer(&ci)), &n, nil, 0); err != nil { + buf := make([]byte, SizeofClockinfo) + if err := sysctl(mib, &buf[0], &n, nil, 0); err != nil { return nil, err } if n != SizeofClockinfo { return nil, EIO } - return &ci, nil + return (*Clockinfo)(unsafe.Pointer(&buf[0])), nil } //sysnb pipe() (fd1 int, fd2 int, err error) diff --git a/vendor/golang.org/x/sys/unix/syscall_openbsd.go b/vendor/golang.org/x/sys/unix/syscall_openbsd.go index 2c674a5c8a..07e6669cab 100644 --- a/vendor/golang.org/x/sys/unix/syscall_openbsd.go +++ b/vendor/golang.org/x/sys/unix/syscall_openbsd.go @@ -43,23 +43,6 @@ func nametomib(name string) (mib []_C_int, err error) { return nil, EINVAL } -func SysctlUvmexp(name string) (*Uvmexp, error) { - mib, err := sysctlmib(name) - if err != nil { - return nil, err - } - - n := uintptr(SizeofUvmexp) - var u Uvmexp - if err := sysctl(mib, (*byte)(unsafe.Pointer(&u)), &n, nil, 0); err != nil { - return nil, err - } - if n != SizeofUvmexp { - return nil, EIO - } - return &u, nil -} - //sysnb pipe(p *[2]_C_int) (err error) func Pipe(p []int) (err error) { if len(p) != 2 { diff --git a/vendor/golang.org/x/sys/unix/syscall_unix.go b/vendor/golang.org/x/sys/unix/syscall_unix.go index 64fcda4aef..13956b7954 100644 --- a/vendor/golang.org/x/sys/unix/syscall_unix.go +++ b/vendor/golang.org/x/sys/unix/syscall_unix.go @@ -22,10 +22,10 @@ var ( ) const ( - darwin64Bit = runtime.GOOS == "darwin" && SizeofPtr == 8 - dragonfly64Bit = runtime.GOOS == "dragonfly" && SizeofPtr == 8 - netbsd32Bit = runtime.GOOS == "netbsd" && SizeofPtr == 4 - solaris64Bit = runtime.GOOS == "solaris" && SizeofPtr == 8 + darwin64Bit = runtime.GOOS == "darwin" && sizeofPtr == 8 + dragonfly64Bit = runtime.GOOS == "dragonfly" && sizeofPtr == 8 + netbsd32Bit = runtime.GOOS == "netbsd" && sizeofPtr == 4 + solaris64Bit = runtime.GOOS == "solaris" && sizeofPtr == 8 ) // Do the interface allocations only once for common diff --git a/vendor/golang.org/x/sys/unix/types_aix.go b/vendor/golang.org/x/sys/unix/types_aix.go index 25e834940d..18fbddd52c 100644 --- a/vendor/golang.org/x/sys/unix/types_aix.go +++ b/vendor/golang.org/x/sys/unix/types_aix.go @@ -59,14 +59,14 @@ struct sockaddr_any { */ import "C" -// Machine characteristics +// Machine characteristics; for internal use. const ( - SizeofPtr = C.sizeofPtr - SizeofShort = C.sizeof_short - SizeofInt = C.sizeof_int - SizeofLong = C.sizeof_long - SizeofLongLong = C.sizeof_longlong + sizeofPtr = C.sizeofPtr + sizeofShort = C.sizeof_short + sizeofInt = C.sizeof_int + sizeofLong = C.sizeof_long + sizeofLongLong = C.sizeof_longlong PathMax = C.PATH_MAX ) diff --git a/vendor/golang.org/x/sys/unix/types_darwin.go b/vendor/golang.org/x/sys/unix/types_darwin.go index 9fd2aaa6a2..46b9908e03 100644 --- a/vendor/golang.org/x/sys/unix/types_darwin.go +++ b/vendor/golang.org/x/sys/unix/types_darwin.go @@ -70,14 +70,14 @@ struct sockaddr_any { */ import "C" -// Machine characteristics +// Machine characteristics; for internal use. const ( - SizeofPtr = C.sizeofPtr - SizeofShort = C.sizeof_short - SizeofInt = C.sizeof_int - SizeofLong = C.sizeof_long - SizeofLongLong = C.sizeof_longlong + sizeofPtr = C.sizeofPtr + sizeofShort = C.sizeof_short + sizeofInt = C.sizeof_int + sizeofLong = C.sizeof_long + sizeofLongLong = C.sizeof_longlong ) // Basic types diff --git a/vendor/golang.org/x/sys/unix/types_dragonfly.go b/vendor/golang.org/x/sys/unix/types_dragonfly.go index 3365dd79d0..386d5f89ff 100644 --- a/vendor/golang.org/x/sys/unix/types_dragonfly.go +++ b/vendor/golang.org/x/sys/unix/types_dragonfly.go @@ -65,14 +65,14 @@ struct sockaddr_any { */ import "C" -// Machine characteristics +// Machine characteristics; for internal use. const ( - SizeofPtr = C.sizeofPtr - SizeofShort = C.sizeof_short - SizeofInt = C.sizeof_int - SizeofLong = C.sizeof_long - SizeofLongLong = C.sizeof_longlong + sizeofPtr = C.sizeofPtr + sizeofShort = C.sizeof_short + sizeofInt = C.sizeof_int + sizeofLong = C.sizeof_long + sizeofLongLong = C.sizeof_longlong ) // Basic types diff --git a/vendor/golang.org/x/sys/unix/types_freebsd.go b/vendor/golang.org/x/sys/unix/types_freebsd.go index a0a5843b92..e84a892d63 100644 --- a/vendor/golang.org/x/sys/unix/types_freebsd.go +++ b/vendor/golang.org/x/sys/unix/types_freebsd.go @@ -154,14 +154,14 @@ struct if_msghdr8 { */ import "C" -// Machine characteristics +// Machine characteristics; for internal use. const ( - SizeofPtr = C.sizeofPtr - SizeofShort = C.sizeof_short - SizeofInt = C.sizeof_int - SizeofLong = C.sizeof_long - SizeofLongLong = C.sizeof_longlong + sizeofPtr = C.sizeofPtr + sizeofShort = C.sizeof_short + sizeofInt = C.sizeof_int + sizeofLong = C.sizeof_long + sizeofLongLong = C.sizeof_longlong ) // Basic types diff --git a/vendor/golang.org/x/sys/unix/types_netbsd.go b/vendor/golang.org/x/sys/unix/types_netbsd.go index 1edbf1ba71..c49621ce52 100644 --- a/vendor/golang.org/x/sys/unix/types_netbsd.go +++ b/vendor/golang.org/x/sys/unix/types_netbsd.go @@ -67,14 +67,14 @@ struct sockaddr_any { */ import "C" -// Machine characteristics +// Machine characteristics; for internal use. const ( - SizeofPtr = C.sizeofPtr - SizeofShort = C.sizeof_short - SizeofInt = C.sizeof_int - SizeofLong = C.sizeof_long - SizeofLongLong = C.sizeof_longlong + sizeofPtr = C.sizeofPtr + sizeofShort = C.sizeof_short + sizeofInt = C.sizeof_int + sizeofLong = C.sizeof_long + sizeofLongLong = C.sizeof_longlong ) // Basic types diff --git a/vendor/golang.org/x/sys/unix/types_openbsd.go b/vendor/golang.org/x/sys/unix/types_openbsd.go index 297e40d37e..8f2fe704c8 100644 --- a/vendor/golang.org/x/sys/unix/types_openbsd.go +++ b/vendor/golang.org/x/sys/unix/types_openbsd.go @@ -38,7 +38,6 @@ package unix #include #include #include -#include #include #include #include @@ -67,14 +66,14 @@ struct sockaddr_any { */ import "C" -// Machine characteristics +// Machine characteristics; for internal use. const ( - SizeofPtr = C.sizeofPtr - SizeofShort = C.sizeof_short - SizeofInt = C.sizeof_int - SizeofLong = C.sizeof_long - SizeofLongLong = C.sizeof_longlong + sizeofPtr = C.sizeofPtr + sizeofShort = C.sizeof_short + sizeofInt = C.sizeof_int + sizeofLong = C.sizeof_long + sizeofLongLong = C.sizeof_longlong ) // Basic types @@ -264,9 +263,3 @@ const ( // Uname type Utsname C.struct_utsname - -// Uvmexp - -const SizeofUvmexp = C.sizeof_struct_uvmexp - -type Uvmexp C.struct_uvmexp diff --git a/vendor/golang.org/x/sys/unix/types_solaris.go b/vendor/golang.org/x/sys/unix/types_solaris.go index 2b716f9348..8cef71bd45 100644 --- a/vendor/golang.org/x/sys/unix/types_solaris.go +++ b/vendor/golang.org/x/sys/unix/types_solaris.go @@ -75,14 +75,14 @@ struct sockaddr_any { */ import "C" -// Machine characteristics +// Machine characteristics; for internal use. const ( - SizeofPtr = C.sizeofPtr - SizeofShort = C.sizeof_short - SizeofInt = C.sizeof_int - SizeofLong = C.sizeof_long - SizeofLongLong = C.sizeof_longlong + sizeofPtr = C.sizeofPtr + sizeofShort = C.sizeof_short + sizeofInt = C.sizeof_int + sizeofLong = C.sizeof_long + sizeofLongLong = C.sizeof_longlong PathMax = C.PATH_MAX MaxHostNameLen = C.MAXHOSTNAMELEN ) diff --git a/vendor/golang.org/x/sys/unix/zerrors_linux_386.go b/vendor/golang.org/x/sys/unix/zerrors_linux_386.go index 86b980a5aa..fe564160bf 100644 --- a/vendor/golang.org/x/sys/unix/zerrors_linux_386.go +++ b/vendor/golang.org/x/sys/unix/zerrors_linux_386.go @@ -879,26 +879,6 @@ const ( IXOFF = 0x1000 IXON = 0x400 JFFS2_SUPER_MAGIC = 0x72b6 - KEXEC_ARCH_386 = 0x30000 - KEXEC_ARCH_68K = 0x40000 - KEXEC_ARCH_AARCH64 = 0xb70000 - KEXEC_ARCH_ARM = 0x280000 - KEXEC_ARCH_DEFAULT = 0x0 - KEXEC_ARCH_IA_64 = 0x320000 - KEXEC_ARCH_MASK = 0xffff0000 - KEXEC_ARCH_MIPS = 0x80000 - KEXEC_ARCH_MIPS_LE = 0xa0000 - KEXEC_ARCH_PPC = 0x140000 - KEXEC_ARCH_PPC64 = 0x150000 - KEXEC_ARCH_S390 = 0x160000 - KEXEC_ARCH_SH = 0x2a0000 - KEXEC_ARCH_X86_64 = 0x3e0000 - KEXEC_FILE_NO_INITRAMFS = 0x4 - KEXEC_FILE_ON_CRASH = 0x2 - KEXEC_FILE_UNLOAD = 0x1 - KEXEC_ON_CRASH = 0x1 - KEXEC_PRESERVE_CONTEXT = 0x2 - KEXEC_SEGMENT_MAX = 0x10 KEYCTL_ASSUME_AUTHORITY = 0x10 KEYCTL_CHOWN = 0x4 KEYCTL_CLEAR = 0x7 diff --git a/vendor/golang.org/x/sys/unix/zerrors_linux_amd64.go b/vendor/golang.org/x/sys/unix/zerrors_linux_amd64.go index 286311572e..dcfa667495 100644 --- a/vendor/golang.org/x/sys/unix/zerrors_linux_amd64.go +++ b/vendor/golang.org/x/sys/unix/zerrors_linux_amd64.go @@ -879,26 +879,6 @@ const ( IXOFF = 0x1000 IXON = 0x400 JFFS2_SUPER_MAGIC = 0x72b6 - KEXEC_ARCH_386 = 0x30000 - KEXEC_ARCH_68K = 0x40000 - KEXEC_ARCH_AARCH64 = 0xb70000 - KEXEC_ARCH_ARM = 0x280000 - KEXEC_ARCH_DEFAULT = 0x0 - KEXEC_ARCH_IA_64 = 0x320000 - KEXEC_ARCH_MASK = 0xffff0000 - KEXEC_ARCH_MIPS = 0x80000 - KEXEC_ARCH_MIPS_LE = 0xa0000 - KEXEC_ARCH_PPC = 0x140000 - KEXEC_ARCH_PPC64 = 0x150000 - KEXEC_ARCH_S390 = 0x160000 - KEXEC_ARCH_SH = 0x2a0000 - KEXEC_ARCH_X86_64 = 0x3e0000 - KEXEC_FILE_NO_INITRAMFS = 0x4 - KEXEC_FILE_ON_CRASH = 0x2 - KEXEC_FILE_UNLOAD = 0x1 - KEXEC_ON_CRASH = 0x1 - KEXEC_PRESERVE_CONTEXT = 0x2 - KEXEC_SEGMENT_MAX = 0x10 KEYCTL_ASSUME_AUTHORITY = 0x10 KEYCTL_CHOWN = 0x4 KEYCTL_CLEAR = 0x7 diff --git a/vendor/golang.org/x/sys/unix/zerrors_linux_arm.go b/vendor/golang.org/x/sys/unix/zerrors_linux_arm.go index 1b58da1e78..c2ef50c658 100644 --- a/vendor/golang.org/x/sys/unix/zerrors_linux_arm.go +++ b/vendor/golang.org/x/sys/unix/zerrors_linux_arm.go @@ -878,26 +878,6 @@ const ( IXOFF = 0x1000 IXON = 0x400 JFFS2_SUPER_MAGIC = 0x72b6 - KEXEC_ARCH_386 = 0x30000 - KEXEC_ARCH_68K = 0x40000 - KEXEC_ARCH_AARCH64 = 0xb70000 - KEXEC_ARCH_ARM = 0x280000 - KEXEC_ARCH_DEFAULT = 0x0 - KEXEC_ARCH_IA_64 = 0x320000 - KEXEC_ARCH_MASK = 0xffff0000 - KEXEC_ARCH_MIPS = 0x80000 - KEXEC_ARCH_MIPS_LE = 0xa0000 - KEXEC_ARCH_PPC = 0x140000 - KEXEC_ARCH_PPC64 = 0x150000 - KEXEC_ARCH_S390 = 0x160000 - KEXEC_ARCH_SH = 0x2a0000 - KEXEC_ARCH_X86_64 = 0x3e0000 - KEXEC_FILE_NO_INITRAMFS = 0x4 - KEXEC_FILE_ON_CRASH = 0x2 - KEXEC_FILE_UNLOAD = 0x1 - KEXEC_ON_CRASH = 0x1 - KEXEC_PRESERVE_CONTEXT = 0x2 - KEXEC_SEGMENT_MAX = 0x10 KEYCTL_ASSUME_AUTHORITY = 0x10 KEYCTL_CHOWN = 0x4 KEYCTL_CLEAR = 0x7 diff --git a/vendor/golang.org/x/sys/unix/zerrors_linux_arm64.go b/vendor/golang.org/x/sys/unix/zerrors_linux_arm64.go index 08377eb4fb..1a820d668f 100644 --- a/vendor/golang.org/x/sys/unix/zerrors_linux_arm64.go +++ b/vendor/golang.org/x/sys/unix/zerrors_linux_arm64.go @@ -881,26 +881,6 @@ const ( IXOFF = 0x1000 IXON = 0x400 JFFS2_SUPER_MAGIC = 0x72b6 - KEXEC_ARCH_386 = 0x30000 - KEXEC_ARCH_68K = 0x40000 - KEXEC_ARCH_AARCH64 = 0xb70000 - KEXEC_ARCH_ARM = 0x280000 - KEXEC_ARCH_DEFAULT = 0x0 - KEXEC_ARCH_IA_64 = 0x320000 - KEXEC_ARCH_MASK = 0xffff0000 - KEXEC_ARCH_MIPS = 0x80000 - KEXEC_ARCH_MIPS_LE = 0xa0000 - KEXEC_ARCH_PPC = 0x140000 - KEXEC_ARCH_PPC64 = 0x150000 - KEXEC_ARCH_S390 = 0x160000 - KEXEC_ARCH_SH = 0x2a0000 - KEXEC_ARCH_X86_64 = 0x3e0000 - KEXEC_FILE_NO_INITRAMFS = 0x4 - KEXEC_FILE_ON_CRASH = 0x2 - KEXEC_FILE_UNLOAD = 0x1 - KEXEC_ON_CRASH = 0x1 - KEXEC_PRESERVE_CONTEXT = 0x2 - KEXEC_SEGMENT_MAX = 0x10 KEYCTL_ASSUME_AUTHORITY = 0x10 KEYCTL_CHOWN = 0x4 KEYCTL_CLEAR = 0x7 diff --git a/vendor/golang.org/x/sys/unix/zerrors_linux_mips.go b/vendor/golang.org/x/sys/unix/zerrors_linux_mips.go index 5de2c7aa40..b515b2a63f 100644 --- a/vendor/golang.org/x/sys/unix/zerrors_linux_mips.go +++ b/vendor/golang.org/x/sys/unix/zerrors_linux_mips.go @@ -878,26 +878,6 @@ const ( IXOFF = 0x1000 IXON = 0x400 JFFS2_SUPER_MAGIC = 0x72b6 - KEXEC_ARCH_386 = 0x30000 - KEXEC_ARCH_68K = 0x40000 - KEXEC_ARCH_AARCH64 = 0xb70000 - KEXEC_ARCH_ARM = 0x280000 - KEXEC_ARCH_DEFAULT = 0x0 - KEXEC_ARCH_IA_64 = 0x320000 - KEXEC_ARCH_MASK = 0xffff0000 - KEXEC_ARCH_MIPS = 0x80000 - KEXEC_ARCH_MIPS_LE = 0xa0000 - KEXEC_ARCH_PPC = 0x140000 - KEXEC_ARCH_PPC64 = 0x150000 - KEXEC_ARCH_S390 = 0x160000 - KEXEC_ARCH_SH = 0x2a0000 - KEXEC_ARCH_X86_64 = 0x3e0000 - KEXEC_FILE_NO_INITRAMFS = 0x4 - KEXEC_FILE_ON_CRASH = 0x2 - KEXEC_FILE_UNLOAD = 0x1 - KEXEC_ON_CRASH = 0x1 - KEXEC_PRESERVE_CONTEXT = 0x2 - KEXEC_SEGMENT_MAX = 0x10 KEYCTL_ASSUME_AUTHORITY = 0x10 KEYCTL_CHOWN = 0x4 KEYCTL_CLEAR = 0x7 diff --git a/vendor/golang.org/x/sys/unix/zerrors_linux_mips64.go b/vendor/golang.org/x/sys/unix/zerrors_linux_mips64.go index 51015f354e..29a88f0e5e 100644 --- a/vendor/golang.org/x/sys/unix/zerrors_linux_mips64.go +++ b/vendor/golang.org/x/sys/unix/zerrors_linux_mips64.go @@ -878,26 +878,6 @@ const ( IXOFF = 0x1000 IXON = 0x400 JFFS2_SUPER_MAGIC = 0x72b6 - KEXEC_ARCH_386 = 0x30000 - KEXEC_ARCH_68K = 0x40000 - KEXEC_ARCH_AARCH64 = 0xb70000 - KEXEC_ARCH_ARM = 0x280000 - KEXEC_ARCH_DEFAULT = 0x0 - KEXEC_ARCH_IA_64 = 0x320000 - KEXEC_ARCH_MASK = 0xffff0000 - KEXEC_ARCH_MIPS = 0x80000 - KEXEC_ARCH_MIPS_LE = 0xa0000 - KEXEC_ARCH_PPC = 0x140000 - KEXEC_ARCH_PPC64 = 0x150000 - KEXEC_ARCH_S390 = 0x160000 - KEXEC_ARCH_SH = 0x2a0000 - KEXEC_ARCH_X86_64 = 0x3e0000 - KEXEC_FILE_NO_INITRAMFS = 0x4 - KEXEC_FILE_ON_CRASH = 0x2 - KEXEC_FILE_UNLOAD = 0x1 - KEXEC_ON_CRASH = 0x1 - KEXEC_PRESERVE_CONTEXT = 0x2 - KEXEC_SEGMENT_MAX = 0x10 KEYCTL_ASSUME_AUTHORITY = 0x10 KEYCTL_CHOWN = 0x4 KEYCTL_CLEAR = 0x7 diff --git a/vendor/golang.org/x/sys/unix/zerrors_linux_mips64le.go b/vendor/golang.org/x/sys/unix/zerrors_linux_mips64le.go index fdd388debd..0767ac1b0d 100644 --- a/vendor/golang.org/x/sys/unix/zerrors_linux_mips64le.go +++ b/vendor/golang.org/x/sys/unix/zerrors_linux_mips64le.go @@ -878,26 +878,6 @@ const ( IXOFF = 0x1000 IXON = 0x400 JFFS2_SUPER_MAGIC = 0x72b6 - KEXEC_ARCH_386 = 0x30000 - KEXEC_ARCH_68K = 0x40000 - KEXEC_ARCH_AARCH64 = 0xb70000 - KEXEC_ARCH_ARM = 0x280000 - KEXEC_ARCH_DEFAULT = 0x0 - KEXEC_ARCH_IA_64 = 0x320000 - KEXEC_ARCH_MASK = 0xffff0000 - KEXEC_ARCH_MIPS = 0x80000 - KEXEC_ARCH_MIPS_LE = 0xa0000 - KEXEC_ARCH_PPC = 0x140000 - KEXEC_ARCH_PPC64 = 0x150000 - KEXEC_ARCH_S390 = 0x160000 - KEXEC_ARCH_SH = 0x2a0000 - KEXEC_ARCH_X86_64 = 0x3e0000 - KEXEC_FILE_NO_INITRAMFS = 0x4 - KEXEC_FILE_ON_CRASH = 0x2 - KEXEC_FILE_UNLOAD = 0x1 - KEXEC_ON_CRASH = 0x1 - KEXEC_PRESERVE_CONTEXT = 0x2 - KEXEC_SEGMENT_MAX = 0x10 KEYCTL_ASSUME_AUTHORITY = 0x10 KEYCTL_CHOWN = 0x4 KEYCTL_CLEAR = 0x7 diff --git a/vendor/golang.org/x/sys/unix/zerrors_linux_mipsle.go b/vendor/golang.org/x/sys/unix/zerrors_linux_mipsle.go index 2d15046129..269b813182 100644 --- a/vendor/golang.org/x/sys/unix/zerrors_linux_mipsle.go +++ b/vendor/golang.org/x/sys/unix/zerrors_linux_mipsle.go @@ -878,26 +878,6 @@ const ( IXOFF = 0x1000 IXON = 0x400 JFFS2_SUPER_MAGIC = 0x72b6 - KEXEC_ARCH_386 = 0x30000 - KEXEC_ARCH_68K = 0x40000 - KEXEC_ARCH_AARCH64 = 0xb70000 - KEXEC_ARCH_ARM = 0x280000 - KEXEC_ARCH_DEFAULT = 0x0 - KEXEC_ARCH_IA_64 = 0x320000 - KEXEC_ARCH_MASK = 0xffff0000 - KEXEC_ARCH_MIPS = 0x80000 - KEXEC_ARCH_MIPS_LE = 0xa0000 - KEXEC_ARCH_PPC = 0x140000 - KEXEC_ARCH_PPC64 = 0x150000 - KEXEC_ARCH_S390 = 0x160000 - KEXEC_ARCH_SH = 0x2a0000 - KEXEC_ARCH_X86_64 = 0x3e0000 - KEXEC_FILE_NO_INITRAMFS = 0x4 - KEXEC_FILE_ON_CRASH = 0x2 - KEXEC_FILE_UNLOAD = 0x1 - KEXEC_ON_CRASH = 0x1 - KEXEC_PRESERVE_CONTEXT = 0x2 - KEXEC_SEGMENT_MAX = 0x10 KEYCTL_ASSUME_AUTHORITY = 0x10 KEYCTL_CHOWN = 0x4 KEYCTL_CLEAR = 0x7 diff --git a/vendor/golang.org/x/sys/unix/zerrors_linux_ppc64.go b/vendor/golang.org/x/sys/unix/zerrors_linux_ppc64.go index cd8fcd35ce..eb52e9689f 100644 --- a/vendor/golang.org/x/sys/unix/zerrors_linux_ppc64.go +++ b/vendor/golang.org/x/sys/unix/zerrors_linux_ppc64.go @@ -878,26 +878,6 @@ const ( IXOFF = 0x400 IXON = 0x200 JFFS2_SUPER_MAGIC = 0x72b6 - KEXEC_ARCH_386 = 0x30000 - KEXEC_ARCH_68K = 0x40000 - KEXEC_ARCH_AARCH64 = 0xb70000 - KEXEC_ARCH_ARM = 0x280000 - KEXEC_ARCH_DEFAULT = 0x0 - KEXEC_ARCH_IA_64 = 0x320000 - KEXEC_ARCH_MASK = 0xffff0000 - KEXEC_ARCH_MIPS = 0x80000 - KEXEC_ARCH_MIPS_LE = 0xa0000 - KEXEC_ARCH_PPC = 0x140000 - KEXEC_ARCH_PPC64 = 0x150000 - KEXEC_ARCH_S390 = 0x160000 - KEXEC_ARCH_SH = 0x2a0000 - KEXEC_ARCH_X86_64 = 0x3e0000 - KEXEC_FILE_NO_INITRAMFS = 0x4 - KEXEC_FILE_ON_CRASH = 0x2 - KEXEC_FILE_UNLOAD = 0x1 - KEXEC_ON_CRASH = 0x1 - KEXEC_PRESERVE_CONTEXT = 0x2 - KEXEC_SEGMENT_MAX = 0x10 KEYCTL_ASSUME_AUTHORITY = 0x10 KEYCTL_CHOWN = 0x4 KEYCTL_CLEAR = 0x7 diff --git a/vendor/golang.org/x/sys/unix/zerrors_linux_ppc64le.go b/vendor/golang.org/x/sys/unix/zerrors_linux_ppc64le.go index cdb6088760..0563d34b31 100644 --- a/vendor/golang.org/x/sys/unix/zerrors_linux_ppc64le.go +++ b/vendor/golang.org/x/sys/unix/zerrors_linux_ppc64le.go @@ -878,26 +878,6 @@ const ( IXOFF = 0x400 IXON = 0x200 JFFS2_SUPER_MAGIC = 0x72b6 - KEXEC_ARCH_386 = 0x30000 - KEXEC_ARCH_68K = 0x40000 - KEXEC_ARCH_AARCH64 = 0xb70000 - KEXEC_ARCH_ARM = 0x280000 - KEXEC_ARCH_DEFAULT = 0x0 - KEXEC_ARCH_IA_64 = 0x320000 - KEXEC_ARCH_MASK = 0xffff0000 - KEXEC_ARCH_MIPS = 0x80000 - KEXEC_ARCH_MIPS_LE = 0xa0000 - KEXEC_ARCH_PPC = 0x140000 - KEXEC_ARCH_PPC64 = 0x150000 - KEXEC_ARCH_S390 = 0x160000 - KEXEC_ARCH_SH = 0x2a0000 - KEXEC_ARCH_X86_64 = 0x3e0000 - KEXEC_FILE_NO_INITRAMFS = 0x4 - KEXEC_FILE_ON_CRASH = 0x2 - KEXEC_FILE_UNLOAD = 0x1 - KEXEC_ON_CRASH = 0x1 - KEXEC_PRESERVE_CONTEXT = 0x2 - KEXEC_SEGMENT_MAX = 0x10 KEYCTL_ASSUME_AUTHORITY = 0x10 KEYCTL_CHOWN = 0x4 KEYCTL_CLEAR = 0x7 diff --git a/vendor/golang.org/x/sys/unix/zerrors_linux_riscv64.go b/vendor/golang.org/x/sys/unix/zerrors_linux_riscv64.go index 9e9472bec5..e95e3f6778 100644 --- a/vendor/golang.org/x/sys/unix/zerrors_linux_riscv64.go +++ b/vendor/golang.org/x/sys/unix/zerrors_linux_riscv64.go @@ -878,26 +878,6 @@ const ( IXOFF = 0x1000 IXON = 0x400 JFFS2_SUPER_MAGIC = 0x72b6 - KEXEC_ARCH_386 = 0x30000 - KEXEC_ARCH_68K = 0x40000 - KEXEC_ARCH_AARCH64 = 0xb70000 - KEXEC_ARCH_ARM = 0x280000 - KEXEC_ARCH_DEFAULT = 0x0 - KEXEC_ARCH_IA_64 = 0x320000 - KEXEC_ARCH_MASK = 0xffff0000 - KEXEC_ARCH_MIPS = 0x80000 - KEXEC_ARCH_MIPS_LE = 0xa0000 - KEXEC_ARCH_PPC = 0x140000 - KEXEC_ARCH_PPC64 = 0x150000 - KEXEC_ARCH_S390 = 0x160000 - KEXEC_ARCH_SH = 0x2a0000 - KEXEC_ARCH_X86_64 = 0x3e0000 - KEXEC_FILE_NO_INITRAMFS = 0x4 - KEXEC_FILE_ON_CRASH = 0x2 - KEXEC_FILE_UNLOAD = 0x1 - KEXEC_ON_CRASH = 0x1 - KEXEC_PRESERVE_CONTEXT = 0x2 - KEXEC_SEGMENT_MAX = 0x10 KEYCTL_ASSUME_AUTHORITY = 0x10 KEYCTL_CHOWN = 0x4 KEYCTL_CLEAR = 0x7 diff --git a/vendor/golang.org/x/sys/unix/zerrors_linux_s390x.go b/vendor/golang.org/x/sys/unix/zerrors_linux_s390x.go index f33d031add..bad17418e8 100644 --- a/vendor/golang.org/x/sys/unix/zerrors_linux_s390x.go +++ b/vendor/golang.org/x/sys/unix/zerrors_linux_s390x.go @@ -878,26 +878,6 @@ const ( IXOFF = 0x1000 IXON = 0x400 JFFS2_SUPER_MAGIC = 0x72b6 - KEXEC_ARCH_386 = 0x30000 - KEXEC_ARCH_68K = 0x40000 - KEXEC_ARCH_AARCH64 = 0xb70000 - KEXEC_ARCH_ARM = 0x280000 - KEXEC_ARCH_DEFAULT = 0x0 - KEXEC_ARCH_IA_64 = 0x320000 - KEXEC_ARCH_MASK = 0xffff0000 - KEXEC_ARCH_MIPS = 0x80000 - KEXEC_ARCH_MIPS_LE = 0xa0000 - KEXEC_ARCH_PPC = 0x140000 - KEXEC_ARCH_PPC64 = 0x150000 - KEXEC_ARCH_S390 = 0x160000 - KEXEC_ARCH_SH = 0x2a0000 - KEXEC_ARCH_X86_64 = 0x3e0000 - KEXEC_FILE_NO_INITRAMFS = 0x4 - KEXEC_FILE_ON_CRASH = 0x2 - KEXEC_FILE_UNLOAD = 0x1 - KEXEC_ON_CRASH = 0x1 - KEXEC_PRESERVE_CONTEXT = 0x2 - KEXEC_SEGMENT_MAX = 0x10 KEYCTL_ASSUME_AUTHORITY = 0x10 KEYCTL_CHOWN = 0x4 KEYCTL_CLEAR = 0x7 diff --git a/vendor/golang.org/x/sys/unix/zerrors_linux_sparc64.go b/vendor/golang.org/x/sys/unix/zerrors_linux_sparc64.go index ba93f3e53c..7fdc85b172 100644 --- a/vendor/golang.org/x/sys/unix/zerrors_linux_sparc64.go +++ b/vendor/golang.org/x/sys/unix/zerrors_linux_sparc64.go @@ -1,10 +1,10 @@ -// mkerrors.sh -Wall -Werror -static -I/tmp/include -// Code generated by the command above; see README.md. DO NOT EDIT. +// mkerrors.sh -m64 +// Code generated by the command above; DO NOT EDIT. // +build sparc64,linux -// Code generated by cmd/cgo -godefs; DO NOT EDIT. -// cgo -godefs -- -Wall -Werror -static -I/tmp/include _const.go +// Created by cgo -godefs - DO NOT EDIT +// cgo -godefs -- -m64 _const.go package unix @@ -1969,182 +1969,174 @@ const ( ) // Error table -var errorList = [...]struct { - num syscall.Errno - name string - desc string -}{ - {1, "EPERM", "operation not permitted"}, - {2, "ENOENT", "no such file or directory"}, - {3, "ESRCH", "no such process"}, - {4, "EINTR", "interrupted system call"}, - {5, "EIO", "input/output error"}, - {6, "ENXIO", "no such device or address"}, - {7, "E2BIG", "argument list too long"}, - {8, "ENOEXEC", "exec format error"}, - {9, "EBADF", "bad file descriptor"}, - {10, "ECHILD", "no child processes"}, - {11, "EAGAIN", "resource temporarily unavailable"}, - {12, "ENOMEM", "cannot allocate memory"}, - {13, "EACCES", "permission denied"}, - {14, "EFAULT", "bad address"}, - {15, "ENOTBLK", "block device required"}, - {16, "EBUSY", "device or resource busy"}, - {17, "EEXIST", "file exists"}, - {18, "EXDEV", "invalid cross-device link"}, - {19, "ENODEV", "no such device"}, - {20, "ENOTDIR", "not a directory"}, - {21, "EISDIR", "is a directory"}, - {22, "EINVAL", "invalid argument"}, - {23, "ENFILE", "too many open files in system"}, - {24, "EMFILE", "too many open files"}, - {25, "ENOTTY", "inappropriate ioctl for device"}, - {26, "ETXTBSY", "text file busy"}, - {27, "EFBIG", "file too large"}, - {28, "ENOSPC", "no space left on device"}, - {29, "ESPIPE", "illegal seek"}, - {30, "EROFS", "read-only file system"}, - {31, "EMLINK", "too many links"}, - {32, "EPIPE", "broken pipe"}, - {33, "EDOM", "numerical argument out of domain"}, - {34, "ERANGE", "numerical result out of range"}, - {36, "EINPROGRESS", "operation now in progress"}, - {37, "EALREADY", "operation already in progress"}, - {38, "ENOTSOCK", "socket operation on non-socket"}, - {39, "EDESTADDRREQ", "destination address required"}, - {40, "EMSGSIZE", "message too long"}, - {41, "EPROTOTYPE", "protocol wrong type for socket"}, - {42, "ENOPROTOOPT", "protocol not available"}, - {43, "EPROTONOSUPPORT", "protocol not supported"}, - {44, "ESOCKTNOSUPPORT", "socket type not supported"}, - {45, "ENOTSUP", "operation not supported"}, - {46, "EPFNOSUPPORT", "protocol family not supported"}, - {47, "EAFNOSUPPORT", "address family not supported by protocol"}, - {48, "EADDRINUSE", "address already in use"}, - {49, "EADDRNOTAVAIL", "cannot assign requested address"}, - {50, "ENETDOWN", "network is down"}, - {51, "ENETUNREACH", "network is unreachable"}, - {52, "ENETRESET", "network dropped connection on reset"}, - {53, "ECONNABORTED", "software caused connection abort"}, - {54, "ECONNRESET", "connection reset by peer"}, - {55, "ENOBUFS", "no buffer space available"}, - {56, "EISCONN", "transport endpoint is already connected"}, - {57, "ENOTCONN", "transport endpoint is not connected"}, - {58, "ESHUTDOWN", "cannot send after transport endpoint shutdown"}, - {59, "ETOOMANYREFS", "too many references: cannot splice"}, - {60, "ETIMEDOUT", "connection timed out"}, - {61, "ECONNREFUSED", "connection refused"}, - {62, "ELOOP", "too many levels of symbolic links"}, - {63, "ENAMETOOLONG", "file name too long"}, - {64, "EHOSTDOWN", "host is down"}, - {65, "EHOSTUNREACH", "no route to host"}, - {66, "ENOTEMPTY", "directory not empty"}, - {67, "EPROCLIM", "too many processes"}, - {68, "EUSERS", "too many users"}, - {69, "EDQUOT", "disk quota exceeded"}, - {70, "ESTALE", "stale file handle"}, - {71, "EREMOTE", "object is remote"}, - {72, "ENOSTR", "device not a stream"}, - {73, "ETIME", "timer expired"}, - {74, "ENOSR", "out of streams resources"}, - {75, "ENOMSG", "no message of desired type"}, - {76, "EBADMSG", "bad message"}, - {77, "EIDRM", "identifier removed"}, - {78, "EDEADLK", "resource deadlock avoided"}, - {79, "ENOLCK", "no locks available"}, - {80, "ENONET", "machine is not on the network"}, - {81, "ERREMOTE", "unknown error 81"}, - {82, "ENOLINK", "link has been severed"}, - {83, "EADV", "advertise error"}, - {84, "ESRMNT", "srmount error"}, - {85, "ECOMM", "communication error on send"}, - {86, "EPROTO", "protocol error"}, - {87, "EMULTIHOP", "multihop attempted"}, - {88, "EDOTDOT", "RFS specific error"}, - {89, "EREMCHG", "remote address changed"}, - {90, "ENOSYS", "function not implemented"}, - {91, "ESTRPIPE", "streams pipe error"}, - {92, "EOVERFLOW", "value too large for defined data type"}, - {93, "EBADFD", "file descriptor in bad state"}, - {94, "ECHRNG", "channel number out of range"}, - {95, "EL2NSYNC", "level 2 not synchronized"}, - {96, "EL3HLT", "level 3 halted"}, - {97, "EL3RST", "level 3 reset"}, - {98, "ELNRNG", "link number out of range"}, - {99, "EUNATCH", "protocol driver not attached"}, - {100, "ENOCSI", "no CSI structure available"}, - {101, "EL2HLT", "level 2 halted"}, - {102, "EBADE", "invalid exchange"}, - {103, "EBADR", "invalid request descriptor"}, - {104, "EXFULL", "exchange full"}, - {105, "ENOANO", "no anode"}, - {106, "EBADRQC", "invalid request code"}, - {107, "EBADSLT", "invalid slot"}, - {108, "EDEADLOCK", "file locking deadlock error"}, - {109, "EBFONT", "bad font file format"}, - {110, "ELIBEXEC", "cannot exec a shared library directly"}, - {111, "ENODATA", "no data available"}, - {112, "ELIBBAD", "accessing a corrupted shared library"}, - {113, "ENOPKG", "package not installed"}, - {114, "ELIBACC", "can not access a needed shared library"}, - {115, "ENOTUNIQ", "name not unique on network"}, - {116, "ERESTART", "interrupted system call should be restarted"}, - {117, "EUCLEAN", "structure needs cleaning"}, - {118, "ENOTNAM", "not a XENIX named type file"}, - {119, "ENAVAIL", "no XENIX semaphores available"}, - {120, "EISNAM", "is a named type file"}, - {121, "EREMOTEIO", "remote I/O error"}, - {122, "EILSEQ", "invalid or incomplete multibyte or wide character"}, - {123, "ELIBMAX", "attempting to link in too many shared libraries"}, - {124, "ELIBSCN", ".lib section in a.out corrupted"}, - {125, "ENOMEDIUM", "no medium found"}, - {126, "EMEDIUMTYPE", "wrong medium type"}, - {127, "ECANCELED", "operation canceled"}, - {128, "ENOKEY", "required key not available"}, - {129, "EKEYEXPIRED", "key has expired"}, - {130, "EKEYREVOKED", "key has been revoked"}, - {131, "EKEYREJECTED", "key was rejected by service"}, - {132, "EOWNERDEAD", "owner died"}, - {133, "ENOTRECOVERABLE", "state not recoverable"}, - {134, "ERFKILL", "operation not possible due to RF-kill"}, - {135, "EHWPOISON", "memory page has hardware error"}, +var errors = [...]string{ + 1: "operation not permitted", + 2: "no such file or directory", + 3: "no such process", + 4: "interrupted system call", + 5: "input/output error", + 6: "no such device or address", + 7: "argument list too long", + 8: "exec format error", + 9: "bad file descriptor", + 10: "no child processes", + 11: "resource temporarily unavailable", + 12: "cannot allocate memory", + 13: "permission denied", + 14: "bad address", + 15: "block device required", + 16: "device or resource busy", + 17: "file exists", + 18: "invalid cross-device link", + 19: "no such device", + 20: "not a directory", + 21: "is a directory", + 22: "invalid argument", + 23: "too many open files in system", + 24: "too many open files", + 25: "inappropriate ioctl for device", + 26: "text file busy", + 27: "file too large", + 28: "no space left on device", + 29: "illegal seek", + 30: "read-only file system", + 31: "too many links", + 32: "broken pipe", + 33: "numerical argument out of domain", + 34: "numerical result out of range", + 36: "operation now in progress", + 37: "operation already in progress", + 38: "socket operation on non-socket", + 39: "destination address required", + 40: "message too long", + 41: "protocol wrong type for socket", + 42: "protocol not available", + 43: "protocol not supported", + 44: "socket type not supported", + 45: "operation not supported", + 46: "protocol family not supported", + 47: "address family not supported by protocol", + 48: "address already in use", + 49: "cannot assign requested address", + 50: "network is down", + 51: "network is unreachable", + 52: "network dropped connection on reset", + 53: "software caused connection abort", + 54: "connection reset by peer", + 55: "no buffer space available", + 56: "transport endpoint is already connected", + 57: "transport endpoint is not connected", + 58: "cannot send after transport endpoint shutdown", + 59: "too many references: cannot splice", + 60: "connection timed out", + 61: "connection refused", + 62: "too many levels of symbolic links", + 63: "file name too long", + 64: "host is down", + 65: "no route to host", + 66: "directory not empty", + 67: "too many processes", + 68: "too many users", + 69: "disk quota exceeded", + 70: "stale file handle", + 71: "object is remote", + 72: "device not a stream", + 73: "timer expired", + 74: "out of streams resources", + 75: "no message of desired type", + 76: "bad message", + 77: "identifier removed", + 78: "resource deadlock avoided", + 79: "no locks available", + 80: "machine is not on the network", + 81: "unknown error 81", + 82: "link has been severed", + 83: "advertise error", + 84: "srmount error", + 85: "communication error on send", + 86: "protocol error", + 87: "multihop attempted", + 88: "RFS specific error", + 89: "remote address changed", + 90: "function not implemented", + 91: "streams pipe error", + 92: "value too large for defined data type", + 93: "file descriptor in bad state", + 94: "channel number out of range", + 95: "level 2 not synchronized", + 96: "level 3 halted", + 97: "level 3 reset", + 98: "link number out of range", + 99: "protocol driver not attached", + 100: "no CSI structure available", + 101: "level 2 halted", + 102: "invalid exchange", + 103: "invalid request descriptor", + 104: "exchange full", + 105: "no anode", + 106: "invalid request code", + 107: "invalid slot", + 108: "file locking deadlock error", + 109: "bad font file format", + 110: "cannot exec a shared library directly", + 111: "no data available", + 112: "accessing a corrupted shared library", + 113: "package not installed", + 114: "can not access a needed shared library", + 115: "name not unique on network", + 116: "interrupted system call should be restarted", + 117: "structure needs cleaning", + 118: "not a XENIX named type file", + 119: "no XENIX semaphores available", + 120: "is a named type file", + 121: "remote I/O error", + 122: "invalid or incomplete multibyte or wide character", + 123: "attempting to link in too many shared libraries", + 124: ".lib section in a.out corrupted", + 125: "no medium found", + 126: "wrong medium type", + 127: "operation canceled", + 128: "required key not available", + 129: "key has expired", + 130: "key has been revoked", + 131: "key was rejected by service", + 132: "owner died", + 133: "state not recoverable", + 134: "operation not possible due to RF-kill", + 135: "memory page has hardware error", } // Signal table -var signalList = [...]struct { - num syscall.Signal - name string - desc string -}{ - {1, "SIGHUP", "hangup"}, - {2, "SIGINT", "interrupt"}, - {3, "SIGQUIT", "quit"}, - {4, "SIGILL", "illegal instruction"}, - {5, "SIGTRAP", "trace/breakpoint trap"}, - {6, "SIGABRT", "aborted"}, - {7, "SIGEMT", "EMT trap"}, - {8, "SIGFPE", "floating point exception"}, - {9, "SIGKILL", "killed"}, - {10, "SIGBUS", "bus error"}, - {11, "SIGSEGV", "segmentation fault"}, - {12, "SIGSYS", "bad system call"}, - {13, "SIGPIPE", "broken pipe"}, - {14, "SIGALRM", "alarm clock"}, - {15, "SIGTERM", "terminated"}, - {16, "SIGURG", "urgent I/O condition"}, - {17, "SIGSTOP", "stopped (signal)"}, - {18, "SIGTSTP", "stopped"}, - {19, "SIGCONT", "continued"}, - {20, "SIGCHLD", "child exited"}, - {21, "SIGTTIN", "stopped (tty input)"}, - {22, "SIGTTOU", "stopped (tty output)"}, - {23, "SIGIO", "I/O possible"}, - {24, "SIGXCPU", "CPU time limit exceeded"}, - {25, "SIGXFSZ", "file size limit exceeded"}, - {26, "SIGVTALRM", "virtual timer expired"}, - {27, "SIGPROF", "profiling timer expired"}, - {28, "SIGWINCH", "window changed"}, - {29, "SIGLOST", "power failure"}, - {30, "SIGUSR1", "user defined signal 1"}, - {31, "SIGUSR2", "user defined signal 2"}, +var signals = [...]string{ + 1: "hangup", + 2: "interrupt", + 3: "quit", + 4: "illegal instruction", + 5: "trace/breakpoint trap", + 6: "aborted", + 7: "EMT trap", + 8: "floating point exception", + 9: "killed", + 10: "bus error", + 11: "segmentation fault", + 12: "bad system call", + 13: "broken pipe", + 14: "alarm clock", + 15: "terminated", + 16: "urgent I/O condition", + 17: "stopped (signal)", + 18: "stopped", + 19: "continued", + 20: "child exited", + 21: "stopped (tty input)", + 22: "stopped (tty output)", + 23: "I/O possible", + 24: "CPU time limit exceeded", + 25: "file size limit exceeded", + 26: "virtual timer expired", + 27: "profiling timer expired", + 28: "window changed", + 29: "resource lost", + 30: "user defined signal 1", + 31: "user defined signal 2", } diff --git a/vendor/golang.org/x/sys/unix/zerrors_openbsd_amd64.go b/vendor/golang.org/x/sys/unix/zerrors_openbsd_amd64.go index 1f9e8a29ea..12261a562f 100644 --- a/vendor/golang.org/x/sys/unix/zerrors_openbsd_amd64.go +++ b/vendor/golang.org/x/sys/unix/zerrors_openbsd_amd64.go @@ -952,7 +952,6 @@ const ( MNT_NOATIME = 0x8000 MNT_NODEV = 0x10 MNT_NOEXEC = 0x4 - MNT_NOPERM = 0x20 MNT_NOSUID = 0x8 MNT_NOWAIT = 0x2 MNT_QUOTA = 0x2000 @@ -960,7 +959,6 @@ const ( MNT_RELOAD = 0x40000 MNT_ROOTFS = 0x4000 MNT_SOFTDEP = 0x4000000 - MNT_STALLED = 0x100000 MNT_SYNCHRONOUS = 0x2 MNT_UPDATE = 0x10000 MNT_VISFLAGMASK = 0x400ffff @@ -1443,8 +1441,6 @@ const ( TIOCUCNTL_CBRK = 0x7a TIOCUCNTL_SBRK = 0x7b TOSTOP = 0x400000 - UTIME_NOW = -0x2 - UTIME_OMIT = -0x1 VDISCARD = 0xf VDSUSP = 0xb VEOF = 0x0 diff --git a/vendor/golang.org/x/sys/unix/zsyscall_linux_amd64.go b/vendor/golang.org/x/sys/unix/zsyscall_linux_amd64.go index 46e9ddfb52..11a30786cf 100644 --- a/vendor/golang.org/x/sys/unix/zsyscall_linux_amd64.go +++ b/vendor/golang.org/x/sys/unix/zsyscall_linux_amd64.go @@ -2296,18 +2296,3 @@ func poll(fds *PollFd, nfds int, timeout int) (n int, err error) { } return } - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func kexecFileLoad(kernelFd int, initrdFd int, cmdlineLen int, cmdline string, flags int) (err error) { - var _p0 *byte - _p0, err = BytePtrFromString(cmdline) - if err != nil { - return - } - _, _, e1 := Syscall6(SYS_KEXEC_FILE_LOAD, uintptr(kernelFd), uintptr(initrdFd), uintptr(cmdlineLen), uintptr(unsafe.Pointer(_p0)), uintptr(flags), 0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} diff --git a/vendor/golang.org/x/sys/unix/zsyscall_linux_ppc64.go b/vendor/golang.org/x/sys/unix/zsyscall_linux_ppc64.go index c8ca4279e4..8300814d2c 100644 --- a/vendor/golang.org/x/sys/unix/zsyscall_linux_ppc64.go +++ b/vendor/golang.org/x/sys/unix/zsyscall_linux_ppc64.go @@ -2343,18 +2343,3 @@ func syncFileRange2(fd int, flags int, off int64, n int64) (err error) { } return } - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func kexecFileLoad(kernelFd int, initrdFd int, cmdlineLen int, cmdline string, flags int) (err error) { - var _p0 *byte - _p0, err = BytePtrFromString(cmdline) - if err != nil { - return - } - _, _, e1 := Syscall6(SYS_KEXEC_FILE_LOAD, uintptr(kernelFd), uintptr(initrdFd), uintptr(cmdlineLen), uintptr(unsafe.Pointer(_p0)), uintptr(flags), 0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} diff --git a/vendor/golang.org/x/sys/unix/zsyscall_linux_ppc64le.go b/vendor/golang.org/x/sys/unix/zsyscall_linux_ppc64le.go index 870c8f6db6..002b4e175a 100644 --- a/vendor/golang.org/x/sys/unix/zsyscall_linux_ppc64le.go +++ b/vendor/golang.org/x/sys/unix/zsyscall_linux_ppc64le.go @@ -2343,18 +2343,3 @@ func syncFileRange2(fd int, flags int, off int64, n int64) (err error) { } return } - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func kexecFileLoad(kernelFd int, initrdFd int, cmdlineLen int, cmdline string, flags int) (err error) { - var _p0 *byte - _p0, err = BytePtrFromString(cmdline) - if err != nil { - return - } - _, _, e1 := Syscall6(SYS_KEXEC_FILE_LOAD, uintptr(kernelFd), uintptr(initrdFd), uintptr(cmdlineLen), uintptr(unsafe.Pointer(_p0)), uintptr(flags), 0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} diff --git a/vendor/golang.org/x/sys/unix/zsyscall_linux_s390x.go b/vendor/golang.org/x/sys/unix/zsyscall_linux_s390x.go index 55e79d6407..1a9ba99925 100644 --- a/vendor/golang.org/x/sys/unix/zsyscall_linux_s390x.go +++ b/vendor/golang.org/x/sys/unix/zsyscall_linux_s390x.go @@ -2113,18 +2113,3 @@ func poll(fds *PollFd, nfds int, timeout int) (n int, err error) { } return } - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func kexecFileLoad(kernelFd int, initrdFd int, cmdlineLen int, cmdline string, flags int) (err error) { - var _p0 *byte - _p0, err = BytePtrFromString(cmdline) - if err != nil { - return - } - _, _, e1 := Syscall6(SYS_KEXEC_FILE_LOAD, uintptr(kernelFd), uintptr(initrdFd), uintptr(cmdlineLen), uintptr(unsafe.Pointer(_p0)), uintptr(flags), 0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} diff --git a/vendor/golang.org/x/sys/unix/zsyscall_solaris_amd64.go b/vendor/golang.org/x/sys/unix/zsyscall_solaris_amd64.go index 97b22a499e..e2e5fc5e0a 100644 --- a/vendor/golang.org/x/sys/unix/zsyscall_solaris_amd64.go +++ b/vendor/golang.org/x/sys/unix/zsyscall_solaris_amd64.go @@ -399,8 +399,6 @@ var ( procrecvfrom syscallFunc ) -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - func pipe(p *[2]_C_int) (n int, err error) { r0, _, e1 := rawSysvicall6(uintptr(unsafe.Pointer(&procpipe)), 1, uintptr(unsafe.Pointer(p)), 0, 0, 0, 0, 0) n = int(r0) @@ -410,8 +408,6 @@ func pipe(p *[2]_C_int) (n int, err error) { return } -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - func getsockname(fd int, rsa *RawSockaddrAny, addrlen *_Socklen) (err error) { _, _, e1 := sysvicall6(uintptr(unsafe.Pointer(&procgetsockname)), 3, uintptr(fd), uintptr(unsafe.Pointer(rsa)), uintptr(unsafe.Pointer(addrlen)), 0, 0, 0) if e1 != 0 { @@ -420,8 +416,6 @@ func getsockname(fd int, rsa *RawSockaddrAny, addrlen *_Socklen) (err error) { return } -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - func Getcwd(buf []byte) (n int, err error) { var _p0 *byte if len(buf) > 0 { @@ -435,8 +429,6 @@ func Getcwd(buf []byte) (n int, err error) { return } -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - func getgroups(ngid int, gid *_Gid_t) (n int, err error) { r0, _, e1 := rawSysvicall6(uintptr(unsafe.Pointer(&procgetgroups)), 2, uintptr(ngid), uintptr(unsafe.Pointer(gid)), 0, 0, 0, 0) n = int(r0) @@ -446,8 +438,6 @@ func getgroups(ngid int, gid *_Gid_t) (n int, err error) { return } -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - func setgroups(ngid int, gid *_Gid_t) (err error) { _, _, e1 := rawSysvicall6(uintptr(unsafe.Pointer(&procsetgroups)), 2, uintptr(ngid), uintptr(unsafe.Pointer(gid)), 0, 0, 0, 0) if e1 != 0 { @@ -456,8 +446,6 @@ func setgroups(ngid int, gid *_Gid_t) (err error) { return } -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - func wait4(pid int32, statusp *_C_int, options int, rusage *Rusage) (wpid int32, err error) { r0, _, e1 := sysvicall6(uintptr(unsafe.Pointer(&procwait4)), 4, uintptr(pid), uintptr(unsafe.Pointer(statusp)), uintptr(options), uintptr(unsafe.Pointer(rusage)), 0, 0) wpid = int32(r0) @@ -467,8 +455,6 @@ func wait4(pid int32, statusp *_C_int, options int, rusage *Rusage) (wpid int32, return } -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - func gethostname(buf []byte) (n int, err error) { var _p0 *byte if len(buf) > 0 { @@ -482,8 +468,6 @@ func gethostname(buf []byte) (n int, err error) { return } -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - func utimes(path string, times *[2]Timeval) (err error) { var _p0 *byte _p0, err = BytePtrFromString(path) @@ -497,8 +481,6 @@ func utimes(path string, times *[2]Timeval) (err error) { return } -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - func utimensat(fd int, path string, times *[2]Timespec, flag int) (err error) { var _p0 *byte _p0, err = BytePtrFromString(path) @@ -512,8 +494,6 @@ func utimensat(fd int, path string, times *[2]Timespec, flag int) (err error) { return } -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - func fcntl(fd int, cmd int, arg int) (val int, err error) { r0, _, e1 := sysvicall6(uintptr(unsafe.Pointer(&procfcntl)), 3, uintptr(fd), uintptr(cmd), uintptr(arg), 0, 0, 0) val = int(r0) @@ -523,8 +503,6 @@ func fcntl(fd int, cmd int, arg int) (val int, err error) { return } -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - func futimesat(fildes int, path *byte, times *[2]Timeval) (err error) { _, _, e1 := sysvicall6(uintptr(unsafe.Pointer(&procfutimesat)), 3, uintptr(fildes), uintptr(unsafe.Pointer(path)), uintptr(unsafe.Pointer(times)), 0, 0, 0) if e1 != 0 { @@ -533,8 +511,6 @@ func futimesat(fildes int, path *byte, times *[2]Timeval) (err error) { return } -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - func accept(s int, rsa *RawSockaddrAny, addrlen *_Socklen) (fd int, err error) { r0, _, e1 := sysvicall6(uintptr(unsafe.Pointer(&procaccept)), 3, uintptr(s), uintptr(unsafe.Pointer(rsa)), uintptr(unsafe.Pointer(addrlen)), 0, 0, 0) fd = int(r0) @@ -544,8 +520,6 @@ func accept(s int, rsa *RawSockaddrAny, addrlen *_Socklen) (fd int, err error) { return } -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - func recvmsg(s int, msg *Msghdr, flags int) (n int, err error) { r0, _, e1 := sysvicall6(uintptr(unsafe.Pointer(&proc__xnet_recvmsg)), 3, uintptr(s), uintptr(unsafe.Pointer(msg)), uintptr(flags), 0, 0, 0) n = int(r0) @@ -555,8 +529,6 @@ func recvmsg(s int, msg *Msghdr, flags int) (n int, err error) { return } -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - func sendmsg(s int, msg *Msghdr, flags int) (n int, err error) { r0, _, e1 := sysvicall6(uintptr(unsafe.Pointer(&proc__xnet_sendmsg)), 3, uintptr(s), uintptr(unsafe.Pointer(msg)), uintptr(flags), 0, 0, 0) n = int(r0) @@ -566,8 +538,6 @@ func sendmsg(s int, msg *Msghdr, flags int) (n int, err error) { return } -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - func acct(path *byte) (err error) { _, _, e1 := sysvicall6(uintptr(unsafe.Pointer(&procacct)), 1, uintptr(unsafe.Pointer(path)), 0, 0, 0, 0, 0) if e1 != 0 { @@ -576,32 +546,24 @@ func acct(path *byte) (err error) { return } -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - func __makedev(version int, major uint, minor uint) (val uint64) { r0, _, _ := sysvicall6(uintptr(unsafe.Pointer(&proc__makedev)), 3, uintptr(version), uintptr(major), uintptr(minor), 0, 0, 0) val = uint64(r0) return } -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - func __major(version int, dev uint64) (val uint) { r0, _, _ := sysvicall6(uintptr(unsafe.Pointer(&proc__major)), 2, uintptr(version), uintptr(dev), 0, 0, 0, 0) val = uint(r0) return } -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - func __minor(version int, dev uint64) (val uint) { r0, _, _ := sysvicall6(uintptr(unsafe.Pointer(&proc__minor)), 2, uintptr(version), uintptr(dev), 0, 0, 0, 0) val = uint(r0) return } -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - func ioctl(fd int, req uint, arg uintptr) (err error) { _, _, e1 := sysvicall6(uintptr(unsafe.Pointer(&procioctl)), 3, uintptr(fd), uintptr(req), uintptr(arg), 0, 0, 0) if e1 != 0 { @@ -610,8 +572,6 @@ func ioctl(fd int, req uint, arg uintptr) (err error) { return } -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - func poll(fds *PollFd, nfds int, timeout int) (n int, err error) { r0, _, e1 := sysvicall6(uintptr(unsafe.Pointer(&procpoll)), 3, uintptr(unsafe.Pointer(fds)), uintptr(nfds), uintptr(timeout), 0, 0, 0) n = int(r0) @@ -621,8 +581,6 @@ func poll(fds *PollFd, nfds int, timeout int) (n int, err error) { return } -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - func Access(path string, mode uint32) (err error) { var _p0 *byte _p0, err = BytePtrFromString(path) @@ -636,8 +594,6 @@ func Access(path string, mode uint32) (err error) { return } -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - func Adjtime(delta *Timeval, olddelta *Timeval) (err error) { _, _, e1 := sysvicall6(uintptr(unsafe.Pointer(&procAdjtime)), 2, uintptr(unsafe.Pointer(delta)), uintptr(unsafe.Pointer(olddelta)), 0, 0, 0, 0) if e1 != 0 { @@ -646,8 +602,6 @@ func Adjtime(delta *Timeval, olddelta *Timeval) (err error) { return } -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - func Chdir(path string) (err error) { var _p0 *byte _p0, err = BytePtrFromString(path) @@ -661,8 +615,6 @@ func Chdir(path string) (err error) { return } -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - func Chmod(path string, mode uint32) (err error) { var _p0 *byte _p0, err = BytePtrFromString(path) @@ -676,8 +628,6 @@ func Chmod(path string, mode uint32) (err error) { return } -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - func Chown(path string, uid int, gid int) (err error) { var _p0 *byte _p0, err = BytePtrFromString(path) @@ -691,8 +641,6 @@ func Chown(path string, uid int, gid int) (err error) { return } -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - func Chroot(path string) (err error) { var _p0 *byte _p0, err = BytePtrFromString(path) @@ -706,8 +654,6 @@ func Chroot(path string) (err error) { return } -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - func Close(fd int) (err error) { _, _, e1 := sysvicall6(uintptr(unsafe.Pointer(&procClose)), 1, uintptr(fd), 0, 0, 0, 0, 0) if e1 != 0 { @@ -716,8 +662,6 @@ func Close(fd int) (err error) { return } -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - func Creat(path string, mode uint32) (fd int, err error) { var _p0 *byte _p0, err = BytePtrFromString(path) @@ -732,8 +676,6 @@ func Creat(path string, mode uint32) (fd int, err error) { return } -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - func Dup(fd int) (nfd int, err error) { r0, _, e1 := sysvicall6(uintptr(unsafe.Pointer(&procDup)), 1, uintptr(fd), 0, 0, 0, 0, 0) nfd = int(r0) @@ -743,8 +685,6 @@ func Dup(fd int) (nfd int, err error) { return } -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - func Dup2(oldfd int, newfd int) (err error) { _, _, e1 := sysvicall6(uintptr(unsafe.Pointer(&procDup2)), 2, uintptr(oldfd), uintptr(newfd), 0, 0, 0, 0) if e1 != 0 { @@ -753,15 +693,11 @@ func Dup2(oldfd int, newfd int) (err error) { return } -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - func Exit(code int) { sysvicall6(uintptr(unsafe.Pointer(&procExit)), 1, uintptr(code), 0, 0, 0, 0, 0) return } -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - func Faccessat(dirfd int, path string, mode uint32, flags int) (err error) { var _p0 *byte _p0, err = BytePtrFromString(path) @@ -775,8 +711,6 @@ func Faccessat(dirfd int, path string, mode uint32, flags int) (err error) { return } -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - func Fchdir(fd int) (err error) { _, _, e1 := sysvicall6(uintptr(unsafe.Pointer(&procFchdir)), 1, uintptr(fd), 0, 0, 0, 0, 0) if e1 != 0 { @@ -785,8 +719,6 @@ func Fchdir(fd int) (err error) { return } -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - func Fchmod(fd int, mode uint32) (err error) { _, _, e1 := sysvicall6(uintptr(unsafe.Pointer(&procFchmod)), 2, uintptr(fd), uintptr(mode), 0, 0, 0, 0) if e1 != 0 { @@ -795,8 +727,6 @@ func Fchmod(fd int, mode uint32) (err error) { return } -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - func Fchmodat(dirfd int, path string, mode uint32, flags int) (err error) { var _p0 *byte _p0, err = BytePtrFromString(path) @@ -810,8 +740,6 @@ func Fchmodat(dirfd int, path string, mode uint32, flags int) (err error) { return } -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - func Fchown(fd int, uid int, gid int) (err error) { _, _, e1 := sysvicall6(uintptr(unsafe.Pointer(&procFchown)), 3, uintptr(fd), uintptr(uid), uintptr(gid), 0, 0, 0) if e1 != 0 { @@ -820,8 +748,6 @@ func Fchown(fd int, uid int, gid int) (err error) { return } -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - func Fchownat(dirfd int, path string, uid int, gid int, flags int) (err error) { var _p0 *byte _p0, err = BytePtrFromString(path) @@ -835,8 +761,6 @@ func Fchownat(dirfd int, path string, uid int, gid int, flags int) (err error) { return } -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - func Fdatasync(fd int) (err error) { _, _, e1 := sysvicall6(uintptr(unsafe.Pointer(&procFdatasync)), 1, uintptr(fd), 0, 0, 0, 0, 0) if e1 != 0 { @@ -845,8 +769,6 @@ func Fdatasync(fd int) (err error) { return } -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - func Flock(fd int, how int) (err error) { _, _, e1 := sysvicall6(uintptr(unsafe.Pointer(&procFlock)), 2, uintptr(fd), uintptr(how), 0, 0, 0, 0) if e1 != 0 { @@ -855,8 +777,6 @@ func Flock(fd int, how int) (err error) { return } -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - func Fpathconf(fd int, name int) (val int, err error) { r0, _, e1 := sysvicall6(uintptr(unsafe.Pointer(&procFpathconf)), 2, uintptr(fd), uintptr(name), 0, 0, 0, 0) val = int(r0) @@ -866,8 +786,6 @@ func Fpathconf(fd int, name int) (val int, err error) { return } -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - func Fstat(fd int, stat *Stat_t) (err error) { _, _, e1 := sysvicall6(uintptr(unsafe.Pointer(&procFstat)), 2, uintptr(fd), uintptr(unsafe.Pointer(stat)), 0, 0, 0, 0) if e1 != 0 { @@ -876,8 +794,6 @@ func Fstat(fd int, stat *Stat_t) (err error) { return } -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - func Fstatat(fd int, path string, stat *Stat_t, flags int) (err error) { var _p0 *byte _p0, err = BytePtrFromString(path) @@ -891,8 +807,6 @@ func Fstatat(fd int, path string, stat *Stat_t, flags int) (err error) { return } -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - func Fstatvfs(fd int, vfsstat *Statvfs_t) (err error) { _, _, e1 := sysvicall6(uintptr(unsafe.Pointer(&procFstatvfs)), 2, uintptr(fd), uintptr(unsafe.Pointer(vfsstat)), 0, 0, 0, 0) if e1 != 0 { @@ -901,8 +815,6 @@ func Fstatvfs(fd int, vfsstat *Statvfs_t) (err error) { return } -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - func Getdents(fd int, buf []byte, basep *uintptr) (n int, err error) { var _p0 *byte if len(buf) > 0 { @@ -916,24 +828,18 @@ func Getdents(fd int, buf []byte, basep *uintptr) (n int, err error) { return } -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - func Getgid() (gid int) { r0, _, _ := rawSysvicall6(uintptr(unsafe.Pointer(&procGetgid)), 0, 0, 0, 0, 0, 0, 0) gid = int(r0) return } -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - func Getpid() (pid int) { r0, _, _ := rawSysvicall6(uintptr(unsafe.Pointer(&procGetpid)), 0, 0, 0, 0, 0, 0, 0) pid = int(r0) return } -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - func Getpgid(pid int) (pgid int, err error) { r0, _, e1 := rawSysvicall6(uintptr(unsafe.Pointer(&procGetpgid)), 1, uintptr(pid), 0, 0, 0, 0, 0) pgid = int(r0) @@ -943,8 +849,6 @@ func Getpgid(pid int) (pgid int, err error) { return } -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - func Getpgrp() (pgid int, err error) { r0, _, e1 := rawSysvicall6(uintptr(unsafe.Pointer(&procGetpgrp)), 0, 0, 0, 0, 0, 0, 0) pgid = int(r0) @@ -954,32 +858,24 @@ func Getpgrp() (pgid int, err error) { return } -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - func Geteuid() (euid int) { r0, _, _ := sysvicall6(uintptr(unsafe.Pointer(&procGeteuid)), 0, 0, 0, 0, 0, 0, 0) euid = int(r0) return } -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - func Getegid() (egid int) { r0, _, _ := sysvicall6(uintptr(unsafe.Pointer(&procGetegid)), 0, 0, 0, 0, 0, 0, 0) egid = int(r0) return } -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - func Getppid() (ppid int) { r0, _, _ := sysvicall6(uintptr(unsafe.Pointer(&procGetppid)), 0, 0, 0, 0, 0, 0, 0) ppid = int(r0) return } -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - func Getpriority(which int, who int) (n int, err error) { r0, _, e1 := sysvicall6(uintptr(unsafe.Pointer(&procGetpriority)), 2, uintptr(which), uintptr(who), 0, 0, 0, 0) n = int(r0) @@ -989,8 +885,6 @@ func Getpriority(which int, who int) (n int, err error) { return } -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - func Getrlimit(which int, lim *Rlimit) (err error) { _, _, e1 := rawSysvicall6(uintptr(unsafe.Pointer(&procGetrlimit)), 2, uintptr(which), uintptr(unsafe.Pointer(lim)), 0, 0, 0, 0) if e1 != 0 { @@ -999,8 +893,6 @@ func Getrlimit(which int, lim *Rlimit) (err error) { return } -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - func Getrusage(who int, rusage *Rusage) (err error) { _, _, e1 := rawSysvicall6(uintptr(unsafe.Pointer(&procGetrusage)), 2, uintptr(who), uintptr(unsafe.Pointer(rusage)), 0, 0, 0, 0) if e1 != 0 { @@ -1009,8 +901,6 @@ func Getrusage(who int, rusage *Rusage) (err error) { return } -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - func Gettimeofday(tv *Timeval) (err error) { _, _, e1 := rawSysvicall6(uintptr(unsafe.Pointer(&procGettimeofday)), 1, uintptr(unsafe.Pointer(tv)), 0, 0, 0, 0, 0) if e1 != 0 { @@ -1019,16 +909,12 @@ func Gettimeofday(tv *Timeval) (err error) { return } -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - func Getuid() (uid int) { r0, _, _ := rawSysvicall6(uintptr(unsafe.Pointer(&procGetuid)), 0, 0, 0, 0, 0, 0, 0) uid = int(r0) return } -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - func Kill(pid int, signum syscall.Signal) (err error) { _, _, e1 := sysvicall6(uintptr(unsafe.Pointer(&procKill)), 2, uintptr(pid), uintptr(signum), 0, 0, 0, 0) if e1 != 0 { @@ -1037,8 +923,6 @@ func Kill(pid int, signum syscall.Signal) (err error) { return } -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - func Lchown(path string, uid int, gid int) (err error) { var _p0 *byte _p0, err = BytePtrFromString(path) @@ -1052,8 +936,6 @@ func Lchown(path string, uid int, gid int) (err error) { return } -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - func Link(path string, link string) (err error) { var _p0 *byte _p0, err = BytePtrFromString(path) @@ -1072,8 +954,6 @@ func Link(path string, link string) (err error) { return } -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - func Listen(s int, backlog int) (err error) { _, _, e1 := sysvicall6(uintptr(unsafe.Pointer(&proc__xnet_llisten)), 2, uintptr(s), uintptr(backlog), 0, 0, 0, 0) if e1 != 0 { @@ -1082,8 +962,6 @@ func Listen(s int, backlog int) (err error) { return } -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - func Lstat(path string, stat *Stat_t) (err error) { var _p0 *byte _p0, err = BytePtrFromString(path) @@ -1097,8 +975,6 @@ func Lstat(path string, stat *Stat_t) (err error) { return } -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - func Madvise(b []byte, advice int) (err error) { var _p0 *byte if len(b) > 0 { @@ -1111,8 +987,6 @@ func Madvise(b []byte, advice int) (err error) { return } -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - func Mkdir(path string, mode uint32) (err error) { var _p0 *byte _p0, err = BytePtrFromString(path) @@ -1126,8 +1000,6 @@ func Mkdir(path string, mode uint32) (err error) { return } -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - func Mkdirat(dirfd int, path string, mode uint32) (err error) { var _p0 *byte _p0, err = BytePtrFromString(path) @@ -1141,8 +1013,6 @@ func Mkdirat(dirfd int, path string, mode uint32) (err error) { return } -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - func Mkfifo(path string, mode uint32) (err error) { var _p0 *byte _p0, err = BytePtrFromString(path) @@ -1156,8 +1026,6 @@ func Mkfifo(path string, mode uint32) (err error) { return } -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - func Mkfifoat(dirfd int, path string, mode uint32) (err error) { var _p0 *byte _p0, err = BytePtrFromString(path) @@ -1171,8 +1039,6 @@ func Mkfifoat(dirfd int, path string, mode uint32) (err error) { return } -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - func Mknod(path string, mode uint32, dev int) (err error) { var _p0 *byte _p0, err = BytePtrFromString(path) @@ -1186,8 +1052,6 @@ func Mknod(path string, mode uint32, dev int) (err error) { return } -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - func Mknodat(dirfd int, path string, mode uint32, dev int) (err error) { var _p0 *byte _p0, err = BytePtrFromString(path) @@ -1201,8 +1065,6 @@ func Mknodat(dirfd int, path string, mode uint32, dev int) (err error) { return } -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - func Mlock(b []byte) (err error) { var _p0 *byte if len(b) > 0 { @@ -1215,8 +1077,6 @@ func Mlock(b []byte) (err error) { return } -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - func Mlockall(flags int) (err error) { _, _, e1 := sysvicall6(uintptr(unsafe.Pointer(&procMlockall)), 1, uintptr(flags), 0, 0, 0, 0, 0) if e1 != 0 { @@ -1225,8 +1085,6 @@ func Mlockall(flags int) (err error) { return } -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - func Mprotect(b []byte, prot int) (err error) { var _p0 *byte if len(b) > 0 { @@ -1239,8 +1097,6 @@ func Mprotect(b []byte, prot int) (err error) { return } -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - func Msync(b []byte, flags int) (err error) { var _p0 *byte if len(b) > 0 { @@ -1253,8 +1109,6 @@ func Msync(b []byte, flags int) (err error) { return } -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - func Munlock(b []byte) (err error) { var _p0 *byte if len(b) > 0 { @@ -1267,8 +1121,6 @@ func Munlock(b []byte) (err error) { return } -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - func Munlockall() (err error) { _, _, e1 := sysvicall6(uintptr(unsafe.Pointer(&procMunlockall)), 0, 0, 0, 0, 0, 0, 0) if e1 != 0 { @@ -1277,8 +1129,6 @@ func Munlockall() (err error) { return } -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - func Nanosleep(time *Timespec, leftover *Timespec) (err error) { _, _, e1 := sysvicall6(uintptr(unsafe.Pointer(&procNanosleep)), 2, uintptr(unsafe.Pointer(time)), uintptr(unsafe.Pointer(leftover)), 0, 0, 0, 0) if e1 != 0 { @@ -1287,8 +1137,6 @@ func Nanosleep(time *Timespec, leftover *Timespec) (err error) { return } -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - func Open(path string, mode int, perm uint32) (fd int, err error) { var _p0 *byte _p0, err = BytePtrFromString(path) @@ -1303,8 +1151,6 @@ func Open(path string, mode int, perm uint32) (fd int, err error) { return } -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - func Openat(dirfd int, path string, flags int, mode uint32) (fd int, err error) { var _p0 *byte _p0, err = BytePtrFromString(path) @@ -1319,8 +1165,6 @@ func Openat(dirfd int, path string, flags int, mode uint32) (fd int, err error) return } -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - func Pathconf(path string, name int) (val int, err error) { var _p0 *byte _p0, err = BytePtrFromString(path) @@ -1335,8 +1179,6 @@ func Pathconf(path string, name int) (val int, err error) { return } -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - func Pause() (err error) { _, _, e1 := sysvicall6(uintptr(unsafe.Pointer(&procPause)), 0, 0, 0, 0, 0, 0, 0) if e1 != 0 { @@ -1345,8 +1187,6 @@ func Pause() (err error) { return } -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - func Pread(fd int, p []byte, offset int64) (n int, err error) { var _p0 *byte if len(p) > 0 { @@ -1360,8 +1200,6 @@ func Pread(fd int, p []byte, offset int64) (n int, err error) { return } -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - func Pwrite(fd int, p []byte, offset int64) (n int, err error) { var _p0 *byte if len(p) > 0 { @@ -1375,8 +1213,6 @@ func Pwrite(fd int, p []byte, offset int64) (n int, err error) { return } -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - func read(fd int, p []byte) (n int, err error) { var _p0 *byte if len(p) > 0 { @@ -1390,8 +1226,6 @@ func read(fd int, p []byte) (n int, err error) { return } -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - func Readlink(path string, buf []byte) (n int, err error) { var _p0 *byte _p0, err = BytePtrFromString(path) @@ -1410,8 +1244,6 @@ func Readlink(path string, buf []byte) (n int, err error) { return } -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - func Rename(from string, to string) (err error) { var _p0 *byte _p0, err = BytePtrFromString(from) @@ -1430,8 +1262,6 @@ func Rename(from string, to string) (err error) { return } -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - func Renameat(olddirfd int, oldpath string, newdirfd int, newpath string) (err error) { var _p0 *byte _p0, err = BytePtrFromString(oldpath) @@ -1450,8 +1280,6 @@ func Renameat(olddirfd int, oldpath string, newdirfd int, newpath string) (err e return } -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - func Rmdir(path string) (err error) { var _p0 *byte _p0, err = BytePtrFromString(path) @@ -1465,8 +1293,6 @@ func Rmdir(path string) (err error) { return } -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - func Seek(fd int, offset int64, whence int) (newoffset int64, err error) { r0, _, e1 := sysvicall6(uintptr(unsafe.Pointer(&proclseek)), 3, uintptr(fd), uintptr(offset), uintptr(whence), 0, 0, 0) newoffset = int64(r0) @@ -1476,8 +1302,6 @@ func Seek(fd int, offset int64, whence int) (newoffset int64, err error) { return } -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - func Select(n int, r *FdSet, w *FdSet, e *FdSet, timeout *Timeval) (err error) { _, _, e1 := sysvicall6(uintptr(unsafe.Pointer(&procSelect)), 5, uintptr(n), uintptr(unsafe.Pointer(r)), uintptr(unsafe.Pointer(w)), uintptr(unsafe.Pointer(e)), uintptr(unsafe.Pointer(timeout)), 0) if e1 != 0 { @@ -1486,8 +1310,6 @@ func Select(n int, r *FdSet, w *FdSet, e *FdSet, timeout *Timeval) (err error) { return } -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - func Setegid(egid int) (err error) { _, _, e1 := rawSysvicall6(uintptr(unsafe.Pointer(&procSetegid)), 1, uintptr(egid), 0, 0, 0, 0, 0) if e1 != 0 { @@ -1496,8 +1318,6 @@ func Setegid(egid int) (err error) { return } -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - func Seteuid(euid int) (err error) { _, _, e1 := rawSysvicall6(uintptr(unsafe.Pointer(&procSeteuid)), 1, uintptr(euid), 0, 0, 0, 0, 0) if e1 != 0 { @@ -1506,8 +1326,6 @@ func Seteuid(euid int) (err error) { return } -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - func Setgid(gid int) (err error) { _, _, e1 := rawSysvicall6(uintptr(unsafe.Pointer(&procSetgid)), 1, uintptr(gid), 0, 0, 0, 0, 0) if e1 != 0 { @@ -1516,8 +1334,6 @@ func Setgid(gid int) (err error) { return } -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - func Sethostname(p []byte) (err error) { var _p0 *byte if len(p) > 0 { @@ -1530,8 +1346,6 @@ func Sethostname(p []byte) (err error) { return } -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - func Setpgid(pid int, pgid int) (err error) { _, _, e1 := rawSysvicall6(uintptr(unsafe.Pointer(&procSetpgid)), 2, uintptr(pid), uintptr(pgid), 0, 0, 0, 0) if e1 != 0 { @@ -1540,8 +1354,6 @@ func Setpgid(pid int, pgid int) (err error) { return } -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - func Setpriority(which int, who int, prio int) (err error) { _, _, e1 := sysvicall6(uintptr(unsafe.Pointer(&procSetpriority)), 3, uintptr(which), uintptr(who), uintptr(prio), 0, 0, 0) if e1 != 0 { @@ -1550,8 +1362,6 @@ func Setpriority(which int, who int, prio int) (err error) { return } -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - func Setregid(rgid int, egid int) (err error) { _, _, e1 := rawSysvicall6(uintptr(unsafe.Pointer(&procSetregid)), 2, uintptr(rgid), uintptr(egid), 0, 0, 0, 0) if e1 != 0 { @@ -1560,8 +1370,6 @@ func Setregid(rgid int, egid int) (err error) { return } -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - func Setreuid(ruid int, euid int) (err error) { _, _, e1 := rawSysvicall6(uintptr(unsafe.Pointer(&procSetreuid)), 2, uintptr(ruid), uintptr(euid), 0, 0, 0, 0) if e1 != 0 { @@ -1570,8 +1378,6 @@ func Setreuid(ruid int, euid int) (err error) { return } -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - func Setrlimit(which int, lim *Rlimit) (err error) { _, _, e1 := rawSysvicall6(uintptr(unsafe.Pointer(&procSetrlimit)), 2, uintptr(which), uintptr(unsafe.Pointer(lim)), 0, 0, 0, 0) if e1 != 0 { @@ -1580,8 +1386,6 @@ func Setrlimit(which int, lim *Rlimit) (err error) { return } -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - func Setsid() (pid int, err error) { r0, _, e1 := rawSysvicall6(uintptr(unsafe.Pointer(&procSetsid)), 0, 0, 0, 0, 0, 0, 0) pid = int(r0) @@ -1591,8 +1395,6 @@ func Setsid() (pid int, err error) { return } -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - func Setuid(uid int) (err error) { _, _, e1 := rawSysvicall6(uintptr(unsafe.Pointer(&procSetuid)), 1, uintptr(uid), 0, 0, 0, 0, 0) if e1 != 0 { @@ -1601,8 +1403,6 @@ func Setuid(uid int) (err error) { return } -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - func Shutdown(s int, how int) (err error) { _, _, e1 := sysvicall6(uintptr(unsafe.Pointer(&procshutdown)), 2, uintptr(s), uintptr(how), 0, 0, 0, 0) if e1 != 0 { @@ -1611,8 +1411,6 @@ func Shutdown(s int, how int) (err error) { return } -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - func Stat(path string, stat *Stat_t) (err error) { var _p0 *byte _p0, err = BytePtrFromString(path) @@ -1626,8 +1424,6 @@ func Stat(path string, stat *Stat_t) (err error) { return } -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - func Statvfs(path string, vfsstat *Statvfs_t) (err error) { var _p0 *byte _p0, err = BytePtrFromString(path) @@ -1641,8 +1437,6 @@ func Statvfs(path string, vfsstat *Statvfs_t) (err error) { return } -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - func Symlink(path string, link string) (err error) { var _p0 *byte _p0, err = BytePtrFromString(path) @@ -1661,8 +1455,6 @@ func Symlink(path string, link string) (err error) { return } -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - func Sync() (err error) { _, _, e1 := sysvicall6(uintptr(unsafe.Pointer(&procSync)), 0, 0, 0, 0, 0, 0, 0) if e1 != 0 { @@ -1671,8 +1463,6 @@ func Sync() (err error) { return } -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - func Times(tms *Tms) (ticks uintptr, err error) { r0, _, e1 := rawSysvicall6(uintptr(unsafe.Pointer(&procTimes)), 1, uintptr(unsafe.Pointer(tms)), 0, 0, 0, 0, 0) ticks = uintptr(r0) @@ -1682,8 +1472,6 @@ func Times(tms *Tms) (ticks uintptr, err error) { return } -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - func Truncate(path string, length int64) (err error) { var _p0 *byte _p0, err = BytePtrFromString(path) @@ -1697,8 +1485,6 @@ func Truncate(path string, length int64) (err error) { return } -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - func Fsync(fd int) (err error) { _, _, e1 := sysvicall6(uintptr(unsafe.Pointer(&procFsync)), 1, uintptr(fd), 0, 0, 0, 0, 0) if e1 != 0 { @@ -1707,8 +1493,6 @@ func Fsync(fd int) (err error) { return } -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - func Ftruncate(fd int, length int64) (err error) { _, _, e1 := sysvicall6(uintptr(unsafe.Pointer(&procFtruncate)), 2, uintptr(fd), uintptr(length), 0, 0, 0, 0) if e1 != 0 { @@ -1717,16 +1501,12 @@ func Ftruncate(fd int, length int64) (err error) { return } -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - func Umask(mask int) (oldmask int) { r0, _, _ := sysvicall6(uintptr(unsafe.Pointer(&procUmask)), 1, uintptr(mask), 0, 0, 0, 0, 0) oldmask = int(r0) return } -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - func Uname(buf *Utsname) (err error) { _, _, e1 := rawSysvicall6(uintptr(unsafe.Pointer(&procUname)), 1, uintptr(unsafe.Pointer(buf)), 0, 0, 0, 0, 0) if e1 != 0 { @@ -1735,8 +1515,6 @@ func Uname(buf *Utsname) (err error) { return } -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - func Unmount(target string, flags int) (err error) { var _p0 *byte _p0, err = BytePtrFromString(target) @@ -1750,8 +1528,6 @@ func Unmount(target string, flags int) (err error) { return } -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - func Unlink(path string) (err error) { var _p0 *byte _p0, err = BytePtrFromString(path) @@ -1765,8 +1541,6 @@ func Unlink(path string) (err error) { return } -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - func Unlinkat(dirfd int, path string, flags int) (err error) { var _p0 *byte _p0, err = BytePtrFromString(path) @@ -1780,8 +1554,6 @@ func Unlinkat(dirfd int, path string, flags int) (err error) { return } -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - func Ustat(dev int, ubuf *Ustat_t) (err error) { _, _, e1 := sysvicall6(uintptr(unsafe.Pointer(&procUstat)), 2, uintptr(dev), uintptr(unsafe.Pointer(ubuf)), 0, 0, 0, 0) if e1 != 0 { @@ -1790,8 +1562,6 @@ func Ustat(dev int, ubuf *Ustat_t) (err error) { return } -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - func Utime(path string, buf *Utimbuf) (err error) { var _p0 *byte _p0, err = BytePtrFromString(path) @@ -1805,8 +1575,6 @@ func Utime(path string, buf *Utimbuf) (err error) { return } -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - func bind(s int, addr unsafe.Pointer, addrlen _Socklen) (err error) { _, _, e1 := sysvicall6(uintptr(unsafe.Pointer(&proc__xnet_bind)), 3, uintptr(s), uintptr(addr), uintptr(addrlen), 0, 0, 0) if e1 != 0 { @@ -1815,8 +1583,6 @@ func bind(s int, addr unsafe.Pointer, addrlen _Socklen) (err error) { return } -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - func connect(s int, addr unsafe.Pointer, addrlen _Socklen) (err error) { _, _, e1 := sysvicall6(uintptr(unsafe.Pointer(&proc__xnet_connect)), 3, uintptr(s), uintptr(addr), uintptr(addrlen), 0, 0, 0) if e1 != 0 { @@ -1825,8 +1591,6 @@ func connect(s int, addr unsafe.Pointer, addrlen _Socklen) (err error) { return } -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - func mmap(addr uintptr, length uintptr, prot int, flag int, fd int, pos int64) (ret uintptr, err error) { r0, _, e1 := sysvicall6(uintptr(unsafe.Pointer(&procmmap)), 6, uintptr(addr), uintptr(length), uintptr(prot), uintptr(flag), uintptr(fd), uintptr(pos)) ret = uintptr(r0) @@ -1836,8 +1600,6 @@ func mmap(addr uintptr, length uintptr, prot int, flag int, fd int, pos int64) ( return } -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - func munmap(addr uintptr, length uintptr) (err error) { _, _, e1 := sysvicall6(uintptr(unsafe.Pointer(&procmunmap)), 2, uintptr(addr), uintptr(length), 0, 0, 0, 0) if e1 != 0 { @@ -1846,8 +1608,6 @@ func munmap(addr uintptr, length uintptr) (err error) { return } -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - func sendfile(outfd int, infd int, offset *int64, count int) (written int, err error) { r0, _, e1 := sysvicall6(uintptr(unsafe.Pointer(&procsendfile)), 4, uintptr(outfd), uintptr(infd), uintptr(unsafe.Pointer(offset)), uintptr(count), 0, 0) written = int(r0) @@ -1857,8 +1617,6 @@ func sendfile(outfd int, infd int, offset *int64, count int) (written int, err e return } -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - func sendto(s int, buf []byte, flags int, to unsafe.Pointer, addrlen _Socklen) (err error) { var _p0 *byte if len(buf) > 0 { @@ -1871,8 +1629,6 @@ func sendto(s int, buf []byte, flags int, to unsafe.Pointer, addrlen _Socklen) ( return } -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - func socket(domain int, typ int, proto int) (fd int, err error) { r0, _, e1 := sysvicall6(uintptr(unsafe.Pointer(&proc__xnet_socket)), 3, uintptr(domain), uintptr(typ), uintptr(proto), 0, 0, 0) fd = int(r0) @@ -1882,8 +1638,6 @@ func socket(domain int, typ int, proto int) (fd int, err error) { return } -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - func socketpair(domain int, typ int, proto int, fd *[2]int32) (err error) { _, _, e1 := rawSysvicall6(uintptr(unsafe.Pointer(&proc__xnet_socketpair)), 4, uintptr(domain), uintptr(typ), uintptr(proto), uintptr(unsafe.Pointer(fd)), 0, 0) if e1 != 0 { @@ -1892,8 +1646,6 @@ func socketpair(domain int, typ int, proto int, fd *[2]int32) (err error) { return } -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - func write(fd int, p []byte) (n int, err error) { var _p0 *byte if len(p) > 0 { @@ -1907,8 +1659,6 @@ func write(fd int, p []byte) (n int, err error) { return } -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - func getsockopt(s int, level int, name int, val unsafe.Pointer, vallen *_Socklen) (err error) { _, _, e1 := sysvicall6(uintptr(unsafe.Pointer(&proc__xnet_getsockopt)), 5, uintptr(s), uintptr(level), uintptr(name), uintptr(val), uintptr(unsafe.Pointer(vallen)), 0) if e1 != 0 { @@ -1917,8 +1667,6 @@ func getsockopt(s int, level int, name int, val unsafe.Pointer, vallen *_Socklen return } -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - func getpeername(fd int, rsa *RawSockaddrAny, addrlen *_Socklen) (err error) { _, _, e1 := rawSysvicall6(uintptr(unsafe.Pointer(&procgetpeername)), 3, uintptr(fd), uintptr(unsafe.Pointer(rsa)), uintptr(unsafe.Pointer(addrlen)), 0, 0, 0) if e1 != 0 { @@ -1927,8 +1675,6 @@ func getpeername(fd int, rsa *RawSockaddrAny, addrlen *_Socklen) (err error) { return } -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - func setsockopt(s int, level int, name int, val unsafe.Pointer, vallen uintptr) (err error) { _, _, e1 := sysvicall6(uintptr(unsafe.Pointer(&procsetsockopt)), 5, uintptr(s), uintptr(level), uintptr(name), uintptr(val), uintptr(vallen), 0) if e1 != 0 { @@ -1937,8 +1683,6 @@ func setsockopt(s int, level int, name int, val unsafe.Pointer, vallen uintptr) return } -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - func recvfrom(fd int, p []byte, flags int, from *RawSockaddrAny, fromlen *_Socklen) (n int, err error) { var _p0 *byte if len(p) > 0 { diff --git a/vendor/golang.org/x/sys/unix/zsysctl_openbsd_amd64.go b/vendor/golang.org/x/sys/unix/zsysctl_openbsd_amd64.go index d014451c9d..90c95c2c75 100644 --- a/vendor/golang.org/x/sys/unix/zsysctl_openbsd_amd64.go +++ b/vendor/golang.org/x/sys/unix/zsysctl_openbsd_amd64.go @@ -254,17 +254,4 @@ var sysctlMib = []mibentry{ {"net.mpls.ttl", []_C_int{4, 33, 2}}, {"net.pflow.stats", []_C_int{4, 34, 1}}, {"net.pipex.enable", []_C_int{4, 35, 1}}, - {"vm.anonmin", []_C_int{2, 7}}, - {"vm.loadavg", []_C_int{2, 2}}, - {"vm.maxslp", []_C_int{2, 10}}, - {"vm.nkmempages", []_C_int{2, 6}}, - {"vm.psstrings", []_C_int{2, 3}}, - {"vm.swapencrypt.enable", []_C_int{2, 5, 0}}, - {"vm.swapencrypt.keyscreated", []_C_int{2, 5, 1}}, - {"vm.swapencrypt.keysdeleted", []_C_int{2, 5, 2}}, - {"vm.uspace", []_C_int{2, 11}}, - {"vm.uvmexp", []_C_int{2, 4}}, - {"vm.vmmeter", []_C_int{2, 1}}, - {"vm.vnodemin", []_C_int{2, 9}}, - {"vm.vtextmin", []_C_int{2, 8}}, } diff --git a/vendor/golang.org/x/sys/unix/ztypes_aix_ppc.go b/vendor/golang.org/x/sys/unix/ztypes_aix_ppc.go index cedc9b0f26..f1cfe7db15 100644 --- a/vendor/golang.org/x/sys/unix/ztypes_aix_ppc.go +++ b/vendor/golang.org/x/sys/unix/ztypes_aix_ppc.go @@ -6,11 +6,11 @@ package unix const ( - SizeofPtr = 0x4 - SizeofShort = 0x2 - SizeofInt = 0x4 - SizeofLong = 0x4 - SizeofLongLong = 0x8 + sizeofPtr = 0x4 + sizeofShort = 0x2 + sizeofInt = 0x4 + sizeofLong = 0x4 + sizeofLongLong = 0x8 PathMax = 0x3ff ) diff --git a/vendor/golang.org/x/sys/unix/ztypes_aix_ppc64.go b/vendor/golang.org/x/sys/unix/ztypes_aix_ppc64.go index f46482d272..95581a3bc3 100644 --- a/vendor/golang.org/x/sys/unix/ztypes_aix_ppc64.go +++ b/vendor/golang.org/x/sys/unix/ztypes_aix_ppc64.go @@ -6,11 +6,11 @@ package unix const ( - SizeofPtr = 0x8 - SizeofShort = 0x2 - SizeofInt = 0x4 - SizeofLong = 0x8 - SizeofLongLong = 0x8 + sizeofPtr = 0x8 + sizeofShort = 0x2 + sizeofInt = 0x4 + sizeofLong = 0x8 + sizeofLongLong = 0x8 PathMax = 0x3ff ) diff --git a/vendor/golang.org/x/sys/unix/ztypes_darwin_386.go b/vendor/golang.org/x/sys/unix/ztypes_darwin_386.go index 2aeb52a886..327af5fba1 100644 --- a/vendor/golang.org/x/sys/unix/ztypes_darwin_386.go +++ b/vendor/golang.org/x/sys/unix/ztypes_darwin_386.go @@ -6,11 +6,11 @@ package unix const ( - SizeofPtr = 0x4 - SizeofShort = 0x2 - SizeofInt = 0x4 - SizeofLong = 0x4 - SizeofLongLong = 0x8 + sizeofPtr = 0x4 + sizeofShort = 0x2 + sizeofInt = 0x4 + sizeofLong = 0x4 + sizeofLongLong = 0x8 ) type ( diff --git a/vendor/golang.org/x/sys/unix/ztypes_darwin_amd64.go b/vendor/golang.org/x/sys/unix/ztypes_darwin_amd64.go index 0d0d9f2ccb..116e6e0757 100644 --- a/vendor/golang.org/x/sys/unix/ztypes_darwin_amd64.go +++ b/vendor/golang.org/x/sys/unix/ztypes_darwin_amd64.go @@ -6,11 +6,11 @@ package unix const ( - SizeofPtr = 0x8 - SizeofShort = 0x2 - SizeofInt = 0x4 - SizeofLong = 0x8 - SizeofLongLong = 0x8 + sizeofPtr = 0x8 + sizeofShort = 0x2 + sizeofInt = 0x4 + sizeofLong = 0x8 + sizeofLongLong = 0x8 ) type ( diff --git a/vendor/golang.org/x/sys/unix/ztypes_darwin_arm.go b/vendor/golang.org/x/sys/unix/ztypes_darwin_arm.go index 04e344b78d..2750ad7607 100644 --- a/vendor/golang.org/x/sys/unix/ztypes_darwin_arm.go +++ b/vendor/golang.org/x/sys/unix/ztypes_darwin_arm.go @@ -7,11 +7,11 @@ package unix const ( - SizeofPtr = 0x4 - SizeofShort = 0x2 - SizeofInt = 0x4 - SizeofLong = 0x4 - SizeofLongLong = 0x8 + sizeofPtr = 0x4 + sizeofShort = 0x2 + sizeofInt = 0x4 + sizeofLong = 0x4 + sizeofLongLong = 0x8 ) type ( diff --git a/vendor/golang.org/x/sys/unix/ztypes_darwin_arm64.go b/vendor/golang.org/x/sys/unix/ztypes_darwin_arm64.go index 9fec185c18..8cead0996c 100644 --- a/vendor/golang.org/x/sys/unix/ztypes_darwin_arm64.go +++ b/vendor/golang.org/x/sys/unix/ztypes_darwin_arm64.go @@ -6,11 +6,11 @@ package unix const ( - SizeofPtr = 0x8 - SizeofShort = 0x2 - SizeofInt = 0x4 - SizeofLong = 0x8 - SizeofLongLong = 0x8 + sizeofPtr = 0x8 + sizeofShort = 0x2 + sizeofInt = 0x4 + sizeofLong = 0x8 + sizeofLongLong = 0x8 ) type ( diff --git a/vendor/golang.org/x/sys/unix/ztypes_dragonfly_amd64.go b/vendor/golang.org/x/sys/unix/ztypes_dragonfly_amd64.go index 7b34e2e2c6..c01ae67016 100644 --- a/vendor/golang.org/x/sys/unix/ztypes_dragonfly_amd64.go +++ b/vendor/golang.org/x/sys/unix/ztypes_dragonfly_amd64.go @@ -6,11 +6,11 @@ package unix const ( - SizeofPtr = 0x8 - SizeofShort = 0x2 - SizeofInt = 0x4 - SizeofLong = 0x8 - SizeofLongLong = 0x8 + sizeofPtr = 0x8 + sizeofShort = 0x2 + sizeofInt = 0x4 + sizeofLong = 0x8 + sizeofLongLong = 0x8 ) type ( diff --git a/vendor/golang.org/x/sys/unix/ztypes_freebsd_386.go b/vendor/golang.org/x/sys/unix/ztypes_freebsd_386.go index 11380294ac..8006c5638e 100644 --- a/vendor/golang.org/x/sys/unix/ztypes_freebsd_386.go +++ b/vendor/golang.org/x/sys/unix/ztypes_freebsd_386.go @@ -6,11 +6,11 @@ package unix const ( - SizeofPtr = 0x4 - SizeofShort = 0x2 - SizeofInt = 0x4 - SizeofLong = 0x4 - SizeofLongLong = 0x8 + sizeofPtr = 0x4 + sizeofShort = 0x2 + sizeofInt = 0x4 + sizeofLong = 0x4 + sizeofLongLong = 0x8 ) type ( diff --git a/vendor/golang.org/x/sys/unix/ztypes_freebsd_amd64.go b/vendor/golang.org/x/sys/unix/ztypes_freebsd_amd64.go index a6fc127180..716774ded0 100644 --- a/vendor/golang.org/x/sys/unix/ztypes_freebsd_amd64.go +++ b/vendor/golang.org/x/sys/unix/ztypes_freebsd_amd64.go @@ -6,11 +6,11 @@ package unix const ( - SizeofPtr = 0x8 - SizeofShort = 0x2 - SizeofInt = 0x4 - SizeofLong = 0x8 - SizeofLongLong = 0x8 + sizeofPtr = 0x8 + sizeofShort = 0x2 + sizeofInt = 0x4 + sizeofLong = 0x8 + sizeofLongLong = 0x8 ) type ( diff --git a/vendor/golang.org/x/sys/unix/ztypes_freebsd_arm.go b/vendor/golang.org/x/sys/unix/ztypes_freebsd_arm.go index 6b3006d6b3..92e07b00f5 100644 --- a/vendor/golang.org/x/sys/unix/ztypes_freebsd_arm.go +++ b/vendor/golang.org/x/sys/unix/ztypes_freebsd_arm.go @@ -6,11 +6,11 @@ package unix const ( - SizeofPtr = 0x4 - SizeofShort = 0x2 - SizeofInt = 0x4 - SizeofLong = 0x4 - SizeofLongLong = 0x8 + sizeofPtr = 0x4 + sizeofShort = 0x2 + sizeofInt = 0x4 + sizeofLong = 0x4 + sizeofLongLong = 0x8 ) type ( diff --git a/vendor/golang.org/x/sys/unix/ztypes_linux_386.go b/vendor/golang.org/x/sys/unix/ztypes_linux_386.go index 3879002a9c..793b3fdd21 100644 --- a/vendor/golang.org/x/sys/unix/ztypes_linux_386.go +++ b/vendor/golang.org/x/sys/unix/ztypes_linux_386.go @@ -6,11 +6,11 @@ package unix const ( - SizeofPtr = 0x4 - SizeofShort = 0x2 - SizeofInt = 0x4 - SizeofLong = 0x4 - SizeofLongLong = 0x8 + sizeofPtr = 0x4 + sizeofShort = 0x2 + sizeofInt = 0x4 + sizeofLong = 0x4 + sizeofLongLong = 0x8 PathMax = 0x1000 ) @@ -1937,31 +1937,3 @@ type XDPDesc struct { Len uint32 Options uint32 } - -const ( - NCSI_CMD_UNSPEC = 0x0 - NCSI_CMD_PKG_INFO = 0x1 - NCSI_CMD_SET_INTERFACE = 0x2 - NCSI_CMD_CLEAR_INTERFACE = 0x3 - NCSI_ATTR_UNSPEC = 0x0 - NCSI_ATTR_IFINDEX = 0x1 - NCSI_ATTR_PACKAGE_LIST = 0x2 - NCSI_ATTR_PACKAGE_ID = 0x3 - NCSI_ATTR_CHANNEL_ID = 0x4 - NCSI_PKG_ATTR_UNSPEC = 0x0 - NCSI_PKG_ATTR = 0x1 - NCSI_PKG_ATTR_ID = 0x2 - NCSI_PKG_ATTR_FORCED = 0x3 - NCSI_PKG_ATTR_CHANNEL_LIST = 0x4 - NCSI_CHANNEL_ATTR_UNSPEC = 0x0 - NCSI_CHANNEL_ATTR = 0x1 - NCSI_CHANNEL_ATTR_ID = 0x2 - NCSI_CHANNEL_ATTR_VERSION_MAJOR = 0x3 - NCSI_CHANNEL_ATTR_VERSION_MINOR = 0x4 - NCSI_CHANNEL_ATTR_VERSION_STR = 0x5 - NCSI_CHANNEL_ATTR_LINK_STATE = 0x6 - NCSI_CHANNEL_ATTR_ACTIVE = 0x7 - NCSI_CHANNEL_ATTR_FORCED = 0x8 - NCSI_CHANNEL_ATTR_VLAN_LIST = 0x9 - NCSI_CHANNEL_ATTR_VLAN_ID = 0xa -) diff --git a/vendor/golang.org/x/sys/unix/ztypes_linux_amd64.go b/vendor/golang.org/x/sys/unix/ztypes_linux_amd64.go index cbc2c7d073..c3548848a4 100644 --- a/vendor/golang.org/x/sys/unix/ztypes_linux_amd64.go +++ b/vendor/golang.org/x/sys/unix/ztypes_linux_amd64.go @@ -6,11 +6,11 @@ package unix const ( - SizeofPtr = 0x8 - SizeofShort = 0x2 - SizeofInt = 0x4 - SizeofLong = 0x8 - SizeofLongLong = 0x8 + sizeofPtr = 0x8 + sizeofShort = 0x2 + sizeofInt = 0x4 + sizeofLong = 0x8 + sizeofLongLong = 0x8 PathMax = 0x1000 ) @@ -1959,31 +1959,3 @@ type XDPDesc struct { Len uint32 Options uint32 } - -const ( - NCSI_CMD_UNSPEC = 0x0 - NCSI_CMD_PKG_INFO = 0x1 - NCSI_CMD_SET_INTERFACE = 0x2 - NCSI_CMD_CLEAR_INTERFACE = 0x3 - NCSI_ATTR_UNSPEC = 0x0 - NCSI_ATTR_IFINDEX = 0x1 - NCSI_ATTR_PACKAGE_LIST = 0x2 - NCSI_ATTR_PACKAGE_ID = 0x3 - NCSI_ATTR_CHANNEL_ID = 0x4 - NCSI_PKG_ATTR_UNSPEC = 0x0 - NCSI_PKG_ATTR = 0x1 - NCSI_PKG_ATTR_ID = 0x2 - NCSI_PKG_ATTR_FORCED = 0x3 - NCSI_PKG_ATTR_CHANNEL_LIST = 0x4 - NCSI_CHANNEL_ATTR_UNSPEC = 0x0 - NCSI_CHANNEL_ATTR = 0x1 - NCSI_CHANNEL_ATTR_ID = 0x2 - NCSI_CHANNEL_ATTR_VERSION_MAJOR = 0x3 - NCSI_CHANNEL_ATTR_VERSION_MINOR = 0x4 - NCSI_CHANNEL_ATTR_VERSION_STR = 0x5 - NCSI_CHANNEL_ATTR_LINK_STATE = 0x6 - NCSI_CHANNEL_ATTR_ACTIVE = 0x7 - NCSI_CHANNEL_ATTR_FORCED = 0x8 - NCSI_CHANNEL_ATTR_VLAN_LIST = 0x9 - NCSI_CHANNEL_ATTR_VLAN_ID = 0xa -) diff --git a/vendor/golang.org/x/sys/unix/ztypes_linux_arm.go b/vendor/golang.org/x/sys/unix/ztypes_linux_arm.go index 6ed804fa3c..c7b6994329 100644 --- a/vendor/golang.org/x/sys/unix/ztypes_linux_arm.go +++ b/vendor/golang.org/x/sys/unix/ztypes_linux_arm.go @@ -6,11 +6,11 @@ package unix const ( - SizeofPtr = 0x4 - SizeofShort = 0x2 - SizeofInt = 0x4 - SizeofLong = 0x4 - SizeofLongLong = 0x8 + sizeofPtr = 0x4 + sizeofShort = 0x2 + sizeofInt = 0x4 + sizeofLong = 0x4 + sizeofLongLong = 0x8 PathMax = 0x1000 ) @@ -1927,31 +1927,3 @@ type XDPDesc struct { Len uint32 Options uint32 } - -const ( - NCSI_CMD_UNSPEC = 0x0 - NCSI_CMD_PKG_INFO = 0x1 - NCSI_CMD_SET_INTERFACE = 0x2 - NCSI_CMD_CLEAR_INTERFACE = 0x3 - NCSI_ATTR_UNSPEC = 0x0 - NCSI_ATTR_IFINDEX = 0x1 - NCSI_ATTR_PACKAGE_LIST = 0x2 - NCSI_ATTR_PACKAGE_ID = 0x3 - NCSI_ATTR_CHANNEL_ID = 0x4 - NCSI_PKG_ATTR_UNSPEC = 0x0 - NCSI_PKG_ATTR = 0x1 - NCSI_PKG_ATTR_ID = 0x2 - NCSI_PKG_ATTR_FORCED = 0x3 - NCSI_PKG_ATTR_CHANNEL_LIST = 0x4 - NCSI_CHANNEL_ATTR_UNSPEC = 0x0 - NCSI_CHANNEL_ATTR = 0x1 - NCSI_CHANNEL_ATTR_ID = 0x2 - NCSI_CHANNEL_ATTR_VERSION_MAJOR = 0x3 - NCSI_CHANNEL_ATTR_VERSION_MINOR = 0x4 - NCSI_CHANNEL_ATTR_VERSION_STR = 0x5 - NCSI_CHANNEL_ATTR_LINK_STATE = 0x6 - NCSI_CHANNEL_ATTR_ACTIVE = 0x7 - NCSI_CHANNEL_ATTR_FORCED = 0x8 - NCSI_CHANNEL_ATTR_VLAN_LIST = 0x9 - NCSI_CHANNEL_ATTR_VLAN_ID = 0xa -) diff --git a/vendor/golang.org/x/sys/unix/ztypes_linux_arm64.go b/vendor/golang.org/x/sys/unix/ztypes_linux_arm64.go index b5fe7ddf76..2339b21298 100644 --- a/vendor/golang.org/x/sys/unix/ztypes_linux_arm64.go +++ b/vendor/golang.org/x/sys/unix/ztypes_linux_arm64.go @@ -6,11 +6,11 @@ package unix const ( - SizeofPtr = 0x8 - SizeofShort = 0x2 - SizeofInt = 0x4 - SizeofLong = 0x8 - SizeofLongLong = 0x8 + sizeofPtr = 0x8 + sizeofShort = 0x2 + sizeofInt = 0x4 + sizeofLong = 0x8 + sizeofLongLong = 0x8 PathMax = 0x1000 ) @@ -1938,31 +1938,3 @@ type XDPDesc struct { Len uint32 Options uint32 } - -const ( - NCSI_CMD_UNSPEC = 0x0 - NCSI_CMD_PKG_INFO = 0x1 - NCSI_CMD_SET_INTERFACE = 0x2 - NCSI_CMD_CLEAR_INTERFACE = 0x3 - NCSI_ATTR_UNSPEC = 0x0 - NCSI_ATTR_IFINDEX = 0x1 - NCSI_ATTR_PACKAGE_LIST = 0x2 - NCSI_ATTR_PACKAGE_ID = 0x3 - NCSI_ATTR_CHANNEL_ID = 0x4 - NCSI_PKG_ATTR_UNSPEC = 0x0 - NCSI_PKG_ATTR = 0x1 - NCSI_PKG_ATTR_ID = 0x2 - NCSI_PKG_ATTR_FORCED = 0x3 - NCSI_PKG_ATTR_CHANNEL_LIST = 0x4 - NCSI_CHANNEL_ATTR_UNSPEC = 0x0 - NCSI_CHANNEL_ATTR = 0x1 - NCSI_CHANNEL_ATTR_ID = 0x2 - NCSI_CHANNEL_ATTR_VERSION_MAJOR = 0x3 - NCSI_CHANNEL_ATTR_VERSION_MINOR = 0x4 - NCSI_CHANNEL_ATTR_VERSION_STR = 0x5 - NCSI_CHANNEL_ATTR_LINK_STATE = 0x6 - NCSI_CHANNEL_ATTR_ACTIVE = 0x7 - NCSI_CHANNEL_ATTR_FORCED = 0x8 - NCSI_CHANNEL_ATTR_VLAN_LIST = 0x9 - NCSI_CHANNEL_ATTR_VLAN_ID = 0xa -) diff --git a/vendor/golang.org/x/sys/unix/ztypes_linux_mips.go b/vendor/golang.org/x/sys/unix/ztypes_linux_mips.go index 7379ad2d81..013462ba5d 100644 --- a/vendor/golang.org/x/sys/unix/ztypes_linux_mips.go +++ b/vendor/golang.org/x/sys/unix/ztypes_linux_mips.go @@ -6,11 +6,11 @@ package unix const ( - SizeofPtr = 0x4 - SizeofShort = 0x2 - SizeofInt = 0x4 - SizeofLong = 0x4 - SizeofLongLong = 0x8 + sizeofPtr = 0x4 + sizeofShort = 0x2 + sizeofInt = 0x4 + sizeofLong = 0x4 + sizeofLongLong = 0x8 PathMax = 0x1000 ) @@ -1932,31 +1932,3 @@ type XDPDesc struct { Len uint32 Options uint32 } - -const ( - NCSI_CMD_UNSPEC = 0x0 - NCSI_CMD_PKG_INFO = 0x1 - NCSI_CMD_SET_INTERFACE = 0x2 - NCSI_CMD_CLEAR_INTERFACE = 0x3 - NCSI_ATTR_UNSPEC = 0x0 - NCSI_ATTR_IFINDEX = 0x1 - NCSI_ATTR_PACKAGE_LIST = 0x2 - NCSI_ATTR_PACKAGE_ID = 0x3 - NCSI_ATTR_CHANNEL_ID = 0x4 - NCSI_PKG_ATTR_UNSPEC = 0x0 - NCSI_PKG_ATTR = 0x1 - NCSI_PKG_ATTR_ID = 0x2 - NCSI_PKG_ATTR_FORCED = 0x3 - NCSI_PKG_ATTR_CHANNEL_LIST = 0x4 - NCSI_CHANNEL_ATTR_UNSPEC = 0x0 - NCSI_CHANNEL_ATTR = 0x1 - NCSI_CHANNEL_ATTR_ID = 0x2 - NCSI_CHANNEL_ATTR_VERSION_MAJOR = 0x3 - NCSI_CHANNEL_ATTR_VERSION_MINOR = 0x4 - NCSI_CHANNEL_ATTR_VERSION_STR = 0x5 - NCSI_CHANNEL_ATTR_LINK_STATE = 0x6 - NCSI_CHANNEL_ATTR_ACTIVE = 0x7 - NCSI_CHANNEL_ATTR_FORCED = 0x8 - NCSI_CHANNEL_ATTR_VLAN_LIST = 0x9 - NCSI_CHANNEL_ATTR_VLAN_ID = 0xa -) diff --git a/vendor/golang.org/x/sys/unix/ztypes_linux_mips64.go b/vendor/golang.org/x/sys/unix/ztypes_linux_mips64.go index 0b131a24e1..86f0ab5520 100644 --- a/vendor/golang.org/x/sys/unix/ztypes_linux_mips64.go +++ b/vendor/golang.org/x/sys/unix/ztypes_linux_mips64.go @@ -6,11 +6,11 @@ package unix const ( - SizeofPtr = 0x8 - SizeofShort = 0x2 - SizeofInt = 0x4 - SizeofLong = 0x8 - SizeofLongLong = 0x8 + sizeofPtr = 0x8 + sizeofShort = 0x2 + sizeofInt = 0x4 + sizeofLong = 0x8 + sizeofLongLong = 0x8 PathMax = 0x1000 ) @@ -1940,31 +1940,3 @@ type XDPDesc struct { Len uint32 Options uint32 } - -const ( - NCSI_CMD_UNSPEC = 0x0 - NCSI_CMD_PKG_INFO = 0x1 - NCSI_CMD_SET_INTERFACE = 0x2 - NCSI_CMD_CLEAR_INTERFACE = 0x3 - NCSI_ATTR_UNSPEC = 0x0 - NCSI_ATTR_IFINDEX = 0x1 - NCSI_ATTR_PACKAGE_LIST = 0x2 - NCSI_ATTR_PACKAGE_ID = 0x3 - NCSI_ATTR_CHANNEL_ID = 0x4 - NCSI_PKG_ATTR_UNSPEC = 0x0 - NCSI_PKG_ATTR = 0x1 - NCSI_PKG_ATTR_ID = 0x2 - NCSI_PKG_ATTR_FORCED = 0x3 - NCSI_PKG_ATTR_CHANNEL_LIST = 0x4 - NCSI_CHANNEL_ATTR_UNSPEC = 0x0 - NCSI_CHANNEL_ATTR = 0x1 - NCSI_CHANNEL_ATTR_ID = 0x2 - NCSI_CHANNEL_ATTR_VERSION_MAJOR = 0x3 - NCSI_CHANNEL_ATTR_VERSION_MINOR = 0x4 - NCSI_CHANNEL_ATTR_VERSION_STR = 0x5 - NCSI_CHANNEL_ATTR_LINK_STATE = 0x6 - NCSI_CHANNEL_ATTR_ACTIVE = 0x7 - NCSI_CHANNEL_ATTR_FORCED = 0x8 - NCSI_CHANNEL_ATTR_VLAN_LIST = 0x9 - NCSI_CHANNEL_ATTR_VLAN_ID = 0xa -) diff --git a/vendor/golang.org/x/sys/unix/ztypes_linux_mips64le.go b/vendor/golang.org/x/sys/unix/ztypes_linux_mips64le.go index 9191020cc8..007537b4d3 100644 --- a/vendor/golang.org/x/sys/unix/ztypes_linux_mips64le.go +++ b/vendor/golang.org/x/sys/unix/ztypes_linux_mips64le.go @@ -6,11 +6,11 @@ package unix const ( - SizeofPtr = 0x8 - SizeofShort = 0x2 - SizeofInt = 0x4 - SizeofLong = 0x8 - SizeofLongLong = 0x8 + sizeofPtr = 0x8 + sizeofShort = 0x2 + sizeofInt = 0x4 + sizeofLong = 0x8 + sizeofLongLong = 0x8 PathMax = 0x1000 ) @@ -1940,31 +1940,3 @@ type XDPDesc struct { Len uint32 Options uint32 } - -const ( - NCSI_CMD_UNSPEC = 0x0 - NCSI_CMD_PKG_INFO = 0x1 - NCSI_CMD_SET_INTERFACE = 0x2 - NCSI_CMD_CLEAR_INTERFACE = 0x3 - NCSI_ATTR_UNSPEC = 0x0 - NCSI_ATTR_IFINDEX = 0x1 - NCSI_ATTR_PACKAGE_LIST = 0x2 - NCSI_ATTR_PACKAGE_ID = 0x3 - NCSI_ATTR_CHANNEL_ID = 0x4 - NCSI_PKG_ATTR_UNSPEC = 0x0 - NCSI_PKG_ATTR = 0x1 - NCSI_PKG_ATTR_ID = 0x2 - NCSI_PKG_ATTR_FORCED = 0x3 - NCSI_PKG_ATTR_CHANNEL_LIST = 0x4 - NCSI_CHANNEL_ATTR_UNSPEC = 0x0 - NCSI_CHANNEL_ATTR = 0x1 - NCSI_CHANNEL_ATTR_ID = 0x2 - NCSI_CHANNEL_ATTR_VERSION_MAJOR = 0x3 - NCSI_CHANNEL_ATTR_VERSION_MINOR = 0x4 - NCSI_CHANNEL_ATTR_VERSION_STR = 0x5 - NCSI_CHANNEL_ATTR_LINK_STATE = 0x6 - NCSI_CHANNEL_ATTR_ACTIVE = 0x7 - NCSI_CHANNEL_ATTR_FORCED = 0x8 - NCSI_CHANNEL_ATTR_VLAN_LIST = 0x9 - NCSI_CHANNEL_ATTR_VLAN_ID = 0xa -) diff --git a/vendor/golang.org/x/sys/unix/ztypes_linux_mipsle.go b/vendor/golang.org/x/sys/unix/ztypes_linux_mipsle.go index 8fcad32bfc..fc4a159124 100644 --- a/vendor/golang.org/x/sys/unix/ztypes_linux_mipsle.go +++ b/vendor/golang.org/x/sys/unix/ztypes_linux_mipsle.go @@ -6,11 +6,11 @@ package unix const ( - SizeofPtr = 0x4 - SizeofShort = 0x2 - SizeofInt = 0x4 - SizeofLong = 0x4 - SizeofLongLong = 0x8 + sizeofPtr = 0x4 + sizeofShort = 0x2 + sizeofInt = 0x4 + sizeofLong = 0x4 + sizeofLongLong = 0x8 PathMax = 0x1000 ) @@ -1932,31 +1932,3 @@ type XDPDesc struct { Len uint32 Options uint32 } - -const ( - NCSI_CMD_UNSPEC = 0x0 - NCSI_CMD_PKG_INFO = 0x1 - NCSI_CMD_SET_INTERFACE = 0x2 - NCSI_CMD_CLEAR_INTERFACE = 0x3 - NCSI_ATTR_UNSPEC = 0x0 - NCSI_ATTR_IFINDEX = 0x1 - NCSI_ATTR_PACKAGE_LIST = 0x2 - NCSI_ATTR_PACKAGE_ID = 0x3 - NCSI_ATTR_CHANNEL_ID = 0x4 - NCSI_PKG_ATTR_UNSPEC = 0x0 - NCSI_PKG_ATTR = 0x1 - NCSI_PKG_ATTR_ID = 0x2 - NCSI_PKG_ATTR_FORCED = 0x3 - NCSI_PKG_ATTR_CHANNEL_LIST = 0x4 - NCSI_CHANNEL_ATTR_UNSPEC = 0x0 - NCSI_CHANNEL_ATTR = 0x1 - NCSI_CHANNEL_ATTR_ID = 0x2 - NCSI_CHANNEL_ATTR_VERSION_MAJOR = 0x3 - NCSI_CHANNEL_ATTR_VERSION_MINOR = 0x4 - NCSI_CHANNEL_ATTR_VERSION_STR = 0x5 - NCSI_CHANNEL_ATTR_LINK_STATE = 0x6 - NCSI_CHANNEL_ATTR_ACTIVE = 0x7 - NCSI_CHANNEL_ATTR_FORCED = 0x8 - NCSI_CHANNEL_ATTR_VLAN_LIST = 0x9 - NCSI_CHANNEL_ATTR_VLAN_ID = 0xa -) diff --git a/vendor/golang.org/x/sys/unix/ztypes_linux_ppc64.go b/vendor/golang.org/x/sys/unix/ztypes_linux_ppc64.go index a9d1b6c9ff..377e9efdfc 100644 --- a/vendor/golang.org/x/sys/unix/ztypes_linux_ppc64.go +++ b/vendor/golang.org/x/sys/unix/ztypes_linux_ppc64.go @@ -6,11 +6,11 @@ package unix const ( - SizeofPtr = 0x8 - SizeofShort = 0x2 - SizeofInt = 0x4 - SizeofLong = 0x8 - SizeofLongLong = 0x8 + sizeofPtr = 0x8 + sizeofShort = 0x2 + sizeofInt = 0x4 + sizeofLong = 0x8 + sizeofLongLong = 0x8 PathMax = 0x1000 ) @@ -1948,31 +1948,3 @@ type XDPDesc struct { Len uint32 Options uint32 } - -const ( - NCSI_CMD_UNSPEC = 0x0 - NCSI_CMD_PKG_INFO = 0x1 - NCSI_CMD_SET_INTERFACE = 0x2 - NCSI_CMD_CLEAR_INTERFACE = 0x3 - NCSI_ATTR_UNSPEC = 0x0 - NCSI_ATTR_IFINDEX = 0x1 - NCSI_ATTR_PACKAGE_LIST = 0x2 - NCSI_ATTR_PACKAGE_ID = 0x3 - NCSI_ATTR_CHANNEL_ID = 0x4 - NCSI_PKG_ATTR_UNSPEC = 0x0 - NCSI_PKG_ATTR = 0x1 - NCSI_PKG_ATTR_ID = 0x2 - NCSI_PKG_ATTR_FORCED = 0x3 - NCSI_PKG_ATTR_CHANNEL_LIST = 0x4 - NCSI_CHANNEL_ATTR_UNSPEC = 0x0 - NCSI_CHANNEL_ATTR = 0x1 - NCSI_CHANNEL_ATTR_ID = 0x2 - NCSI_CHANNEL_ATTR_VERSION_MAJOR = 0x3 - NCSI_CHANNEL_ATTR_VERSION_MINOR = 0x4 - NCSI_CHANNEL_ATTR_VERSION_STR = 0x5 - NCSI_CHANNEL_ATTR_LINK_STATE = 0x6 - NCSI_CHANNEL_ATTR_ACTIVE = 0x7 - NCSI_CHANNEL_ATTR_FORCED = 0x8 - NCSI_CHANNEL_ATTR_VLAN_LIST = 0x9 - NCSI_CHANNEL_ATTR_VLAN_ID = 0xa -) diff --git a/vendor/golang.org/x/sys/unix/ztypes_linux_ppc64le.go b/vendor/golang.org/x/sys/unix/ztypes_linux_ppc64le.go index f0f5214a53..595ba63030 100644 --- a/vendor/golang.org/x/sys/unix/ztypes_linux_ppc64le.go +++ b/vendor/golang.org/x/sys/unix/ztypes_linux_ppc64le.go @@ -6,11 +6,11 @@ package unix const ( - SizeofPtr = 0x8 - SizeofShort = 0x2 - SizeofInt = 0x4 - SizeofLong = 0x8 - SizeofLongLong = 0x8 + sizeofPtr = 0x8 + sizeofShort = 0x2 + sizeofInt = 0x4 + sizeofLong = 0x8 + sizeofLongLong = 0x8 PathMax = 0x1000 ) @@ -1948,31 +1948,3 @@ type XDPDesc struct { Len uint32 Options uint32 } - -const ( - NCSI_CMD_UNSPEC = 0x0 - NCSI_CMD_PKG_INFO = 0x1 - NCSI_CMD_SET_INTERFACE = 0x2 - NCSI_CMD_CLEAR_INTERFACE = 0x3 - NCSI_ATTR_UNSPEC = 0x0 - NCSI_ATTR_IFINDEX = 0x1 - NCSI_ATTR_PACKAGE_LIST = 0x2 - NCSI_ATTR_PACKAGE_ID = 0x3 - NCSI_ATTR_CHANNEL_ID = 0x4 - NCSI_PKG_ATTR_UNSPEC = 0x0 - NCSI_PKG_ATTR = 0x1 - NCSI_PKG_ATTR_ID = 0x2 - NCSI_PKG_ATTR_FORCED = 0x3 - NCSI_PKG_ATTR_CHANNEL_LIST = 0x4 - NCSI_CHANNEL_ATTR_UNSPEC = 0x0 - NCSI_CHANNEL_ATTR = 0x1 - NCSI_CHANNEL_ATTR_ID = 0x2 - NCSI_CHANNEL_ATTR_VERSION_MAJOR = 0x3 - NCSI_CHANNEL_ATTR_VERSION_MINOR = 0x4 - NCSI_CHANNEL_ATTR_VERSION_STR = 0x5 - NCSI_CHANNEL_ATTR_LINK_STATE = 0x6 - NCSI_CHANNEL_ATTR_ACTIVE = 0x7 - NCSI_CHANNEL_ATTR_FORCED = 0x8 - NCSI_CHANNEL_ATTR_VLAN_LIST = 0x9 - NCSI_CHANNEL_ATTR_VLAN_ID = 0xa -) diff --git a/vendor/golang.org/x/sys/unix/ztypes_linux_riscv64.go b/vendor/golang.org/x/sys/unix/ztypes_linux_riscv64.go index 09c905866f..0ccf5bc3e1 100644 --- a/vendor/golang.org/x/sys/unix/ztypes_linux_riscv64.go +++ b/vendor/golang.org/x/sys/unix/ztypes_linux_riscv64.go @@ -6,11 +6,11 @@ package unix const ( - SizeofPtr = 0x8 - SizeofShort = 0x2 - SizeofInt = 0x4 - SizeofLong = 0x8 - SizeofLongLong = 0x8 + sizeofPtr = 0x8 + sizeofShort = 0x2 + sizeofInt = 0x4 + sizeofLong = 0x8 + sizeofLongLong = 0x8 PathMax = 0x1000 ) @@ -1965,31 +1965,3 @@ type XDPDesc struct { Len uint32 Options uint32 } - -const ( - NCSI_CMD_UNSPEC = 0x0 - NCSI_CMD_PKG_INFO = 0x1 - NCSI_CMD_SET_INTERFACE = 0x2 - NCSI_CMD_CLEAR_INTERFACE = 0x3 - NCSI_ATTR_UNSPEC = 0x0 - NCSI_ATTR_IFINDEX = 0x1 - NCSI_ATTR_PACKAGE_LIST = 0x2 - NCSI_ATTR_PACKAGE_ID = 0x3 - NCSI_ATTR_CHANNEL_ID = 0x4 - NCSI_PKG_ATTR_UNSPEC = 0x0 - NCSI_PKG_ATTR = 0x1 - NCSI_PKG_ATTR_ID = 0x2 - NCSI_PKG_ATTR_FORCED = 0x3 - NCSI_PKG_ATTR_CHANNEL_LIST = 0x4 - NCSI_CHANNEL_ATTR_UNSPEC = 0x0 - NCSI_CHANNEL_ATTR = 0x1 - NCSI_CHANNEL_ATTR_ID = 0x2 - NCSI_CHANNEL_ATTR_VERSION_MAJOR = 0x3 - NCSI_CHANNEL_ATTR_VERSION_MINOR = 0x4 - NCSI_CHANNEL_ATTR_VERSION_STR = 0x5 - NCSI_CHANNEL_ATTR_LINK_STATE = 0x6 - NCSI_CHANNEL_ATTR_ACTIVE = 0x7 - NCSI_CHANNEL_ATTR_FORCED = 0x8 - NCSI_CHANNEL_ATTR_VLAN_LIST = 0x9 - NCSI_CHANNEL_ATTR_VLAN_ID = 0xa -) diff --git a/vendor/golang.org/x/sys/unix/ztypes_linux_s390x.go b/vendor/golang.org/x/sys/unix/ztypes_linux_s390x.go index 5e86e496cd..06b07852d1 100644 --- a/vendor/golang.org/x/sys/unix/ztypes_linux_s390x.go +++ b/vendor/golang.org/x/sys/unix/ztypes_linux_s390x.go @@ -6,11 +6,11 @@ package unix const ( - SizeofPtr = 0x8 - SizeofShort = 0x2 - SizeofInt = 0x4 - SizeofLong = 0x8 - SizeofLongLong = 0x8 + sizeofPtr = 0x8 + sizeofShort = 0x2 + sizeofInt = 0x4 + sizeofLong = 0x8 + sizeofLongLong = 0x8 PathMax = 0x1000 ) @@ -1965,31 +1965,3 @@ type XDPDesc struct { Len uint32 Options uint32 } - -const ( - NCSI_CMD_UNSPEC = 0x0 - NCSI_CMD_PKG_INFO = 0x1 - NCSI_CMD_SET_INTERFACE = 0x2 - NCSI_CMD_CLEAR_INTERFACE = 0x3 - NCSI_ATTR_UNSPEC = 0x0 - NCSI_ATTR_IFINDEX = 0x1 - NCSI_ATTR_PACKAGE_LIST = 0x2 - NCSI_ATTR_PACKAGE_ID = 0x3 - NCSI_ATTR_CHANNEL_ID = 0x4 - NCSI_PKG_ATTR_UNSPEC = 0x0 - NCSI_PKG_ATTR = 0x1 - NCSI_PKG_ATTR_ID = 0x2 - NCSI_PKG_ATTR_FORCED = 0x3 - NCSI_PKG_ATTR_CHANNEL_LIST = 0x4 - NCSI_CHANNEL_ATTR_UNSPEC = 0x0 - NCSI_CHANNEL_ATTR = 0x1 - NCSI_CHANNEL_ATTR_ID = 0x2 - NCSI_CHANNEL_ATTR_VERSION_MAJOR = 0x3 - NCSI_CHANNEL_ATTR_VERSION_MINOR = 0x4 - NCSI_CHANNEL_ATTR_VERSION_STR = 0x5 - NCSI_CHANNEL_ATTR_LINK_STATE = 0x6 - NCSI_CHANNEL_ATTR_ACTIVE = 0x7 - NCSI_CHANNEL_ATTR_FORCED = 0x8 - NCSI_CHANNEL_ATTR_VLAN_LIST = 0x9 - NCSI_CHANNEL_ATTR_VLAN_ID = 0xa -) diff --git a/vendor/golang.org/x/sys/unix/ztypes_linux_sparc64.go b/vendor/golang.org/x/sys/unix/ztypes_linux_sparc64.go index 1fc7f7dea9..8e7384b89c 100644 --- a/vendor/golang.org/x/sys/unix/ztypes_linux_sparc64.go +++ b/vendor/golang.org/x/sys/unix/ztypes_linux_sparc64.go @@ -5,11 +5,11 @@ package unix const ( - SizeofPtr = 0x8 - SizeofShort = 0x2 - SizeofInt = 0x4 - SizeofLong = 0x8 - SizeofLongLong = 0x8 + sizeofPtr = 0x8 + sizeofShort = 0x2 + sizeofInt = 0x4 + sizeofLong = 0x8 + sizeofLongLong = 0x8 PathMax = 0x1000 ) diff --git a/vendor/golang.org/x/sys/unix/ztypes_netbsd_386.go b/vendor/golang.org/x/sys/unix/ztypes_netbsd_386.go index 1fdc5fd211..9e9088de11 100644 --- a/vendor/golang.org/x/sys/unix/ztypes_netbsd_386.go +++ b/vendor/golang.org/x/sys/unix/ztypes_netbsd_386.go @@ -6,11 +6,11 @@ package unix const ( - SizeofPtr = 0x4 - SizeofShort = 0x2 - SizeofInt = 0x4 - SizeofLong = 0x4 - SizeofLongLong = 0x8 + sizeofPtr = 0x4 + sizeofShort = 0x2 + sizeofInt = 0x4 + sizeofLong = 0x4 + sizeofLongLong = 0x8 ) type ( diff --git a/vendor/golang.org/x/sys/unix/ztypes_netbsd_amd64.go b/vendor/golang.org/x/sys/unix/ztypes_netbsd_amd64.go index 711f780675..ed3f17366a 100644 --- a/vendor/golang.org/x/sys/unix/ztypes_netbsd_amd64.go +++ b/vendor/golang.org/x/sys/unix/ztypes_netbsd_amd64.go @@ -6,11 +6,11 @@ package unix const ( - SizeofPtr = 0x8 - SizeofShort = 0x2 - SizeofInt = 0x4 - SizeofLong = 0x8 - SizeofLongLong = 0x8 + sizeofPtr = 0x8 + sizeofShort = 0x2 + sizeofInt = 0x4 + sizeofLong = 0x8 + sizeofLongLong = 0x8 ) type ( diff --git a/vendor/golang.org/x/sys/unix/ztypes_netbsd_arm.go b/vendor/golang.org/x/sys/unix/ztypes_netbsd_arm.go index fa1a16bae1..d263b61476 100644 --- a/vendor/golang.org/x/sys/unix/ztypes_netbsd_arm.go +++ b/vendor/golang.org/x/sys/unix/ztypes_netbsd_arm.go @@ -6,11 +6,11 @@ package unix const ( - SizeofPtr = 0x4 - SizeofShort = 0x2 - SizeofInt = 0x4 - SizeofLong = 0x4 - SizeofLongLong = 0x8 + sizeofPtr = 0x4 + sizeofShort = 0x2 + sizeofInt = 0x4 + sizeofLong = 0x4 + sizeofLongLong = 0x8 ) type ( diff --git a/vendor/golang.org/x/sys/unix/ztypes_openbsd_386.go b/vendor/golang.org/x/sys/unix/ztypes_openbsd_386.go index c8509bf0e4..231f4e8ef3 100644 --- a/vendor/golang.org/x/sys/unix/ztypes_openbsd_386.go +++ b/vendor/golang.org/x/sys/unix/ztypes_openbsd_386.go @@ -6,11 +6,11 @@ package unix const ( - SizeofPtr = 0x4 - SizeofShort = 0x2 - SizeofInt = 0x4 - SizeofLong = 0x4 - SizeofLongLong = 0x8 + sizeofPtr = 0x4 + sizeofShort = 0x2 + sizeofInt = 0x4 + sizeofLong = 0x4 + sizeofLongLong = 0x8 ) type ( @@ -465,94 +465,3 @@ type Utsname struct { Version [256]byte Machine [256]byte } - -const SizeofUvmexp = 0x158 - -type Uvmexp struct { - Pagesize int32 - Pagemask int32 - Pageshift int32 - Npages int32 - Free int32 - Active int32 - Inactive int32 - Paging int32 - Wired int32 - Zeropages int32 - Reserve_pagedaemon int32 - Reserve_kernel int32 - Anonpages int32 - Vnodepages int32 - Vtextpages int32 - Freemin int32 - Freetarg int32 - Inactarg int32 - Wiredmax int32 - Anonmin int32 - Vtextmin int32 - Vnodemin int32 - Anonminpct int32 - Vtextminpct int32 - Vnodeminpct int32 - Nswapdev int32 - Swpages int32 - Swpginuse int32 - Swpgonly int32 - Nswget int32 - Nanon int32 - Nanonneeded int32 - Nfreeanon int32 - Faults int32 - Traps int32 - Intrs int32 - Swtch int32 - Softs int32 - Syscalls int32 - Pageins int32 - Obsolete_swapins int32 - Obsolete_swapouts int32 - Pgswapin int32 - Pgswapout int32 - Forks int32 - Forks_ppwait int32 - Forks_sharevm int32 - Pga_zerohit int32 - Pga_zeromiss int32 - Zeroaborts int32 - Fltnoram int32 - Fltnoanon int32 - Fltnoamap int32 - Fltpgwait int32 - Fltpgrele int32 - Fltrelck int32 - Fltrelckok int32 - Fltanget int32 - Fltanretry int32 - Fltamcopy int32 - Fltnamap int32 - Fltnomap int32 - Fltlget int32 - Fltget int32 - Flt_anon int32 - Flt_acow int32 - Flt_obj int32 - Flt_prcopy int32 - Flt_przero int32 - Pdwoke int32 - Pdrevs int32 - Pdswout int32 - Pdfreed int32 - Pdscans int32 - Pdanscan int32 - Pdobscan int32 - Pdreact int32 - Pdbusy int32 - Pdpageouts int32 - Pdpending int32 - Pddeact int32 - Pdreanon int32 - Pdrevnode int32 - Pdrevtext int32 - Fpswtch int32 - Kmapent int32 -} diff --git a/vendor/golang.org/x/sys/unix/ztypes_openbsd_amd64.go b/vendor/golang.org/x/sys/unix/ztypes_openbsd_amd64.go index 200575d941..bb2c44886e 100644 --- a/vendor/golang.org/x/sys/unix/ztypes_openbsd_amd64.go +++ b/vendor/golang.org/x/sys/unix/ztypes_openbsd_amd64.go @@ -6,11 +6,11 @@ package unix const ( - SizeofPtr = 0x8 - SizeofShort = 0x2 - SizeofInt = 0x4 - SizeofLong = 0x8 - SizeofLongLong = 0x8 + sizeofPtr = 0x8 + sizeofShort = 0x2 + sizeofInt = 0x4 + sizeofLong = 0x8 + sizeofLongLong = 0x8 ) type ( @@ -465,94 +465,3 @@ type Utsname struct { Version [256]byte Machine [256]byte } - -const SizeofUvmexp = 0x158 - -type Uvmexp struct { - Pagesize int32 - Pagemask int32 - Pageshift int32 - Npages int32 - Free int32 - Active int32 - Inactive int32 - Paging int32 - Wired int32 - Zeropages int32 - Reserve_pagedaemon int32 - Reserve_kernel int32 - Anonpages int32 - Vnodepages int32 - Vtextpages int32 - Freemin int32 - Freetarg int32 - Inactarg int32 - Wiredmax int32 - Anonmin int32 - Vtextmin int32 - Vnodemin int32 - Anonminpct int32 - Vtextminpct int32 - Vnodeminpct int32 - Nswapdev int32 - Swpages int32 - Swpginuse int32 - Swpgonly int32 - Nswget int32 - Nanon int32 - Nanonneeded int32 - Nfreeanon int32 - Faults int32 - Traps int32 - Intrs int32 - Swtch int32 - Softs int32 - Syscalls int32 - Pageins int32 - Obsolete_swapins int32 - Obsolete_swapouts int32 - Pgswapin int32 - Pgswapout int32 - Forks int32 - Forks_ppwait int32 - Forks_sharevm int32 - Pga_zerohit int32 - Pga_zeromiss int32 - Zeroaborts int32 - Fltnoram int32 - Fltnoanon int32 - Fltnoamap int32 - Fltpgwait int32 - Fltpgrele int32 - Fltrelck int32 - Fltrelckok int32 - Fltanget int32 - Fltanretry int32 - Fltamcopy int32 - Fltnamap int32 - Fltnomap int32 - Fltlget int32 - Fltget int32 - Flt_anon int32 - Flt_acow int32 - Flt_obj int32 - Flt_prcopy int32 - Flt_przero int32 - Pdwoke int32 - Pdrevs int32 - Pdswout int32 - Pdfreed int32 - Pdscans int32 - Pdanscan int32 - Pdobscan int32 - Pdreact int32 - Pdbusy int32 - Pdpageouts int32 - Pdpending int32 - Pddeact int32 - Pdreanon int32 - Pdrevnode int32 - Pdrevtext int32 - Fpswtch int32 - Kmapent int32 -} diff --git a/vendor/golang.org/x/sys/unix/ztypes_openbsd_arm.go b/vendor/golang.org/x/sys/unix/ztypes_openbsd_arm.go index 3e20cdf092..941367cab8 100644 --- a/vendor/golang.org/x/sys/unix/ztypes_openbsd_arm.go +++ b/vendor/golang.org/x/sys/unix/ztypes_openbsd_arm.go @@ -6,11 +6,11 @@ package unix const ( - SizeofPtr = 0x4 - SizeofShort = 0x2 - SizeofInt = 0x4 - SizeofLong = 0x4 - SizeofLongLong = 0x8 + sizeofPtr = 0x4 + sizeofShort = 0x2 + sizeofInt = 0x4 + sizeofLong = 0x4 + sizeofLongLong = 0x8 ) type ( @@ -458,94 +458,3 @@ type Utsname struct { Version [256]byte Machine [256]byte } - -const SizeofUvmexp = 0x158 - -type Uvmexp struct { - Pagesize int32 - Pagemask int32 - Pageshift int32 - Npages int32 - Free int32 - Active int32 - Inactive int32 - Paging int32 - Wired int32 - Zeropages int32 - Reserve_pagedaemon int32 - Reserve_kernel int32 - Anonpages int32 - Vnodepages int32 - Vtextpages int32 - Freemin int32 - Freetarg int32 - Inactarg int32 - Wiredmax int32 - Anonmin int32 - Vtextmin int32 - Vnodemin int32 - Anonminpct int32 - Vtextminpct int32 - Vnodeminpct int32 - Nswapdev int32 - Swpages int32 - Swpginuse int32 - Swpgonly int32 - Nswget int32 - Nanon int32 - Nanonneeded int32 - Nfreeanon int32 - Faults int32 - Traps int32 - Intrs int32 - Swtch int32 - Softs int32 - Syscalls int32 - Pageins int32 - Obsolete_swapins int32 - Obsolete_swapouts int32 - Pgswapin int32 - Pgswapout int32 - Forks int32 - Forks_ppwait int32 - Forks_sharevm int32 - Pga_zerohit int32 - Pga_zeromiss int32 - Zeroaborts int32 - Fltnoram int32 - Fltnoanon int32 - Fltnoamap int32 - Fltpgwait int32 - Fltpgrele int32 - Fltrelck int32 - Fltrelckok int32 - Fltanget int32 - Fltanretry int32 - Fltamcopy int32 - Fltnamap int32 - Fltnomap int32 - Fltlget int32 - Fltget int32 - Flt_anon int32 - Flt_acow int32 - Flt_obj int32 - Flt_prcopy int32 - Flt_przero int32 - Pdwoke int32 - Pdrevs int32 - Pdswout int32 - Pdfreed int32 - Pdscans int32 - Pdanscan int32 - Pdobscan int32 - Pdreact int32 - Pdbusy int32 - Pdpageouts int32 - Pdpending int32 - Pddeact int32 - Pdreanon int32 - Pdrevnode int32 - Pdrevtext int32 - Fpswtch int32 - Kmapent int32 -} diff --git a/vendor/golang.org/x/sys/unix/ztypes_solaris_amd64.go b/vendor/golang.org/x/sys/unix/ztypes_solaris_amd64.go index 8531a190f2..0543e1a49a 100644 --- a/vendor/golang.org/x/sys/unix/ztypes_solaris_amd64.go +++ b/vendor/golang.org/x/sys/unix/ztypes_solaris_amd64.go @@ -6,11 +6,11 @@ package unix const ( - SizeofPtr = 0x8 - SizeofShort = 0x2 - SizeofInt = 0x4 - SizeofLong = 0x8 - SizeofLongLong = 0x8 + sizeofPtr = 0x8 + sizeofShort = 0x2 + sizeofInt = 0x4 + sizeofLong = 0x8 + sizeofLongLong = 0x8 PathMax = 0x400 MaxHostNameLen = 0x100 ) diff --git a/vendor/yunion.io/x/jsonutils/yamlutils.go b/vendor/yunion.io/x/jsonutils/yamlutils.go index de45df9211..fd2b978882 100644 --- a/vendor/yunion.io/x/jsonutils/yamlutils.go +++ b/vendor/yunion.io/x/jsonutils/yamlutils.go @@ -61,6 +61,7 @@ func parseYAMLDict(lines []string) (map[string]JSONObject, error) { } else { key := lines[i][0:keypos] val := strings.Trim(lines[i][keypos+1:], " ") + if len(val) > 0 && val != "|" { dict[key] = NewString(val) i++