From 5042f474c287774a30780f1ec2e0c32c8763bc67 Mon Sep 17 00:00:00 2001
From: Kajetan Puchalski <kajetan.puchalski@arm.com>
Date: Mon, 18 Jul 2022 13:40:37 +0100
Subject: [PATCH] module/cgroups: Skip disabled cgroup controllers

Currently the cgroups module will pull all available controllers from
/proc/cgroups and then try to mount them, including the disabled ones.
This will result in the entire mount failing.

Lines in /proc/cgroups ending in 0 correspond to disabled controllers.
Filtering those out solves the issue.
---
 devlib/module/cgroups.py | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/devlib/module/cgroups.py b/devlib/module/cgroups.py
index 6cbab19..b3cdb1d 100644
--- a/devlib/module/cgroups.py
+++ b/devlib/module/cgroups.py
@@ -411,7 +411,7 @@ class CgroupsModule(Module):
         for line in self.target.execute('{} cat /proc/cgroups'\
                 .format(self.target.busybox), as_root=self.target.is_rooted).splitlines()[1:]:
             line = line.strip()
-            if not line or line.startswith('#'):
+            if not line or line.startswith('#') or line.endswith('0'):
                 continue
             name, hierarchy, num_cgroups, enabled = line.split()
             subsystems.append(CgroupSubsystemEntry(name,