From 6fc9abce93fb193d748c45dbe47920b287c9aa07 Mon Sep 17 00:00:00 2001
Message-Id: <6fc9abce93fb193d748c45dbe47920b287c9aa07@dist-git>
From: Pavel Hrdina <phrdina@redhat.com>
Date: Mon, 1 Jul 2019 17:07:23 +0200
Subject: [PATCH] vircgroup: introduce virCgroupV2GetAnyController
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Signed-off-by: Pavel Hrdina <phrdina@redhat.com>
(cherry picked from commit 171c700cd8c5509dc868c00faed9a16feaa2339d)
Resolves: https://bugzilla.redhat.com/show_bug.cgi?id=1689297
Signed-off-by: Pavel Hrdina <phrdina@redhat.com>
Message-Id: <2bc9d83fa5195d1650a8801c69b850ff86fd8386.1561993100.git.phrdina@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
---
src/util/vircgroupv2.c | 9 +++++++++
1 file changed, 9 insertions(+)
diff --git a/src/util/vircgroupv2.c b/src/util/vircgroupv2.c
index babce95aeb..65cbad533b 100644
--- a/src/util/vircgroupv2.c
+++ b/src/util/vircgroupv2.c
@@ -307,6 +307,14 @@ virCgroupV2HasController(virCgroupPtr group,
}
+static int
+virCgroupV2GetAnyController(virCgroupPtr group)
+{
+ /* The least significant bit is position 1. */
+ return ffs(group->unified.controllers) - 1;
+}
+
+
virCgroupBackend virCgroupV2Backend = {
.type = VIR_CGROUP_BACKEND_TYPE_V2,
@@ -320,6 +328,7 @@ virCgroupBackend virCgroupV2Backend = {
.stealPlacement = virCgroupV2StealPlacement,
.detectControllers = virCgroupV2DetectControllers,
.hasController = virCgroupV2HasController,
+ .getAnyController = virCgroupV2GetAnyController,
};
--
2.22.0