From nobody Wed May 14 03:36:38 2025 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 15283797003671016.540303854509; Thu, 7 Jun 2018 06:55:00 -0700 (PDT) Received: from smtp.corp.redhat.com (int-mx11.intmail.prod.int.phx2.redhat.com [10.5.11.26]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 505F73086267; Thu, 7 Jun 2018 13:54:59 +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 12F683001A64; Thu, 7 Jun 2018 13:54:59 +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 8C9DF180BA87; Thu, 7 Jun 2018 13:54:58 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.rdu2.redhat.com [10.11.54.3]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id w57Dsa0J000461 for ; Thu, 7 Jun 2018 09:54:36 -0400 Received: by smtp.corp.redhat.com (Postfix) id AB0011002962; Thu, 7 Jun 2018 13:54:36 +0000 (UTC) Received: from caroline (unknown [10.43.2.67]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 88164111DD03 for ; Thu, 7 Jun 2018 13:54:33 +0000 (UTC) Received: from caroline.brq.redhat.com (caroline.usersys.redhat.com [127.0.0.1]) by caroline (Postfix) with ESMTP id EFCB912006C for ; Thu, 7 Jun 2018 15:54:32 +0200 (CEST) From: Martin Kletzander To: libvir-list@redhat.com Date: Thu, 7 Jun 2018 15:54:25 +0200 Message-Id: In-Reply-To: References: In-Reply-To: References: X-Scanned-By: MIMEDefang 2.78 on 10.11.54.3 X-loop: libvir-list@redhat.com Subject: [libvirt] [PATCH 04/10] util: Avoid needless preprocessor conditionals in virresctrl 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.26 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.49]); Thu, 07 Jun 2018 13:54:59 +0000 (UTC) X-ZohoMail: RSF_0 Z_629925259 SPT_0 Content-Type: text/plain; charset="utf-8" By exporting virResctrlAllocMasksAssign() we can remove most of the conditionals. And that function should be used from the tests later anyway. Signed-off-by: Martin Kletzander Reviewed-by: J=EF=BF=BDn Tomko --- src/libvirt_private.syms | 1 + src/util/virresctrl.c | 30 +----------------------------- src/util/virresctrlpriv.h | 4 ++++ 3 files changed, 6 insertions(+), 29 deletions(-) diff --git a/src/libvirt_private.syms b/src/libvirt_private.syms index 3a9680b3cd2b..6a8b40bbbdb1 100644 --- a/src/libvirt_private.syms +++ b/src/libvirt_private.syms @@ -2628,6 +2628,7 @@ virResctrlAllocForeachSize; virResctrlAllocFormat; virResctrlAllocGetID; virResctrlAllocGetUnused; +virResctrlAllocMasksAssign; virResctrlAllocNew; virResctrlAllocRemove; virResctrlAllocSetID; diff --git a/src/util/virresctrl.c b/src/util/virresctrl.c index 9a118fc3595d..787db31b6126 100644 --- a/src/util/virresctrl.c +++ b/src/util/virresctrl.c @@ -380,8 +380,6 @@ virResctrlInfoIsEmpty(virResctrlInfoPtr resctrl) } =20 =20 -#ifdef __linux__ - int virResctrlGetInfo(virResctrlInfoPtr resctrl) { @@ -512,18 +510,6 @@ virResctrlGetInfo(virResctrlInfoPtr resctrl) return ret; } =20 -#else /* ! __linux__ */ - -int -virResctrlGetInfo(virResctrlInfoPtr resctrl ATTRIBUTE_UNUSED) -{ - virReportSystemError(ENOSYS, "%s", - _("Cache tune not supported on this platform")); - return -1; -} - -#endif /* ! __linux__ */ - =20 int virResctrlInfoGetCache(virResctrlInfoPtr resctrl, @@ -1089,8 +1075,6 @@ virResctrlAllocGetDefault(virResctrlInfoPtr resctrl) } =20 =20 -#ifdef __linux__ - static void virResctrlAllocSubtractPerType(virResctrlAllocPerTypePtr dst, virResctrlAllocPerTypePtr src) @@ -1246,18 +1230,6 @@ virResctrlAllocGetUnused(virResctrlInfoPtr resctrl) goto cleanup; } =20 -#else /* ! __linux__ */ - -virResctrlAllocPtr -virResctrlAllocGetUnused(virResctrlInfoPtr resctrl ATTRIBUTE_UNUSED) -{ - virReportSystemError(ENOSYS, "%s", - _("Cache tune not supported on this platform")); - return NULL; -} - -#endif /* ! __linux__ */ - =20 /* * Given the information about requested allocation type `a_type`, the host @@ -1434,7 +1406,7 @@ virResctrlAllocCopyMasks(virResctrlAllocPtr dst, * then tries to find a proper space for every requested allocation effect= ively * transforming `sizes` into `masks`. */ -static int +int virResctrlAllocMasksAssign(virResctrlInfoPtr resctrl, virResctrlAllocPtr alloc) { diff --git a/src/util/virresctrlpriv.h b/src/util/virresctrlpriv.h index 72b115afd13e..80ddd4b875a3 100644 --- a/src/util/virresctrlpriv.h +++ b/src/util/virresctrlpriv.h @@ -24,4 +24,8 @@ virResctrlAllocPtr virResctrlAllocGetUnused(virResctrlInfoPtr resctrl); =20 +int +virResctrlAllocMasksAssign(virResctrlInfoPtr resctrl, + virResctrlAllocPtr alloc); + #endif /* __VIR_RESCTRL_PRIV_H__ */ --=20 2.17.1 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list