// Devices provides a mock function with given fields:
558380
func (_m *Location) Devices() []common.Device {
	ret := _m.Called()

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

	return r0
}
443187
func (s *DeviceDefinitionVersion) SetDevices(v []*Device) *DeviceDefinitionVersion {
	s.Devices = v
	return s
}
370405
func (s *ListDevicesOutput) SetDevices(v []*DeviceType) *ListDevicesOutput {
	s.Devices = v
	return s
}
264791
func (addr *Address) Device() (*LinkLayerDevice, error) {
	return addr.machineProxy().LinkLayerDevice(addr.doc.DeviceName)
}
472660
func (_m *DBClient) AddDeviceService(ds models.DeviceService) (string, error) {
	ret := _m.Called(ds)

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

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

	return r0, r1
}
706967
func (d *driver) LocalDevices(
	ctx types.Context,
	opts *types.LocalDevicesOpts) (*types.LocalDevices, error) {

	// Read all of the attached devices
	scsiDevs, err := getSCSIDevs()
	if err != nil {
		return nil, err
	}

	devMap := map[string]string{}

	scanner := bufio.NewScanner(bytes.NewReader(scsiDevs))
	for scanner.Scan() {
		fields := strings.Fields(scanner.Text())
		device := fields[len(fields)-1]
		if !devRX.MatchString(device) {
			continue
		}

		matches := scsiRx.FindStringSubmatch(fields[0])
		if matches == nil {
			continue
		}

		lun := matches[1]
		devMap[device] = lun
	}

	ld := &types.LocalDevices{Driver: d.Name()}
	if len(devMap) > 0 {
		ld.DeviceMap = devMap
	}

	ctx.WithField("devicemap", ld.DeviceMap).Debug("local devices")

	return ld, nil
}
1011203
func (d *DeviceMapperDriver) deviceSize(deviceHash string) (uint64, error) {
	return getDeviceSize(d.devicePath(deviceHash))
}
1362738
func DevicesFromInterfaceInfo(interfaces []network.InterfaceInfo) (map[string]device, []string, error) {
	nics := make(map[string]device, len(interfaces))
	var unknown []string

	for _, v := range interfaces {
		if v.InterfaceType == network.LoopbackInterface {
			continue
		}
		if v.InterfaceType != network.EthernetInterface {
			return nil, nil, errors.Errorf("interface type %q not supported", v.InterfaceType)
		}
		if v.ParentInterfaceName == "" {
			return nil, nil, errors.Errorf("parent interface name is empty")
		}
		if v.CIDR == "" {
			unknown = append(unknown, v.ParentInterfaceName)
		}
		nics[v.InterfaceName] = newNICDevice(v.InterfaceName, v.ParentInterfaceName, v.MACAddress, v.MTU)
	}

	return nics, unknown, nil
}
103135
func (devices *DeviceSet) registerDevice(id int, hash string, size uint64, transactionID uint64) (*devInfo, error) {
	logrus.Debugf("devmapper: registerDevice(%v, %v)", id, hash)
	info := &devInfo{
		Hash:          hash,
		DeviceID:      id,
		Size:          size,
		TransactionID: transactionID,
		Initialized:   false,
		devices:       devices,
	}

	devices.Devices[hash] = info

	if err := devices.saveMetadata(info); err != nil {
		// Try to remove unused device
		delete(devices.Devices, hash)
		return nil, err
	}

	return info, 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
}
1137442
func (w *wrapper) SetDevices(devs []DeviceConfiguration) (Waiter, error) {
	w.mut.Lock()
	defer w.mut.Unlock()

	newCfg := w.cfg.Copy()
	var replaced bool
	for oldIndex := range devs {
		replaced = false
		for newIndex := range newCfg.Devices {
			if newCfg.Devices[newIndex].DeviceID == devs[oldIndex].DeviceID {
				newCfg.Devices[newIndex] = devs[oldIndex].Copy()
				replaced = true
				break
			}
		}
		if !replaced {
			newCfg.Devices = append(newCfg.Devices, devs[oldIndex].Copy())
		}
	}

	return w.replaceLocked(newCfg)
}
258664
func (pdev podDevices) containerDevices(podUID, contName, resource string) sets.String {
	if _, podExists := pdev[podUID]; !podExists {
		return nil
	}
	if _, contExists := pdev[podUID][contName]; !contExists {
		return nil
	}
	devs, resourceExists := pdev[podUID][contName][resource]
	if !resourceExists {
		return nil
	}
	return devs.deviceIds
}
337736
func (r *Robot) Device(name string) Device {
	if r == nil {
		return nil
	}
	for _, device := range *r.devices {
		if device.Name() == name {
			return device
		}
	}
	return nil
}
1243039
func mapDevices(devices []protocol.DeviceID) map[protocol.DeviceID]struct{} {
	m := make(map[protocol.DeviceID]struct{}, len(devices))
	for _, dev := range devices {
		m[dev] = struct{}{}
	}
	return m
}
1111305
func DevicesFromPath(pathOnHost, pathInContainer, cgroupPermissions string) (devs []specs.LinuxDevice, devPermissions []specs.LinuxDeviceCgroup, err error) {
	return nil, nil, errors.New("oci/devices: unsupported platform")
}
1132078
func DeviceMotion(listener func(*vecty.Event)) *vecty.EventListener {
	return &vecty.EventListener{Name: "devicemotion", Listener: listener}
}
365708
func (m *metadataTracker) devices() []protocol.DeviceID {
	devs := make(map[protocol.DeviceID]struct{}, len(m.counts.Counts))

	m.mut.RLock()
	for _, dev := range m.counts.Counts {
		if dev.Sequence > 0 {
			id := protocol.DeviceIDFromBytes(dev.DeviceID)
			if id == protocol.GlobalDeviceID || id == protocol.LocalDeviceID {
				continue
			}
			devs[id] = struct{}{}
		}
	}
	m.mut.RUnlock()

	devList := make([]protocol.DeviceID, 0, len(devs))
	for dev := range devs {
		devList = append(devList, dev)
	}

	return devList
}