0x1949 Team - FAZEMRX - MANAGER
Edit File: disk.cpython-310.pyc
o ���c� � @ sn d dl mZ d dlZd dlZd dlZd dlmZ eg d��Ze� d�Z efdd�Zdd � Zd d� Z dd � ZdS )� )�divisionN)�_PY3)�ext�ext2�ext3�ext4�reiserfs�ntfs�msdos�dos�vfat�xfs�hpfs�jfs�ufs�hfs�hfsplus�simfs�drvfs�lxfsz([a-z]+)[0-9]*c c s� � t | �D ]]}z|�� dd� \}}}trt�|d�}nt�|d�}W n ty, Y qw |dur6||vr6qd}z||�}W n tyG Y qw |j} |j| | } |j | | }|||| |d�V qdS )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_space� r/ �4/usr/lib/python3/dist-packages/landscape/lib/disk.py�get_mount_info s8 ���� ��r1 c C sf d}t j�| �} | �d�}t||�D ]}|d �d�}| �|d �r0|r.|dt|�� |kr0|}q|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 r1 � startswith�len)r4 r% r&