From nobody Wed Jun 28 01:33:07 2023 X-Original-To: dev-commits-src-all@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 4QrPGq4CZJz4kxwS; Wed, 28 Jun 2023 01:33:07 +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 4QrPGq3ZTJz3DGw; Wed, 28 Jun 2023 01:33:07 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1687915987; 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=1dOvFLirulABbR5YQWe0TiCjsQfFEI89prccvaA2TKY=; b=HEqZbQF8WlpuNfTScxYo+pkcWs8QMZvo8RP6nh4AIO+Of7Cn9C54XEvGp9NytnChwi17t1 ankFSSasBGL80wHctsk9wxVqabqJlGVFFXANxb300IJG0vCNJbVRlFfLB3Ib9yDNczwvsM nRRJEunuO9ot5Q3f+qJ898wTk46gbjA9l8bmx9eRZLK3sYcvuIZtxJpJ3AUfyjiSYw2+Fn 93KVjVFeNq2kQw9kpyZk2CdyqrCO1glUr8ro43xgox8A+UrQJBN4vi6S6L6/o6tk4PiTWi h2hM1xAl1Q1dNj50qjjPNlW2zLrEgtV9BKujnSupjO93Ya1iziEM/oYYETuEzg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1687915987; 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=1dOvFLirulABbR5YQWe0TiCjsQfFEI89prccvaA2TKY=; b=pwv+actmdeV2dJDFmQMpVGm5WzgvUa2kLQpnxReHvyFgS+WZoHmc6my88Qxns6AQml9XhL RarxXpXc6VwWVKxdXNc/Bki9/LUXhzUK8wzeyRsM8F/AVxNG4PT0HCueCv4QgXdNC/QNlY b7PRpIUxVwH2Ex5hHy711tOKBpvUHT/qE5Yt5a102+e/U0MyH2FyKEyZHf5Qq0/1tEs4v2 0sPZkYmLQ4IJ+iK6FopZmk0RJ7OMglnR9Ny5pTIBM18Mdnryhz6vfGFXVK9oIJ3YgB2niU f6lELC9LxMJlN38gbm7ko3Vyfpd0vxi0U9DsC2kb39NbEAbztk9HeF5QBahmrQ== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1687915987; a=rsa-sha256; cv=none; b=lsSqQXY3luUKNJTx3I983JykmH3HUAAM8R7HJFJD/yQ/StA5YefNkXMFab+fzjMyqwFQ/X Yk7VlJ2LDETEL7UAH0mMGkFMZ6AaWbdFx/q0GauEwoeyTjM0R0i2V/fAk1PszS5i4RDZi8 nah14c5kTZmu8KfNOZkBi3G2fzmU+7vL+/lkclDhVmWdYm4d2kDue5gnMVJHLOuHjgPwJm P42BT4QsPqOuUZGJibp945BeyjfY7uwaYyzzstTD8L8ULVcHCCIM8SDcEj9+NILOKnq/jN f4NYJ1hwrfcD/bk9LySs8/tLk2dN/4tuYjLSGQN6PiwXIVAg2FALOEtN6kmkCg== 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 4QrPGq2dzPzFYX; Wed, 28 Jun 2023 01:33:07 +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 35S1X7jB044983; Wed, 28 Jun 2023 01:33:07 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 35S1X7Ye044982; Wed, 28 Jun 2023 01:33:07 GMT (envelope-from git) Date: Wed, 28 Jun 2023 01:33:07 GMT Message-Id: <202306280133.35S1X7Ye044982@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: 1b18fb7faa75 - main - LinuxKPI: list.h add list_count_nodes() List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-all@freebsd.org X-BeenThere: dev-commits-src-all@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: 1b18fb7faa75cc6dfa2e253190b41e63a997ca9d Auto-Submitted: auto-generated X-ThisMailContainsUnwantedMimeParts: N The branch main has been updated by bz: URL: https://cgit.FreeBSD.org/src/commit/?id=1b18fb7faa75cc6dfa2e253190b41e63a997ca9d commit 1b18fb7faa75cc6dfa2e253190b41e63a997ca9d Author: Bjoern A. Zeeb AuthorDate: 2023-06-26 08:45:17 +0000 Commit: Bjoern A. Zeeb CommitDate: 2023-06-28 01:32:29 +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 MFC after: 10 days Reviewed by: emaste Differential Revision: https://reviews.freebsd.org/D40757 --- 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 46da7cc7bc8e..194f09f0c570 100644 --- a/sys/compat/linuxkpi/common/include/linux/list.h +++ b/sys/compat/linuxkpi/common/include/linux/list.h @@ -466,6 +466,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) \