From nobody Mon Feb 9 04:31:34 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 1537285676777805.6806856402623; Tue, 18 Sep 2018 08:47:56 -0700 (PDT) Received: from smtp.corp.redhat.com (int-mx07.intmail.prod.int.phx2.redhat.com [10.5.11.22]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id DE7ECC01EE9A; Tue, 18 Sep 2018 15:47:54 +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 9849B10021B1; Tue, 18 Sep 2018 15:47:54 +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 3CE7A181A73C; Tue, 18 Sep 2018 15:47:54 +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 w8IFlO72013167 for ; Tue, 18 Sep 2018 11:47:24 -0400 Received: by smtp.corp.redhat.com (Postfix) id D6BBC82AD6; Tue, 18 Sep 2018 15:47:24 +0000 (UTC) Received: from antique-work.brq.redhat.com (unknown [10.43.2.181]) by smtp.corp.redhat.com (Postfix) with ESMTP id 533CA4F9A1 for ; Tue, 18 Sep 2018 15:47:24 +0000 (UTC) From: Pavel Hrdina To: libvir-list@redhat.com Date: Tue, 18 Sep 2018 17:46:03 +0200 Message-Id: <3cb195710a15ab8b8718224b3e8209963ff3007b.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 42/47] vircgroup: extract virCgroupV1(Set|Get)FreezerState 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.84 on 10.5.11.22 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.31]); Tue, 18 Sep 2018 15:47:55 +0000 (UTC) X-ZohoMail: RDMRC_0 RSF_0 Z_629925259 SPT_0 Content-Type: text/plain; charset="utf-8" Signed-off-by: Pavel Hrdina --- src/util/vircgroup.c | 8 ++------ src/util/vircgroupbackend.h | 11 +++++++++++ src/util/vircgroupv1.c | 23 +++++++++++++++++++++++ 3 files changed, 36 insertions(+), 6 deletions(-) diff --git a/src/util/vircgroup.c b/src/util/vircgroup.c index 9ba2318c0b..8744cd067d 100644 --- a/src/util/vircgroup.c +++ b/src/util/vircgroup.c @@ -2605,18 +2605,14 @@ virCgroupGetCpuacctStat(virCgroupPtr group, unsigne= d long long *user, int virCgroupSetFreezerState(virCgroupPtr group, const char *state) { - return virCgroupSetValueStr(group, - VIR_CGROUP_CONTROLLER_FREEZER, - "freezer.state", state); + VIR_CGROUP_BACKEND_CALL(group, setFreezerState, -1, state); } =20 =20 int virCgroupGetFreezerState(virCgroupPtr group, char **state) { - return virCgroupGetValueStr(group, - VIR_CGROUP_CONTROLLER_FREEZER, - "freezer.state", state); + VIR_CGROUP_BACKEND_CALL(group, getFreezerState, -1, state); } =20 =20 diff --git a/src/util/vircgroupbackend.h b/src/util/vircgroupbackend.h index a80ad0b5d3..0369b48f2b 100644 --- a/src/util/vircgroupbackend.h +++ b/src/util/vircgroupbackend.h @@ -308,6 +308,14 @@ typedef int unsigned long long *user, unsigned long long *sys); =20 +typedef int +(*virCgroupSetFreezerStateCB)(virCgroupPtr group, + const char *state); + +typedef int +(*virCgroupGetFreezerStateCB)(virCgroupPtr group, + char **state); + struct _virCgroupBackend { virCgroupBackendType type; =20 @@ -374,6 +382,9 @@ struct _virCgroupBackend { virCgroupGetCpuacctUsageCB getCpuacctUsage; virCgroupGetCpuacctPercpuUsageCB getCpuacctPercpuUsage; virCgroupGetCpuacctStatCB getCpuacctStat; + + virCgroupSetFreezerStateCB setFreezerState; + virCgroupGetFreezerStateCB getFreezerState; }; typedef struct _virCgroupBackend virCgroupBackend; typedef virCgroupBackend *virCgroupBackendPtr; diff --git a/src/util/vircgroupv1.c b/src/util/vircgroupv1.c index f99cf5c6d6..a1b2f3eb23 100644 --- a/src/util/vircgroupv1.c +++ b/src/util/vircgroupv1.c @@ -1923,6 +1923,26 @@ virCgroupV1GetCpuacctStat(virCgroupPtr group, } =20 =20 +static int +virCgroupV1SetFreezerState(virCgroupPtr group, + const char *state) +{ + return virCgroupSetValueStr(group, + VIR_CGROUP_CONTROLLER_FREEZER, + "freezer.state", state); +} + + +static int +virCgroupV1GetFreezerState(virCgroupPtr group, + char **state) +{ + return virCgroupGetValueStr(group, + VIR_CGROUP_CONTROLLER_FREEZER, + "freezer.state", state); +} + + virCgroupBackend virCgroupV1Backend =3D { .type =3D VIR_CGROUP_BACKEND_TYPE_V1, =20 @@ -1987,6 +2007,9 @@ virCgroupBackend virCgroupV1Backend =3D { .getCpuacctUsage =3D virCgroupV1GetCpuacctUsage, .getCpuacctPercpuUsage =3D virCgroupV1GetCpuacctPercpuUsage, .getCpuacctStat =3D virCgroupV1GetCpuacctStat, + + .setFreezerState =3D virCgroupV1SetFreezerState, + .getFreezerState =3D virCgroupV1GetFreezerState, }; =20 =20 --=20 2.17.1 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list