From 88322908f3dfad6217b1c2a2a0f8968b079d0795 Mon Sep 17 00:00:00 2001 Message-Id: <88322908f3dfad6217b1c2a2a0f8968b079d0795@dist-git> From: Pavel Hrdina Date: Mon, 1 Jul 2019 17:06:00 +0200 Subject: [PATCH] vircgroup: Remove virCgroupAddTaskController MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit There is no need for this function, both of the checks are done later by virCgroupGetControllerPath. Signed-off-by: Pavel Hrdina (cherry picked from commit db868852fdb32c76955c925dcbd92b2d6d9bfeb2) Resolves: https://bugzilla.redhat.com/show_bug.cgi?id=1689297 Signed-off-by: Pavel Hrdina Message-Id: Reviewed-by: Ján Tomko --- src/util/vircgroup.c | 31 +------------------------------ 1 file changed, 1 insertion(+), 30 deletions(-) diff --git a/src/util/vircgroup.c b/src/util/vircgroup.c index 5adf9d3c11..a94f958d75 100644 --- a/src/util/vircgroup.c +++ b/src/util/vircgroup.c @@ -1128,35 +1128,6 @@ virCgroupNew(pid_t pid, } -/** - * virCgroupAddTaskController: - * - * @group: The cgroup to add a task to - * @pid: The pid of the task to add - * @controller: The cgroup controller to be operated on - * - * Returns: 0 on success or -1 on error - */ -static int -virCgroupAddTaskController(virCgroupPtr group, pid_t pid, int controller) -{ - if (controller < 0 || controller >= VIR_CGROUP_CONTROLLER_LAST) { - virReportError(VIR_ERR_INTERNAL_ERROR, - _("Controller %d out of range"), controller); - return -1; - } - - if (!group->controllers[controller].mountPoint) { - virReportError(VIR_ERR_INTERNAL_ERROR, - _("Controller '%s' not mounted"), - virCgroupControllerTypeToString(controller)); - return -1; - } - - return virCgroupSetValueI64(group, controller, "tasks", pid); -} - - static int virCgroupAddTaskInternal(virCgroupPtr group, pid_t pid, bool withSystemd) { @@ -1174,7 +1145,7 @@ virCgroupAddTaskInternal(virCgroupPtr group, pid_t pid, bool withSystemd) if (i == VIR_CGROUP_CONTROLLER_SYSTEMD && !withSystemd) continue; - if (virCgroupAddTaskController(group, pid, i) < 0) + if (virCgroupSetValueI64(group, i, "tasks", pid) < 0) goto cleanup; } -- 2.22.0