提交 41510b1b 编写于 作者: P Pavel Hrdina

vircgroup: extract virCgroupV1(Set|Get)CpusetMems

Reviewed-by: NFabiano Fidêncio <fidencio@redhat.com>
Reviewed-by: NJán Tomko <jtomko@redhat.com>
Signed-off-by: NPavel Hrdina <phrdina@redhat.com>
上级 269a8e27
......@@ -1708,10 +1708,7 @@ virCgroupGetMemSwapUsage(virCgroupPtr group, unsigned long long *kb)
int
virCgroupSetCpusetMems(virCgroupPtr group, const char *mems)
{
return virCgroupSetValueStr(group,
VIR_CGROUP_CONTROLLER_CPUSET,
"cpuset.mems",
mems);
VIR_CGROUP_BACKEND_CALL(group, setCpusetMems, -1, mems);
}
......@@ -1726,10 +1723,7 @@ virCgroupSetCpusetMems(virCgroupPtr group, const char *mems)
int
virCgroupGetCpusetMems(virCgroupPtr group, char **mems)
{
return virCgroupGetValueStr(group,
VIR_CGROUP_CONTROLLER_CPUSET,
"cpuset.mems",
mems);
VIR_CGROUP_BACKEND_CALL(group, getCpusetMems, -1, mems);
}
......
......@@ -324,6 +324,14 @@ typedef int
(*virCgroupGetFreezerStateCB)(virCgroupPtr group,
char **state);
typedef int
(*virCgroupSetCpusetMemsCB)(virCgroupPtr group,
const char *mems);
typedef int
(*virCgroupGetCpusetMemsCB)(virCgroupPtr group,
char **mems);
struct _virCgroupBackend {
virCgroupBackendType type;
......@@ -393,6 +401,9 @@ struct _virCgroupBackend {
virCgroupSetFreezerStateCB setFreezerState;
virCgroupGetFreezerStateCB getFreezerState;
virCgroupSetCpusetMemsCB setCpusetMems;
virCgroupGetCpusetMemsCB getCpusetMems;
};
typedef struct _virCgroupBackend virCgroupBackend;
typedef virCgroupBackend *virCgroupBackendPtr;
......
......@@ -1948,6 +1948,28 @@ virCgroupV1GetFreezerState(virCgroupPtr group,
}
static int
virCgroupV1SetCpusetMems(virCgroupPtr group,
const char *mems)
{
return virCgroupSetValueStr(group,
VIR_CGROUP_CONTROLLER_CPUSET,
"cpuset.mems",
mems);
}
static int
virCgroupV1GetCpusetMems(virCgroupPtr group,
char **mems)
{
return virCgroupGetValueStr(group,
VIR_CGROUP_CONTROLLER_CPUSET,
"cpuset.mems",
mems);
}
virCgroupBackend virCgroupV1Backend = {
.type = VIR_CGROUP_BACKEND_TYPE_V1,
......@@ -2015,6 +2037,9 @@ virCgroupBackend virCgroupV1Backend = {
.setFreezerState = virCgroupV1SetFreezerState,
.getFreezerState = virCgroupV1GetFreezerState,
.setCpusetMems = virCgroupV1SetCpusetMems,
.getCpusetMems = virCgroupV1GetCpusetMems,
};
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册