File: //lib/python3/dist-packages/landscape/lib/__pycache__/disk.cpython-312.pyc
�
�1Db� � � � d dl mZ d dlZd dlZd dlZd dlmZ eg d�� Z ej d� Z
efd�Zd� Zd� Z
d � Zy)
� )�divisionN)�_PY3)�ext�ext2�ext3�ext4�reiserfs�ntfs�msdos�dos�vfat�xfs�hpfs�jfs�ufs�hfs�hfsplus�simfsz([a-z]+)[0-9]*c # � K � t | � D ]� } |j � dd \ }}}t rt j |d� }nt j |d� }|�||vr�Ud} ||� }|j } |j | z |z }
|j | z |z }||||
|d��� �� y# t
$ r Y ��w xY w# t $ r Y ��w xY w�w)aZ
This is a generator that yields information about mounted filesystems.
@param mounts_file: A file with information about mounted filesystems,
such as C{/proc/mounts}.
@param statvfs_: A function to get file status information.
@param filesystems_whitelist: Optionally, a list of which filesystems to
stat.
@return: A C{dict} with C{device}, C{mount-point}, C{filesystem},
C{total-space} and C{free-space} keys. If the filesystem information
is not available, C{None} is returned. Both C{total-space} and
C{free-space} are in megabytes.
N� �unicode_escape�
string_escapei )�device�mount-point�
filesystemztotal-spacez
free-space)
�open�splitr �codecs�decode�
ValueError�OSError�f_bsize�f_blocks�f_bfree)�mounts_file�statvfs_�filesystems_whitelist�liner �mount_pointr � megabytes�stats�
block_size�total_space�
free_spaces �4/usr/lib/python3/dist-packages/landscape/lib/disk.py�get_mount_infor0 s� � �� � �[�!�� �.2�j�j�l�2�A�.>�+�F�K���$�m�m�K�9I�J��$�m�m�K��I��
"�-��3�3��� � ��[�)�E� �]�]�
��~�~�
�2�y�@���m�m�j�0�Y�>�
���'��'�)� )�+ "�� � �� �� � �� �sM �C �A
B+� C �&B:�.=C �+ B7�4C �6B7�7C �: C�C �C�C c �
� d}t j j | � } | j d� }t ||� D ]A }|d j d� }| j |d � s�,|r|dt
|� |k( s�@|}�C |S )a�
Tries to determine to which of the mounted filesystem C{path} belongs to,
and then returns information about that filesystem or C{None} if it
couldn't be determined.
@param path: The path we want filesystem information about.
@param mounts_file: A file with information about mounted filesystems,
such as C{/proc/mounts}.
@param statvfs_: A function to get file status information.
@return: A C{dict} with C{device}, C{mount-point}, C{filesystem},
C{total-space} and C{free-space} keys. If the filesystem information
is not available, C{None} is returned. Both C{total-space} and
C{free-space} are in megabytes.
N�/r )�os�path�realpathr r0 �
startswith�len)r4 r% r&