// GetDevicesData gets cgroup devices data
179639
func (cg *CgroupV1) GetDevicesData(pid int, cgPath string) ([]rspec.LinuxDeviceCgroup, error) {
	ld := []rspec.LinuxDeviceCgroup{}
	fileName := strings.Join([]string{"devices", "list"}, ".")
	filePath := filepath.Join(cg.MountPath, "devices", cgPath, fileName)
	if !filepath.IsAbs(cgPath) {
		subPath, err := GetSubsystemPath(pid, "devices")
		if err != nil {
			return nil, err
		}
		if !strings.Contains(subPath, cgPath) {
			return nil, fmt.Errorf("cgroup subsystem %s is not mounted as expected", "devices")
		}
		filePath = filepath.Join(cg.MountPath, "devices", subPath, fileName)
	}
	contents, err := ioutil.ReadFile(filePath)
	if err != nil {
		return nil, err
	}
	parts := strings.Split(strings.TrimSpace(string(contents)), "\n")
	for _, part := range parts {
		elem := strings.Split(part, " ")
		ele := strings.Split(elem[1], ":")
		var major, minor int64
		if ele[0] == "*" {
			major = 0
		} else {
			major, err = strconv.ParseInt(ele[0], 10, 64)
			if err != nil {
				return nil, err
			}
		}
		if ele[1] == "*" {
			minor = 0
		} else {
			minor, err = strconv.ParseInt(ele[1], 10, 64)
			if err != nil {
				return nil, err
			}
		}

		device := rspec.LinuxDeviceCgroup{}
		device.Allow = true
		device.Type = elem[0]
		device.Major = &major
		device.Minor = &minor
		device.Access = elem[2]
		ld = append(ld, device)
	}

	return ld, nil
}
484285
func convertProtoDeviceGroupStats(in *proto.DeviceGroupStats) *DeviceGroupStats {
	if in == nil {
		return nil
	}

	out := &DeviceGroupStats{
		Vendor:        in.Vendor,
		Type:          in.Type,
		Name:          in.Name,
		InstanceStats: make(map[string]*DeviceStats, len(in.InstanceStats)),
	}

	for k, v := range in.InstanceStats {
		out.InstanceStats[k] = convertProtoDeviceStats(v)
	}

	return out
}
1109148
func (_m *DBClient) GetDeviceByName(n string) (models.Device, error) {
	ret := _m.Called(n)

	var r0 models.Device
	if rf, ok := ret.Get(0).(func(string) models.Device); ok {
		r0 = rf(n)
	} else {
		r0 = ret.Get(0).(models.Device)
	}

	var r1 error
	if rf, ok := ret.Get(1).(func(string) error); ok {
		r1 = rf(n)
	} else {
		r1 = ret.Error(1)
	}

	return r0, r1
}
228854
func (h *ManagerStub) GetDeviceRunContainerOptions(pod *v1.Pod, container *v1.Container) (*DeviceRunContainerOptions, error) {
	return nil, nil
}
529542
func (pdev podDevices) getContainerDevices(podUID, contName string) []*podresourcesapi.ContainerDevices {
	if _, podExists := pdev[podUID]; !podExists {
		return nil
	}
	if _, contExists := pdev[podUID][contName]; !contExists {
		return nil
	}
	cDev := []*podresourcesapi.ContainerDevices{}
	for resource, allocateInfo := range pdev[podUID][contName] {
		cDev = append(cDev, &podresourcesapi.ContainerDevices{
			ResourceName: resource,
			DeviceIds:    allocateInfo.deviceIds.UnsortedList(),
		})
	}
	return cDev
}
952047
func (disk *dataDisk) GetPodDeviceMapPath() (string, string) {
	name := azureDataDiskPluginName
	return disk.plugin.host.GetPodVolumeDeviceDir(disk.podUID, utilstrings.EscapeQualifiedName(name)), disk.volumeName
}
242050
func (_m *DBClient) GetAllDeviceReports() ([]models.DeviceReport, error) {
	ret := _m.Called()

	var r0 []models.DeviceReport
	if rf, ok := ret.Get(0).(func() []models.DeviceReport); ok {
		r0 = rf()
	} else {
		if ret.Get(0) != nil {
			r0 = ret.Get(0).([]models.DeviceReport)
		}
	}

	var r1 error
	if rf, ok := ret.Get(1).(func() error); ok {
		r1 = rf()
	} else {
		r1 = ret.Error(1)
	}

	return r0, r1
}
1134478
func GetDeviceGatewayRXInfoSet(p *redis.Pool, devEUI lorawan.EUI64) (DeviceGatewayRXInfoSet, error) {
	var rxInfoSetPB DeviceGatewayRXInfoSetPB

	c := p.Get()
	defer c.Close()

	val, err := redis.Bytes(c.Do("GET", fmt.Sprintf(deviceGatewayRXInfoSetKeyTempl, devEUI)))
	if err != nil {
		if err == redis.ErrNil {
			return DeviceGatewayRXInfoSet{}, ErrDoesNotExist
		}
		return DeviceGatewayRXInfoSet{}, errors.Wrap(err, "get error")
	}

	err = proto.Unmarshal(val, &rxInfoSetPB)
	if err != nil {
		return DeviceGatewayRXInfoSet{}, errors.Wrap(err, "protobuf unmarshal error")
	}

	return deviceGatewayRXInfoSetFromPB(rxInfoSetPB), nil
}
260892
func (s deviceService) FetchDevices(opts ...DeviceRequestOption) (*DeviceResponse, error) {
	request := &deviceRequestOpts{}
	for _, option := range opts {
		if err := option(request); err != nil {
			return nil, err
		}
	}
	var response DeviceResponse
	req, err := s.client.NewRequest("POST", fetchDevicesPath, request)
	if err != nil {
		return nil, err
	}
	err = s.client.Do(req, &response)
	if err != nil {
		return nil, err
	}
	return &response, nil
}
747628
func getDeviceSize(dev string) (uint64, error) {
	cmd := exec.Command("lsblk", "-dbno", "SIZE", dev)
	out, err := cmd.Output()
	if err != nil {
		return 0, err
	}
	var size uint64
	if size, err = strconv.ParseUint(strings.TrimSpace(string(out)), 10, 64); err != nil {
		return 0, err
	}
	return size, nil
}
1270160
func (ispr iscsiDevicePathResolver) getDevicePaths(devices []string, shouldExist bool) ([]string, error) {
	var paths []string
	for _, device := range devices {
		exist, err := regexp.MatchString("-part1", device)
		if err != nil {
			return paths, bosherr.WrapError(err, "There is a problem with your regexp: '-part1'. That is used to find existing device")
		}
		if exist == shouldExist {
			matchedPath := path.Join("/dev/mapper", strings.Split(strings.Fields(device)[0], "-")[0])
			ispr.logger.Debug(ispr.logTag, "path in device list: '%+v'", matchedPath)
			paths = append(paths, matchedPath)
		}
	}

	return paths, nil
}
1226511
func (h *MPU6050Driver) GetData() (err error) {
	if _, err = h.connection.Write([]byte{MPU6050_RA_ACCEL_XOUT_H}); err != nil {
		return
	}

	data := make([]byte, 14)
	_, err = h.connection.Read(data)
	if err != nil {
		return
	}

	buf := bytes.NewBuffer(data)
	binary.Read(buf, binary.BigEndian, &h.Accelerometer)
	binary.Read(buf, binary.BigEndian, &h.Temperature)
	binary.Read(buf, binary.BigEndian, &h.Gyroscope)
	h.convertToCelsius()
	return
}
356994
func (c *IniConfigContainer) getdata(key string) string {
	if len(key) == 0 {
		return ""
	}
	c.RLock()
	defer c.RUnlock()

	var (
		section, k string
		sectionKey = strings.Split(strings.ToLower(key), "::")
	)
	if len(sectionKey) >= 2 {
		section = sectionKey[0]
		k = sectionKey[1]
	} else {
		section = defaultSection
		k = sectionKey[0]
	}
	if v, ok := c.data[section]; ok {
		if vv, ok := v[k]; ok {
			return vv
		}
	}
	return ""
}
98415
func (md *RootMetadataV2) GetUserDevicePublicKeys(_ ExtraMetadata) (
	writerDeviceKeys, readerDeviceKeys UserDevicePublicKeys, err error) {
	if md.TlfID().Type() != tlf.Private {
		return nil, nil, InvalidNonPrivateTLFOperation{
			md.TlfID(), "GetUserDevicePublicKeys", md.Version()}
	}

	if len(md.WKeys) == 0 || len(md.RKeys) == 0 {
		return nil, nil, errors.New(
			"GetUserDevicePublicKeys called with no key generations (V2)")
	}

	wUDKIM := md.WKeys[len(md.WKeys)-1]
	rUDKIM := md.RKeys[len(md.RKeys)-1]

	return wUDKIM.WKeys.ToPublicKeys(), rUDKIM.RKeys.ToPublicKeys(), nil
}
1054118
func (i *instanceManager) DeviceStats(d *structs.AllocatedDeviceResource) *device.DeviceGroupStats {
	i.deviceStatsLock.RLock()
	defer i.deviceStatsLock.RUnlock()

	// Find the device in question and then gather the instance statistics we
	// are interested in
	for _, group := range i.deviceStats {
		if group.Vendor != d.Vendor || group.Type != d.Type || group.Name != d.Name {
			continue
		}

		// We found the group we want so now grab the instance stats
		out := &device.DeviceGroupStats{
			Vendor:        d.Vendor,
			Type:          d.Type,
			Name:          d.Name,
			InstanceStats: make(map[string]*device.DeviceStats, len(d.DeviceIDs)),
		}

		for _, id := range d.DeviceIDs {
			out.InstanceStats[id] = group.InstanceStats[id]
		}

		return out
	}

	return nil
}
869998
func (_m *DBClient) GetAllDeviceServices() ([]models.DeviceService, error) {
	ret := _m.Called()

	var r0 []models.DeviceService
	if rf, ok := ret.Get(0).(func() []models.DeviceService); ok {
		r0 = rf()
	} else {
		if ret.Get(0) != nil {
			r0 = ret.Get(0).([]models.DeviceService)
		}
	}

	var r1 error
	if rf, ok := ret.Get(1).(func() error); ok {
		r1 = rf()
	} else {
		r1 = ret.Error(1)
	}

	return r0, r1
}
535527
func (_m *DBClient) GetAllDevices() ([]models.Device, error) {
	ret := _m.Called()

	var r0 []models.Device
	if rf, ok := ret.Get(0).(func() []models.Device); ok {
		r0 = rf()
	} else {
		if ret.Get(0) != nil {
			r0 = ret.Get(0).([]models.Device)
		}
	}

	var r1 error
	if rf, ok := ret.Get(1).(func() error); ok {
		r1 = rf()
	} else {
		r1 = ret.Error(1)
	}

	return r0, r1
}