storage/reflink: consistently use _io suffix
This commit is contained in:
parent
c56f06166b
commit
87b9ed2a5f
@ -397,15 +397,15 @@ def _remove_empty_dir(path):
|
|||||||
|
|
||||||
def _resize_file(path, size):
|
def _resize_file(path, size):
|
||||||
''' Resize an existing file. '''
|
''' Resize an existing file. '''
|
||||||
with open(path, 'rb+') as file:
|
with open(path, 'rb+') as file_io:
|
||||||
file.truncate(size)
|
file_io.truncate(size)
|
||||||
os.fsync(file.fileno())
|
os.fsync(file_io.fileno())
|
||||||
|
|
||||||
def _create_sparse_file(path, size):
|
def _create_sparse_file(path, size):
|
||||||
''' Create an empty sparse file. '''
|
''' Create an empty sparse file. '''
|
||||||
with _replace_file(path) as tmp:
|
with _replace_file(path) as tmp_io:
|
||||||
tmp.truncate(size)
|
tmp_io.truncate(size)
|
||||||
LOGGER.info('Created sparse file: %r', tmp.name)
|
LOGGER.info('Created sparse file: %r', tmp_io.name)
|
||||||
|
|
||||||
def _update_loopdev_sizes(img):
|
def _update_loopdev_sizes(img):
|
||||||
''' Resolve img; update the size of loop devices backed by it. '''
|
''' 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:
|
with open('/dev/' + sys_path.split('/')[3], 'rb') as dev_io:
|
||||||
fcntl.ioctl(dev_io.fileno(), LOOP_SET_CAPACITY)
|
fcntl.ioctl(dev_io.fileno(), LOOP_SET_CAPACITY)
|
||||||
|
|
||||||
def _attempt_ficlone(src, dst):
|
def _attempt_ficlone(src_io, dst_io):
|
||||||
try:
|
try:
|
||||||
fcntl.ioctl(dst.fileno(), FICLONE, src.fileno())
|
fcntl.ioctl(dst_io.fileno(), FICLONE, src_io.fileno())
|
||||||
return True
|
return True
|
||||||
except OSError as ex:
|
except OSError as ex:
|
||||||
if ex.errno not in (errno.EBADF, errno.EINVAL,
|
if ex.errno not in (errno.EBADF, errno.EINVAL,
|
||||||
|
Loading…
Reference in New Issue
Block a user