From nobody Sun Aug 20 05:05:40 2023 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 4RT3Tc5NSPz4qjt9; Sun, 20 Aug 2023 05:05: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 4RT3Tc4m5Lz4VnN; Sun, 20 Aug 2023 05:05:40 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1692507940; 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=7rl5piNeSckKpkiNmFLR+ZrZq7xJKY/02zrVicsE7mY=; b=N3YxT7QOZphjPA9znNoBjJXrgiIrBUhAMPR++oCL/70YaSGBSHFRBM0i9VqRlSHkhwk0Gl Sj0bTI4Xjf7tcAQUplG9PGbwGPPp3z6P41MO1ANyG4wsewOD74bkMcvzLKHWRvjpfO1lEd n3os1Ss+BOe6xVkBmhCxWeqOTaknG9YCi1CBRv9Rak2XAxN0AA0vfwrPpxsGFDqjIBiCa8 +pNyWQnXNao9i2Hww3ODy5oh+ldRec8JU4vZ2u4ZR18IpuLuNuQNx4eDBIUc9OxSkXZoGB 6ABw49XELGp15qqSQObayOoIojYyfEzqjv6JUkF4TemOE0vUO55OhiSR7eBAJA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1692507940; 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=7rl5piNeSckKpkiNmFLR+ZrZq7xJKY/02zrVicsE7mY=; b=e1RNN//6Td5aAnZ51Lvvffc1JSg0C7cy2rdhwxnJFpUM6aBHI+L0lxmBMm288Owt5Z7rXm YkWxvPfvbtCyw0Ejv53UsD6iNeez98UV2Aht4iq7/0qjTXt3eDYjCiANrSExFfIdjK2eVj FbIMwPn0UA5qXlO40DpUx+aiR+x6aCcK78W1flYjmYdpsbr4hYAJzXl0AO6qcljflFnjXF ajo+ne4WPk6I7KMp3lJ3mxQLbwwMAIXXPYLWFjmqlwXn2y6svKNMrxLwjBpbVK7W6+fBhv bSKLIwt1xANSGFSToEfx/CWQrAnE+4azWOsI14asJmypFy7k/RRZBglP36m11Q== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1692507940; a=rsa-sha256; cv=none; b=Arbvqe79mZ+aNC0P9FiXX3oqeylgpz19FTwhSlKiTxqbm1eMUooCCZ4MpUeLIv3zftYQ+b 54k7WOCwmIU2+1I0oykmjt+7RHlQYlD1phnrGJ+FnVT8nanTpuvvFTiUh/oU19cNA/iuJd kZTZL1RmayKCgrcPqZwWZQwY6A5PKrL74CBf8ODiINvuA5nI2Pn7837UGqVk7U5y/pUgid 2C8sSl1WhD4P3YfxVjT3dDebfc/i8HpI23KBId6Xyjq3BOe4CdKNNDyvOGWBMca8hHw44u K9nfbP7joB8cULpYoNbckmzX17JkW42aZcodyDsvCZpWb5U4hWFcy3CJ8GPftw== ARC-Authentication-Results: i=1; mx1.freebsd.org; none 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 4RT3Tc3qGLzBJ8; Sun, 20 Aug 2023 05:05:40 +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 37K55eHd000264; Sun, 20 Aug 2023 05:05:40 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.17.1/8.17.1/Submit) id 37K55e2d000261; Sun, 20 Aug 2023 05:05:40 GMT (envelope-from git) Date: Sun, 20 Aug 2023 05:05:40 GMT Message-Id: <202308200505.37K55e2d000261@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Colin Percival Subject: git: 79fafc09740a - main - queue.h: Define {LIST,TAILQ}_REMOVE_HEAD 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: cperciva X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 79fafc09740ad508b40e909dc898cbac2d4f67c4 Auto-Submitted: auto-generated The branch main has been updated by cperciva: URL: https://cgit.FreeBSD.org/src/commit/?id=79fafc09740ad508b40e909dc898cbac2d4f67c4 commit 79fafc09740ad508b40e909dc898cbac2d4f67c4 Author: Colin Percival AuthorDate: 2023-07-17 23:42:50 +0000 Commit: Colin Percival CommitDate: 2023-08-20 05:04:55 +0000 queue.h: Define {LIST,TAILQ}_REMOVE_HEAD The LIST and TAILQ structures have fast _REMOVE macros (since each element has a pointer to the previous element); we implement the _REMOVE_HEAD macros for them by simply finding the first element and then removing it. Reviewed by: jhb, emaste Sponsored by: https://www.patreon.com/cperciva Differential Revision: https://reviews.freebsd.org/D41072 --- sys/sys/queue.h | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/sys/sys/queue.h b/sys/sys/queue.h index 8e91ebf7949d..47d85121e317 100644 --- a/sys/sys/queue.h +++ b/sys/sys/queue.h @@ -110,7 +110,7 @@ * _INSERT_TAIL - - + + * _CONCAT s s + + * _REMOVE_AFTER + - + - - * _REMOVE_HEAD + - + - + * _REMOVE_HEAD + + + + * _REMOVE s + s + * _SWAP + + + + * @@ -595,6 +595,9 @@ struct { \ __containerof((elm)->field.le_prev, \ QUEUE_TYPEOF(type), field.le_next)) +#define LIST_REMOVE_HEAD(head, field) \ + LIST_REMOVE(LIST_FIRST(head), field) + #define LIST_REMOVE(elm, field) do { \ QMD_SAVELINK(oldnext, (elm)->field.le_next); \ QMD_SAVELINK(oldprev, (elm)->field.le_prev); \ @@ -841,6 +844,9 @@ struct { \ ((elm)->field.tqe_prev == &(head)->tqh_first ? NULL : \ __containerof((elm)->field.tqe_prev, QUEUE_TYPEOF(type), field.tqe_next)) +#define TAILQ_REMOVE_HEAD(head, field) \ + TAILQ_REMOVE(head, TAILQ_FIRST(head), field) + #define TAILQ_REMOVE(head, elm, field) do { \ QMD_SAVELINK(oldnext, (elm)->field.tqe_next); \ QMD_SAVELINK(oldprev, (elm)->field.tqe_prev); \