ó ±2öYc@sŒddlZddlZddlZddlZddlTddlZddlTddl m Z ej j ƒZ dejfd„ƒYZdS(iÿÿÿÿN(t*(tcommandst SysfsPlugincBsbeZdZd„Zd„Zd„Zd„Zd„Zed„Z d„Z d„Z d „Z RS( sR Plugin for applying custom sysfs options, using specific plugins is preferred. cOs5t|j|ƒj||Žt|_tƒ|_dS(N(tsupert __class__t__init__tTruet_has_dynamic_optionsRt_cmd(tselftargstkwargs((s>/usr/lib/python2.7/site-packages/tuned/plugins/plugin_sysfs.pyRs cCsCt|_t|_ttd„|jjƒƒƒ|_i|_ dS(NcSs"|\}}tjj|ƒ|fS(N(tostpathtnormpath(t.0tkeytvalue((s>/usr/lib/python2.7/site-packages/tuned/plugins/plugin_sysfs.pyts( tFalset_has_dynamic_tuningRt_has_static_tuningtdicttmaptoptionstitemst_sysfst_sysfs_original(R tinstance((s>/usr/lib/python2.7/site-packages/tuned/plugins/plugin_sysfs.pyt_instance_inits  $cCsdS(N((R R((s>/usr/lib/python2.7/site-packages/tuned/plugins/plugin_sysfs.pyt_instance_cleanupscCs™x’|jjƒD]\}}|jj|ƒ}x`tj|ƒD]O}|j|ƒr||j|ƒ|j|<|j ||ƒq>t j d|ƒq>WqWdS(Ns)rejecting write to '%s' (not inside /sys)( RRt _variablestexpandtglobtiglobt _check_sysfst _read_sysfsRt _write_sysfstlogterror(R RRRtvtf((s>/usr/lib/python2.7/site-packages/tuned/plugins/plugin_sysfs.pyt_instance_apply_static"sc Csžt}x‘|jjƒD]€\}}|jj|ƒ}x_tj|ƒD]N}|j|ƒrD|j|ƒ}|j ||||ƒt kr’t }q’qDqDWqW|S(N( RRRRR R!R"R#R$t _verify_valueR( R Rtignore_missingtretRRR(R)tcurr_val((s>/usr/lib/python2.7/site-packages/tuned/plugins/plugin_sysfs.pyt_instance_verify_static,scCs4x-|jjƒD]\}}|j||ƒqWdS(N(RRR%(R Rt full_rollbackRR((s>/usr/lib/python2.7/site-packages/tuned/plugins/plugin_sysfs.pyt_instance_unapply_static7scCstjd|ƒS(Ns^/sys/.*(tretmatch(R t sysfs_file((s>/usr/lib/python2.7/site-packages/tuned/plugins/plugin_sysfs.pyR#;scCs?|jj|ƒ}t|ƒdkr7|jj|tƒSdSdS(Ni(Rt read_filetlentget_active_optionRtNone(R R4tdata((s>/usr/lib/python2.7/site-packages/tuned/plugins/plugin_sysfs.pyR$>scCs|jj||ƒS(N(Rt write_to_file(R R4R((s>/usr/lib/python2.7/site-packages/tuned/plugins/plugin_sysfs.pyR%Es( t__name__t __module__t__doc__RRRR*R/RR1R#R$R%(((s>/usr/lib/python2.7/site-packages/tuned/plugins/plugin_sysfs.pyR s      (tbaseR!R2tos.pathR t decoratorst tuned.logsttunedt subprocessttuned.utils.commandsRtlogstgetR&tPluginR(((s>/usr/lib/python2.7/site-packages/tuned/plugins/plugin_sysfs.pyts