diff options
Diffstat (limited to 'test/py/libvfio_user.py')
-rw-r--r-- | test/py/libvfio_user.py | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/test/py/libvfio_user.py b/test/py/libvfio_user.py index d586888..c83a75d 100644 --- a/test/py/libvfio_user.py +++ b/test/py/libvfio_user.py @@ -1248,4 +1248,9 @@ def fds_are_same(fd1: int, fd2: int) -> bool: return s1.st_dev == s2.st_dev and s1.st_ino == s2.st_ino +def get_bitmap_size(size: int, pgsize: int) -> int: + nr_pages = (size // pgsize) + (1 if size % pgsize != 0 else 0) + return ((nr_pages + 63) & ~63) // 8 + + # ex: set tabstop=4 shiftwidth=4 softtabstop=4 expandtab: # |