From e5f2fdbd6499d97073ad20fe1ea491accecff704 Mon Sep 17 00:00:00 2001 Message-Id: From: Pavel Hrdina Date: Mon, 1 Jul 2019 17:07:22 +0200 Subject: [PATCH] vircgroup: introduce virCgroupV2HasController MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Pavel Hrdina (cherry picked from commit c8f08a5346919b3d963908eb0b61fc077dbdbccd) Resolves: https://bugzilla.redhat.com/show_bug.cgi?id=1689297 Signed-off-by: Pavel Hrdina Message-Id: <8dfef2b4c814027c13ab2d693144ec77844bff7a.1561993100.git.phrdina@redhat.com> Reviewed-by: Ján Tomko --- src/util/vircgroupv2.c | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/src/util/vircgroupv2.c b/src/util/vircgroupv2.c index c8f2573864..babce95aeb 100644 --- a/src/util/vircgroupv2.c +++ b/src/util/vircgroupv2.c @@ -299,6 +299,14 @@ virCgroupV2DetectControllers(virCgroupPtr group, } +static bool +virCgroupV2HasController(virCgroupPtr group, + int controller) +{ + return group->unified.controllers & (1 << controller); +} + + virCgroupBackend virCgroupV2Backend = { .type = VIR_CGROUP_BACKEND_TYPE_V2, @@ -311,6 +319,7 @@ virCgroupBackend virCgroupV2Backend = { .validatePlacement = virCgroupV2ValidatePlacement, .stealPlacement = virCgroupV2StealPlacement, .detectControllers = virCgroupV2DetectControllers, + .hasController = virCgroupV2HasController, }; -- 2.22.0