From nobody Sun Feb 8 17:04:15 2026 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of redhat.com designates 216.205.24.124 as permitted sender) client-ip=216.205.24.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 216.205.24.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=1604407337; cv=none; d=zohomail.com; s=zohoarc; b=KPlrxJTWpmPbmY9rgRHyhBFaX2tLdmqFa2Pg0dluiT2EfEgOeKQoJqSCeN0XinwxR0ABFypfurMLUNuzvmGdEeNBz1FYKke6wG17Tg73EHmT6yiLbKmVRIQGQLTRp17JrpD0DFwYfUaBxY8hp3Wa6uU7CMbSItEqPSsOunmxp70= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1604407337; 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=kd/ZUkMECgDAIEXhWhT8RHk7Je3zuSiud3aplfKZ3yQ=; b=EPxKE5ovCe+JJ0PIVQFLlErsP6EqWZ508RNwZfYiRxDMTFOun2N9SEBgv5Eb2ynYxtjxn9p23/M4YTngL6KcahlRz4/wjkdrGOpRN48voQPpCIV/n3bCsFPDUy7K3ZbF30iDQulSZPCt94cd98xkKrvPNEL+5/QpEFQBR8YYp/A= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 216.205.24.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 [216.205.24.124]) by mx.zohomail.com with SMTPS id 1604407337656196.46799350790116; Tue, 3 Nov 2020 04:42:17 -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-351-halkwuWMNS6a5hiBScq8Dw-1; Tue, 03 Nov 2020 07:42:14 -0500 Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.phx2.redhat.com [10.5.11.13]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id C6C3457208; Tue, 3 Nov 2020 12:42:07 +0000 (UTC) Received: from colo-mx.corp.redhat.com (colo-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.21]) by smtp.corp.redhat.com (Postfix) with ESMTPS id A54C273664; Tue, 3 Nov 2020 12:42:07 +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 6EA528C7D2; Tue, 3 Nov 2020 12:42:07 +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 0A3Cfpfg015928 for ; Tue, 3 Nov 2020 07:41:51 -0500 Received: by smtp.corp.redhat.com (Postfix) id 4A95C73661; Tue, 3 Nov 2020 12:41:51 +0000 (UTC) Received: from antique-work.redhat.com (unknown [10.40.192.11]) by smtp.corp.redhat.com (Postfix) with ESMTP id B94C71C4 for ; Tue, 3 Nov 2020 12:41:50 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1604407336; 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=kd/ZUkMECgDAIEXhWhT8RHk7Je3zuSiud3aplfKZ3yQ=; b=azGBZ/nLmm3EQqR69emy7ETTMFDLPRdfGO6TkojnUvNrTlIIIv+FCZuXq/qmQzlOWrmfTf Etx220Knuhl48eejftqcEvgSHRpw6ifYkQ7vnDi+upinCuBMb3ETLKcfy1n46jxSAvri/a r0P4D8uEyBLnKalIRqIv4WO0zb+d5CM= X-MC-Unique: halkwuWMNS6a5hiBScq8Dw-1 From: Pavel Hrdina To: libvir-list@redhat.com Subject: [libvirt PATCH 10/25] vircgroup: introduce virCgroupCopyPlacement helper Date: Tue, 3 Nov 2020 13:41:22 +0100 Message-Id: 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.79 on 10.5.11.13 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" Signed-off-by: Pavel Hrdina --- src/util/vircgroup.c | 26 ++++++++++++++++++++------ 1 file changed, 20 insertions(+), 6 deletions(-) diff --git a/src/util/vircgroup.c b/src/util/vircgroup.c index a30aec4e5e..b5f38210fb 100644 --- a/src/util/vircgroup.c +++ b/src/util/vircgroup.c @@ -294,6 +294,24 @@ virCgroupDetectMounts(virCgroupPtr group) } =20 =20 +static int +virCgroupCopyPlacement(virCgroupPtr group, + const char *path, + virCgroupPtr parent) +{ + size_t i; + + for (i =3D 0; i < VIR_CGROUP_BACKEND_TYPE_LAST; i++) { + if (group->backends[i] && + group->backends[i]->copyPlacement(group, path, parent) < 0) { + return -1; + } + } + + return 0; +} + + /* * virCgroupDetectPlacement: * @group: the group to process @@ -403,12 +421,8 @@ virCgroupDetect(virCgroupPtr group, * based on the parent cgroup... */ if (parent || path[0] =3D=3D '/') { - for (i =3D 0; i < VIR_CGROUP_BACKEND_TYPE_LAST; i++) { - if (group->backends[i] && - group->backends[i]->copyPlacement(group, path, parent) < 0= ) { - return -1; - } - } + if (virCgroupCopyPlacement(group, path, parent) < 0) + return -1; } =20 /* ... but use /proc/cgroups to fill in the rest */ --=20 2.26.2