%PDF- %PDF-
Mini Shell

Mini Shell

Direktori : /usr/lib/python3.9/site-packages/tuned/plugins/__pycache__/
Upload File :
Create Path :
Current 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�Zdd
�Z	dd�Z
dd�Zdd�Zdd�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.pyrszPlugin.__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'szPlugin._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/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_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
rrbszPlugin._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�sz%Plugin._removed_device_unapply_tuning)�__name__�
__module__�__qualname__�__doc__rrrrrrr'rr2r4rrr7r!r3�
__classcell__r
r
rrrs 

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


Zerion Mini Shell 1.0