Current Path : /usr/lib/python2.7/dist-packages/landscape/lib/ |
Current File : //usr/lib/python2.7/dist-packages/landscape/lib/disk.pyc |
Tc @ s d d l m Z d d l Z d d l Z d d l Z e d d d d d d d d d d d d d d d g Z e j d Z e d Z d Z d Z d Z d S( i( t divisionNt extt ext2t ext3t ext4t reiserfst ntfst msdost dost vfatt xfst hpfst jfst ufst hfst hfspluss ([a-z]+)[0-9]*c c s xt | D] } y, | j d \ } } } | j d } Wn t k rU q n X| d k rt | | k rt q n d } y | | } Wn t k r q n X| t j } | t j | | } | t j | | } i | d 6| d 6| d 6| d 6| d 6Vq Wd S( sZ 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. i s string-escapei t devices mount-pointt filesystems total-spaces free-spaceNi ( t opent splitt decodet ValueErrort Nonet OSErrort statvfst F_BSIZEt F_BLOCKSt F_BFREE( t mounts_filet statvfs_t filesystems_whitelistt lineR t mount_pointR t megabytest statst block_sizet total_spacet free_space( ( s6 /usr/lib/python2.7/dist-packages/landscape/lib/disk.pyt get_mount_info s( c C s d } t j j | } | j d } xf t | | D]U } | d j d } | j | d r7 | s | t | | k r | } q q7 q7 W| S( s 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. @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. t /s mount-pointN( R t ost patht realpathR R&