// Get the sriov_logical_PIF_of field of the given PIF.
338593
func (_class PIFClass) GetSriovLogicalPIFOf(sessionID SessionRef, self PIFRef) (_retval []NetworkSriovRef, _err error) {
	_method := "PIF.get_sriov_logical_PIF_of"
	_sessionIDArg, _err := convertSessionRefToXen(fmt.Sprintf("%s(%s)", _method, "session_id"), sessionID)
	if _err != nil {
		return
	}
	_selfArg, _err := convertPIFRefToXen(fmt.Sprintf("%s(%s)", _method, "self"), self)
	if _err != nil {
		return
	}
	_result, _err := _class.client.APICall(_method, _sessionIDArg, _selfArg)
	if _err != nil {
		return
	}
	_retval, _err = convertNetworkSriovRefSetToGo(_method + " -> ", _result.Value)
	return
}
1233460
func (s *VPCService) GetPrivateGatewayByID(id string, opts ...OptionFunc) (*PrivateGateway, int, error) {
	p := &ListPrivateGatewaysParams{}
	p.p = make(map[string]interface{})

	p.p["id"] = id

	for _, fn := range append(s.cs.options, opts...) {
		if err := fn(s.cs, p); err != nil {
			return nil, -1, err
		}
	}

	l, err := s.ListPrivateGateways(p)
	if err != nil {
		if strings.Contains(err.Error(), fmt.Sprintf(
			"Invalid parameter id value=%s due to incorrect long value format, "+
				"or entity does not exist", id)) {
			return nil, 0, fmt.Errorf("No match found for %s: %+v", id, l)
		}
		return nil, -1, err
	}

	if l.Count == 0 {
		return nil, l.Count, fmt.Errorf("No match found for %s: %+v", id, l)
	}

	if l.Count == 1 {
		return l.PrivateGateways[0], l.Count, nil
	}
	return nil, l.Count, fmt.Errorf("There is more then one result for PrivateGateway UUID: %s!", id)
}
421922
func getvarint(pp *[]uint8) uint32 {
	var p []uint8
	var shift int
	var v uint32
	v = 0
	p = []uint8(*pp)
	for shift = 0; ; shift += 7 {
		v |= uint32(p[0]&0x7F) << uint(shift)
		tmp7 := p
		p = p[1:]
		if tmp7[0]&0x80 == 0 {
			break
		}
	}
	*pp = p
	return v
}
20933
func (cg *CgroupV1) GetCPUData(pid int, cgPath string) (*rspec.LinuxCPU, error) {
	if filepath.IsAbs(cgPath) {
		path := filepath.Join(cg.MountPath, "cpu", cgPath)
		if _, err := os.Stat(path); err != nil {
			if os.IsNotExist(err) {
				return nil, specerror.NewError(specerror.CgroupsAbsPathRelToMount, fmt.Errorf("In the case of an absolute path, the runtime MUST take the path to be relative to the cgroups mount point"), rspec.Version)
			}
			return nil, err
		}
	}
	lc := &rspec.LinuxCPU{}
	names := []string{"shares", "cfs_quota_us", "cfs_period_us"}
	for i, name := range names {
		fileName := strings.Join([]string{"cpu", name}, ".")
		filePath := filepath.Join(cg.MountPath, "cpu", cgPath, fileName)
		if !filepath.IsAbs(cgPath) {
			subPath, err := GetSubsystemPath(pid, "cpu")
			if err != nil {
				return nil, err
			}
			if !strings.Contains(subPath, cgPath) {
				return nil, fmt.Errorf("cgroup subsystem %s is not mounted as expected", "cpu")
			}
			filePath = filepath.Join(cg.MountPath, "cpu", subPath, fileName)
		}
		contents, err := ioutil.ReadFile(filePath)
		if err != nil {
			if os.IsNotExist(err) {
				return nil, specerror.NewError(specerror.CgroupsPathAttach, fmt.Errorf("The runtime MUST consistently attach to the same place in the cgroups hierarchy given the same value of `cgroupsPath`"), rspec.Version)
			}

			return nil, err
		}
		switch i {
		case 0:
			res, err := strconv.ParseUint(strings.TrimSpace(string(contents)), 10, 64)
			if err != nil {
				return nil, err
			}
			shares := res
			lc.Shares = &shares
		case 1:
			res, err := strconv.ParseInt(strings.TrimSpace(string(contents)), 10, 64)
			if err != nil {
				return nil, err
			}
			quota := res
			lc.Quota = &quota
		case 2:
			res, err := strconv.ParseUint(strings.TrimSpace(string(contents)), 10, 64)
			if err != nil {
				return nil, err
			}
			period := res
			lc.Period = &period
		}
	}
	// CONFIG_RT_GROUP_SCHED may be not set
	// Can always get rt data from /proc
	contents, err := ioutil.ReadFile("/proc/sys/kernel/sched_rt_period_us")
	if err != nil {
		return nil, err
	}
	rtPeriod, err := strconv.ParseUint(strings.TrimSpace(string(contents)), 10, 64)
	if err != nil {
		return nil, err
	}
	lc.RealtimePeriod = &rtPeriod
	contents, err = ioutil.ReadFile("/proc/sys/kernel/sched_rt_runtime_us")
	if err != nil {
		return nil, err
	}
	rtQuota, err := strconv.ParseInt(strings.TrimSpace(string(contents)), 10, 64)
	if err != nil {
		return nil, err
	}
	lc.RealtimeRuntime = &rtQuota

	names = []string{"cpus", "mems"}
	for i, name := range names {
		fileName := strings.Join([]string{"cpuset", name}, ".")
		filePath := filepath.Join(cg.MountPath, "cpuset", cgPath, fileName)
		if !filepath.IsAbs(cgPath) {
			subPath, err := GetSubsystemPath(pid, "cpuset")
			if err != nil {
				return nil, err
			}
			if !strings.Contains(subPath, cgPath) {
				return nil, fmt.Errorf("cgroup subsystem %s is not mounted as expected", "cpuset")
			}
			filePath = filepath.Join(cg.MountPath, "cpuset", subPath, fileName)
		}
		contents, err := ioutil.ReadFile(filePath)
		if err != nil {
			return nil, err
		}
		switch i {
		case 0:
			lc.Cpus = strings.TrimSpace(string(contents))
		case 1:
			lc.Mems = strings.TrimSpace(string(contents))
		}
	}

	return lc, nil
}
1375009
func (p *Procstat) getPIDFinder() (PIDFinder, error) {
	if p.finder == nil {
		f, err := p.createPIDFinder()
		if err != nil {
			return nil, err
		}
		p.finder = f
	}
	return p.finder, nil
}
919131
func PidOf(name string) ([]int, error) {
	if len(name) == 0 {
		return []int{}, fmt.Errorf("name should not be empty")
	}
	re, err := regexp.Compile("(^|/)" + name + "$")
	if err != nil {
		return []int{}, err
	}
	return getPids(re), nil
}
309399
func (_class PIFMetricsClass) GetAll(sessionID SessionRef) (_retval []PIFMetricsRef, _err error) {
	_method := "PIF_metrics.get_all"
	_sessionIDArg, _err := convertSessionRefToXen(fmt.Sprintf("%s(%s)", _method, "session_id"), sessionID)
	if _err != nil {
		return
	}
	_result, _err := _class.client.APICall(_method, _sessionIDArg)
	if _err != nil {
		return
	}
	_retval, _err = convertPIFMetricsRefSetToGo(_method + " -> ", _result.Value)
	return
}
916629
func (lft *FieldTranslator) Get(id uint64) (val interface{}, err error) {
	idBytes := make([]byte, 8)
	binary.BigEndian.PutUint64(idBytes, id)
	data, err := lft.idMap.Get(idBytes, nil)
	if err != nil {
		return nil, errors.Wrap(err, "fetching from idMap")
	}
	return pdk.FromBytes(data), nil
}
820624
func (s *VPNService) GetVpnUserByID(id string, opts ...OptionFunc) (*VpnUser, int, error) {
	p := &ListVpnUsersParams{}
	p.p = make(map[string]interface{})

	p.p["id"] = id

	for _, fn := range append(s.cs.options, opts...) {
		if err := fn(s.cs, p); err != nil {
			return nil, -1, err
		}
	}

	l, err := s.ListVpnUsers(p)
	if err != nil {
		if strings.Contains(err.Error(), fmt.Sprintf(
			"Invalid parameter id value=%s due to incorrect long value format, "+
				"or entity does not exist", id)) {
			return nil, 0, fmt.Errorf("No match found for %s: %+v", id, l)
		}
		return nil, -1, err
	}

	if l.Count == 0 {
		return nil, l.Count, fmt.Errorf("No match found for %s: %+v", id, l)
	}

	if l.Count == 1 {
		return l.VpnUsers[0], l.Count, nil
	}
	return nil, l.Count, fmt.Errorf("There is more then one result for VpnUser UUID: %s!", id)
}
889944
func GetProgInfoByFD(fd int) (ProgInfo, error) {
	info := ProgInfo{}
	attrInfo := attrObjInfo{
		bpfFD:   uint32(fd),
		infoLen: uint32(unsafe.Sizeof(info)),
		info:    uint64(uintptr(unsafe.Pointer(&info))),
	}
	// This struct must be in sync with union bpf_attr's anonymous struct
	attr := struct {
		info attrObjInfo
	}{
		info: attrInfo,
	}

	duration := spanstat.Start()
	ret, _, err := unix.Syscall(unix.SYS_BPF, BPF_OBJ_GET_INFO_BY_FD, uintptr(unsafe.Pointer(&attr)), unsafe.Sizeof(attr))
	metricSyscallDuration.WithLabelValues(metricOpObjGetInfoByFD, metrics.Errno2Outcome(err)).Observe(duration.End(err == 0).Total().Seconds())
	if ret != 0 || err != 0 {
		return ProgInfo{}, fmt.Errorf("Unable to get object info: %v", err)
	}

	return info, nil
}
1304477
func (b *backend) getConfigFieldData() (*framework.FieldData, error) {
	configPath := b.Route("config")

	if configPath == nil {
		return nil, logical.ErrUnsupportedPath
	}

	raw := make(map[string]interface{}, len(configPath.Fields))

	fd := framework.FieldData{
		Raw:    raw,
		Schema: configPath.Fields,
	}

	return &fd, nil
}
1107074
func (fi *fieldInfo) getValue(a reflect.Value) interface{} {
	for _, i := range fi.path {
		a = a.Field(i)
		if a.Kind() == reflect.Ptr {
			if a.IsNil() {
				return nil
			}
			a = a.Elem()
		}
	}
	return a.Interface()
}
1208333
func (_class NetworkClass) GetPIFs(sessionID SessionRef, self NetworkRef) (_retval []PIFRef, _err error) {
	_method := "network.get_PIFs"
	_sessionIDArg, _err := convertSessionRefToXen(fmt.Sprintf("%s(%s)", _method, "session_id"), sessionID)
	if _err != nil {
		return
	}
	_selfArg, _err := convertNetworkRefToXen(fmt.Sprintf("%s(%s)", _method, "self"), self)
	if _err != nil {
		return
	}
	_result, _err := _class.client.APICall(_method, _sessionIDArg, _selfArg)
	if _err != nil {
		return
	}
	_retval, _err = convertPIFRefSetToGo(_method + " -> ", _result.Value)
	return
}
892095
func (_class PIFClass) GetVLAN(sessionID SessionRef, self PIFRef) (_retval int, _err error) {
	_method := "PIF.get_VLAN"
	_sessionIDArg, _err := convertSessionRefToXen(fmt.Sprintf("%s(%s)", _method, "session_id"), sessionID)
	if _err != nil {
		return
	}
	_selfArg, _err := convertPIFRefToXen(fmt.Sprintf("%s(%s)", _method, "self"), self)
	if _err != nil {
		return
	}
	_result, _err := _class.client.APICall(_method, _sessionIDArg, _selfArg)
	if _err != nil {
		return
	}
	_retval, _err = convertIntToGo(_method + " -> ", _result.Value)
	return
}
824729
func (v *Image) GetPixbuf() *gdkpixbuf.Pixbuf {
	gpixbuf := C.gtk_image_get_pixbuf(IMAGE(v))
	return &gdkpixbuf.Pixbuf{
		GdkPixbuf: gdkpixbuf.NewGdkPixbuf(unsafe.Pointer(gpixbuf)),
		GObject:   glib.ObjectFromNative(unsafe.Pointer(gpixbuf)),
	}
}
1129981
func (_class TunnelClass) GetTransportPIF(sessionID SessionRef, self TunnelRef) (_retval PIFRef, _err error) {
	_method := "tunnel.get_transport_PIF"
	_sessionIDArg, _err := convertSessionRefToXen(fmt.Sprintf("%s(%s)", _method, "session_id"), sessionID)
	if _err != nil {
		return
	}
	_selfArg, _err := convertTunnelRefToXen(fmt.Sprintf("%s(%s)", _method, "self"), self)
	if _err != nil {
		return
	}
	_result, _err := _class.client.APICall(_method, _sessionIDArg, _selfArg)
	if _err != nil {
		return
	}
	_retval, _err = convertPIFRefToGo(_method + " -> ", _result.Value)
	return
}
976086
func (s *TemplateService) GetTemplateID(name string, templatefilter string, zoneid string, opts ...OptionFunc) (string, int, error) {
	p := &ListTemplatesParams{}
	p.p = make(map[string]interface{})

	p.p["name"] = name
	p.p["templatefilter"] = templatefilter
	p.p["zoneid"] = zoneid

	for _, fn := range append(s.cs.options, opts...) {
		if err := fn(s.cs, p); err != nil {
			return "", -1, err
		}
	}

	l, err := s.ListTemplates(p)
	if err != nil {
		return "", -1, err
	}

	if l.Count == 0 {
		return "", l.Count, fmt.Errorf("No match found for %s: %+v", name, l)
	}

	if l.Count == 1 {
		return l.Templates[0].Id, l.Count, nil
	}

	if l.Count > 1 {
		for _, v := range l.Templates {
			if v.Name == name {
				return v.Id, l.Count, nil
			}
		}
	}
	return "", l.Count, fmt.Errorf("Could not find an exact match for %s: %+v", name, l)
}