[PATCH v2 13/53] [ACKED] vircgroup: introduce virCgroupV2PathOfController

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Signed-off-by: Pavel Hrdina <phrdina@xxxxxxxxxx>
---
 src/util/vircgroupv2.c | 24 ++++++++++++++++++++++++
 1 file changed, 24 insertions(+)

diff --git a/src/util/vircgroupv2.c b/src/util/vircgroupv2.c
index e17ceccac8..29d320e630 100644
--- a/src/util/vircgroupv2.c
+++ b/src/util/vircgroupv2.c
@@ -323,6 +323,29 @@ virCgroupV2GetAnyController(virCgroupPtr group)
 }
 
 
+static int
+virCgroupV2PathOfController(virCgroupPtr group,
+                            int controller,
+                            const char *key,
+                            char **path)
+{
+    if (!virCgroupV2HasController(group, controller)) {
+        virReportError(VIR_ERR_INTERNAL_ERROR,
+                       _("v2 controller '%s' is not available"),
+                       virCgroupV2ControllerTypeToString(controller));
+        return -1;
+    }
+
+    if (virAsprintf(path, "%s%s/%s",
+                    group->unified.mountPoint,
+                    group->unified.placement,
+                    key ? key : "") < 0)
+        return -1;
+
+    return 0;
+}
+
+
 virCgroupBackend virCgroupV2Backend = {
     .type = VIR_CGROUP_BACKEND_TYPE_V2,
 
@@ -337,6 +360,7 @@ virCgroupBackend virCgroupV2Backend = {
     .detectControllers = virCgroupV2DetectControllers,
     .hasController = virCgroupV2HasController,
     .getAnyController = virCgroupV2GetAnyController,
+    .pathOfController = virCgroupV2PathOfController,
 };
 
 
-- 
2.17.1

--
libvir-list mailing list
libvir-list@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/libvir-list



[Index of Archives]     [Virt Tools]     [Libvirt Users]     [Lib OS Info]     [Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [KDE Users]     [Fedora Tools]

  Powered by Linux