Sindbad~EG File Manager
3
�<�e�
�@srddlmZddlZddlZddlZddlTddlZddl j
Z
ddlTddlm
Z
ejj�ZGdd�dej�ZdS)�)�base�N)�*)�commandscsfeZdZdZ�fdd�Zdd�Zdd�Zdd �Zd
d�Ze j
fdd
�Zdd�Zdd�Z
dd�Z�ZS)�SysfsPlugina|
`sysfs`::
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||�d|_t�|_dS)NT)�superr�__init__Z_has_dynamic_optionsr�_cmd)�self�args�kwargs)� __class__��"/usr/lib/python3.6/plugin_sysfs.pyr'szSysfsPlugin.__init__cCs4d|_d|_tdd�t|jj��D��|_i|_dS)NFTcSs$g|]}tjj|d�|df�qS)rr)�os�path�normpath)�.0� key_valuerrr�
<listcomp>0sz.SysfsPlugin._instance_init.<locals>.<listcomp>)Z_has_dynamic_tuningZ_has_static_tuning�dict�listZoptions�items�_sysfs�_sysfs_original)r
�instancerrr�_instance_init,szSysfsPlugin._instance_initcCsdS)Nr)r
rrrr�_instance_cleanup3szSysfsPlugin._instance_cleanupcCsvxpt|jj��D]^\}}|jj|�}xHtj|�D]:}|j|�r\|j|�|j |<|j
||�q0tjd|�q0WqWdS)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_static6s
z"SysfsPlugin._instance_apply_staticc
Cspd}xft|jj��D]T\}}|jj|�}x>tj|�D]0}|j|�r4|j|�} |j ||| |�dkr4d}q4WqW|S)NTF)
rrrrrr r!r"r#Z
_verify_value)
r
rZignore_missingZdevices�retr'r(r)r*Zcurr_valrrr�_instance_verify_static@s
z#SysfsPlugin._instance_verify_staticcCs,x&t|jj��D]\}}|j||�qWdS)N)rrrr$)r
rZrollbackr'r(rrr�_instance_unapply_staticKsz$SysfsPlugin._instance_unapply_staticcCstjd|�S)Nz^/sys/.*)�re�match)r
�
sysfs_filerrrr"OszSysfsPlugin._check_sysfscCs2|jj|�j�}t|�dkr*|jj|d�SdSdS)NrF)r Z read_file�strip�lenZget_active_option)r
r1�datarrrr#RszSysfsPlugin._read_sysfscCs|jj||�S)N)r Z
write_to_file)r
r1r(rrrr$YszSysfsPlugin._write_sysfs)�__name__�
__module__�__qualname__�__doc__rrrr+r-�constsZ
ROLLBACK_SOFTr.r"r#r$�
__classcell__rr)r
rr
s
r)�rr r/Zos.pathrZ
decoratorsZ
tuned.logsZtunedZtuned.constsr9�
subprocessZtuned.utils.commandsrZlogs�getr%ZPluginrrrrr�<module>s
Sindbad File Manager Version 1.0, Coded By Sindbad EG ~ The Terrorists