Edit File: plugin_sysfs.cpython-36.opt-1.pyc
3 ��c^ ������������������@���sh���d�dl�mZ�ddlZddlZddlZd�dlT�ddlZddl T�ddl mZ�ejj ��ZG�dd��dej�ZdS�)����)�base�����N)�*)�commandsc�������������������sb���e�Zd�ZdZ��fdd�Zdd��Zdd��Zdd ��Zd d��Zdd d�Z dd��Z dd��Zdd��Z���Z S�)�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 ---- ==== c����������������s$���t�t|��j||��d|�_t��|�_d�S�)NT)�superr����__init__Z_has_dynamic_optionsr����_cmd)�self�args�kwargs)� __class__���"/usr/lib/python3.6/plugin_sysfs.pyr���&���s����zSysfsPlugin.__init__c�������������C���s4���d|_�d|_tdd��t|jj���D���|_i�|_d�S�)NFTc�������������S���s$���g�|�]}t�jj|d���|d�f�qS�)r���r���)�os�path�normpath)�.0� key_valuer���r���r���� <listcomp>/���s����z.SysfsPlugin._instance_init.<locals>.<listcomp>)Z_has_dynamic_tuningZ_has_static_tuning�dict�listZoptions�items�_sysfs�_sysfs_original)r ����instancer���r���r����_instance_init+���s����zSysfsPlugin._instance_initc�������������C���s���d�S�)Nr���)r ���r���r���r���r����_instance_cleanup2���s����zSysfsPlugin._instance_cleanupc�������������C���sv���xpt�|jj���D�]^\}}|�jj|�}xHtj|�D�]:}|�j|�r\|�j|�|j |<�|�j ||��q0tjd|���q0W�qW�d�S�)Nz)rejecting write to '%s' (not inside /sys)) r���r���r���� _variables�expand�glob�iglob�_check_sysfs�_read_sysfsr����_write_sysfs�log�error)r ���r����key�value�v�fr���r���r����_instance_apply_static5���s���� z"SysfsPlugin._instance_apply_staticc������� ������C���sp���d}xft�|jj���D�]T\}}|�jj|�}x>tj|�D�]0}|�j|�r4|�j|�} |�j ||| |�dkr4d}q4W�qW�|S�)NTF) r���r���r���r���r���r ���r!���r"���r#���Z _verify_value) r ���r���Zignore_missingZdevices�retr'���r(���r)���r*���Zcurr_valr���r���r����_instance_verify_static?���s���� z#SysfsPlugin._instance_verify_staticFc�������������C���s,���x&t�|jj���D�]\}}|�j||��qW�d�S�)N)r���r���r���r$���)r ���r���Z full_rollbackr'���r(���r���r���r����_instance_unapply_staticJ���s����z$SysfsPlugin._instance_unapply_staticc�������������C���s���t�jd|�S�)Nz^/sys/.*)�re�match)r ���� sysfs_filer���r���r���r"���N���s����zSysfsPlugin._check_sysfsc�������������C���s2���|�j�j|�j��}t|�dkr*|�j�j|d�S�d�S�d�S�)Nr���F)r ���Z read_file�strip�lenZget_active_option)r ���r1����datar���r���r���r#���Q���s����zSysfsPlugin._read_sysfsc�������������C���s���|�j�j||�S�)N)r ���Z write_to_file)r ���r1���r(���r���r���r���r$���X���s����zSysfsPlugin._write_sysfs)F)�__name__� __module__�__qualname__�__doc__r���r���r���r+���r-���r.���r"���r#���r$���� __classcell__r���r���)r ���r���r������s��� r���)��r���r ���r/���Zos.pathr���Z decoratorsZ tuned.logsZtuned� subprocessZtuned.utils.commandsr���Zlogs�getr%���ZPluginr���r���r���r���r����<module>���s���