// EmulateModeSense responds to a static Mode Sense command. `wce` enables or diables
// the SCSI "Write Cache Enabled" flag.
554804
func EmulateModeSense(cmd *SCSICmd, wce bool) (SCSIResponse, error) {
	pgs := &bytes.Buffer{}
	outlen := int(cmd.XferLen())

	page := cmd.GetCDB(2)
	if page == 0x3f || page == 0x08 {
		CachingModePage(pgs, wce)
	}
	scsiCmd := cmd.Command()

	dsp := byte(0x10) // Support DPO/FUA

	pgdata := pgs.Bytes()
	var hdr []byte
	if scsiCmd == scsi.ModeSense {
		// MODE_SENSE_6
		hdr = make([]byte, 4)
		hdr[0] = byte(len(pgdata) + 3)
		hdr[1] = 0x00 // Device type
		hdr[2] = dsp
	} else {
		// MODE_SENSE_10
		hdr = make([]byte, 8)
		order := binary.BigEndian
		order.PutUint16(hdr, uint16(len(pgdata)+6))
		hdr[2] = 0x00 // Device type
		hdr[3] = dsp
	}
	data := append(hdr, pgdata...)
	if outlen < len(data) {
		data = data[:outlen]
	}
	cmd.Write(data)
	return cmd.Ok(), nil
}
452314
func (s *RestoreDBClusterFromSnapshotInput) SetEngineMode(v string) *RestoreDBClusterFromSnapshotInput {
	s.EngineMode = &v
	return s
}
226462
func (h *Handle) DevLinkSetEswitchMode(Dev *DevlinkDevice, NewMode string) error {
	mode, err := eswitchStringToMode(NewMode)
	if err != nil {
		return err
	}

	_, req, err := h.createCmdReq(nl.DEVLINK_CMD_ESWITCH_SET, Dev.BusName, Dev.DeviceName)
	if err != nil {
		return err
	}

	req.AddData(nl.NewRtAttr(nl.DEVLINK_ATTR_ESWITCH_MODE, nl.Uint16Attr(mode)))

	_, err = req.Execute(unix.NETLINK_GENERIC, 0)
	return err
}
1071477
func OverrideResolve(resolveFN func(net string, addr string) (*net.TCPAddr, error)) {
	resolveTCPAddr.Store(resolveFN)
}
343752
func NewSandboxModeSetting(enable bool, forwardSpam bool, spamCheck *SpamCheckSetting) *SandboxModeSetting {
	setEnable := enable
	setForwardSpam := forwardSpam
	return &SandboxModeSetting{
		Enable:      &setEnable,
		ForwardSpam: &setForwardSpam,
		SpamCheck:   spamCheck,
	}
}
129970
func WithEmulation(c context.Context, enabled bool) context.Context {
	return context.WithValue(c, &emulationEnabledKey, enabled)
}
83842
func NewModulateResultError(message string, values ...interface{}) ModulateResultError {
	return ModulateResultError{
		message: fmt.Sprintf(message, values...),
	}
}
27858
func (s *Profile) SetSetupModeDisabled(v bool) *Profile {
	s.SetupModeDisabled = &v
	return s
}
890465
func (c *Emulation) SetGeolocationOverrideWithParams(v *EmulationSetGeolocationOverrideParams) (*gcdmessage.ChromeResponse, error) {
	return gcdmessage.SendDefaultRequest(c.target, c.target.GetSendCh(), &gcdmessage.ParamRequest{Id: c.target.GetId(), Method: "Emulation.setGeolocationOverride", Params: v})
}
789644
func (c *Client) SupportedModules() (map[string]string, error) {
	var result map[string]string
	ctx, cancel := context.WithTimeout(context.Background(), subscribeTimeout)
	defer cancel()
	err := c.CallContext(ctx, &result, "rpc_modules")
	return result, err
}
809033
func (_class NetworkSriovClass) GetConfigurationMode(sessionID SessionRef, self NetworkSriovRef) (_retval SriovConfigurationMode, _err error) {
	_method := "network_sriov.get_configuration_mode"
	_sessionIDArg, _err := convertSessionRefToXen(fmt.Sprintf("%s(%s)", _method, "session_id"), sessionID)
	if _err != nil {
		return
	}
	_selfArg, _err := convertNetworkSriovRefToXen(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 = convertEnumSriovConfigurationModeToGo(_method + " -> ", _result.Value)
	return
}
60517
func (filterModulator *FilterModulator) Modulate(msg *Message) ModulateResult {
	result, err := filterModulator.ApplyFilter(msg)
	if err != nil {
		logrus.Warning("FilterModulator with error:", err)
	}

	if result == FilterResultMessageAccept {
		return ModulateResultContinue
	}

	newStreamID := result.GetStreamID()
	if newStreamID == InvalidStreamID {
		return ModulateResultDiscard
	}

	msg.SetStreamID(newStreamID)
	return ModulateResultFallback
}
417105
func (window *Window) GetDisplayMode() (mode DisplayMode, err error) {
	err = errorFromInt(int(
		C.SDL_GetWindowDisplayMode(window.cptr(), (&mode).cptr())))
	return
}
1013475
func (d *Domain) GetEmulatorPinInfo(flags DomainModificationImpact) ([]bool, error) {
	var cnodeinfo C.virNodeInfo
	var err C.virError
	ret := C.virNodeGetInfoWrapper(C.virDomainGetConnect(d.ptr), &cnodeinfo, &err)
	if ret == -1 {
		return []bool{}, makeError(&err)
	}

	ncpus := cnodeinfo.nodes * cnodeinfo.sockets * cnodeinfo.cores * cnodeinfo.threads
	maplen := int((ncpus + 7) / 8)
	ccpumaps := make([]C.uchar, maplen)
	ret = C.virDomainGetEmulatorPinInfoWrapper(d.ptr, &ccpumaps[0], C.int(maplen), C.uint(flags), &err)
	if ret == -1 {
		return []bool{}, makeError(&err)
	}

	cpumaps := make([]bool, ncpus)
	for i := 0; i < int(ncpus); i++ {
		byte := i / 8
		bit := i % 8
		cpumaps[i] = (ccpumaps[byte] & (1 << uint(bit))) != 0
	}

	return cpumaps, nil
}
920993
func (remote *RemoteDebugger) SetDeviceMetricsOverride(width int, height int, deviceScaleFactor float64, mobile bool, fitWindow bool) error {
	_, err := remote.SendRequest("Emulation.setDeviceMetricsOverride", Params{
		"width":             width,
		"height":            height,
		"deviceScaleFactor": deviceScaleFactor,
		"mobile":            mobile,
		"fitWindow":         fitWindow})

	return err
}
530812
func (c *Config) WithEC2MetadataDisableTimeoutOverride(enable bool) *Config {
	c.EC2MetadataDisableTimeoutOverride = &enable
	return c
}
921592
func (s *DBEngineVersion) SetSupportedEngineModes(v []*string) *DBEngineVersion {
	s.SupportedEngineModes = v
	return s
}