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