HEX
Server: Apache
System: Linux 185.122.168.184.host.secureserver.net 5.14.0-570.52.1.el9_6.x86_64 #1 SMP PREEMPT_DYNAMIC Wed Oct 15 06:39:08 EDT 2025 x86_64
User: barbeatleanalyti (1024)
PHP: 8.1.33
Disabled: NONE
Upload Files
File: //usr/lib/python3.9/site-packages/tuned/plugins/__pycache__/plugin_sysfs.cpython-39.pyc
a

,�g�
�@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)�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�
<listcomp>.�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_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||dd�S)NT)Zignore_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�<module>s