remoteloop: pass filename to create_device
This makes LoopClient simpler to use in the common case.
This commit is contained in:
parent
356f62058f
commit
0dd60b3abf
2 changed files with 4 additions and 4 deletions
|
|
@ -20,9 +20,7 @@ def mount(source, dest, *options):
|
|||
|
||||
@contextlib.contextmanager
|
||||
def loop_device(loop_client, image, size, offset=0):
|
||||
fd = os.open(image, os.O_RDWR | os.O_DIRECT)
|
||||
devname = loop_client.create_device(fd, offset=offset, sizelimit=size)
|
||||
os.close(fd)
|
||||
devname = loop_client.create_device(image, offset=offset, sizelimit=size)
|
||||
path = f"/dev/{devname}"
|
||||
try:
|
||||
yield path
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue