From patchwork Thu Oct 17 13:15:30 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Alex_Benn=C3=A9e?= X-Patchwork-Id: 1178604 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=nongnu.org (client-ip=209.51.188.17; helo=lists.gnu.org; envelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org; receiver=) Authentication-Results: ozlabs.org; dmarc=fail (p=none dis=none) header.from=linaro.org Authentication-Results: ozlabs.org; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=linaro.org header.i=@linaro.org header.b="ANtwZlKj"; dkim-atps=neutral Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 46v99F61ymz9sPV for ; Fri, 18 Oct 2019 00:33:37 +1100 (AEDT) Received: from localhost ([::1]:47794 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1iL5uI-0002Do-Rg for incoming@patchwork.ozlabs.org; Thu, 17 Oct 2019 09:33:34 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:33944) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1iL5dj-00084v-9v for qemu-devel@nongnu.org; Thu, 17 Oct 2019 09:16:28 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1iL5di-0005TI-1M for qemu-devel@nongnu.org; Thu, 17 Oct 2019 09:16:26 -0400 Received: from mail-wr1-x433.google.com ([2a00:1450:4864:20::433]:44360) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1iL5dh-0005Sg-RS for qemu-devel@nongnu.org; Thu, 17 Oct 2019 09:16:25 -0400 Received: by mail-wr1-x433.google.com with SMTP id z9so2295786wrl.11 for ; Thu, 17 Oct 2019 06:16:25 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=4u0DAyRPQyWfOOgltou2F/pxj6T1sopcMhD6CsKad8c=; b=ANtwZlKjptqrzZntw/imIkxEzMzWSUisY7EV1BEnF/0uwTl3dTLWAGKKv6osJnjR9p xqmMvanFuHpDEwIOatSLKhsrSljVKFvXy0a2g5SWOtLIvfTVUpwkQceNVcPnoMO5OE2t h6grn74EVcYUcMwwqWrKj7LtjMCrADy0huaTdlrcq2ycir9rL2r5fGyDgGqSVaKe5VsX YdQqwRQkOeocY/mngB6BcE7LhPCEzaExQm+OGJndQlj39VWLyxXpCsXjZXs5b2styBTn 02/zEvKa7EWMTiRM+WjUnJ2X9QlS1IZG1HQX0ZVUlh9/I+WECQB8k62DZf3q9loCvfa2 ZQ5Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=4u0DAyRPQyWfOOgltou2F/pxj6T1sopcMhD6CsKad8c=; b=srIFb4Nzck6x3RMMLO0jDUkiKt76a8Dc+2ZNhWq9XwnFU0U+gdJrbrruYV+ai6w+aO tueyoojdhNL2JyuSkarYV1J+4vdHvaxxIb1Jf2Ooz5aU1WgouDrhJhKo0kXnKduxHY2+ 00zFQv5m8iLbGAhQ1qTRdtUZfVvEEajoA4Txwoy6jNxy+V/tVlmTco0K2j2fsbhRkI7c sLKGlP4w+xml1H2q0FcFffhT8mVSAIT+xKO1doUtgDg2k26vqCyoq5THHe4zC61yI8Yp ErZX1P+JyElZxvinaLuwiCOT6fjXWQ9cL1+qkvHvT21MKFpzjq5vPJcRQ3fbqJ/BuYKD pXDg== X-Gm-Message-State: APjAAAW99f/qTzuFDmpr85z8sClBBde385FkYVMfqfBew6pRMzSXwGO2 YYB/Rg7pNqJvSyhzmDDxvSrWzA== X-Google-Smtp-Source: APXvYqwaXW1we6RMVa24dBTBgzuUKnhgZTXc4u9seJQGGfI3/2QkcdN6CnLKrzGAgIyirCRcpagKIg== X-Received: by 2002:adf:da4a:: with SMTP id r10mr3131057wrl.356.1571318184632; Thu, 17 Oct 2019 06:16:24 -0700 (PDT) Received: from zen.linaroharston ([51.148.130.216]) by smtp.gmail.com with ESMTPSA id a13sm2245583wrf.73.2019.10.17.06.16.18 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 17 Oct 2019 06:16:21 -0700 (PDT) Received: from zen.lan (localhost [127.0.0.1]) by zen.linaroharston (Postfix) with ESMTP id AD7061FF99; Thu, 17 Oct 2019 14:16:16 +0100 (BST) From: =?utf-8?q?Alex_Benn=C3=A9e?= To: qemu-devel@nongnu.org Subject: [PATCH v6 09/54] queue: add QTAILQ_REMOVE_SEVERAL Date: Thu, 17 Oct 2019 14:15:30 +0100 Message-Id: <20191017131615.19660-10-alex.bennee@linaro.org> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20191017131615.19660-1-alex.bennee@linaro.org> References: <20191017131615.19660-1-alex.bennee@linaro.org> MIME-Version: 1.0 X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2a00:1450:4864:20::433 X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: robert.foley@futurewei.com, Richard Henderson , peter.puhov@futurewei.com, aaron@os.amperecomputing.com, cota@braap.org, =?utf-8?q?Alex_Benn?= =?utf-8?b?w6ll?= Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: "Qemu-devel" From: "Emilio G. Cota" This is faster than removing elements one by one. Will gain a user soon. Signed-off-by: Emilio G. Cota Signed-off-by: Alex Bennée Reviewed-by: Richard Henderson --- include/qemu/queue.h | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/include/qemu/queue.h b/include/qemu/queue.h index 73bf4a984d..4764d93ea3 100644 --- a/include/qemu/queue.h +++ b/include/qemu/queue.h @@ -420,6 +420,16 @@ union { \ (elm)->field.tqe_circ.tql_prev = NULL; \ } while (/*CONSTCOND*/0) +/* remove @left, @right and all elements in between from @head */ +#define QTAILQ_REMOVE_SEVERAL(head, left, right, field) do { \ + if (((right)->field.tqe_next) != NULL) \ + (right)->field.tqe_next->field.tqe_circ.tql_prev = \ + (left)->field.tqe_circ.tql_prev; \ + else \ + (head)->tqh_circ.tql_prev = (left)->field.tqe_circ.tql_prev; \ + (left)->field.tqe_circ.tql_prev->tql_next = (right)->field.tqe_next; \ + } while (/*CONSTCOND*/0) + #define QTAILQ_FOREACH(var, head, field) \ for ((var) = ((head)->tqh_first); \ (var); \