HEX
Server: LiteSpeed
System: Linux us-phx-web629.main-hosting.eu 5.14.0-503.23.2.el9_5.x86_64 #1 SMP PREEMPT_DYNAMIC Wed Feb 12 05:52:18 EST 2025 x86_64
User: u756937133 (756937133)
PHP: 8.2.30
Disabled: passthru,chgrp
Upload Files
File: //lib/python3.9/site-packages/tuned/plugins/__pycache__/hotplug.cpython-39.pyc
a

�ԳfX�@s@ddlmZddlmZddlZej��ZGdd�dej	�Z	dS)�)�base�Ncs�eZdZdZ�fdd�Z�fdd�Zdd�Zdd	�Zd
d�Zdd
�Z	dd�Z
dd�Zdd�Zdd�Z
dd�Zdd�Zdd�Zdd�Z�ZS)�Pluginz:
	Base class for plugins with device hotpluging support.
	cstt|�j|i|��dS�N)�superr�__init__)�self�args�kwargs��	__class__��9/usr/lib/python3.9/site-packages/tuned/plugins/hotplug.pyrszPlugin.__init__cstt|���|��dSr)rr�cleanup�_hardware_events_cleanup�rrr
rrszPlugin.cleanupcCsdSrr
rr
r
r�_hardware_events_initszPlugin._hardware_events_initcCsdSrr
rr
r
rrszPlugin._hardware_events_cleanupcCs|��dSr)rrr
r
r�
_init_devicesszPlugin._init_devicescCsN|dkr&t�d|j�|�|j�n$|dkrJt�d|j�|�|j�dS)N�addzdevice '%s' added�removezdevice '%s' removed)�log�infoZsys_name�_add_device�_remove_device)rZeventZdevicer
r
r�_hardware_events_callbacksz Plugin._hardware_events_callbackcCsdt�d|j|f�|j�|�|�||jd|g�|�||�|�||jd|g�|j	�|�dS)Nz!instance %s: adding new device %sZapply)
rr�name�_assigned_devicesr�_call_device_script�
script_pre�_added_device_apply_tuning�script_post�processed_devices�r�instance�device_namer
r
r�_add_device_process$szPlugin._add_device_processcCsp||j|jBvrdSt|j���D].\}}t|�||g��dkr"|�||�qlq"t�	d|�|j�
|�dS)Nrzno instance wants %s)r�
_free_devices�list�
_instances�items�lenZ_get_matching_devicesr%r�debugr)rr$Z
instance_namer#r
r
rr,szPlugin._add_devicecCs4|D]}|�||�qt|j�t|j�dk|_dS)zN
		Add devices specified by the set to the instance, no check is performed.
		rN)r%r*r!�assigned_devices�active�rr#Zdevice_names�devr
r
r�_add_devices_nocheck8s��zPlugin._add_devices_nocheckcCsx||jvrt|�||jd|g�|�||�|�||jd|g�|j�|�t|j�t|j�dk|_|j	�|�dSdS)NZunapplyrTF)
r!rr �_removed_device_unapply_tuningrrr*r,r-rr"r
r
r�_remove_device_processCs
��zPlugin._remove_device_processcCsH||j|jBvrdSt|j���D]}|�||�r"qDq"|j�|�dS)zVRemove device from the instance

		Parameters:
		device_name -- name of the device

		N)rr&r'r(�valuesr2r)rr$r#r
r
rrQszPlugin._remove_devicecCs|D]}|�||�qdS)zS
		Remove devices specified by the set from the instance, no check is performed.
		N)r2r.r
r
r�_remove_devices_nocheckaszPlugin._remove_devices_nocheckcCs6|�||g�|jr2|j�tjtj�r2|�||�dSr)Z_execute_all_device_commands�has_dynamic_tuning�_global_cfg�get�consts�CFG_DYNAMIC_TUNING�CFG_DEF_DYNAMIC_TUNINGZ_instance_apply_dynamicr"r
r
rrhsz!Plugin._added_device_apply_tuningcCs:|jr$|j�tjtj�r$|�||�|j||gdd�dS)NT)r)r5r6r7r8r9r:Z_instance_unapply_dynamicZ_cleanup_all_device_commandsr"r
r
rr1msz%Plugin._removed_device_unapply_tuning)�__name__�
__module__�__qualname__�__doc__rrrrrrr%rr0r2rr4rr1�
__classcell__r
r
rrrsr)
�rZtuned.constsr8Z
tuned.logsZtunedZlogsr7rrr
r
r
r�<module>s