Spamworldpro Mini Shell
Spamworldpro


Server : Apache/2.4.52 (Ubuntu)
System : Linux webserver 6.8.0-49-generic #49~22.04.1-Ubuntu SMP PREEMPT_DYNAMIC Wed Nov 6 17:42:15 UTC 2 x86_64
User : www-data ( 33)
PHP Version : 8.1.2-1ubuntu2.21
Disable Function : NONE
Directory :  /lib/python3/dist-packages/landscape/lib/__pycache__/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Current File : //lib/python3/dist-packages/landscape/lib/__pycache__/disk.cpython-310.pyc
o

���c��@snddlmZddlZddlZddlZddlmZegd��Ze�	d�Z
efdd�Zdd	�Zd
d�Z
dd
�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	cs��t|�D]]}z|��dd�\}}}trt�|d�}nt�|d�}Wn	ty,Yqw|dur6||vr6qd}z||�}Wn	tyGYqw|j}	|j|	|}
|j	|	|}||||
|d�VqdS)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_infos8����
��r1cCsfd}tj�|�}|�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�realpathrr1�
startswith�len)r4r%r&�	candidate�
path_segments�info�mount_segmentsr/r/r0�get_filesystem_for_path<s
�r<cCs�tj�|��d�rdSt|�}|sdSd}zt|d��}|��}Wd�n1s*wYWn
ty:YdSw|��dkrCdSdS)z�
    This function returns whether a given device is removable or not by looking
    at the corresponding /sys/block/<device>/removable file

    @param device: The filesystem path to the device, e.g. /dev/sda1
    �mmcblkTFN�r�1)	r3r4�basenamer6�_get_device_removable_file_pathr�readline�IOError�strip)rr4�contents�fr/r/r0�is_device_removableXs"	
���rGcCs\tj�|�rt�|�}|�d�dd�\}t�|�}|sdS|��d}tj�d|d�}|S)a5
    Get a device's "removable" file path.

    This function figures out the C{/sys/block/<device>/removable} path
    associated with the given device. The file at that path contains either
    a "0" if the device is not removable, or a "1" if it is.

    @param device: File system path of the device.
    r2���Nrz/sys/block/�	removable)	r3r4�islink�readlinkr�EXTRACT_DEVICE�match�groups�join)r�device_name�matched�removable_filer/r/r0rAus

rA)�
__future__rr3�rer�landscape.lib.compatr�	frozenset�STABLE_FILESYSTEMS�compilerLr1r<rGrAr/r/r/r0�<module>s�

�)

Spamworldpro Mini