| Server IP : 138.197.176.125 / Your IP : 216.73.217.54 Web Server : Apache/2.4.41 (Ubuntu) System : Linux SuiteCRM-8 5.4.0-216-generic #236-Ubuntu SMP Fri Apr 11 19:53:21 UTC 2025 x86_64 User : root ( 0) PHP Version : 8.3.19 Disable Function : NONE MySQL : OFF | cURL : ON | WGET : ON | Perl : ON | Python : ON | Sudo : ON | Pkexec : ON Directory : /proc/self/root/lib/python3/dist-packages/landscape/lib/__pycache__/ |
Upload File : |
U
���c� � @ s� d dl mZ d dlZd dlZd dlZd dlmZ edddddd d
ddd
ddddddddg�Ze� d�Z
efdd�Zdd� Zdd� Z
dd� ZdS )� )�divisionN)�_PY3ZextZext2Zext3Zext4ZreiserfsZntfsZmsdosZdosZvfatZxfsZhpfsZjfsZufsZhfsZhfsplusZsimfsZdrvfsZlxfsz([a-z]+)[0-9]*c c s� t | �D ]�}z8|�� dd� \}}}tr6t�|d�}nt�|d�}W n tk
r\ Y qY nX |dk rp||krpqd}z||�}W n tk
r� Y qY nX |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� Zunicode_escapeZ
string_escapei )�device�mount-point�
filesystemztotal-spacez
free-space)
�open�splitr �codecs�decode�
ValueError�OSError�f_bsize�f_blocks�f_bfree)�mounts_file�statvfs_Zfilesystems_whitelist�liner Zmount_pointr Z megabytesZstatsZ
block_sizeZtotal_spaceZ
free_space� r �4/usr/lib/python3/dist-packages/landscape/lib/disk.py�get_mount_info s2
�
�r c C sf d}t j�| �} | �d�}t||�D ]<}|d �d�}| �|d �r$|r\|dt|�� |kr$|}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 r �
startswith�len)r r r � candidateZ
path_segments�infoZmount_segmentsr r r �get_filesystem_for_path<