Signed-off-by: Pavel Hrdina <phrdina(a)redhat.com>
---
src/util/vircgroup.c | 8 ++------
src/util/vircgroupbackend.h | 11 +++++++++++
src/util/vircgroupv1.c | 23 +++++++++++++++++++++++
3 files changed, 36 insertions(+), 6 deletions(-)
diff --git a/src/util/vircgroup.c b/src/util/vircgroup.c
index 9ba2318c0b..8744cd067d 100644
--- a/src/util/vircgroup.c
+++ b/src/util/vircgroup.c
@@ -2605,18 +2605,14 @@ virCgroupGetCpuacctStat(virCgroupPtr group, unsigned long long
*user,
int
virCgroupSetFreezerState(virCgroupPtr group, const char *state)
{
- return virCgroupSetValueStr(group,
- VIR_CGROUP_CONTROLLER_FREEZER,
- "freezer.state", state);
+ VIR_CGROUP_BACKEND_CALL(group, setFreezerState, -1, state);
}
int
virCgroupGetFreezerState(virCgroupPtr group, char **state)
{
- return virCgroupGetValueStr(group,
- VIR_CGROUP_CONTROLLER_FREEZER,
- "freezer.state", state);
+ VIR_CGROUP_BACKEND_CALL(group, getFreezerState, -1, state);
}
diff --git a/src/util/vircgroupbackend.h b/src/util/vircgroupbackend.h
index a80ad0b5d3..0369b48f2b 100644
--- a/src/util/vircgroupbackend.h
+++ b/src/util/vircgroupbackend.h
@@ -308,6 +308,14 @@ typedef int
unsigned long long *user,
unsigned long long *sys);
+typedef int
+(*virCgroupSetFreezerStateCB)(virCgroupPtr group,
+ const char *state);
+
+typedef int
+(*virCgroupGetFreezerStateCB)(virCgroupPtr group,
+ char **state);
+
struct _virCgroupBackend {
virCgroupBackendType type;
@@ -374,6 +382,9 @@ struct _virCgroupBackend {
virCgroupGetCpuacctUsageCB getCpuacctUsage;
virCgroupGetCpuacctPercpuUsageCB getCpuacctPercpuUsage;
virCgroupGetCpuacctStatCB getCpuacctStat;
+
+ virCgroupSetFreezerStateCB setFreezerState;
+ virCgroupGetFreezerStateCB getFreezerState;
};
typedef struct _virCgroupBackend virCgroupBackend;
typedef virCgroupBackend *virCgroupBackendPtr;
diff --git a/src/util/vircgroupv1.c b/src/util/vircgroupv1.c
index f99cf5c6d6..a1b2f3eb23 100644
--- a/src/util/vircgroupv1.c
+++ b/src/util/vircgroupv1.c
@@ -1923,6 +1923,26 @@ virCgroupV1GetCpuacctStat(virCgroupPtr group,
}
+static int
+virCgroupV1SetFreezerState(virCgroupPtr group,
+ const char *state)
+{
+ return virCgroupSetValueStr(group,
+ VIR_CGROUP_CONTROLLER_FREEZER,
+ "freezer.state", state);
+}
+
+
+static int
+virCgroupV1GetFreezerState(virCgroupPtr group,
+ char **state)
+{
+ return virCgroupGetValueStr(group,
+ VIR_CGROUP_CONTROLLER_FREEZER,
+ "freezer.state", state);
+}
+
+
virCgroupBackend virCgroupV1Backend = {
.type = VIR_CGROUP_BACKEND_TYPE_V1,
@@ -1987,6 +2007,9 @@ virCgroupBackend virCgroupV1Backend = {
.getCpuacctUsage = virCgroupV1GetCpuacctUsage,
.getCpuacctPercpuUsage = virCgroupV1GetCpuacctPercpuUsage,
.getCpuacctStat = virCgroupV1GetCpuacctStat,
+
+ .setFreezerState = virCgroupV1SetFreezerState,
+ .getFreezerState = virCgroupV1GetFreezerState,
};
--
2.17.1