VULN_CHECK_I913V6 GiddlmZddlmZddlZej jZGddejZ y))baseNczeZdZdZfdZfdZdZdZdZdZ dZ d Z d Z d Z d Zd ZdZdZdZxZS)Pluginz: Base class for plugins with device hotpluging support. c,tt| |i|yN)superr__init__)selfargskwargs __class__s :/usr/lib/python3.12/site-packages/tuned/plugins/hotplug.pyr zPlugin.__init__ s//cJ|jtt|yr)_hardware_events_cleanupr rcleanup)r rs rrzPlugin.cleanups!rcyrr s r_hardware_events_initzPlugin._hardware_events_initrcyrrrs rrzPlugin._hardware_events_cleanuprrc$|jyr)rrs r _init_deviceszPlugin._init_devicessrc|dk(r>tjd|jz|j|jy|dk(r>tjd|jz|j |jy|dk(r>tjd|jz|j |jyy)Naddzdevice '%s', add eventremovezdevice '%s', remove eventmovez-device: '%s', rename event, reported new name)loginfosys_name _add_device_remove_device _move_device)r eventdevices r_hardware_events_callbackz Plugin._hardware_events_callbacks e^88 $v 67FOO$ 88 '&// 9:v' 88 ;foo MNV__%rcZtjd|jd||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_postprocessed_devicesr instance device_names r_add_device_processzPlugin._add_device_process's(((-- MN[)8X%8%8'K=Q!!(K88X%9%97[MR   -rc||j|jzvrtjd|zyt |j j D]8\}}t|j||gdk(s&|j||ytjd|z|jj|y)Nz%device: '%s' already exists, ignoringrzno instance wants %s) r, _free_devicesr debuglist _instancesitemslen_get_matching_devicesr5r)r r4 instance_namer3s rr#zPlugin._add_device/sT++d.@.@@A99 4{ BC !%doo&;&;&=!>mX $ $ $X } =>!CX{3 "? 99 #k 12+&rc|D]}|j||t|jt|jzdkD|_y)zN Add devices specified by the set to the instance, no check is performed. rN)r5r<r1assigned_devicesactiver r3 device_namesdevs r_add_devices_nocheckzPlugin._add_devices_nocheck<sMcHc*223 ( # #$%'()(/rc||jvr|j||jd|g|j|||j||jd|g|jj |t |jt |jzdkD|_|jj |yy)NunapplyrTF) r1r-r0_removed_device_unapply_tuningr.rr<r@rAr,r2s r_remove_device_processzPlugin._remove_device_processGsH...Hh&:&:I }U&&x=Hh&9&99{mT $$[1334 8 $ $%&()*8?  -  rcy)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)r r4s rr%zPlugin._move_deviceUsrcj||j|jzvrtjd|zyt |j j D]}|j||sy |jj|y#t$rtjd|zYywxYw)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:valuesrIrKeyError)r r4r3s rr$zPlugin._remove_devicebs//$2D2DDE99 3k AB t--/0h !!(K8 1Ok* OII?+MNOs2B!B21B2c6|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_nocheckvscx-rc|j||g|jrL|jjtj tj r|j||yyyr)_execute_all_device_commandshas_dynamic_tuning _global_cfggetconstsCFG_DYNAMIC_TUNINGCFG_DEF_DYNAMIC_TUNING_instance_apply_dynamicr2s rr/z!Plugin._added_device_apply_tuning}sX##H{m<   T%5%5%9%9&:S:SU[UrUr%s+6&t rc|jrJ|jjtjtj r|j |||j||gdy)NT)r)rRrSrTrUrVrW_instance_unapply_dynamic_cleanup_all_device_commandsr2s rrHz%Plugin._removed_device_unapply_tuningsT   T%5%5%9%9&:S:SU[UrUr%s!!(K8##H{md#Kr)__name__ __module__ __qualname____doc__r rrrrr(r5r#rErIr%r$rOr/rH __classcell__)rs@rrrsU0  &. ' )  O(.7 Lrr) r tuned.constsrU tuned.logstunedlogsrTr rrrrrfs2 jjnn~LT[[~Lr