[PATCH 45/47] vircgroup: extract virCgroupV1(Set|Get)CpusetCpus

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

 



Signed-off-by: Pavel Hrdina <phrdina@xxxxxxxxxx>
---
 src/util/vircgroup.c        | 10 ++--------
 src/util/vircgroupbackend.h | 10 ++++++++++
 src/util/vircgroupv1.c      | 24 ++++++++++++++++++++++++
 3 files changed, 36 insertions(+), 8 deletions(-)

diff --git a/src/util/vircgroup.c b/src/util/vircgroup.c
index c37ada7c26..b61c6bf2f3 100644
--- a/src/util/vircgroup.c
+++ b/src/util/vircgroup.c
@@ -1774,10 +1774,7 @@ virCgroupGetCpusetMemoryMigrate(virCgroupPtr group, bool *migrate)
 int
 virCgroupSetCpusetCpus(virCgroupPtr group, const char *cpus)
 {
-    return virCgroupSetValueStr(group,
-                                VIR_CGROUP_CONTROLLER_CPUSET,
-                                "cpuset.cpus",
-                                cpus);
+    VIR_CGROUP_BACKEND_CALL(group, setCpusetCpus, -1, cpus);
 }
 
 
@@ -1792,10 +1789,7 @@ virCgroupSetCpusetCpus(virCgroupPtr group, const char *cpus)
 int
 virCgroupGetCpusetCpus(virCgroupPtr group, char **cpus)
 {
-    return virCgroupGetValueStr(group,
-                                VIR_CGROUP_CONTROLLER_CPUSET,
-                                "cpuset.cpus",
-                                cpus);
+    VIR_CGROUP_BACKEND_CALL(group, getCpusetCpus, -1, cpus);
 }
 
 
diff --git a/src/util/vircgroupbackend.h b/src/util/vircgroupbackend.h
index 887a508a15..fc7745d714 100644
--- a/src/util/vircgroupbackend.h
+++ b/src/util/vircgroupbackend.h
@@ -332,6 +332,14 @@ typedef int
 (*virCgroupGetCpusetMemoryMigrateCB)(virCgroupPtr group,
                                      bool *migrate);
 
+typedef int
+(*virCgroupSetCpusetCpusCB)(virCgroupPtr group,
+                            const char *cpus);
+
+typedef int
+(*virCgroupGetCpusetCpusCB)(virCgroupPtr group,
+                            char **cpus);
+
 struct _virCgroupBackend {
     virCgroupBackendType type;
 
@@ -406,6 +414,8 @@ struct _virCgroupBackend {
     virCgroupGetCpusetMemsCB getCpusetMems;
     virCgroupSetCpusetMemoryMigrateCB setCpusetMemoryMigrate;
     virCgroupGetCpusetMemoryMigrateCB getCpusetMemoryMigrate;
+    virCgroupSetCpusetCpusCB setCpusetCpus;
+    virCgroupGetCpusetCpusCB getCpusetCpus;
 };
 typedef struct _virCgroupBackend virCgroupBackend;
 typedef virCgroupBackend *virCgroupBackendPtr;
diff --git a/src/util/vircgroupv1.c b/src/util/vircgroupv1.c
index 8070aede3e..be0be0f582 100644
--- a/src/util/vircgroupv1.c
+++ b/src/util/vircgroupv1.c
@@ -1990,6 +1990,28 @@ virCgroupV1GetCpusetMemoryMigrate(virCgroupPtr group,
 }
 
 
+static int
+virCgroupV1SetCpusetCpus(virCgroupPtr group,
+                         const char *cpus)
+{
+    return virCgroupSetValueStr(group,
+                                VIR_CGROUP_CONTROLLER_CPUSET,
+                                "cpuset.cpus",
+                                cpus);
+}
+
+
+static int
+virCgroupV1GetCpusetCpus(virCgroupPtr group,
+                         char **cpus)
+{
+    return virCgroupGetValueStr(group,
+                                VIR_CGROUP_CONTROLLER_CPUSET,
+                                "cpuset.cpus",
+                                cpus);
+}
+
+
 virCgroupBackend virCgroupV1Backend = {
     .type = VIR_CGROUP_BACKEND_TYPE_V1,
 
@@ -2062,6 +2084,8 @@ virCgroupBackend virCgroupV1Backend = {
     .getCpusetMems = virCgroupV1GetCpusetMems,
     .setCpusetMemoryMigrate = virCgroupV1SetCpusetMemoryMigrate,
     .getCpusetMemoryMigrate = virCgroupV1GetCpusetMemoryMigrate,
+    .setCpusetCpus = virCgroupV1SetCpusetCpus,
+    .getCpusetCpus = virCgroupV1GetCpusetCpus,
 };
 
 
-- 
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