diff --git a/src/util/vircgroup.c b/src/util/vircgroup.c index af533a39104c14e3383e6612f89bd3ea5b526fe2..ff21ec9fe01678a50377e53d8bef2277781ebe64 100644 --- a/src/util/vircgroup.c +++ b/src/util/vircgroup.c @@ -2599,18 +2599,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 3e3a73777d24d613f0960de745e12d588e334017..2c16706c962ff076dfbffd7243ad085e2ff5dc41 100644 --- a/src/util/vircgroupbackend.h +++ b/src/util/vircgroupbackend.h @@ -316,6 +316,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; @@ -382,6 +390,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 83a74622632e532235711ca60f9ed926c783d233..244daedac9c7011a7986bfcb8779f43a721348f2 100644 --- a/src/util/vircgroupv1.c +++ b/src/util/vircgroupv1.c @@ -1928,6 +1928,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, @@ -1992,6 +2012,9 @@ virCgroupBackend virCgroupV1Backend = { .getCpuacctUsage = virCgroupV1GetCpuacctUsage, .getCpuacctPercpuUsage = virCgroupV1GetCpuacctPercpuUsage, .getCpuacctStat = virCgroupV1GetCpuacctStat, + + .setFreezerState = virCgroupV1SetFreezerState, + .getFreezerState = virCgroupV1GetFreezerState, };