Mini Shell

Direktori : /lib/python3.6/site-packages/blivet/devices/__pycache__/
Upload File :
Current File : //lib/python3.6/site-packages/blivet/devices/__pycache__/loop.cpython-36.opt-1.pyc

3

�Mf��@s~ddlZejdd�ddlmZddlZddlmZddlm	Z	ddl
mZddlZej
d	�Zd
dlmZGdd
�d
e�ZdS)�N�BlockDevz2.0)r�)�errors)�log_method_call)�availabilityZblivet�)�
StorageDevicec@s�eZdZdZdZejgZddd�Zdd�Z	d	d
�Z
edd��Zed
d��Z
ddd�Zddd�Zdd�Zddd�Zddd�Zedd��ZdS) �
LoopDevicez A loop device. �loopNFcCs4|std��|sd|j}tj||||d|d�dS)a8
            :param name: the device name (generally a device node's basename)
            :type name: str
            :keyword exists: does this device exist?
            :type exists: bool
            :keyword size: the device's size
            :type size: :class:`~.size.Size`
            :keyword parents: a list of parent devices
            :type parents: list of :class:`StorageDevice`
            :keyword fmt: this device's formatting
            :type fmt: :class:`~.formats.DeviceFormat` or a subclass of it

            Loop devices always exist.
        z$LoopDevice requires a backing devicez	tmploop%dT)�fmt�size�exists�parentsN)�
ValueError�idr�__init__)�self�namerr�
sysfs_pathr
r�r�/usr/lib/python3.6/loop.pyr-s
zLoopDevice.__init__cCs
||_dS)N)�_name)r�valuerrr�	_set_nameGszLoopDevice._set_namecCsF|jjs|jS|jjd�r |jStjj|jj�}|jd�r@||_|jS)z Update this device's name. r
)�slave�statusr�
startswith�blockdevr
�
get_loop_name�path)rrrrr�update_nameJs
zLoopDevice.update_namecCs*|jjo(|jjd�o(tjj|jj�|jkS)Nr
)rrrrrr
rr)rrrrrZszLoopDevice.statuscCs|jjS)N)rr)rrrrr`szLoopDevice.sizecCs0tjj|jj�s"tjd|jj��tj||d�S)Nz"specified file (%s) does not exist)�orig)�osrr
rrZDeviceErrorr�
_pre_setup)rr!rrrr#dszLoopDevice._pre_setupcCs,t||j||j|jd�tjj|jj�dS)z Open, or set up, a device. )r!r�controllableN)	rrrr$rr
Zsetuprr)rr!rrr�_setupis
zLoopDevice._setupcCstj|�|j�|j�dS)N)r�_post_setupr Zupdate_sysfs_path)rrrrr&os
zLoopDevice._post_setupcCs(t||j|j|jd�tjj|j�dS)z  Close, or tear down, a device. )rr$N)rrrr$rr
Zteardownr)r�	recursiverrr�	_teardownts
zLoopDevice._teardowncCs$tj||d�d|j|_d|_dS)N)r'z	tmploop%d�)r�_post_teardownrrr)rr'rrrr*zszLoopDevice._post_teardowncCs
|jdS)Nr)r)rrrrrszLoopDevice.slave)NNNNFN)F)F)F)F)�__name__�
__module__�__qualname__�__doc__Z_typerZBLOCKDEV_LOOP_PLUGINZ_external_dependenciesrrr �propertyrrr#r%r&r(r*rrrrrr	's




r	)ZgiZrequire_versionZ
gi.repositoryrrr"r)rZstorage_logrZtasksrZloggingZ	getLogger�logZstoragerr	rrrr�<module>s