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))
评论列表
文章目录