remoteloop: pass filename to create_device

This makes LoopClient simpler to use in the common case.
This commit is contained in:
Lars Karlitski 2019-10-06 00:11:26 +02:00
parent 356f62058f
commit 0dd60b3abf
2 changed files with 4 additions and 4 deletions

View file

@ -112,9 +112,10 @@ class LoopClient:
def __init__(self, sock):
self.sock = sock
def create_device(self, fd, offset=None, sizelimit=None):
def create_device(self, filename, offset=None, sizelimit=None):
req = {}
fds = array.array("i")
fd = os.open(filename, os.O_RDWR | os.O_DIRECT)
dir_fd = os.open("/dev", os.O_DIRECTORY)
fds.append(fd)
@ -129,6 +130,7 @@ class LoopClient:
dump_fds(self.sock, req, fds)
os.close(dir_fd)
os.close(fd)
ret = json.loads(self.sock.recv(1024))