MOON
Server: Apache
System: Linux s5.yayogua.com.py 6.12.0-124.55.3.el10_1.x86_64 #1 SMP PREEMPT_DYNAMIC Thu May 7 16:54:02 EDT 2026 x86_64
User: sanbercountryclu (1012)
PHP: 8.2.33
Disabled: NONE
Upload Files
File: //lib/python3.12/site-packages/tuned/plugins/__pycache__/hotplug.cpython-312.opt-1.pyc
�

�]�i���ddlmZddlmZddlZejj�ZGd�dej�Z	y)�)�base�Nc�z��eZdZdZ�fd�Z�fd�Zd�Zd�Zd�Zd�Z	d�Z
d	�Zd
�Zd�Z
d�Zd
�Zd�Zd�Zd�Z�xZS)�Pluginz:
	Base class for plugins with device hotpluging support.
	c�,��tt|�
|i|��y�N)�superr�__init__)�self�args�kwargs�	__class__s   ��:/usr/lib/python3.12/site-packages/tuned/plugins/hotplug.pyr
zPlugin.__init__s��������/��/�c�J��|j�tt|��yr)�_hardware_events_cleanupr	r�cleanup)rrs �rrzPlugin.cleanups������!�����rc��yr��rs r�_hardware_events_initzPlugin._hardware_events_init���rc��yrrrs rrzPlugin._hardware_events_cleanuprrc�$�|j�yr)rrs r�
_init_deviceszPlugin._init_devicess�����rc��|dk(r>tjd|jz�|j|j�y|dk(r>tjd|jz�|j	|j�y|dk(r>tjd|jz�|j|j�yy)N�addzdevice '%s', add event�removezdevice '%s', remove event�movez-device: '%s', rename event, reported new name)�log�info�sys_name�_add_device�_remove_device�_move_device)r�event�devices   r�_hardware_events_callbackz Plugin._hardware_events_callbacks���
�e�^��8�8�$�v���6�7����F�O�O�$�����8�8�'�&�/�/�9�:����v���'�����8�8�;�f�o�o�M�N����V�_�_�%�rc�Z�tjd|j�d|���|jj	|�|j||jd|g�|j||�|j||jd|g�|jj	|�y)Nz	instance z: adding new device �apply)
r r!�name�_assigned_devicesr�_call_device_script�
script_pre�_added_device_apply_tuning�script_post�processed_devices�r�instance�device_names   r�_add_device_processzPlugin._add_device_process's����(�(�(�-�-��M�N������[�)����8�X�%8�%8�'�K�=�Q��!�!�(�K�8����8�X�%9�%9�7�[�M�R�
��� � ��-rc��||j|jzvrtjd|z�yt	|j
j
��D]8\}}t|j||g��dk(s�&|j||�ytjd|z�|jj|�y)Nz%device: '%s' already exists, ignoringrzno instance wants %s)r,�
_free_devicesr �debug�list�
_instances�items�len�_get_matching_devicesr5r)rr4�
instance_namer3s    rr#zPlugin._add_device/s����T�+�+�d�.@�.@�@�A��9�9�
4�{�
B�C�	�!%�d�o�o�&;�&;�&=�!>��m�X�	�$�
$�
$�X��}�
=�>�!�C����X�{�3�	�"?�
�9�9�
#�k�
1�2������+�&rc��|D]}|j||��t|j�t|j�zdkD|_y)zN
		Add devices specified by the set to the instance, no check is performed.
		rN)r5r<r1�assigned_devices�active�rr3�device_names�devs    r�_add_devices_nocheckzPlugin._add_devices_nocheck<sM���c����H�c�*����2�2�3�	�(�
#�
#�$�%�'(�)�(�/rc��||jvr�|j||jd|g�|j||�|j||jd|g�|jj|�t
|j�t
|j�zdkD|_|jj|�yy)N�unapplyrTF)
r1r-r0�_removed_device_unapply_tuningr.rr<r@rAr,r2s   r�_remove_device_processzPlugin._remove_device_processGs����H�.�.�.����H�h�&:�&:�I��}�U��&�&�x��=����H�h�&9�&9�9�{�m�T����$�$�[�1���3�3�4�
�8�$�$�%�&�()�*�8�?���� � ��-�
�	rc��y)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)rr4s  rr%zPlugin._move_deviceUs��rc�j�||j|jzvrtjd|z�yt	|j
j
��D]}|j||�s�y	|jj|�y#t$rtjd|z�YywxYw)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)
r,r7r r8r9r:�valuesrIr�KeyError)rr4r3s   rr$zPlugin._remove_devicebs�����/�/�$�2D�2D�D�E��9�9�
3�k�
A�B�	��t���-�-�/�0�h�
�!�!�(�K�8�	�1�O������k�*��
�O��I�I�?�+�M�N�O�s�2B�!B2�1B2c�6�|D]}|j||��y)zS
		Remove devices specified by the set from the instance, no check is performed.
		N)rIrBs    r�_remove_devices_nocheckzPlugin._remove_devices_nocheckvs���c����x��-�rc���|j||g�|jrL|jjtj
tj�r|j||�yyyr)�_execute_all_device_commands�has_dynamic_tuning�_global_cfg�get�consts�CFG_DYNAMIC_TUNING�CFG_DEF_DYNAMIC_TUNING�_instance_apply_dynamicr2s   rr/z!Plugin._added_device_apply_tuning}sX���#�#�H�{�m�<�
� � �T�%5�%5�%9�%9�&�:S�:S�U[�Ur�Ur�%s�����+�6�&t� rc���|jrJ|jjtjtj
�r|j
||�|j||gd��y)NT)r)rRrSrTrUrVrW�_instance_unapply_dynamic�_cleanup_all_device_commandsr2s   rrHz%Plugin._removed_device_unapply_tuning�sT��
� � �T�%5�%5�%9�%9�&�:S�:S�U[�Ur�Ur�%s��!�!�(�K�8��#�#�H�{�m�d�#�Kr)�__name__�
__module__�__qualname__�__doc__r
rrrrr(r5r#rErIr%r$rOr/rH�
__classcell__)rs@rrrsU����0� ����	&�.�'�	)���O�(.�7�
Lrr)
�r�tuned.constsrU�
tuned.logs�tuned�logsrTr rrrr�<module>rfs2������j�j�n�n���~L�T�[�[�~Lr