提交 269a8e27 编写于 作者: P Pavel Hrdina

vircgroup: extract virCgroupV1(Set|Get)FreezerState

Reviewed-by: NFabiano Fidêncio <fidencio@redhat.com>
Reviewed-by: NJán Tomko <jtomko@redhat.com>
Signed-off-by: NPavel Hrdina <phrdina@redhat.com>
上级 e294615f
...@@ -2599,18 +2599,14 @@ virCgroupGetCpuacctStat(virCgroupPtr group, unsigned long long *user, ...@@ -2599,18 +2599,14 @@ virCgroupGetCpuacctStat(virCgroupPtr group, unsigned long long *user,
int int
virCgroupSetFreezerState(virCgroupPtr group, const char *state) virCgroupSetFreezerState(virCgroupPtr group, const char *state)
{ {
return virCgroupSetValueStr(group, VIR_CGROUP_BACKEND_CALL(group, setFreezerState, -1, state);
VIR_CGROUP_CONTROLLER_FREEZER,
"freezer.state", state);
} }
int int
virCgroupGetFreezerState(virCgroupPtr group, char **state) virCgroupGetFreezerState(virCgroupPtr group, char **state)
{ {
return virCgroupGetValueStr(group, VIR_CGROUP_BACKEND_CALL(group, getFreezerState, -1, state);
VIR_CGROUP_CONTROLLER_FREEZER,
"freezer.state", state);
} }
......
...@@ -316,6 +316,14 @@ typedef int ...@@ -316,6 +316,14 @@ typedef int
unsigned long long *user, unsigned long long *user,
unsigned long long *sys); unsigned long long *sys);
typedef int
(*virCgroupSetFreezerStateCB)(virCgroupPtr group,
const char *state);
typedef int
(*virCgroupGetFreezerStateCB)(virCgroupPtr group,
char **state);
struct _virCgroupBackend { struct _virCgroupBackend {
virCgroupBackendType type; virCgroupBackendType type;
...@@ -382,6 +390,9 @@ struct _virCgroupBackend { ...@@ -382,6 +390,9 @@ struct _virCgroupBackend {
virCgroupGetCpuacctUsageCB getCpuacctUsage; virCgroupGetCpuacctUsageCB getCpuacctUsage;
virCgroupGetCpuacctPercpuUsageCB getCpuacctPercpuUsage; virCgroupGetCpuacctPercpuUsageCB getCpuacctPercpuUsage;
virCgroupGetCpuacctStatCB getCpuacctStat; virCgroupGetCpuacctStatCB getCpuacctStat;
virCgroupSetFreezerStateCB setFreezerState;
virCgroupGetFreezerStateCB getFreezerState;
}; };
typedef struct _virCgroupBackend virCgroupBackend; typedef struct _virCgroupBackend virCgroupBackend;
typedef virCgroupBackend *virCgroupBackendPtr; typedef virCgroupBackend *virCgroupBackendPtr;
......
...@@ -1928,6 +1928,26 @@ virCgroupV1GetCpuacctStat(virCgroupPtr group, ...@@ -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 = { virCgroupBackend virCgroupV1Backend = {
.type = VIR_CGROUP_BACKEND_TYPE_V1, .type = VIR_CGROUP_BACKEND_TYPE_V1,
...@@ -1992,6 +2012,9 @@ virCgroupBackend virCgroupV1Backend = { ...@@ -1992,6 +2012,9 @@ virCgroupBackend virCgroupV1Backend = {
.getCpuacctUsage = virCgroupV1GetCpuacctUsage, .getCpuacctUsage = virCgroupV1GetCpuacctUsage,
.getCpuacctPercpuUsage = virCgroupV1GetCpuacctPercpuUsage, .getCpuacctPercpuUsage = virCgroupV1GetCpuacctPercpuUsage,
.getCpuacctStat = virCgroupV1GetCpuacctStat, .getCpuacctStat = virCgroupV1GetCpuacctStat,
.setFreezerState = virCgroupV1SetFreezerState,
.getFreezerState = virCgroupV1GetFreezerState,
}; };
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册