gfapi.py 文件源码

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

项目:glustertool 作者: gluster 项目源码 文件源码
def statvfs(volume, host='localhost', port=24007, protocal='tcp'):
    _lazy_init_libgfapi()
    data = StatVfsData()
    _api.glfs_statvfs.restype = ctypes.c_int
    _api.glfs_statvfs.argtypes = [ctypes.c_void_p,
                                  ctypes.c_char_p,
                                  ctypes.POINTER(StatVfsData)]
    fs = _mount_gluster_volume(volume, host, port, protocal)
    rc = _api.glfs_statvfs(fs, "/", ctypes.byref(data))

    # To convert to os.statvfs_result we need to pass tuple/list in
    # following order: bsize, frsize, blocks, bfree, bavail, files
    # ffree, favail, flag, namemax
    return os.statvfs_result((data.f_bsize,
                              data.f_frsize,
                              data.f_blocks,
                              data.f_bfree,
                              data.f_bavail,
                              data.f_files,
                              data.f_ffree,
                              data.f_favail,
                              data.f_flag,
                              data.f_namemax))
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号