From 7dd9c146f4713fd15b6d6642b910af29846d96e2 Mon Sep 17 00:00:00 2001 Message-Id: <7dd9c146f4713fd15b6d6642b910af29846d96e2@dist-git> From: Pavel Hrdina Date: Mon, 1 Jul 2019 17:05:52 +0200 Subject: [PATCH] vircgroup: Unexport unused function virCgroupAddTaskController() MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Pavel Hrdina (cherry picked from commit 0aaac42a6eb3fb8b5aa412d5153e0d6ae459c631) Resolves: https://bugzilla.redhat.com/show_bug.cgi?id=1689297 Signed-off-by: Pavel Hrdina Message-Id: <30f7f52a9e7d0b9ce838a2d32cc6ec0a0cf97788.1561993099.git.phrdina@redhat.com> Reviewed-by: Ján Tomko --- src/libvirt_private.syms | 1 - src/util/vircgroup.c | 69 +++++++++++++++++----------------------- src/util/vircgroup.h | 4 --- 3 files changed, 29 insertions(+), 45 deletions(-) diff --git a/src/libvirt_private.syms b/src/libvirt_private.syms index 3117c8009a..41fca88d09 100644 --- a/src/libvirt_private.syms +++ b/src/libvirt_private.syms @@ -1515,7 +1515,6 @@ virBufferVasprintf; # util/vircgroup.h virCgroupAddMachineTask; virCgroupAddTask; -virCgroupAddTaskController; virCgroupAllowAllDevices; virCgroupAllowDevice; virCgroupAllowDevicePath; diff --git a/src/util/vircgroup.c b/src/util/vircgroup.c index 5f949edec8..8ef6fb5e1a 100644 --- a/src/util/vircgroup.c +++ b/src/util/vircgroup.c @@ -1136,6 +1136,35 @@ 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) { @@ -1197,35 +1226,6 @@ virCgroupAddMachineTask(virCgroupPtr group, 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 - */ -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 virCgroupSetPartitionSuffix(const char *path, char **res) { @@ -4115,17 +4115,6 @@ virCgroupAddMachineTask(virCgroupPtr group ATTRIBUTE_UNUSED, } -int -virCgroupAddTaskController(virCgroupPtr group ATTRIBUTE_UNUSED, - pid_t pid ATTRIBUTE_UNUSED, - int controller ATTRIBUTE_UNUSED) -{ - virReportSystemError(ENXIO, "%s", - _("Control groups not supported on this platform")); - return -1; -} - - int virCgroupGetBlkioIoServiced(virCgroupPtr group ATTRIBUTE_UNUSED, long long *bytes_read ATTRIBUTE_UNUSED, diff --git a/src/util/vircgroup.h b/src/util/vircgroup.h index a23a491d95..74c7dbcccc 100644 --- a/src/util/vircgroup.h +++ b/src/util/vircgroup.h @@ -134,10 +134,6 @@ int virCgroupPathOfController(virCgroupPtr group, int virCgroupAddTask(virCgroupPtr group, pid_t pid); int virCgroupAddMachineTask(virCgroupPtr group, pid_t pid); -int virCgroupAddTaskController(virCgroupPtr group, - pid_t pid, - int controller); - int virCgroupSetBlkioWeight(virCgroupPtr group, unsigned int weight); int virCgroupGetBlkioWeight(virCgroupPtr group, unsigned int *weight); -- 2.22.0