From patchwork Fri Oct 25 06:36:25 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: 177646 Delivered-To: patch@linaro.org Received: by 2002:a92:409a:0:0:0:0:0 with SMTP id d26csp3260868ill; Fri, 25 Oct 2019 00:09:17 -0700 (PDT) X-Google-Smtp-Source: APXvYqw7HwaiNrzpUA00rh/MjuLnAJPWRIBWeaZziNnkOr9q0EERYMIXYUq2Qypc7XwiyWg4adu2 X-Received: by 2002:a17:906:6d82:: with SMTP id h2mr1942942ejt.127.1571987357330; Fri, 25 Oct 2019 00:09:17 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1571987357; cv=none; d=google.com; s=arc-20160816; b=VT76cdP2afd3Cw8cYzxAhfBkgumHUcVp6sjythxka9IKw0zK/SbA31yxdGjulJd8io 6G9IRRFXiYCycEsFi5S44UbVT1ZCl3xutDVklBKMNWaflBIT4tc/xpao0Z12sxSk7oGf BJwCvUYk9fV8mafxti9bjl65/Gl2Z+J4URpgUvcsHM7qXzgJEdEMUc4EFREZhrs55uAa 1w6nxl0ha4ggdtLODP2AjpALDV6jCqIlo9cUlsfo2rG89wF+26UxVO7QS2cpXoDAKptO Oga6eL7mPE+bMNXH3boVhrLStus8rgGZHLuEy1fnUR1ALv4PScGcwrKgF9uI+YQa9mht Pr+A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:cc:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:content-transfer-encoding :mime-version:references:in-reply-to:message-id:date:subject:to:from :dkim-signature; bh=ARdcrEhdcWtFfl52Az/c8K3t0fy2I7ICblv42Psekak=; b=DN36xUn0cAA1KQKMH6z+t8nMnNzJYqvfdu6ztwtR0BTlVVhGHnMjVsXKxmRSqkdkqv sRICJ74SouSRbvPcTTkIB4YzeI+8TNgzbRXL4FFqliPphLEMzBetc41CGF8zxtLsfB30 5j9YKSKA7tRoNS+G4ynSSYpgLlLhOcAqGt6M1SisbzC6mZeR8v5x88q4FLVRGjTR904l SIsAPvZ59ecdbaz64yfnN+c9vuv0YIEoyFDnuSB+xW4iGeINbVQBuCfh6lQRknyD020x hQrOKapkGUCQWCvhpUF/YXfG35evtHf4jk0oRGM6zKM4aOY2L4B1C0a7Dg/oNlzhgPxd Am1w== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@linaro.org header.s=google header.b=e+vrO2MI; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id f13si671304edl.170.2019.10.25.00.09.17 for (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Fri, 25 Oct 2019 00:09:17 -0700 (PDT) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; Authentication-Results: mx.google.com; dkim=fail header.i=@linaro.org header.s=google header.b=e+vrO2MI; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from localhost ([::1]:56428 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1iNtil-0007AF-H3 for patch@linaro.org; Fri, 25 Oct 2019 03:09:15 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:38146) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1iNtWW-0003EK-HU for qemu-devel@nongnu.org; Fri, 25 Oct 2019 02:56:37 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1iNtWV-0007bX-Aj for qemu-devel@nongnu.org; Fri, 25 Oct 2019 02:56:36 -0400 Received: from mail-wm1-x32b.google.com ([2a00:1450:4864:20::32b]:53062) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1iNtWV-0007Z1-35 for qemu-devel@nongnu.org; Fri, 25 Oct 2019 02:56:35 -0400 Received: by mail-wm1-x32b.google.com with SMTP id p21so809691wmg.2 for ; Thu, 24 Oct 2019 23:56:34 -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=ARdcrEhdcWtFfl52Az/c8K3t0fy2I7ICblv42Psekak=; b=e+vrO2MIyhFMxPEB1Oau06arYJkfr516sbLEQhJS/M7YK6z1PspKhe4VuSzgjcdERd /ub0RUvlAV9S+7ThGXabpaxGHqgXCEO1owMugwt+jGaziRXyDZxnW/jA6z85SHCWjorG KeMrHWSLdDU0qF0izLYu4DhRnSOy6E+SwdFAUbUY3NOILIsuZW3xITkaNQgb9ogHmaSc 5bIUCXYIW0zrPLJh7nVXQ24JS/AXqYaQQ1PoZwfrilz0hlnRyPq1hI11Jw9F+NBmMGEd OHI1iNvNCZMaDidi3e6i4r3OCYRoSCMlun/b4472oP3bcjRIViWCn2w9wpD58Li3uBaO /GAg== 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=ARdcrEhdcWtFfl52Az/c8K3t0fy2I7ICblv42Psekak=; b=U7a57fBKbfQ5xoh0C2EPKZ77/Trnt44JH75dNqsKRIYRGZu8pWpmHwLn6zwXqx3AnD LctjGLLmdAhP2S9wR+Dkmlo/qtSNccmiRd3W/FDyNyFt1IUbDlQ2AvfB/eNnKODS7i30 Oq4wOyIY64MpssClP83Dy2KRD6Ue0f2OysxKNSc4l2gXYzMYKQP33rvMJ5m0k/08ubmJ C4Ht5WBnww0mou0oYStRY5V0RniRSvix0UqWT0h2w/svyu97O3hkkHb5UewPZnaTuGQT jkaRgHGlsedmwOmXZek+f4TOZbLiuaVPj6/s+AxWC9Pq5pKEoaUjSMSJM8Pv7W5G63ja g1bQ== X-Gm-Message-State: APjAAAWPTjxZnIySyNAgZPmrdZqi3f3JTyqYgZjkVSE8YKJJZGbZgYog iH3DMv0YHuMLaXZncUvPfDFl2A== X-Received: by 2002:a1c:5641:: with SMTP id k62mr1916872wmb.97.1571986593641; Thu, 24 Oct 2019 23:56:33 -0700 (PDT) Received: from zen.linaroharston ([51.148.130.216]) by smtp.gmail.com with ESMTPSA id a71sm1205364wme.11.2019.10.24.23.56.32 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 24 Oct 2019 23:56:33 -0700 (PDT) Received: from zen.lan (localhost [127.0.0.1]) by zen.linaroharston (Postfix) with ESMTP id 1A89C1FF8C; Fri, 25 Oct 2019 07:37:16 +0100 (BST) From: =?utf-8?q?Alex_Benn=C3=A9e?= To: peter.maydell@linaro.org Subject: [PULL v2 25/73] queue: add QTAILQ_REMOVE_SEVERAL Date: Fri, 25 Oct 2019 07:36:25 +0100 Message-Id: <20191025063713.23374-26-alex.bennee@linaro.org> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20191025063713.23374-1-alex.bennee@linaro.org> References: <20191025063713.23374-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::32b 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: Richard Henderson , "Emilio G. Cota" , =?utf-8?q?Alex_Benn=C3=A9e?= , qemu-devel@nongnu.org Errors-To: qemu-devel-bounces+patch=linaro.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 -- 2.20.1 diff --git a/include/qemu/queue.h b/include/qemu/queue.h index 73bf4a984d8..4764d93ea3f 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); \