device: add support for parent devices

This allows device nesting, i.e. one device being opened inside another
one.
This commit is contained in:
Christian Kellner 2021-08-09 16:16:45 +02:00 committed by Tom Gundersen
parent 6ea5ce1836
commit 45d0594b1b
7 changed files with 128 additions and 11 deletions

View file

@ -78,7 +78,7 @@ class LoopbackService(devices.DeviceService):
return lo
def open(self, devpath: str, tree: str, options: Dict):
def open(self, devpath: str, parent: str, tree: str, options: Dict):
filename = options["filename"]
self.sector_size = options.get("sector-size", 512)
start = options.get("start", 0) * self.sector_size