File: //lib/python3.9/site-packages/tuned/plugins/__pycache__/plugin_mounts.cpython-39.pyc
a
,�g� � @ sr d dl mZ ddlmZ ddlT d dlmZmZ d dlZ d dl
mZ d dlZe j
�� Ze� ZG dd� dej�ZdS ) � N� )�base)�*)�Popen�PIPE)�commandsc @ st e Zd ZdZedd� �Zdd� Zedd� �Zdd � Zd
d� Z dd
� Z
dd� Zdd� Zdd� Z
eddd�dd� �ZdS )�MountsPlugina=
Enables or disables barriers for mounts according to the value of the
boolean option [option]`disable_barriers`. The option additionally allows
the special value `force`, which disables barriers even on mountpoints with
write back caches.
NOTE: Only extended file systems (ext) are supported by this plug-in.
c C s� i }d}t g d�ttddd��� \}}dd� |�� D �D ]�}t|�dk rJq8|dd� \}}}t|�dkrp|d nd} t|�dkr�|d nd}
|d kr�|}q8|d
ks8|dvr�q8|
du s8|
dkr�q8|�|
t� || d
�� ||
d �|� q8|| _dS )z�
Gets the information about disks, partitions and mountpoints. Stores information about used filesystem and
creates a list of all underlying devices (in case of LVM) for each mountpoint.
N)Zlsblkz-rnozTYPE,RM,KNAME,FSTYPE,MOUNTPOINTT)�stdout�stderrZ close_fdsZuniversal_newlinesc S s g | ]}|� � �qS � )�split)�.0�liner r �?/usr/lib/python3.9/site-packages/tuned/plugins/plugin_mounts.py�
<listcomp># � z>MountsPlugin._generate_mountpoint_topology.<locals>.<listcomp>� � Zdisk�1)�partZlvmz[SWAP])�disks�device_name�
filesystemr ) r r Zcommunicate�
splitlines�len�
setdefault�set�add�_mountpoint_topology)�clsZmountpoint_topologyZcurrent_diskr r
�columnsZdevice_typeZdevice_removabler r �
mountpointr r r �_generate_mountpoint_topology s, �z*MountsPlugin._generate_mountpoint_topologyc C s* | � � d| _t| j�� �| _t� | _d S )NT)r"