From patchwork Wed Jul 31 16:06:41 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: 170185 Delivered-To: patch@linaro.org Received: by 2002:a92:512:0:0:0:0:0 with SMTP id q18csp4236322ile; Wed, 31 Jul 2019 09:29:28 -0700 (PDT) X-Google-Smtp-Source: APXvYqxbo0/T86zQ/VAJsSUf3BgFOe7Qmp5SkCAP66RaPNEX2BOSXUUoC5BbSJEmF4ZD4jXLgPya X-Received: by 2002:aa7:d0cc:: with SMTP id u12mr108916815edo.212.1564590568518; Wed, 31 Jul 2019 09:29:28 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1564590568; cv=none; d=google.com; s=arc-20160816; b=Qugv8RjfWbNrxtj8kjROurMTzn/vjYmBmNRmPIUvn5Peelc/yGpbFnCoJYAl7a90MV oInfWnzJqOloBxXoLUcTsusGA8rOUpHQbnj4OS4kxj8SY4W36iQixV8oczQhPSVujNGc Lbr6wBBUrQxVoIW31Sw1gxvLdOwlHIjqXAN0o+mC5gCczrDm4zDXeH5H7v3OvYkvVva/ /QWEwzxACr4Zyp+2wAGtlOi9AvAxSLsAYZG7FuNF016afRVeU46BXnSOtQDnOB5jXCWY ywcbELWaJKmGyUYlIYHkTTG3axDwHbhrMueoZhm/R7IdbQEYG/T5CAt9bKAIPaD2DC/v wqWA== 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:subject :content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:to:from:dkim-signature; bh=SeHSnn6Q7MbUbj1wOiuXEk2fDQ1yqleXTuadw7oSvuI=; b=t2lDYeX3AlKPk3pF6I06T8Ha/v2F6vyj9fEtUfsGhH3IYQUCS+N/FA/ZRWQvIB1t0D TmTuV60bXpB8R76Xo+ktjgZa4YxKV4/kR4RCX1kNwq70He6W+GAQWLz6/gnx3/0tYHJn TGlszA8V2mT9MtJny1jyTPYcAoZAF41FTNGmvkY+qMcPTr7h5UHk4+Q3kMLcxjYJOumh FOILHqZOiyxOQzu9cZKbAGi5CyMcKybR3nTmbiAqFM9iZtNPup38JpWz/xjOqa1+xx22 C2ese9/hVb2iQfZUy8KsATDc0oWvSHyZ3e0galiEV4/BJlKK70iXiWBamJPoHZi7ZmOL BJVw== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@linaro.org header.s=google header.b=LNeoSnN6; 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 b13si20952695eda.130.2019.07.31.09.29.28 for (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Wed, 31 Jul 2019 09:29:28 -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=LNeoSnN6; 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]:42784 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.86_2) (envelope-from ) id 1hsrTj-0007Mn-Gf for patch@linaro.org; Wed, 31 Jul 2019 12:29:27 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:45222) by lists.gnu.org with esmtp (Exim 4.86_2) (envelope-from ) id 1hsrPo-00052W-9P for qemu-devel@nongnu.org; Wed, 31 Jul 2019 12:25:25 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1hsrPn-0000NZ-9R for qemu-devel@nongnu.org; Wed, 31 Jul 2019 12:25:24 -0400 Received: from mail-wr1-x443.google.com ([2a00:1450:4864:20::443]:32769) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1hsrPn-0000N6-3G for qemu-devel@nongnu.org; Wed, 31 Jul 2019 12:25:23 -0400 Received: by mail-wr1-x443.google.com with SMTP id n9so70471426wru.0 for ; Wed, 31 Jul 2019 09:25:23 -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=SeHSnn6Q7MbUbj1wOiuXEk2fDQ1yqleXTuadw7oSvuI=; b=LNeoSnN6Kg+VGwYH8Z4RbpDn3H9/yFqSwzDxeJtve72ahZzm0iXMyXKgWAaR8+fkWH DmbSPVaBUmj3G3umtKXnbKOkZszfjqr0NjxxtyF1m+3EKl5AhM2VC2XC5+dv+l/U96SD UFOk1x5CBDu32Y9cmkb58bzynzAzP2jtdzgiStBZXC7DCfVIfr/2pFt+AIDRoNXVjgUq g2tQ0NMMO6yn2W4oSE8OXAnTl1dPN1VeL7yMCrMK96lyDfLgKWYTysNZMj6/XjmLm9jI vWRgcldwl9zb8QZmYE8L+GHy0PDCAFHZOrMDTTpuaL21/NP4b/2EcIYyPOMpwgLpVXGg HIPg== 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=SeHSnn6Q7MbUbj1wOiuXEk2fDQ1yqleXTuadw7oSvuI=; b=q4217IYDg0zpiSlarf9ZcRaNq0cXni3zMwKidYbZdVSyZFAY2TJgx/tFmUahQ+V8wr N3b4/nGzcMP6cY4tluA/Sh8Q/ADz68oGzff8OfRr0F0y/to0CkskUHWeq4UCUtSXGyUa XDlfKMgs4rEdmBuSp45ETRvlgflSqM3ezEus1sScqg2h8yOObMTCEMD5z/LQtu8b2C6o g3CTrrGH5ahzjkPsTPa4XkB/Orh9wHFEnUVUL8vzTY2uRuOJjPXCe2XdswE0gmFGY+UE Fmcd4gz1m+AjuiEumPDzOpGg5+MAZeSgnD5MJAoN1mm5mIqTcxuLpIkr0tk3cvNPhudi zt2w== X-Gm-Message-State: APjAAAXXmNqtqoRmdFudQYmUpPV4DEK5MwFwigTIwzoTvgJ2LQFRzpIo XjmmomUUNuFmpExXoHIVFaxmIg== X-Received: by 2002:adf:ef8d:: with SMTP id d13mr130688452wro.60.1564590322088; Wed, 31 Jul 2019 09:25:22 -0700 (PDT) Received: from zen.linaroharston ([81.128.185.34]) by smtp.gmail.com with ESMTPSA id h16sm74107395wrv.88.2019.07.31.09.25.15 (version=TLS1_3 cipher=AEAD-AES256-GCM-SHA384 bits=256/256); Wed, 31 Jul 2019 09:25:17 -0700 (PDT) Received: from zen.linaroharston. (localhost [127.0.0.1]) by zen.linaroharston (Postfix) with ESMTP id E5B591FF8F; Wed, 31 Jul 2019 17:07:20 +0100 (BST) From: =?utf-8?q?Alex_Benn=C3=A9e?= To: qemu-devel@nongnu.org Date: Wed, 31 Jul 2019 17:06:41 +0100 Message-Id: <20190731160719.11396-17-alex.bennee@linaro.org> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20190731160719.11396-1-alex.bennee@linaro.org> References: <20190731160719.11396-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::443 Subject: [Qemu-devel] [PATCH v4 16/54] queue: add QTAILQ_REMOVE_SEVERAL 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: bobby.prani@gmail.com, cota@braap.org, =?utf-8?q?Alex_Benn=C3=A9e?= , aaron@os.amperecomputing.com 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 --- include/qemu/queue.h | 10 ++++++++++ 1 file changed, 10 insertions(+) -- 2.20.1 Reviewed-by: Richard Henderson diff --git a/include/qemu/queue.h b/include/qemu/queue.h index 0379bd8fdbb..66e834dad11 100644 --- a/include/qemu/queue.h +++ b/include/qemu/queue.h @@ -422,6 +422,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); \