From 87b9ed2a5fe2b657a9a7cd5c5b0a01c9bdf93ab0 Mon Sep 17 00:00:00 2001 From: Rusty Bird Date: Mon, 15 Feb 2021 14:10:45 +0000 Subject: [PATCH] storage/reflink: consistently use _io suffix --- qubes/storage/reflink.py | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/qubes/storage/reflink.py b/qubes/storage/reflink.py index 4189b5a0..c9ef31fc 100644 --- a/qubes/storage/reflink.py +++ b/qubes/storage/reflink.py @@ -397,15 +397,15 @@ def _remove_empty_dir(path): def _resize_file(path, size): ''' Resize an existing file. ''' - with open(path, 'rb+') as file: - file.truncate(size) - os.fsync(file.fileno()) + with open(path, 'rb+') as file_io: + file_io.truncate(size) + os.fsync(file_io.fileno()) def _create_sparse_file(path, size): ''' Create an empty sparse file. ''' - with _replace_file(path) as tmp: - tmp.truncate(size) - LOGGER.info('Created sparse file: %r', tmp.name) + with _replace_file(path) as tmp_io: + tmp_io.truncate(size) + LOGGER.info('Created sparse file: %r', tmp_io.name) def _update_loopdev_sizes(img): ''' Resolve img; update the size of loop devices backed by it. ''' @@ -420,9 +420,9 @@ def _update_loopdev_sizes(img): with open('/dev/' + sys_path.split('/')[3], 'rb') as dev_io: fcntl.ioctl(dev_io.fileno(), LOOP_SET_CAPACITY) -def _attempt_ficlone(src, dst): +def _attempt_ficlone(src_io, dst_io): try: - fcntl.ioctl(dst.fileno(), FICLONE, src.fileno()) + fcntl.ioctl(dst_io.fileno(), FICLONE, src_io.fileno()) return True except OSError as ex: if ex.errno not in (errno.EBADF, errno.EINVAL,