a ”ˆ«h… ã@stddlmZddlZddlZddlZddlTddlZddl m Z ddl Tddl m Z ej ¡ZGdd„dejƒZdS)é)ÚbaseéN)Ú*)ÚcommandscsfeZdZdZ‡fdd„Zdd„Zdd„Zdd „Zd d „Ze j fd d „Z dd„Z dd„Z dd„Z‡ZS)Ú SysfsPluginai Sets various `sysfs` settings specified by the plug-in options. The syntax is `_name_=_value_`, where `_name_` is the `sysfs` path to use and `_value_` is the value to write. The `sysfs` path supports the shell-style wildcard characters (see `man 7 glob` for additional detail). Use this plugin in case you need to change some settings that are not covered by other plug-ins. Prefer specific plug-ins if they cover the required settings. .Ignore corrected errors and associated scans that cause latency spikes ==== ---- [sysfs] /sys/devices/system/machinecheck/machinecheck*/ignore_ce=1 ---- ==== cs(tt|ƒj|i|¤Žd|_tƒ|_dS)NT)ÚsuperrÚ__init__Z_has_dynamic_optionsrÚ_cmd)ÚselfÚargsÚkwargs©Ú __class__©ú>/usr/lib/python3.9/site-packages/tuned/plugins/plugin_sysfs.pyr%szSysfsPlugin.__init__cCs4d|_d|_tdd„t|j ¡ƒDƒƒ|_i|_dS)NFTcSs$g|]}tj |d¡|df‘qS)rr)ÚosÚpathÚnormpath)Ú.0Ú key_valuerrrÚ .óz.SysfsPlugin._instance_init..)Z_has_dynamic_tuningZ_has_static_tuningÚdictÚlistÚoptionsÚitemsÚ_sysfsÚ_sysfs_original©r ÚinstancerrrÚ_instance_init*szSysfsPlugin._instance_initcCsdS©NrrrrrÚ_instance_cleanup1szSysfsPlugin._instance_cleanupcCsnt|j ¡ƒD]Z\}}|j |¡}t |¡D]:}| |¡rX| |¡|j |<|  ||¡q,t   d|¡q,qdS)Nz)rejecting write to '%s' (not inside /sys)) rrrÚ _variablesÚexpandÚglobÚiglobÚ _check_sysfsÚ _read_sysfsrÚ _write_sysfsÚlogÚerror)r rÚkeyÚvalueÚvÚfrrrÚ_instance_apply_static4s  z"SysfsPlugin._instance_apply_staticc Cshd}t|j ¡ƒD]P\}}|j |¡}t |¡D]0}| |¡r0| |¡} |  ||| |¡dkr0d}q0q|S)NTF) rrrr#r$r%r&r'r(Z _verify_value) r rZignore_missingZdevicesÚretr,r-r.r/Zcurr_valrrrÚ_instance_verify_static>s   z#SysfsPlugin._instance_verify_staticcCs(t|j ¡ƒD]\}}| ||¡qdSr!)rrrr))r rZrollbackr,r-rrrÚ_instance_unapply_staticIsz$SysfsPlugin._instance_unapply_staticcCs t d|¡S)Nz^/sys/.*)ÚreÚmatch)r Ú sysfs_filerrrr'MszSysfsPlugin._check_sysfscCs2|j |¡ ¡}t|ƒdkr*|j |d¡SdSdS)NrF)r Z read_fileÚstripÚlenZget_active_option)r r6Údatarrrr(Ps zSysfsPlugin._read_sysfscCs|jj||ddS)NT)Z ignore_same)r Z write_to_file)r r6r-rrrr)WszSysfsPlugin._write_sysfs)Ú__name__Ú __module__Ú __qualname__Ú__doc__rr r"r0r2ÚconstsZ ROLLBACK_SOFTr3r'r(r)Ú __classcell__rrr rr s   r)Úrr%r4Zos.pathrZ decoratorsZ tuned.logsZtunedZ tuned.constsr>Ú subprocessZtuned.utils.commandsrZlogsÚgetr*ZPluginrrrrrÚs