JFIF$        dd7 

Viewing File: /usr/lib/python3.9/site-packages/tuned/plugins/__pycache__/hotplug.cpython-39.pyc

a

���h�@s@ddlmZddlmZddlZej��ZGdd�dej	�Z	dS)�)�base�Ncs�eZdZdZ�fdd�Z�fdd�Zdd�Zdd	�Zd
d�Zdd
�Z	dd�Z
dd�Zdd�Zdd�Z
dd�Zdd�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.pyrszPlugin.__init__cs|��tt|���dSr)�_hardware_events_cleanuprr�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_devicescCst|dkr&t�d|j�|�|j�nJ|dkrLt�d|j�|�|j�n$|dkrpt�d|j�|�|j�dS)N�addzdevice '%s', add event�removezdevice '%s', remove event�movez-device: '%s', rename event, reported new name)�log�infoZsys_name�_add_device�_remove_device�_move_device)rZeventZdevicer
r
r�_hardware_events_callbacksz 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'szPlugin._add_device_processcCs~||j|jBvr"t�d|�dSt|j���D].\}}t|�||g��dkr0|�	||�qzq0t�d|�|j�
|�dS)Nz%device: '%s' already exists, ignoringrzno instance wants %s)r�
_free_devicesr�debug�list�
_instances�items�lenZ_get_matching_devicesr'r)rr&Z
instance_namer%r
r
rr/szPlugin._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%Zdevice_names�devr
r
r�_add_devices_nocheck<s��zPlugin._add_devices_nocheckcCsx||jvrt|�||jd|g�|�||�|�||jd|g�|j�|�t|j�t|j�dk|_|j	�|�dSdS)NZunapplyrTF)
r#rr"�_removed_device_unapply_tuningr rr-r.r/rr$r
r
r�_remove_device_processGs
��zPlugin._remove_device_processcCsdS)aeRename device in the instance, this probably applies only
		to network interfaces. The udev device environment is
		mostly unchanged (except the name) and the old device name
		isn't announced, thus the rename functionality is plugin
		dependant and has to be implemented in the child plugin class.

		Parameters:
		device_name -- new name of the device

		Nr
)rr&r
r
rrUszPlugin._move_devicecCs|||j|jBvr"t�d|�dSt|j���D]}|�||�r0qxq0z|j�|�Wn t	yvt�d|�Yn0dS)zVRemove device from the instance

		Parameters:
		device_name -- name of the device

		z$device: '%s' doesn't exist, ignoringNz/device: '%s' isn't initialized, not removing it)
rr(rr)r*r+�valuesr4r�KeyError)rr&r%r
r
rrbszPlugin._remove_devicecCs|D]}|�||�qdS)zS
		Remove devices specified by the set from the instance, no check is performed.
		N)r4r0r
r
r�_remove_devices_nocheckvszPlugin._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
rr!}sz!Plugin._added_device_apply_tuningcCs:|jr$|j�tjtj�r$|�||�|j||gdd�dS)NT)r)r8r9r:r;r<r=Z_instance_unapply_dynamicZ_cleanup_all_device_commandsr$r
r
rr3�sz%Plugin._removed_device_unapply_tuning)�__name__�
__module__�__qualname__�__doc__rrrrrrr'rr2r4rrr7r!r3�
__classcell__r
r
rrrs 

r)
�rZtuned.constsr;Z
tuned.logsZtunedZlogsr:rrr
r
r
r�<module>s

Back to Directory  nL+D550H?Mx ,D"v]qv;6*Zqn)ZP0!1 A "#a$2Qr D8 a Ri[f\mIykIw0cuFcRı?lO7к_f˓[C$殷WF<_W ԣsKc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