HEX
Server: Apache
System: Linux insrv.serversdaddy.com 5.14.0-362.24.2.el9_3.x86_64 #1 SMP PREEMPT_DYNAMIC Sat Mar 30 14:11:54 EDT 2024 x86_64
User: jsaha (1066)
PHP: 8.3.6
Disabled: exec,passthru,shell_exec,system
Upload Files
File: //lib/python3.9/site-packages/tuned/plugins/__pycache__/plugin_sysfs.cpython-39.pyc
a

Y��d�
�@stddlmZddlZddlZddlZddlTddlZddl	m
Z
ddlTddlm
Z
ej��ZGdd�dej�ZdS)�)�base�N)�*)�commandscsfeZdZdZ�fdd�Zdd�Zdd�Zdd	�Zd
d�Ze	j
fdd
�Zdd�Zdd�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|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�
<listcomp>0�z.SysfsPlugin._instance_init.<locals>.<listcomp>)Z_has_dynamic_tuningZ_has_static_tuning�dict�list�options�items�_sysfs�_sysfs_original�r
�instancerrr�_instance_init,szSysfsPlugin._instance_initcCsdS�Nrrrrr�_instance_cleanup3szSysfsPlugin._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_static6s
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_staticKsz$SysfsPlugin._instance_unapply_staticcCst�d|�S)Nz^/sys/.*)�re�match)r
�
sysfs_filerrrr'OszSysfsPlugin._check_sysfscCs2|j�|���}t|�dkr*|j�|d�SdSdS)NrF)r	Z	read_file�strip�lenZget_active_option)r
r6�datarrrr(RszSysfsPlugin._read_sysfscCs|j�||�Sr!)r	Z
write_to_file)r
r6r-rrrr)YszSysfsPlugin._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�<module>s