ok

Mini Shell

Direktori : /usr/lib/python2.7/site-packages/tuned/utils/
Upload File :
Current File : //usr/lib/python2.7/site-packages/tuned/utils/nettool.pyc

�
��\c@scdgZddlZddlTddlZejj�Zddd��YZd�Z	ie	_
dS(tethcardi����N(t*tNettoolcBs�eZiddgd6ddgd6ddgd6d	d
gd6d	dgd
6dd6ZeZd�Zd�Zd�Zd�Zd�Z	d�Z
d�Zd�Zd�Z
RS(iii
iiidii i�ii�i�	ii'i?tautocCs�||_|j�tjd||j|j|j|jf�tjd||j|j	f�tjd||j
|jf�dS(Ns1%s: speed %s, full duplex %s, autoneg %s, link %ss"%s: supports: autoneg %s, modes %ss$%s: advertises: autoneg %s, modes %s(t
_interfacetupdatetlogtdebugtspeedtfull_duplextautonegtlinktsupported_autonegtsupported_modestadvertised_autonegtadvertised_modes(tselft	interface((s7/usr/lib/python2.7/site-packages/tuned/utils/nettool.pyt__init__s
	
, cCsLd|_t|_t|_t|_g|_t|_g|_t|_dS(Ni(	RtFalseR	R
RR
RRR(R((s7/usr/lib/python2.7/site-packages/tuned/utils/nettool.pyt
_clean_status"s							cCsDd}x7|D]/}||j|d|dr4dnd7}q
W|S(Nii(t_advertise_values(Rtmodestmodetm((s7/usr/lib/python2.7/site-packages/tuned/utils/nettool.pyt_calculate_mode.s
-cCsT|j|krtS|js tSdtdd|jd|rAdndgdt�kS(Nitethtools-sR
tontofft	close_fds(R
tTrueRRtcallR(Rtenable((s7/usr/lib/python2.7/site-packages/tuned/utils/nettool.pyt_set_autonegotiation5s
	cCs?|jt�stSdtdd|jdd|gdt�kS(NiRs-st	advertises0x%03xR(R!RRRR(Rtvalue((s7/usr/lib/python2.7/site-packages/tuned/utils/nettool.pyt_set_advertise>scCsOd}x.|jD]#}|d|kr|d}qqW|dkrG|SdSdS(Nii�(R
(RtmaxR((s7/usr/lib/python2.7/site-packages/tuned/utils/nettool.pyt
get_max_speedDscCsC|js|jrtS|j|jd�r;|j�tStSdS(NR(t	_disabledRRR$RRR(R((s7/usr/lib/python2.7/site-packages/tuned/utils/nettool.pyt
set_max_speedNs
cCs�|js|jrtSd}x\|jD]Q}|dkr?q'n||kr'||j|d7}||j|d7}q'q'W||j|j�@}tjd|j||f�|j	|�r�|j
�tStSdS(NiRis)%s: set_speed(%d) - effective_mode 0x%03x(R'RRRRR
RRRR$RR(RRRtamteffective_mode((s7/usr/lib/python2.7/site-packages/tuned/utils/nettool.pyt	set_speedYs
c

Cs?|jr
dStd|jgdtdtdtdt�}tddgd|jdtdtdt�}|j�d	}|j�d
}|dkr�tjd|j�tj	d
|j|j
dd�f�|j�t|_dS|j�tj
d�}tj
d�}d}x&|jd�D]}|jd�r�|d }	|	dkrVd}n�|	dkrkd}n�|	dkr�d}no|	dkr�d}nZ|	dkr�d}nE|	dkr�d }n0|	d!kr�d"}n|	d#kr�d$}nd}~	q"|dkr<y|j|�jd
�|_Wnd%|_nXd}q"|dkr`|d&k|_d}q"|dkr�|d'kp�|d(k|_d}q"|dkr�|d'k|_d}q"|dkrJygxW|j�D]I}
|j|
�jd
d)�\}}|jjt|�|d&kf�q�W~
~~Wq7|jjd%tf�q7Xq"|d krn|d*k|_d}q"|d"kryv|d+kr�xW|j�D]I}
|j|
�jd
d)�\}}|jjt|�|d&kf�q�W~
~~nWq7|jjd%tf�q7Xq"|d$kr"|d*k|_d}q"q"WdS(,NRtstdouttstderrRtuniversal_newlinestsedss/^\s*//;s/:\s*/:\n/gtstdiniits*%s: some errors were reported by 'ethtool's%s: %ss
s\ns(\d+)s(\d+)baseT/(Half|Full)twaitt:i����tSpeedRtDuplextduplexsAuto-negotiationR
s
Link detectedRsSupported link modesR
sSupports auto-negotiationRsAdvertised link modesRsAdvertised auto-negotiationRi�tFulltyesRitYessNot reported(R'tPopenRtPIPERR,tcommunicateRtwarningRtreplaceRtretcompiletsplittendswithtmatchtgroupRR	R
RR
tappendtintRRR(
Rt	p_ethtooltp_filtertoutputterrorstre_speedtre_modetstatetlinetsectionRtstd((s7/usr/lib/python2.7/site-packages/tuned/utils/nettool.pyRns�			&
	

								
				!&
	!&(t__name__t
__module__RRR'RRRR!R$R&R(R+R(((s7/usr/lib/python2.7/site-packages/tuned/utils/nettool.pyR	s"





							
		cCs0|tjkr%t|�tj|<ntj|S(N(RtlistR(R((s7/usr/lib/python2.7/site-packages/tuned/utils/nettool.pyR�s((t__all__t
tuned.logsttunedt
subprocessR?tlogstgetRRRRT(((s7/usr/lib/python2.7/site-packages/tuned/utils/nettool.pyt<module>s	
�	

Zerion Mini Shell 1.0