From nobody Tue Nov 15 12:54:39 2022 X-Original-To: dev-commits-src-main@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4NBR340m1Pz4d9mC; Tue, 15 Nov 2022 12:54:40 +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 "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4NBR340C0Jz3Cpp; Tue, 15 Nov 2022 12:54:40 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1668516880; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=jwp+okHxn9tW4vgFFxYob5YHpNfYATaDXm4Al7WQskU=; b=aimkfP5Mtiyj7lVh9x49Z7qFxHSi3Ix9NcFjvMVc4aCmDhRbLoCzhpY+xSN4f0KpgXMqDG R+TyGDKJ78gAvqzhkmZvZD86e9rKtmIESn+Honc/Gt9MYxS8cOWJrtCbyrFxW7990bqhvj dim37I3gGBtXSW/JnG8dsW2iMrFxXxavTWxnSCc+kHael8+4OntE/80yPSWiIm81E/CnZP zhwKVImCrkER3i1CIJoUUDePMyCkvWlQDh0GFRO5cSiECf3FKZDmojF44zBWWPhkwMmGXJ kLzTk5QMzkFfyUQm02BJFqWj54LL2BC6l9DsOXMeXC9rp3e0xr7nvPBXGHllsw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1668516880; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=jwp+okHxn9tW4vgFFxYob5YHpNfYATaDXm4Al7WQskU=; b=qFJyTtkx6ImoCJQoEIr+iZjHNrOH2lto/NKrbnDkcOKko9CDOQNWCZMmWlCO2EGgHhfh1y FojZfR101+lR0KV2sinYiyvXyc/Y2rssE7bhxJmQJxV1KxbKCdEUpwrHqtkjscInIq1zgy xh8xrTAZzLN2lt1bzz1aawAZytjgyhLNH5iKGpproh0SflB5H18NZzzNno594KuKZyA6fP ytmOMqREactLBp9eDqG3Olz2LUaxWMeWNbyL2wVIxA7BrmnaHwkfH16w/l6Vu6tZkuVC6j 7OotT0Jd04p2PeHy/wCSUbNVwcBoJiTkjwYwmShhyT07H+OyT+3NOzC1xzyrLA== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1668516880; a=rsa-sha256; cv=none; b=WFd4OEoHUGeT7GSupfpyrpv6Q50YJkZNDm3lqO0ZMYkW3GP72HNwoIwZp15Hrjx72pnZ9G Q5frTu2vg4rZeAiEMPqLGt69IvuurB27jONHW1l7CTKdrcqVIt87vcknalY8jTRVC9rcyX u0eQFIeKujJzw91fBQf4PDa+/oMtoED65vmOy1oQEDsTU8PNQa/2giHhhHSfaIWveXaPMR uwNDf8awn37j/vC6M7yg5KGULqN4mOUOkEMuO9Tal4c+sjwYWJgW3XQnJuuys9GSqkYwZ/ r4hYKCXCFS+L5wrT9EuKbqfWMhKuBywqhM3vsVi5mf9mDDS/L7ROWubUtwsK9g== 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 4NBR336MbXzNDq; Tue, 15 Nov 2022 12:54:39 +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 2AFCsdHB015055; Tue, 15 Nov 2022 12:54:39 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 2AFCsdqH015054; Tue, 15 Nov 2022 12:54:39 GMT (envelope-from git) Date: Tue, 15 Nov 2022 12:54:39 GMT Message-Id: <202211151254.2AFCsdqH015054@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: "Bjoern A. Zeeb" Subject: git: 5d310ea8c5f9 - main - LinuxKPI: add memset_startat macro List-Id: Commit messages for the main branch of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-main List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-main@freebsd.org X-BeenThere: dev-commits-src-main@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: bz X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 5d310ea8c5f98bbf53078ec632f6441f54dc9e44 Auto-Submitted: auto-generated X-ThisMailContainsUnwantedMimeParts: N The branch main has been updated by bz: URL: https://cgit.FreeBSD.org/src/commit/?id=5d310ea8c5f98bbf53078ec632f6441f54dc9e44 commit 5d310ea8c5f98bbf53078ec632f6441f54dc9e44 Author: Bjoern A. Zeeb AuthorDate: 2022-11-14 23:26:22 +0000 Commit: Bjoern A. Zeeb CommitDate: 2022-11-15 12:52:10 +0000 LinuxKPI: add memset_startat macro Add a memset_startat() macro which sets a pattern from a struct member to the end of the struct. Needed by a wireless driver. MFC after: 3 days Reviewed by: emaste Differential Revision: https://reviews.freebsd.org/D37389 --- sys/compat/linuxkpi/common/include/linux/string.h | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/sys/compat/linuxkpi/common/include/linux/string.h b/sys/compat/linuxkpi/common/include/linux/string.h index 36f27a385d65..932bed81d034 100644 --- a/sys/compat/linuxkpi/common/include/linux/string.h +++ b/sys/compat/linuxkpi/common/include/linux/string.h @@ -249,4 +249,12 @@ memcpy_and_pad(void *dst, size_t dstlen, const void *src, size_t len, int ch) } } +#define memset_startat(ptr, bytepat, smember) \ +({ \ + uint8_t *_ptr = (uint8_t *)(ptr); \ + int _c = (int)(bytepat); \ + size_t _o = offsetof(typeof(*(ptr)), smember); \ + memset(_ptr + _o, _c, sizeof(*(ptr)) - _o); \ +}) + #endif /* _LINUXKPI_LINUX_STRING_H_ */