From nobody Sun Feb 8 11:41:01 2026 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of redhat.com designates 63.128.21.124 as permitted sender) client-ip=63.128.21.124; envelope-from=libvir-list-bounces@redhat.com; helo=us-smtp-delivery-124.mimecast.com; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 63.128.21.124 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1604407510; cv=none; d=zohomail.com; s=zohoarc; b=FuA7GNob8l5ctCtaX5GhqoDLJF+ywAhywb1qjgcnvqJBoh18bejnuOyJs+f/tT13abfbvllU+FXU2A26FSX2tL8TBUT4htqeqeudRSb4f83/Pxzd7mV10O8Hxx1NWtItuqPpKk/LMuY6xFopJhe3MHFA6RsED0D8NmrYBVu3i+8= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1604407510; h=Content-Type:Content-Transfer-Encoding:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=jhHmUBKTbMVK+yhj080S1hbOtmCnIFsm5GvSnVgnQ1Y=; b=EfZ/1H6zByjPlzhhXiypLmalue7RRlUfll2PZSLm7fy+Jg2vXo5vUQl1Tw9ZRdb/+HHTC63WbS18Ujvkcg5vq6pRSZlHyikhh1wzjtZUZGedRjF9RM2t5/0qgxCFBi9zgfQO8PScW0XdCjdGqApt4d4Gg+reXWC5D/YGCSCxyTk= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 63.128.21.124 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass header.from= (p=none dis=none) header.from= Return-Path: Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [63.128.21.124]) by mx.zohomail.com with SMTPS id 1604407510267297.09468711706154; Tue, 3 Nov 2020 04:45:10 -0800 (PST) Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-519-v0-xooB2PJq6cMK02jsUBQ-1; Tue, 03 Nov 2020 07:42:21 -0500 Received: from smtp.corp.redhat.com (int-mx08.intmail.prod.int.phx2.redhat.com [10.5.11.23]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 38F4F1868424; Tue, 3 Nov 2020 12:42:13 +0000 (UTC) Received: from colo-mx.corp.redhat.com (colo-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.20]) by smtp.corp.redhat.com (Postfix) with ESMTPS id F01C421E96; Tue, 3 Nov 2020 12:42:12 +0000 (UTC) Received: from lists01.pubmisc.prod.ext.phx2.redhat.com (lists01.pubmisc.prod.ext.phx2.redhat.com [10.5.19.33]) by colo-mx.corp.redhat.com (Postfix) with ESMTP id AEE37181A3EC; Tue, 3 Nov 2020 12:42:12 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.phx2.redhat.com [10.5.11.13]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id 0A3CftIT015974 for ; Tue, 3 Nov 2020 07:41:55 -0500 Received: by smtp.corp.redhat.com (Postfix) id C6F3D1C4; Tue, 3 Nov 2020 12:41:55 +0000 (UTC) Received: from antique-work.redhat.com (unknown [10.40.192.11]) by smtp.corp.redhat.com (Postfix) with ESMTP id 41DCD73667 for ; Tue, 3 Nov 2020 12:41:55 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1604407508; h=from:from:sender:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references:list-id:list-help: list-unsubscribe:list-subscribe:list-post; bh=jhHmUBKTbMVK+yhj080S1hbOtmCnIFsm5GvSnVgnQ1Y=; b=hq1hmxZJ42QN1yqyMFaU2rpj2Ksy1Ge6ygiZoCFlBB0BVNU8XCa58UnARQRISqn37TXCeD hAQi14kfKSTzOqpUBtQZbZXitiWOaKetLnrHP/3mwsK6Oruh9cTVf3hiN3HCooKDE1zpjc xK4WJHAN/HOGuEiSESfuA05VNJdT2vI= X-MC-Unique: v0-xooB2PJq6cMK02jsUBQ-1 From: Pavel Hrdina To: libvir-list@redhat.com Subject: [libvirt PATCH 15/25] vircgroup: drop @parent from virCgroupNew Date: Tue, 3 Nov 2020 13:41:27 +0100 Message-Id: <66453bc623bc57ab3883e833685db2ecd38c437b.1604407065.git.phrdina@redhat.com> In-Reply-To: References: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.13 X-loop: libvir-list@redhat.com X-BeenThere: libvir-list@redhat.com X-Mailman-Version: 2.1.12 Precedence: junk List-Id: Development discussions about the libvirt library & tools List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: libvir-list-bounces@redhat.com Errors-To: libvir-list-bounces@redhat.com X-Scanned-By: MIMEDefang 2.84 on 10.5.11.23 Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=libvir-list-bounces@redhat.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @redhat.com) Content-Type: text/plain; charset="utf-8" Now it is always NULL. Signed-off-by: Pavel Hrdina --- src/util/vircgroup.c | 40 +++++++++++++--------------------------- src/util/vircgrouppriv.h | 1 - src/util/vircgroupv1.c | 2 +- 3 files changed, 14 insertions(+), 29 deletions(-) diff --git a/src/util/vircgroup.c b/src/util/vircgroup.c index b11139bef1..56aa9cc064 100644 --- a/src/util/vircgroup.c +++ b/src/util/vircgroup.c @@ -446,28 +446,19 @@ static int virCgroupDetect(virCgroupPtr group, pid_t pid, int controllers, - const char *path, - virCgroupPtr parent) + const char *path) { - VIR_DEBUG("group=3D%p controllers=3D%d path=3D%s parent=3D%p", - group, controllers, path, parent); + VIR_DEBUG("group=3D%p controllers=3D%d path=3D%s", + group, controllers, path); =20 if (virCgroupSetBackends(group) < 0) return -1; =20 - if (parent) { - if (virCgroupCopyMounts(group, parent) < 0) - return -1; - } else { - if (virCgroupDetectMounts(group) < 0) - return -1; - } + if (virCgroupDetectMounts(group) < 0) + return -1; =20 - /* In some cases we can copy part of the placement info - * based on the parent cgroup... - */ - if (parent || path[0] =3D=3D '/') { - if (virCgroupCopyPlacement(group, path, parent) < 0) + if (path[0] =3D=3D '/') { + if (virCgroupCopyPlacement(group, path, NULL) < 0) return -1; } =20 @@ -479,7 +470,7 @@ virCgroupDetect(virCgroupPtr group, if (virCgroupValidatePlacement(group, pid) < 0) return -1; =20 - if (virCgroupDetectControllers(group, controllers, parent) < 0) + if (virCgroupDetectControllers(group, controllers, NULL) < 0) return -1; =20 return 0; @@ -708,15 +699,12 @@ virCgroupMakeGroup(virCgroupPtr parent, /** * virCgroupNew: * @path: path for the new group - * @parent: parent group, or NULL * @controllers: bitmask of controllers to activate * * Create a new cgroup storing it in @group. * * If @path starts with a '/' it is treated as an - * absolute path, and @parent is ignored. Otherwise - * it is treated as being relative to @parent. If - * @parent is NULL, then the placement of the current + * absolute path. Otherwise then the placement of the current * process is used. * * Returns 0 on success, -1 on error @@ -724,19 +712,18 @@ virCgroupMakeGroup(virCgroupPtr parent, int virCgroupNew(pid_t pid, const char *path, - virCgroupPtr parent, int controllers, virCgroupPtr *group) { g_autoptr(virCgroup) newGroup =3D NULL; =20 - VIR_DEBUG("pid=3D%lld path=3D%s parent=3D%p controllers=3D%d group=3D%= p", - (long long) pid, path, parent, controllers, group); + VIR_DEBUG("pid=3D%lld path=3D%s controllers=3D%d group=3D%p", + (long long) pid, path, controllers, group); =20 *group =3D NULL; newGroup =3D g_new0(virCgroup, 1); =20 - if (virCgroupDetect(newGroup, pid, controllers, path, parent) < 0) + if (virCgroupDetect(newGroup, pid, controllers, path) < 0) return -1; =20 *group =3D g_steal_pointer(&newGroup); @@ -940,7 +927,7 @@ virCgroupNewPartition(const char *path, tmp++; *tmp =3D '\0'; =20 - if (virCgroupNew(-1, parentPath, NULL, controllers, &parent) < 0) + if (virCgroupNew(-1, parentPath, controllers, &parent) < 0) return -1; } =20 @@ -1156,7 +1143,6 @@ virCgroupEnableMissingControllers(char *path, =20 if (virCgroupNew(pidleader, "/", - NULL, controllers, &parent) < 0) return -1; diff --git a/src/util/vircgrouppriv.h b/src/util/vircgrouppriv.h index af8bf99888..0ac62882a5 100644 --- a/src/util/vircgrouppriv.h +++ b/src/util/vircgrouppriv.h @@ -112,7 +112,6 @@ int virCgroupGetValueForBlkDev(const char *str, =20 int virCgroupNew(pid_t pid, const char *path, - virCgroupPtr parent, int controllers, virCgroupPtr *group); =20 diff --git a/src/util/vircgroupv1.c b/src/util/vircgroupv1.c index 6bb819410b..b3e0f733b9 100644 --- a/src/util/vircgroupv1.c +++ b/src/util/vircgroupv1.c @@ -1468,7 +1468,7 @@ virCgroupV1MemoryOnceInit(void) g_autoptr(virCgroup) group =3D NULL; unsigned long long int mem_unlimited =3D 0ULL; =20 - if (virCgroupNew(-1, "/", NULL, -1, &group) < 0) + if (virCgroupNew(-1, "/", -1, &group) < 0) return; =20 if (!virCgroupV1HasController(group, VIR_CGROUP_CONTROLLER_MEMORY)) --=20 2.26.2