render / rpms / libvirt

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