From owner-freebsd-net@freebsd.org Fri Apr 23 05:39:13 2021 Return-Path: Delivered-To: freebsd-net@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 A2E48627FEE for ; Fri, 23 Apr 2021 05:39:13 +0000 (UTC) (envelope-from Jason@zx2c4.com) Received: from mail.zx2c4.com (mail.zx2c4.com [104.131.123.232]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA512 client-signature RSA-PSS (2048 bits) client-digest SHA256) (Client CN "mail.zx2c4.com", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4FRNQ93fJhz3QnC for ; Fri, 23 Apr 2021 05:39:13 +0000 (UTC) (envelope-from Jason@zx2c4.com) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=zx2c4.com; s=20210105; t=1619156352; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=p+8a1OPdNiiN52PiCkSV60wDmL42u004ebudMU/eeV0=; b=DFVKWH/0cP5m27bP896ZwVbAb5gnAvlaE/Gy7fRPKz//JuAQ+f+zud35rw1esuJexjz1sy cmQeLaeyW1mjpQfVjOxQ2EApAuhBtM6PeGYgyONIruxHR+HFihZaC5Yh2SAQGabeOHANbS bsWV7YXru3G5Vl2TwqFkcAltPYjjBmk= Received: by mail.zx2c4.com (ZX2C4 Mail Server) with ESMTPSA id 005d6c90 (TLSv1.3:AEAD-AES256-GCM-SHA384:256:NO); Fri, 23 Apr 2021 05:39:11 +0000 (UTC) From: "Jason A. Donenfeld" To: freebsd-net@freebsd.org Cc: "Jason A. Donenfeld" Subject: [PATCH 2/2] ck: add pr_{load,store}_bool functions Date: Thu, 22 Apr 2021 23:39:02 -0600 Message-Id: <20210423053902.16087-3-Jason@zx2c4.com> In-Reply-To: <20210423053902.16087-1-Jason@zx2c4.com> References: <20210423053902.16087-1-Jason@zx2c4.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Rspamd-Queue-Id: 4FRNQ93fJhz3QnC X-Spamd-Bar: / Authentication-Results: mx1.freebsd.org; dkim=pass header.d=zx2c4.com header.s=20210105 header.b=DFVKWH/0; dmarc=pass (policy=none) header.from=zx2c4.com; spf=pass (mx1.freebsd.org: domain of Jason@zx2c4.com designates 104.131.123.232 as permitted sender) smtp.mailfrom=Jason@zx2c4.com X-Spamd-Result: default: False [0.30 / 15.00]; RCVD_VIA_SMTP_AUTH(0.00)[]; TO_DN_SOME(0.00)[]; R_SPF_ALLOW(-0.20)[+a:mail.zx2c4.com:c]; R_MISSING_CHARSET(2.50)[]; BROKEN_CONTENT_TYPE(1.50)[]; RCVD_DKIM_ARC_DNSWL_MED(-0.50)[]; DKIM_TRACE(0.00)[zx2c4.com:+]; RCPT_COUNT_TWO(0.00)[2]; DMARC_POLICY_ALLOW(-0.50)[zx2c4.com,none]; RCVD_IN_DNSWL_MED(-0.20)[104.131.123.232:from]; NEURAL_HAM_SHORT(-1.00)[-1.000]; FROM_EQ_ENVFROM(0.00)[]; MIME_TRACE(0.00)[0:+]; ASN(0.00)[asn:14061, ipnet:104.131.64.0/18, country:US]; ARC_NA(0.00)[]; NEURAL_HAM_MEDIUM(-1.00)[-1.000]; R_DKIM_ALLOW(-0.20)[zx2c4.com:s=20210105]; FREEFALL_USER(0.00)[Jason]; FROM_HAS_DN(0.00)[]; NEURAL_HAM_LONG(-1.00)[-1.000]; MIME_GOOD(-0.10)[text/plain]; TO_MATCH_ENVRCPT_SOME(0.00)[]; MID_CONTAINS_FROM(1.00)[]; RCVD_COUNT_TWO(0.00)[2]; RCVD_TLS_ALL(0.00)[]; MAILMAN_DEST(0.00)[freebsd-net] X-BeenThere: freebsd-net@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Networking and TCP/IP with FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 23 Apr 2021 05:39:13 -0000 While these are functionally the same as ck_pr_{load,store}_8, it's actually quite useful to be able to use this on ordinary bool types, without having to add casting to every callsite. Signed-off-by: Jason A. Donenfeld --- sys/contrib/ck/include/ck_pr.h | 2 ++ 1 file changed, 2 insertions(+) diff --git a/sys/contrib/ck/include/ck_pr.h b/sys/contrib/ck/include/ck_pr.h index 2de6e13ec3c..61616213999 100644 --- a/sys/contrib/ck/include/ck_pr.h +++ b/sys/contrib/ck/include/ck_pr.h @@ -179,6 +179,7 @@ ck_pr_rfo(const void *m) #define ck_pr_store_32(DST, VAL) CK_PR_STORE_SAFE((DST), (VAL), 32) #define ck_pr_store_16(DST, VAL) CK_PR_STORE_SAFE((DST), (VAL), 16) #define ck_pr_store_8(DST, VAL) CK_PR_STORE_SAFE((DST), (VAL), 8) +#define ck_pr_store_bool(DST, VAL) ck_pr_store_8((uint8_t *)(DST), (uint8_t)(VAL)) #define ck_pr_store_ptr_unsafe(DST, VAL) ck_pr_md_store_ptr((DST), (VAL)) @@ -199,6 +200,7 @@ ck_pr_rfo(const void *m) #define ck_pr_load_32(SRC) CK_PR_LOAD_SAFE((SRC), 32) #define ck_pr_load_16(SRC) CK_PR_LOAD_SAFE((SRC), 16) #define ck_pr_load_8(SRC) CK_PR_LOAD_SAFE((SRC), 8) +#define ck_pr_load_bool(SRC) ((bool)ck_pr_load_8((uint8_t *)(SRC))) #ifdef CK_F_PR_LOAD_64 #define ck_pr_load_64(SRC) CK_PR_LOAD_SAFE((SRC), 64) -- 2.31.1