fs.py 文件源码

python
阅读 27 收藏 0 点赞 0 评论 0

项目:DeepSea 作者: SUSE 项目源码 文件源码
def btrfs_get_mountpoints_of_subvol(subvol='', **kwargs):
    """
    Determine the list of mountpoints for a given subvol (of the form @/foo/bar).

    Returns a list of mountpoint(s), or an empty list.
    """
    mountpoints = []
    if not subvol:
        return []

    # Seems the easiest way to do this is to walk the disk partitions, extract the opts
    # string and see if subvol is present.  Remember the leading '/'.
    for part in psutil.disk_partitions():
        if "subvol=/{}".format(subvol) in part.opts:
            mountpoints.append(part.mountpoint)

    return mountpoints


# pylint: disable=unused-argument
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号