+
     Gi  c                   s    ^RI Ht ^ RIHt ^ RIt]P                  P                  4       t ! R R]P                  4      t	R# )i   )baseNc                   s   a a ] tR t^t oRtV 3R ltV 3R ltR tR tR t	R t
R tR	 tR
 tR tR tR tR tR tR tRtVtV ;t# )Pluginz8
Base class for plugins with device hotpluging support.
c                s0   < \         \        V `
  ! V/ VB  R # N)superr   __init__)selfZargsZkwargs	__class__s   &*,:/usr/lib/python3.14/site-packages/tuned/plugins/hotplug.pyr   ZPlugin.__init__   s    //    c                sL   < V P                  4        \        \        V `  4        R # r   )_hardware_events_cleanupr   r   cleanup)r   r   s   &r   r
   ZPlugin.cleanup   s    !r   c                    R # r    r      &r   _hardware_events_initZPlugin._hardware_events_init       r   c                r   r   r   r   r   r   r	   ZPlugin._hardware_events_cleanup   r   r   c                s&    V P                  4        R # r   )r   r   r   r   _init_devicesZPlugin._init_devices   s    r   c                s   VR 8X  dD   \         P                  RVP                  ,          4       V P                  VP                  4       R# VR8X  dD   \         P                  RVP                  ,          4       V P	                  VP                  4       R# VR8X  dD   \         P                  RVP                  ,          4       V P                  VP                  4       R# R# )addzdevice '%s', add eventremovezdevice '%s', remove eventZmovez-device: '%s', rename event, reported new nameN)loginfoZsys_name_add_device_remove_device_move_device)r   ZeventZdevice   &&&r   _hardware_events_callbackZ Plugin._hardware_events_callback   s    
e^88$v67FOO$88'&//9:v'88;fooMNV__% r   c                sZ   \         P                  R VP                  : RV: 24       V P                  P	                  V4       V P                  WP                  RV.4       V P                  W4       V P                  WP                  RV.4       VP                  P	                  V4       R# )z	instance z: adding new device ZapplyN)
r   r   Zname_assigned_devicesr   _call_device_script
script_pre_added_device_apply_tuningscript_postprocessed_devicesr   instancedevice_namer   r   _add_device_processZPlugin._add_device_process'   s    (((--MN[)8%8%8'K=Q!!(88%9%97[MR
  -r   c                s   WP                   V P                  ,          9   d   \        P                  R V,          4       R# \	        V P
                  P                  4       4       F9  w  r#\        V P                  W1.4      4      ^8X  g   K'  V P                  W14        R# 	  \        P                  RV,          4       V P                  P                  V4       R# )z%device: '%s' already exists, ignoringNzno instance wants %s)r   _free_devicesr   debuglist
_instancesZitemslenZ_get_matching_devicesr$   r   )r   r#   Zinstance_namer"   s   &&  r   r   ZPlugin._add_device/   s    ++d.@.@@A994{BC	!%doo&;&;&=!>m	$
$
$X}
=>!CX3	 "?
 99#k12+&r   c                s    V F  pV P                  W4       K  	  \        VP                  4      \        VP                  4      ,           ^ 8  Vn        R# )zJ
Add devices specified by the set to the instance, no check is performed.
N)r$   r)   r    assigned_devicesactiver   r"   Zdevice_namesZdev   &&& r   _add_devices_nocheckZPlugin._add_devices_nocheck<   sK     cH*  223	(
#
#$%'()(/r   c                s   W!P                   9   d   V P                  WP                  R V.4       V P                  W4       V P                  WP                  R V.4       VP                   P                  V4       \        VP                   4      \        VP                  4      ,           ^ 8  Vn        V P                  P                  V4       R# R# )ZunapplyTF)
r    r   r   _removed_device_unapply_tuningr   r   r)   r*   r+   r   r!   r   r   _remove_device_processZPlugin._remove_device_processG   s    ...H&:&:I}U&&x=H&9&99{mT$$[1 334
8$$%&()*8?  -
	r   c                s    R# )aW  Rename 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   )r   r#   s   &&r   r   ZPlugin._move_deviceU   s     r   c                s   WP                   V P                  ,          9  d   \        P                  RV,          4       R# \	        V P
                  P                  4       4       F  pV P                  W!4      '       g   K   R# 	   V P                  P                  V4       R#   \         d!    \        P                  RT,          4        R# i ; i)zPRemove 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   r%   r   r&   r'   r(   Zvaluesr0   r   ZKeyError)r   r#   r"   s   && r   r   ZPlugin._remove_deviceb   s     //$2D2DDE993kAB	t--/0h
!!(88	 1Ok*
 OII?+MNOs   B" "'CCc                s:    V F  pV P                  W4       K  	  R# )zO
Remove devices specified by the set from the instance, no check is performed.
N)r0   r,   r-   r   _remove_devices_nocheckZPlugin._remove_devices_nocheckv   s     cx- r   c                s    V P                  W.4       VP                  '       dT   V P                  P                  \        P
                  \        P                  4      '       d   V P                  W4       R # R # R # r   )Z_execute_all_device_commandshas_dynamic_tuning_global_cfggetconstsCFG_DYNAMIC_TUNINGCFG_DEF_DYNAMIC_TUNINGZ_instance_apply_dynamicr!   r   r   r   Z!Plugin._added_device_apply_tuning}   sZ    ##Hm<   T%5%5%9%9&:S:SU[UrUr%s%s6 &t r   c                s    VP                   '       dP   V P                  P                  \        P                  \        P
                  4      '       d   V P                  W4       V P                  W.R R7       R# )T)r   N)r2   r3   r4   r5   r6   r7   Z_instance_unapply_dynamicZ_cleanup_all_device_commandsr!   r   r   r/   Z%Plugin._removed_device_unapply_tuning   sV       T%5%5%9%9&:S:SU[UrUr%s%s!!(8##Hmd#Kr   r   )Z__name__Z
__module__Z__qualname__Z__firstlineno__Z__doc__r   r
   r   r	   r   r   r$   r   r.   r0   r   r   r1   r   r/   Z__static_attributes__Z__classdictcell__Z__classcell__)r   Z__classdict__s   @@r   r   r      s]     0 	&.'	)O(.7
L Lr   r   )
Z r    Ztuned.constsr5   Z
tuned.logsZtunedZlogsr4   r   r   r   r   r   <module>r8      s2      jjnn~LT[[ ~Lr   