提交 12264c12 编写于 作者: P Pavel Hrdina

vircgroup: extract virCgroupV1StealPlacement

Reviewed-by: NFabiano Fidêncio <fidencio@redhat.com>
Reviewed-by: NJán Tomko <jtomko@redhat.com>
Signed-off-by: NPavel Hrdina <phrdina@redhat.com>
上级 b549a66e
......@@ -1319,8 +1319,7 @@ virCgroupNewMachineSystemd(const char *name,
&init) < 0)
return -1;
path = init->controllers[VIR_CGROUP_CONTROLLER_SYSTEMD].placement;
init->controllers[VIR_CGROUP_CONTROLLER_SYSTEMD].placement = NULL;
path = init->backend->stealPlacement(init);
virCgroupFree(&init);
if (!path || STREQ(path, "/") || path[0] != '/') {
......
......@@ -66,6 +66,9 @@ typedef int
(*virCgroupValidatePlacementCB)(virCgroupPtr group,
pid_t pid);
typedef char *
(*virCgroupStealPlacementCB)(virCgroupPtr group);
struct _virCgroupBackend {
virCgroupBackendType type;
......@@ -77,6 +80,7 @@ struct _virCgroupBackend {
virCgroupDetectMountsCB detectMounts;
virCgroupDetectPlacementCB detectPlacement;
virCgroupValidatePlacementCB validatePlacement;
virCgroupStealPlacementCB stealPlacement;
};
typedef struct _virCgroupBackend virCgroupBackend;
typedef virCgroupBackend *virCgroupBackendPtr;
......
......@@ -402,6 +402,17 @@ virCgroupV1ValidatePlacement(virCgroupPtr group,
}
static char *
virCgroupV1StealPlacement(virCgroupPtr group)
{
char *ret = NULL;
VIR_STEAL_PTR(ret, group->controllers[VIR_CGROUP_CONTROLLER_SYSTEMD].placement);
return ret;
}
virCgroupBackend virCgroupV1Backend = {
.type = VIR_CGROUP_BACKEND_TYPE_V1,
......@@ -412,6 +423,7 @@ virCgroupBackend virCgroupV1Backend = {
.detectMounts = virCgroupV1DetectMounts,
.detectPlacement = virCgroupV1DetectPlacement,
.validatePlacement = virCgroupV1ValidatePlacement,
.stealPlacement = virCgroupV1StealPlacement,
};
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册