On 08.10.19 17:56, Ralf Ramsauer wrote: > > > On 10/7/19 6:10 PM, Jan Kiszka wrote: >> On 30.09.19 21:13, Andrej Utz wrote: >>> From: Ralf Ramsauer <[email protected]> >>> >>> Do this step by step. First of all, let's create a new routine that is able >>> to >>> parse a line from /proc/iomem or /proc/ioports. Both files share the same >>> layout, so we can use a common parser. >>> >>> Passing the destination type of the entry to the parser allows to share >>> code. >>> >>> Signed-off-by: Ralf Ramsauer <[email protected]> >>> --- >>> pyjailhouse/sysfs_parser.py | 21 ++++++++++++--------- >>> 1 file changed, 12 insertions(+), 9 deletions(-) >>> >>> diff --git a/pyjailhouse/sysfs_parser.py b/pyjailhouse/sysfs_parser.py >>> index b0a9bf44..a179461d 100644 >>> --- a/pyjailhouse/sysfs_parser.py >>> +++ b/pyjailhouse/sysfs_parser.py >>> @@ -824,6 +824,17 @@ class IOAPIC: >>> return (self.iommu << 16) | self.bdf >>> >>> >>> +class IORegionTree: >>> + @staticmethod >>> + def parse_io_line(line, TargetClass): >>> + region, type = line.split(' : ', 1) >> >> (region, type) >> >>> + level = int(region.count(' ') / 2) + 1 >>> + type = type.strip() >>> + region = [r.strip() for r in region.split('-', 1)] >>> + >>> + return level, TargetClass(int(region[0], 16), int(region[1], 16), >>> type) >> >> Doesn't the style checker complain about a long line here? > > Should it? It's 79 characters. >
Did check, just guessed. That's fine. Jan -- Siemens AG, Corporate Technology, CT RDA IOT SES-DE Corporate Competence Center Embedded Linux -- You received this message because you are subscribed to the Google Groups "Jailhouse" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. To view this discussion on the web visit https://groups.google.com/d/msgid/jailhouse-dev/5458325d-af29-87f8-c4a0-e0a128b33bf5%40siemens.com.
