From nobody Sun Feb 8 20:34:47 2026 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of redhat.com designates 209.132.183.28 as permitted sender) client-ip=209.132.183.28; envelope-from=libvir-list-bounces@redhat.com; helo=mx1.redhat.com; Authentication-Results: mx.zohomail.com; spf=pass (zoho.com: domain of redhat.com designates 209.132.183.28 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass(p=none dis=none) header.from=redhat.com Return-Path: Received: from mx1.redhat.com (mx1.redhat.com [209.132.183.28]) by mx.zohomail.com with SMTPS id 1537285601304508.0696777541374; Tue, 18 Sep 2018 08:46:41 -0700 (PDT) Received: from smtp.corp.redhat.com (int-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.12]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 55A1F6B; Tue, 18 Sep 2018 15:46:39 +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 183C77B014; Tue, 18 Sep 2018 15:46:39 +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 A92D8181A139; Tue, 18 Sep 2018 15:46:38 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.phx2.redhat.com [10.5.11.14]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id w8IFkEWU011905 for ; Tue, 18 Sep 2018 11:46:14 -0400 Received: by smtp.corp.redhat.com (Postfix) id C8FF85D9C7; Tue, 18 Sep 2018 15:46:14 +0000 (UTC) Received: from antique-work.brq.redhat.com (unknown [10.43.2.181]) by smtp.corp.redhat.com (Postfix) with ESMTP id 4B9E882AF8 for ; Tue, 18 Sep 2018 15:46:14 +0000 (UTC) From: Pavel Hrdina To: libvir-list@redhat.com Date: Tue, 18 Sep 2018 17:45:23 +0200 Message-Id: <76d3b0c1fad5426a6ca5e68de3a4bb352a6319fd.1537285203.git.phrdina@redhat.com> In-Reply-To: References: In-Reply-To: References: X-Scanned-By: MIMEDefang 2.79 on 10.5.11.14 X-loop: libvir-list@redhat.com Subject: [libvirt] [PATCH 02/47] vircgroup: introduce cgroup v1 backend files 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: , MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Sender: libvir-list-bounces@redhat.com Errors-To: libvir-list-bounces@redhat.com X-Scanned-By: MIMEDefang 2.79 on 10.5.11.12 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.29]); Tue, 18 Sep 2018 15:46:40 +0000 (UTC) X-ZohoMail: RDMRC_0 RSF_0 Z_629925259 SPT_0 Content-Type: text/plain; charset="utf-8" Signed-off-by: Pavel Hrdina Reviewed-by: Fabiano Fid=C3=AAncio Reviewed-by: J=EF=BF=BDn Tomko --- src/Makefile.am | 1 + src/libvirt_private.syms | 3 ++ src/util/Makefile.inc.am | 2 ++ src/util/vircgroupbackend.c | 2 ++ src/util/vircgroupv1.c | 55 +++++++++++++++++++++++++++++++++++++ src/util/vircgroupv1.h | 27 ++++++++++++++++++ 6 files changed, 90 insertions(+) create mode 100644 src/util/vircgroupv1.c create mode 100644 src/util/vircgroupv1.h diff --git a/src/Makefile.am b/src/Makefile.am index 3465629005..f515569fd5 100644 --- a/src/Makefile.am +++ b/src/Makefile.am @@ -674,6 +674,7 @@ libvirt_setuid_rpc_client_la_SOURCES =3D \ util/virbuffer.c \ util/vircgroup.c \ util/vircgroupbackend.c \ + util/vircgroupv1.c \ util/vircommand.c \ util/virconf.c \ util/virdbus.c \ diff --git a/src/libvirt_private.syms b/src/libvirt_private.syms index eb302b3559..00598b97de 100644 --- a/src/libvirt_private.syms +++ b/src/libvirt_private.syms @@ -1580,6 +1580,9 @@ virCgroupTerminateMachine; virCgroupBackendGetAll; virCgroupBackendRegister; =20 +# util/vircgroupv1.h +virCgroupV1Register; + # util/virclosecallbacks.h virCloseCallbacksGet; virCloseCallbacksGetConn; diff --git a/src/util/Makefile.inc.am b/src/util/Makefile.inc.am index 1b236ca62b..ad3be91867 100644 --- a/src/util/Makefile.inc.am +++ b/src/util/Makefile.inc.am @@ -25,6 +25,8 @@ UTIL_SOURCES =3D \ util/vircgroup.h util/vircgrouppriv.h \ util/vircgroupbackend.c \ util/vircgroupbackend.h \ + util/vircgroupv1.c \ + util/vircgroupv1.h \ util/virclosecallbacks.c \ util/virclosecallbacks.h \ util/vircommand.c \ diff --git a/src/util/vircgroupbackend.c b/src/util/vircgroupbackend.c index e014bfc0e6..d854c9711d 100644 --- a/src/util/vircgroupbackend.c +++ b/src/util/vircgroupbackend.c @@ -20,6 +20,7 @@ #include =20 #include "vircgroupbackend.h" +#include "vircgroupv1.h" #include "virerror.h" #include "virthread.h" =20 @@ -49,6 +50,7 @@ virCgroupBackendRegister(virCgroupBackendPtr backend) static void virCgroupBackendOnceInit(void) { + virCgroupV1Register(); } =20 =20 diff --git a/src/util/vircgroupv1.c b/src/util/vircgroupv1.c new file mode 100644 index 0000000000..711ebf1128 --- /dev/null +++ b/src/util/vircgroupv1.c @@ -0,0 +1,55 @@ +/* + * vircgroupv1.c: methods for cgroups v1 backedn + * + * Copyright (C) 2010-2015,2018 Red Hat, Inc. + * Copyright IBM Corp. 2008 + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library. If not, see + * . + */ +#include + +#include "internal.h" + +#define __VIR_CGROUP_ALLOW_INCLUDE_PRIV_H__ +#include "vircgrouppriv.h" +#undef __VIR_CGROUP_ALLOW_INCLUDE_PRIV_H__ + +#include "vircgroup.h" +#include "vircgroupbackend.h" +#include "vircgroupv1.h" +#include "virlog.h" + +VIR_LOG_INIT("util.cgroup"); + +#define VIR_FROM_THIS VIR_FROM_CGROUP + + +VIR_ENUM_DECL(virCgroupV1Controller); +VIR_ENUM_IMPL(virCgroupV1Controller, VIR_CGROUP_CONTROLLER_LAST, + "cpu", "cpuacct", "cpuset", "memory", "devices", + "freezer", "blkio", "net_cls", "perf_event", + "name=3Dsystemd"); + + +virCgroupBackend virCgroupV1Backend =3D { + .type =3D VIR_CGROUP_BACKEND_TYPE_V1, +}; + + +void +virCgroupV1Register(void) +{ + virCgroupBackendRegister(&virCgroupV1Backend); +} diff --git a/src/util/vircgroupv1.h b/src/util/vircgroupv1.h new file mode 100644 index 0000000000..e75b85a50a --- /dev/null +++ b/src/util/vircgroupv1.h @@ -0,0 +1,27 @@ +/* + * vircgroupv1.h: methods for cgroups v1 backedn + * + * Copyright (C) 2018 Red Hat, Inc. + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library. If not, see + * . + */ + +#ifndef __VIR_CGROUP_V1_H__ +# define __VIR_CGROUP_V1_H__ + +void +virCgroupV1Register(void); + +#endif /* __VIR_CGROUP_V1_H__ */ --=20 2.17.1 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list