From nobody Wed Nov 29 16:37:51 2023 X-Original-To: dev-commits-src-branches@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 4SgQ3h0tSnz52wcY; Wed, 29 Nov 2023 16:37:52 +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 4SgQ3h0Fl2z3GB7; Wed, 29 Nov 2023 16:37:52 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1701275872; 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=4UdXWmZv4G5kuWMBwKKcMP0iyC2MpxMsBhSl0cy0oQY=; b=i9cGQDCvFZM83n3mYMnssZUD8KYKbE6H/hjGoOMlVrOspzObBqES5UHdC5fPSD1EUw72J6 c1POr3DYm9CU/tRVhy3bo6bh4SRs6IDjItWzNqdgvAZ33tJjnpYr0psRWC9uLC+RGE4aRF Rt6drCSuBrH67AJ6yIRbUfZ9aGO4AF1E2D7erhLLCbpidal1MuKuat5fa8IgQXPZ7v5tHD wvQTTBKRtYgBw38qBwNOKINHiyLEre5bCI52xPPTsq9P/aS4Ah/3FQtff3LbddjujHDcdy mQvZLOxnHuNQVsvDJn07G3No2AeINeQ5KzgEedz+CZUJUG07epw6UmPu9ifwjA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1701275872; 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=4UdXWmZv4G5kuWMBwKKcMP0iyC2MpxMsBhSl0cy0oQY=; b=Z5X4JX1O9Be8wPoUOkEB5K/C42UrwEMo4T8ecIO5Xk2YhknpSpyqAUBtGJEBPWpPf9tm8V 9J7Q/d4aBagal3ldh6szQPRoNMI86BnwCnRFDNjMhlBosly5HRjHGjpW1ritQnqAJgFM+E fpbdYXp4Vr4az1lapND5/mR4DPS+wlp9YzdUobHhLdwdPGFjIC8Vv3NgDLpmnhQFesSdWW 5xi+IgFsQ7Yq+H4ZuFPke1GAs12X0UFGxyn71Wf878j78wukS9NRsYpjZ7rukGJSF1p7hq MQaSiSVCCpCAlrVNFo4ubHJNDFLqnX0gX1gqqY1hZCBl8kDiFtmro4heVLVTYg== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1701275872; a=rsa-sha256; cv=none; b=lJBLT0pp2XbtgPAzZ2XZQIyBCmu77nXhHx+yf7EU337XxDokhAwtajAUoSZnB25YcJ6p9g ZnodD2Dho83FxyhajyQHaW5QKBeuFBnSkcNBbHPL8ICMV0aevfq2kTTpeSNv9CK8VjMbXh 5tx0065GszcuaKbHsH4bmawC5jt8gMT+2sp7ATKqwoNY30itIAU2+Uc7M8bLK6frKMzmh4 MbgYTJCsRfQZabsKUML2sB0sgvJ69F37e+TU6Pmi887ycNggu57aa2SHHB82+FU4MPBZnE NS66I3V5kkvKmvuh4OmkLdbTJCJ2CSq4SEMJZ6IwYQlFUdLM24oo5Euiltgghw== 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 4SgQ3g6QB0z1C7P; Wed, 29 Nov 2023 16:37:51 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.17.1/8.17.1) with ESMTP id 3ATGbp9X044331; Wed, 29 Nov 2023 16:37:51 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.17.1/8.17.1/Submit) id 3ATGbpZ6044328; Wed, 29 Nov 2023 16:37:51 GMT (envelope-from git) Date: Wed, 29 Nov 2023 16:37:51 GMT Message-Id: <202311291637.3ATGbpZ6044328@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: "Bjoern A. Zeeb" Subject: git: d7ae58192a9a - stable/13 - LinuxKPI: list.h add list_count_nodes() List-Id: Commits to the stable branches of the FreeBSD src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-branches List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-branches@freebsd.org X-BeenThere: dev-commits-src-branches@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/stable/13 X-Git-Reftype: branch X-Git-Commit: d7ae58192a9a966929220bc8c6b5280bf73e8437 Auto-Submitted: auto-generated The branch stable/13 has been updated by bz: URL: https://cgit.FreeBSD.org/src/commit/?id=d7ae58192a9a966929220bc8c6b5280bf73e8437 commit d7ae58192a9a966929220bc8c6b5280bf73e8437 Author: Bjoern A. Zeeb AuthorDate: 2023-06-26 08:45:17 +0000 Commit: Bjoern A. Zeeb CommitDate: 2023-11-29 16:36:03 +0000 LinuxKPI: list.h add list_count_nodes() Implement list_count_nodes() using a simple loop. This is needed by an updated wireless driver. Sponsored by: The FreeBSD Foundation (cherry picked from commit 1b18fb7faa75cc6dfa2e253190b41e63a997ca9d) --- sys/compat/linuxkpi/common/include/linux/list.h | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/sys/compat/linuxkpi/common/include/linux/list.h b/sys/compat/linuxkpi/common/include/linux/list.h index 30437bb54888..a27abedc55b0 100644 --- a/sys/compat/linuxkpi/common/include/linux/list.h +++ b/sys/compat/linuxkpi/common/include/linux/list.h @@ -464,6 +464,20 @@ static inline int list_is_last(const struct list_head *list, return list->next == head; } +static inline size_t +list_count_nodes(const struct list_head *list) +{ + const struct list_head *lh; + size_t count; + + count = 0; + list_for_each(lh, list) { + count++; + } + + return (count); +} + #define hlist_entry(ptr, type, field) container_of(ptr, type, field) #define hlist_for_each(p, head) \