1
0
mirror of https://github.com/ARM-software/devlib.git synced 2024-10-06 02:40:50 +01:00

cgroups: keep track if a controller is mounted with noprefix option

CGroups controller can be mounted by specifying a "noprefix" option,
in which case attribute names are named as:
   <mountpoint>/<attribute_name>
instead of the (more recent) naming schema using:
   <mountpoint>/<contoller_name>.<attribute_name>

For example, Android uses the old format for backward compatibility
with user-space. Thus, it's possible in general to work on a target
system where some controller are mounted "noprefix" while others not.

This patchset adds a set of updates which allows to use the proper
attributes naming schema based on how the controller has been mounted.

This first patch keeps track of whatever a controller has been mounted
using the noprefix option.

Signed-off-by: Patrick Bellasi <patrick.bellasi@arm.com>
This commit is contained in:
Patrick Bellasi 2016-04-26 15:23:56 +01:00
parent 28739397c0
commit 15f9c03b45

View File

@ -34,6 +34,7 @@ class Controller(object):
self.mount_name = 'devlib_'+kind
self.kind = kind
self.target = None
self._noprefix = False
self.logger = logging.getLogger('cgroups.'+self.kind)
self.mount_point = None
@ -68,8 +69,15 @@ class Controller(object):
self.mount_point),
as_root=True)
self.logger.debug('Controller %s mounted under: %s',
self.kind, self.mount_point)
# Check if this controller uses "noprefix" option
output = target.execute('mount | grep "{} "'.format(self.mount_name))
if 'noprefix' in output:
self._noprefix = True
# self.logger.debug('Controller %s using "noprefix" option',
# self.kind)
self.logger.debug('Controller %s mounted under: %s (noprefix=%s)',
self.kind, self.mount_point, self._noprefix)
# Mark this contoller as available
self.target = target