AlkantarClanX12

Your IP : 3.21.159.223


Current Path : /lib/python3.6/site-packages/tuned/plugins/__pycache__/
Upload File :
Current File : //lib/python3.6/site-packages/tuned/plugins/__pycache__/hotplug.cpython-36.pyc

3

�<�eX�@s>ddlmZddljZddlZejj�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||�dS)N)�superr�__init__)�self�args�kwargs)�	__class__��/usr/lib/python3.6/hotplug.pyrszPlugin.__init__cstt|�j�|j�dS)N)rr�cleanup�_hardware_events_cleanup)r)r
rrr
szPlugin.cleanupcCsdS)Nr)rrrr�_hardware_events_initszPlugin._hardware_events_initcCsdS)Nr)rrrrrszPlugin._hardware_events_cleanupcCs|j�dS)N)r)rrrr�
_init_devicesszPlugin._init_devicescCsN|dkr&tjd|j�|j|j�n$|dkrJtjd|j�|j|j�dS)N�addzdevice '%s' added�removezdevice '%s' removed)�log�infoZsys_name�_add_device�_remove_device)rZeventZdevicerrr�_hardware_events_callbacksz Plugin._hardware_events_callbackcCsdtjd|j|f�|jj|�|j||jd|g�|j||�|j||jd|g�|j	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_namerrr�_add_device_process$szPlugin._add_device_processcCsr||j|jBkrdSxXt|jj��D],\}}t|j||g��dkr$|j||�Pq$Wtj	d|�|jj
|�dS)Nrzno instance wants %s)r�
_free_devices�list�
_instances�items�lenZ_get_matching_devicesr!r�debugr)rr Z
instance_namerrrrr,szPlugin._add_devicecCs8x|D]}|j||�qWt|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�device_names�devrrr�_add_devices_nocheck8s
zPlugin._add_devices_nocheckcCsx||jkrt|j||jd|g�|j||�|j||jd|g�|jj|�t|j�t|j�dk|_|j	j|�dSdS)NZunapplyrTF)
rrr�_removed_device_unapply_tuningrrr&r(r)r)rrr rrr�_remove_device_processCs
zPlugin._remove_device_processcCsJ||j|jBkrdSx0t|jj��D]}|j||�r$Pq$W|jj|�dS)zVRemove device from the instance

		Parameters:
		device_name -- name of the device

		N)rr"r#r$�valuesr.r)rr rrrrrQszPlugin._remove_devicecCsx|D]}|j||�qWdS)zS
		Remove devices specified by the set from the instance, no check is performed.
		N)r.)rrr*r+rrr�_remove_devices_nocheckas
zPlugin._remove_devices_nocheckcCs6|j||g�|jr2|jjtjtj�r2|j||�dS)N)Z_execute_all_device_commands�has_dynamic_tuning�_global_cfg�get�consts�CFG_DYNAMIC_TUNING�CFG_DEF_DYNAMIC_TUNINGZ_instance_apply_dynamic)rrr rrrrhsz!Plugin._added_device_apply_tuningcCs:|jr$|jjtjtj�r$|j||�|j||gdd�dS)NT)r)r1r2r3r4r5r6Z_instance_unapply_dynamicZ_cleanup_all_device_commands)rrr rrrr-msz%Plugin._removed_device_unapply_tuning)�__name__�
__module__�__qualname__�__doc__rr
rrrrr!rr,r.rr0rr-�
__classcell__rr)r
rrsr)
�rZtuned.constsr4Z
tuned.logsZtunedZlogsr3rrrrrr�<module>s