+
     Gi  c                   s    ^ RI t ^RIHt ^RI5 ^ RIt^ RIHt ^ RIH	t	 ^ RI
t
^ RIt]P                  P                  4       t ! R R]P                  4      tR# )i    N)hotplug)Z*)commandsc                   s   a a ] tR t^t oRtV 3R ltV 3R ltR t]R 4       t	R t
R tV 3R ltV 3R	 ltV 3R
 lt]R 4       tR tR tR tR tR t]! RRR7      R 4       t]! R4      RR l4       tRtVtV ;t# )SCSIHostPlugina  
Tunes options for SCSI hosts.

The plug-in sets Aggressive Link Power Management (ALPM) to the value specified
by the [option]`alpm` option. The option takes one of four values:
`min_power`, `med_power_with_dipm`, `medium_power` and `max_performance`.

NOTE: ALPM is only available on SATA controllers that use the Advanced
Host Controller Interface (AHCI).

.ALPM setting when extended periods of idle time are expected
====
----
[scsi_host]
alpm=med_power_with_dipm
----
====
c                sN   < \         \        V `
  ! V/ VB  \        4       V n        R # N)superr   __init__r   _cmd)selfZargsZkwargs	__class__s   &*,C/usr/lib/python3.14/site-packages/tuned/plugins/plugin_scsi_host.pyr   ZSCSIHostPlugin.__init__    s     &77j$)    c                s6  < \         \        V `  4        R V n        \	        4       V n        V P                  P                  R4       FA  pV P                  V4      '       g   K  V P
                  P                  VP                  4       KC  	  \	        4       V n        R# )TscsiN)r   r   _init_devices_devices_supportedZset_free_devices_hardware_inventoryZget_devices_device_is_supportedZaddZsys_name_assigned_devices)r   devicer   s   & r	   r   ZSCSIHostPlugin._init_devices%   sr    +- $u$((44V<f
''6??+ = 5$r
   c                sb    V Uu. uF  q P                   P                  R V4      NK   	  up# u upi )r   )r   Z
get_device)r   ZdevicesZxs   && r	   _get_device_objectsZ"SCSIHostPlugin._get_device_objects/   s+    BI	J'Q
"
"
-
-fa
8'	JJ	Js   $,c                s     VP                   R 8H  # )Z	scsi_host)Zdevice_type)clsr      &&r	   r   Z#SCSIHostPlugin._device_is_supported2   s    



++r
   c                sT    V P                   P                  V R V P                  4       R# )r   N)r   Z	subscribe_hardware_events_callbackr      &r	   _hardware_events_initZ$SCSIHostPlugin._hardware_events_init6   s     $$T643Q3QRr
   c                s<    V P                   P                  V 4       R # r   )r   Zunsubscriber   r   r	   _hardware_events_cleanupZ'SCSIHostPlugin._hardware_events_cleanup9   s    &&t,r
   c                s`   < V P                  V4      '       d   \        \        V `  W4       R # R # r   )r   r   r   r   )r   Zeventr   r      &&&r	   r   Z(SCSIHostPlugin._hardware_events_callback<   s(    	v&&8G 'r
   c                .   < \         \        V `  W4       R # r   )r   r   _added_device_apply_tuningr   instanceZdevice_namer   r   r	   r   Z)SCSIHostPlugin._added_device_apply_tuning@   s    8Or
   c                r   r   )r   r   _removed_device_unapply_tuningr   r   r	   r    Z-SCSIHostPlugin._removed_device_unapply_tuningC   s    <XSr
   c                s
    R R/# )alpmN )r   r   r	   _get_config_optionsZ"SCSIHostPlugin._get_config_optionsF   s     
$
 r
   c                s"    R Vn         RVn        R# )TFN)Z_has_static_tuningZ_has_dynamic_tuningr   r   r   r	   _instance_initZSCSIHostPlugin._instance_initL   s     $(!&(r
   c                s    R # r   r"   r$   r   r	   _instance_cleanupZ SCSIHostPlugin._instance_cleanupP   s    r
   c                V    \         P                  P                  R \        V4      R4      # )/sys/class/scsi_host/Zlink_power_management_policyospathZjoinstrr   r   r   r	   _get_alpm_policy_fileZ$SCSIHostPlugin._get_alpm_policy_fileS   s    	-s6{<Z	[[r
   c                r'   )r(   Zahci_port_cmdr)   r-   r   r	   _get_ahci_port_cmd_fileZ&SCSIHostPlugin._get_ahci_port_cmd_fileV   s    	-s6{O	LLr
   c                s    V P                  V4      p\        P                  P                  V4      '       g   R # \	        V P
                  P                  V4      ^4      pVR,          ^ 8g  # )Fi  $ )r/   r*   r+   ZisfileZintr   	read_file)r   r   Zport_cmd_fileZport_cmds   &&  r	   _is_external_sata_portZ%SCSIHostPlugin._is_external_sata_portY   sV    ..v6-		&	&
$$]3R8( 
&	'1	,,r
   r!   T)Z
per_devicec                s   Vf   R # V P                  V4      '       d(   \        P                  R\        V4      ,          4       R # V P	                  V4      pV'       g   \
        P                  P                  V4      '       d9   V P                  P                  YaV'       d   \        P                  .MRR7       V# \        P                  RV: R\        V4      : R24       R # V# )NzUDevice '%s' is an external SATA controller, skipping ALPM setting to support hot plugFZno_errorzALPM control file ('z)') not found, skipping ALPM setting for 'Z')r1   logZinfor,   r.   r*   r+   Zexistsr   Zwrite_to_fileerrnoZENOENT)r   policyr   r   ZsimZremovepolicy_files   &&&&&& r	   	_set_alpmZSCSIHostPlugin._set_alpmb   s    ^
	  (( 88cfijpfqqr
**62+	ggnn[!!IIK"(e  5
 
- HHU`beflbmno	-r
   c                s    V P                  V4      pV P                  P                  VR R7      P                  4       pVR8w  d   V# R# )Tr2    N)r.   r   r0   Zstrip)r   r   r   Zignore_missingr6   r5   s   &&&&  r	   	_get_alpmZSCSIHostPlugin._get_alpmu   sE    **62+99{t<BBD&R<)T)r
   )r   r   r   r   )F)Z__name__Z
__module__Z__qualname__Z__firstlineno__Z__doc__r   r   r   Zclassmethodr   r   r   r   r   r    r#   r%   r&   r.   r/   r1   Zcommand_setr7   Zcommand_getr9   Z__static_attributes__Z__classdictcell__Z__classcell__)r   Z__classdict__s   @@r	   r   r      s     &
!K , ,S-HPT  
'\M- f4( )$ f* * *r
   r   )r4   r8   r    Z
decoratorsZ
tuned.logsZtunedZtuned.constsZconstsZtuned.utils.commandsr   r*   ZreZlogsZgetr3   ZPluginr   r"   r
   r	   <module>r:      s?         ) 	 	jjnnm*W^^ m*r
   