提交 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) ...@@ -1708,10 +1708,7 @@ virCgroupGetMemSwapUsage(virCgroupPtr group, unsigned long long *kb)
int int
virCgroupSetCpusetMems(virCgroupPtr group, const char *mems) virCgroupSetCpusetMems(virCgroupPtr group, const char *mems)
{ {
return virCgroupSetValueStr(group, VIR_CGROUP_BACKEND_CALL(group, setCpusetMems, -1, mems);
VIR_CGROUP_CONTROLLER_CPUSET,
"cpuset.mems",
mems);
} }
...@@ -1726,10 +1723,7 @@ virCgroupSetCpusetMems(virCgroupPtr group, const char *mems) ...@@ -1726,10 +1723,7 @@ virCgroupSetCpusetMems(virCgroupPtr group, const char *mems)
int int
virCgroupGetCpusetMems(virCgroupPtr group, char **mems) virCgroupGetCpusetMems(virCgroupPtr group, char **mems)
{ {
return virCgroupGetValueStr(group, VIR_CGROUP_BACKEND_CALL(group, getCpusetMems, -1, mems);
VIR_CGROUP_CONTROLLER_CPUSET,
"cpuset.mems",
mems);
} }
......
...@@ -324,6 +324,14 @@ typedef int ...@@ -324,6 +324,14 @@ typedef int
(*virCgroupGetFreezerStateCB)(virCgroupPtr group, (*virCgroupGetFreezerStateCB)(virCgroupPtr group,
char **state); char **state);
typedef int
(*virCgroupSetCpusetMemsCB)(virCgroupPtr group,
const char *mems);
typedef int
(*virCgroupGetCpusetMemsCB)(virCgroupPtr group,
char **mems);
struct _virCgroupBackend { struct _virCgroupBackend {
virCgroupBackendType type; virCgroupBackendType type;
...@@ -393,6 +401,9 @@ struct _virCgroupBackend { ...@@ -393,6 +401,9 @@ struct _virCgroupBackend {
virCgroupSetFreezerStateCB setFreezerState; virCgroupSetFreezerStateCB setFreezerState;
virCgroupGetFreezerStateCB getFreezerState; virCgroupGetFreezerStateCB getFreezerState;
virCgroupSetCpusetMemsCB setCpusetMems;
virCgroupGetCpusetMemsCB getCpusetMems;
}; };
typedef struct _virCgroupBackend virCgroupBackend; typedef struct _virCgroupBackend virCgroupBackend;
typedef virCgroupBackend *virCgroupBackendPtr; typedef virCgroupBackend *virCgroupBackendPtr;
......
...@@ -1948,6 +1948,28 @@ virCgroupV1GetFreezerState(virCgroupPtr group, ...@@ -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 = { virCgroupBackend virCgroupV1Backend = {
.type = VIR_CGROUP_BACKEND_TYPE_V1, .type = VIR_CGROUP_BACKEND_TYPE_V1,
...@@ -2015,6 +2037,9 @@ virCgroupBackend virCgroupV1Backend = { ...@@ -2015,6 +2037,9 @@ virCgroupBackend virCgroupV1Backend = {
.setFreezerState = virCgroupV1SetFreezerState, .setFreezerState = virCgroupV1SetFreezerState,
.getFreezerState = virCgroupV1GetFreezerState, .getFreezerState = virCgroupV1GetFreezerState,
.setCpusetMems = virCgroupV1SetCpusetMems,
.getCpusetMems = virCgroupV1GetCpusetMems,
}; };
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册