From owner-dev-commits-src-main@freebsd.org Tue Jan 12 18:40:51 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 0320D4E24B7; Tue, 12 Jan 2021 18:40:51 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4DFfXf4K4nz4VV2; Tue, 12 Jan 2021 18:40:50 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 6B72A14ED; Tue, 12 Jan 2021 18:40:50 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 10CIeopB038387; Tue, 12 Jan 2021 18:40:50 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 10CIeoQd038386; Tue, 12 Jan 2021 18:40:50 GMT (envelope-from git) Date: Tue, 12 Jan 2021 18:40:50 GMT Message-Id: <202101121840.10CIeoQd038386@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Mariusz Zaborski Subject: git: d2ceee38ca26 - main - casper: convert macros to inline functions MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: oshogbo X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: d2ceee38ca26d8ea48b8dfd9018636eadd41fbc4 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 12 Jan 2021 18:40:51 -0000 The branch main has been updated by oshogbo: URL: https://cgit.FreeBSD.org/src/commit/?id=d2ceee38ca26d8ea48b8dfd9018636eadd41fbc4 commit d2ceee38ca26d8ea48b8dfd9018636eadd41fbc4 Author: Mariusz Zaborski AuthorDate: 2021-01-12 18:38:10 +0000 Commit: Mariusz Zaborski CommitDate: 2021-01-12 18:40:45 +0000 casper: convert macros to inline functions In libcasper, the first argument to the function is a structure that represents a connection to Casper. On systems without Casper, macros are used to interpose the Casper functions to standard libc ones. This may cause errors/warnings that the variable is not used. With the inline function, there is no such problem. I omitted this file in: 8c121177f063a187534dcd475b136c34474802cd --- lib/libcasper/libcasper/libcasper.h | 25 ++++++++++++++++++++++--- 1 file changed, 22 insertions(+), 3 deletions(-) diff --git a/lib/libcasper/libcasper/libcasper.h b/lib/libcasper/libcasper/libcasper.h index c8ed184d92cd..b55619b01506 100644 --- a/lib/libcasper/libcasper/libcasper.h +++ b/lib/libcasper/libcasper/libcasper.h @@ -123,8 +123,21 @@ cap_channel_t *cap_service_open(const cap_channel_t *chan, const char *name); int cap_service_limit(const cap_channel_t *chan, const char * const *names, size_t nnames); #else -#define cap_service_open(chan, name) (cap_init()) -#define cap_service_limit(chan, names, nnames) (0) +static inline cap_channel_t * +cap_service_open(const cap_channel_t *chan __unused, + const char *name __unused) +{ + + return (cap_init()); +} + +static inline int +cap_service_limit(const cap_channel_t *chan __unused, + const char * const *names __unused, size_t nnames __unused) +{ + + return (0); +} #endif /* @@ -229,7 +242,13 @@ int cap_sock(const cap_channel_t *chan); #ifdef WITH_CASPER int cap_limit_set(const cap_channel_t *chan, nvlist_t *limits); #else -#define cap_limit_set(chan, limits) (0) +static inline int +cap_limit_set(const cap_channel_t *chan __unused, + nvlist_t *limits __unused) +{ + + return (0); +} #endif /*